9
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
This commit is contained in:
Harald Welte 2017-08-12 14:55:09 +02:00
parent 8a03ea8a32
commit e257be1d69
2 changed files with 11 additions and 1 deletions

View File

@ -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)

View File

@ -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 */