8
0
Fork 0

libgtp: Add back-reference to gsn from pdp context

This is required once one wants to support multiple GSNs in a single
application.

WARNING: This breaks ABI compatibility, LIBVERSION must be adjusted

Change-Id: I68ae49a765828fa681054c68bf7f5e74dbe48ad2
master
Harald Welte 5 years ago
parent 8a03ea8a32
commit e257be1d69
  1. 8
      gtp/gtp.c
  2. 4
      gtp/pdp.h

@ -90,7 +90,11 @@ const char *gtp_version()
int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp,
uint64_t imsi, uint8_t nsapi)
{
return pdp_newpdp(pdp, imsi, nsapi, NULL);
int rc;
rc = pdp_newpdp(pdp, imsi, nsapi, NULL);
if (!rc && *pdp)
(*pdp)->gsn = gsn;
return rc;
}
int gtp_freepdp(struct gsn_t *gsn, struct pdp_t *pdp)
@ -1570,6 +1574,8 @@ int gtp_create_pdp_ind(struct gsn_t *gsn, int version,
}
pdp_newpdp(&pdp, pdp->imsi, pdp->nsapi, pdp);
if (pdp)
pdp->gsn = gsn;
/* Callback function to validata login */
if (gsn->cb_create_context_ind != 0)

@ -12,6 +12,8 @@
#ifndef _PDP_H
#define _PDP_H
struct gsn_t;
#define PDP_MAX 1024 /* Max number of PDP contexts */
#define PDP_MAXNSAPI 16 /* Max number of NSAPI */
@ -221,6 +223,8 @@ struct pdp_t {
/* to be used by libgtp callers/users (to attach their own private state) */
void *priv;
struct gsn_t *gsn;
};
/* functions related to pdp_t management */