diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-22 15:00:00 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-28 11:24:08 +0200 |
commit | 5d8b2265975f93616d7677bd41edb426839a2698 (patch) | |
tree | a6e0b2edcb3f2f8a8acd37104de78261e9aad09f | |
parent | c602d7cf0071973c167d12d2bfd0037b5ad0d36a (diff) |
libgtp: Introduce cb_recovery3
Since osmo-ggsn can manage several GSN structures simultaneously, it
needs the gsn_t pointer to know the ggsn it should forward the call to.
Related: OS#4165
Change-Id: I33b4fe594d5833993af01cce34737e61e597b320
-rw-r--r-- | gtp/gtp.c | 17 | ||||
-rw-r--r-- | gtp/gtp.h | 6 |
2 files changed, 23 insertions, 0 deletions
@@ -219,6 +219,8 @@ static void emit_cb_recovery(struct gsn_t *gsn, struct sockaddr_in * peer, gsn->cb_recovery(peer, recovery); if (gsn->cb_recovery2) gsn->cb_recovery2(peer, pdp, recovery); + if (gsn->cb_recovery3) + gsn->cb_recovery3(gsn, peer, pdp, recovery); } int gtp_set_cb_recovery(struct gsn_t *gsn, @@ -242,6 +244,21 @@ int gtp_set_cb_recovery2(struct gsn_t *gsn, return 0; } +/* cb_recovery() + * pdp may be NULL if Recovery IE was received from a message independent + * of any PDP ctx (such as Echo Response), or because pdp ctx is unknown to the + * local setup. In case pdp is known, caller may want to keep that pdp alive to + * handle subsequent msg cb as this specific pdp ctx is still valid according to + * specs. + */ +int gtp_set_cb_recovery3(struct gsn_t *gsn, + int (*cb_recovery3) (struct gsn_t *gsn, struct sockaddr_in *peer, + struct pdp_t *pdp, uint8_t recovery)) +{ + gsn->cb_recovery3 = cb_recovery3; + return 0; +} + int gtp_set_cb_data_ind(struct gsn_t *gsn, int (*cb_data_ind) (struct pdp_t * pdp, void *pack, unsigned len)) @@ -277,6 +277,7 @@ struct gsn_t { int (*cb_data_ind) (struct pdp_t * pdp, void *pack, unsigned len); int (*cb_recovery) (struct sockaddr_in * peer, uint8_t recovery); int (*cb_recovery2) (struct sockaddr_in * peer, struct pdp_t * pdp, uint8_t recovery); + int (*cb_recovery3) (struct gsn_t *gsn, struct sockaddr_in *peer, struct pdp_t *pdp, uint8_t recovery); /* Counters */ @@ -373,6 +374,11 @@ int gtp_set_cb_recovery(struct gsn_t *gsn, int gtp_set_cb_recovery2(struct gsn_t *gsn, int (*cb) (struct sockaddr_in * peer, struct pdp_t * pdp, + uint8_t recovery)) + OSMO_DEPRECATED("Use gtp_set_cb_recovery3() instead, to obtain gsn handling the recovery");; +int gtp_set_cb_recovery3(struct gsn_t *gsn, + int (*cb) (struct gsn_t * gsn, struct sockaddr_in * peer, + struct pdp_t * pdp, uint8_t recovery)); void gtp_clear_queues(struct gsn_t *gsn); |