From c94837c6a401bf0f80791b619a9b4cfbe9160afd Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 28 Aug 2019 19:44:20 +0200 Subject: gtp: Manage queue timers internally Currently each user (application) of libgtp needs to manage its own timers in order to call gtp_retrans_timeout() and gtp_retrans() and maintain retransmit and duplicate queues working correctly. This adds unnecesary complexity to applications since nowadays, as a libosmocore user, libgtp can handle this internally in an easy way. Furthermore, keeping the timers internal to the library allows for easier extension of features as well as re-implementation of related code in the future. Last but not least, it was detected that existing known applications (osmo-sgsn, osmo-ggsn, sgsnemu) are not using correctly the API, since they should be updating their timers through gtp_retrans_timeout() everytime a message is enqueued/transmitted, otherwise they may fire gtp_retrans() for retransmition too late in some cases. Related: OS#4178 Change-Id: Ife7cfd66d6356f413263fe5bda9e43091f5c9e98 --- gtp/gtp.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gtp/gtp.h') diff --git a/gtp/gtp.h b/gtp/gtp.h index f2a4e1d..e03d77d 100644 --- a/gtp/gtp.h +++ b/gtp/gtp.h @@ -14,6 +14,7 @@ #include #include +#include #include "pdp.h" @@ -268,6 +269,8 @@ struct gsn_t { struct pdp_t pdpa[PDP_MAX]; /* PDP storage */ struct pdp_t *hashtid[PDP_MAX]; /* Hash table for IMSI + NSAPI */ + struct osmo_timer_list queue_timer; /* internal queue_{req,resp} timer */ + /* Call back functions */ int (*cb_delete_context) (struct pdp_t *); int (*cb_create_context_ind) (struct pdp_t *); @@ -348,8 +351,8 @@ extern int gtp_fd(struct gsn_t *gsn); extern int gtp_decaps0(struct gsn_t *gsn); extern int gtp_decaps1c(struct gsn_t *gsn); extern int gtp_decaps1u(struct gsn_t *gsn); -extern int gtp_retrans(struct gsn_t *gsn); -extern int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout); +extern int gtp_retrans(struct gsn_t *gsn) OSMO_DEPRECATED("This API is a no-op, libgtp already does the job internally"); +extern int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout) OSMO_DEPRECATED("This API is a no-op and will return a 1 day timeout"); extern int gtp_set_cb_delete_context(struct gsn_t *gsn, int (*cb_delete_context) (struct pdp_t * -- cgit v1.2.3