aboutsummaryrefslogtreecommitdiffstats
path: root/gtp/gtp.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-12-24 20:58:09 +0100
committerHarald Welte <laforge@gnumonks.org>2010-12-24 20:58:09 +0100
commit629e986ea4cee385237573aa0e80e07560951716 (patch)
tree333316daf1e494b3be1a12c23211741531f7e5c6 /gtp/gtp.c
parent944dce3e66f3bc5b74f24dfbbee2370a231a39a9 (diff)
libgtp: introduce cb_recovery() callback
The cb_recovery() callback enables the user application to detect a change in the restart counter and thus start the appropriate recovery procedures.
Diffstat (limited to 'gtp/gtp.c')
-rw-r--r--gtp/gtp.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 133e2aa..922fcb7 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -160,6 +160,13 @@ int gtp_set_cb_conf(struct gsn_t *gsn,
return 0;
}
+int gtp_set_cb_recovery(struct gsn_t *gsn,
+ int (*cb) (struct sockaddr_in *peer,
+ uint8_t recovery)) {
+ gsn->cb_recovery = cb;
+ return 0;
+}
+
extern int gtp_set_cb_data_ind(struct gsn_t *gsn,
int (*cb_data_ind) (struct pdp_t* pdp,
void* pack,
@@ -932,6 +939,8 @@ int gtp_echo_conf(struct gsn_t *gsn, int version, struct sockaddr_in *peer,
/* Instead we return the recovery number in the callback function */
if (gsn->cb_conf) gsn->cb_conf(type, recovery, NULL, cbp);
+ if (gsn->cb_recovery) gsn->cb_recovery(peer, recovery);
+
return 0;
}
@@ -1343,7 +1352,7 @@ int gtp_create_pdp_ind(struct gsn_t *gsn, int version,
/* Recovery (optional) */
if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
- /* TODO: Handle received recovery IE */
+ if (gsn->cb_recovery) gsn->cb_recovery(peer, recovery);
}
/* Selection mode (conditional) */
@@ -1619,7 +1628,7 @@ int gtp_create_pdp_conf(struct gsn_t *gsn, int version,
/* Extract recovery (optional) */
if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
- /* TODO: Handle received recovery IE */
+ if (gsn->cb_recovery) gsn->cb_recovery(peer, recovery);
}
/* Extract protocol configuration options (optional) */
@@ -2001,7 +2010,7 @@ int gtp_update_pdp_ind(struct gsn_t *gsn, int version,
/* Recovery (optional) */
if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
- /* TODO: Handle received recovery IE */
+ if (gsn->cb_recovery) gsn->cb_recovery(peer, recovery);
}
if (version == 0) {
@@ -2166,7 +2175,7 @@ int gtp_update_pdp_conf(struct gsn_t *gsn, int version,
/* Extract recovery (optional) */
if (!gtpie_gettv1(ie, GTPIE_RECOVERY, 0, &recovery)) {
- /* TODO: Handle received recovery IE */
+ if (gsn->cb_recovery) gsn->cb_recovery(peer, recovery);
}
/* Check all conditional information elements */