pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ggsn/+/37597?usp=email )
Change subject: WIP: gtp: Allow setting callback to receive update_context_ind
......................................................................
WIP: gtp: Allow setting callback to receive update_context_ind
This will be used:
SGSN: Get to know that RNC has gonne down according to GGSN (re-attempt
Direct Tunnel or go back to tun SGSN<->GGSN).
GGSN: Maybe find out that Direct Flags are used (should be handled
internally directly in the rx path probably)
Change-Id: Ic80a9a928c55b6ff85be96014920bb42793cb943
---
M gtp/gsn.c
M gtp/gtp.c
M include/osmocom/gtp/gsn.h
3 files changed, 37 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/97/37597/1
diff --git a/gtp/gsn.c b/gtp/gsn.c
index c23fb2a..612baf2 100644
--- a/gtp/gsn.c
+++ b/gtp/gsn.c
@@ -497,6 +497,7 @@
/* Initialise call back functions */
(*gsn)->cb_create_context_ind = 0;
+ (*gsn)->cb_update_context_ind = 0;
(*gsn)->cb_delete_context = 0;
(*gsn)->cb_unsup_ind = 0;
(*gsn)->cb_conf = 0;
@@ -563,6 +564,13 @@
return 0;
}
+int gtp_set_cb_update_context_ind(struct gsn_t *gsn,
+ int (*cb_update_context_ind)(struct pdp_t *pdp))
+{
+ gsn->cb_update_context_ind = cb_update_context_ind;
+ return 0;
+}
+
int gtp_retrans(struct gsn_t *gsn)
{
/* dummy API, deprecated. */
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 8736cad..662eea9 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -1772,6 +1772,7 @@
struct pdp_t pdp_backup;
union gtpie_member *ie[GTPIE_SIZE];
uint8_t recovery;
+ int rc;
uint16_t seq = get_seq(pack);
int hlen = get_hlen(pack);
@@ -1991,9 +1992,17 @@
}
}
+ /* Callback function to validate login */
+ if (gsn->cb_update_context_ind != 0)
+ rc = gsn->cb_update_context_ind(pdp);
+ else {
+ /* Confirm to peer that things were "successful" */
+ rc = gtp_update_pdp_resp(gsn, version, peer, fd, pack, len, pdp,
+ GTPCAUSE_ACC_REQ);
+ }
+
/* Confirm to peer that things were "successful" */
- return gtp_update_pdp_resp(gsn, version, peer, fd, pack, len, pdp,
- GTPCAUSE_ACC_REQ);
+ return rc;
}
/* Handle Update PDP Context Response */
diff --git a/include/osmocom/gtp/gsn.h b/include/osmocom/gtp/gsn.h
index 936db9b..006fdfd 100644
--- a/include/osmocom/gtp/gsn.h
+++ b/include/osmocom/gtp/gsn.h
@@ -99,6 +99,7 @@
/* Call back functions */
int (*cb_delete_context) (struct pdp_t *);
int (*cb_create_context_ind) (struct pdp_t *);
+ int (*cb_update_context_ind)(struct pdp_t *pdp);
int (*cb_unsup_ind) (struct sockaddr_in * peer);
int (*cb_extheader_ind) (struct sockaddr_in * peer);
int (*cb_ran_info_relay_ind) (struct sockaddr_in *peer, union gtpie_member **ie);
@@ -134,6 +135,8 @@
int (*cb_create_context_ind) (struct
pdp_t *
pdp));
+extern int gtp_set_cb_update_context_ind(struct gsn_t *gsn,
+ int (*cb_update_context_ind)(struct pdp_t *pdp));
extern int gtp_set_cb_data_ind(struct gsn_t *gsn,
int (*cb_data_ind) (struct pdp_t * pdp,
void *pack, unsigned len));
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ggsn/+/37597?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ic80a9a928c55b6ff85be96014920bb42793cb943
Gerrit-Change-Number: 37597
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange