lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/40699?usp=email )
Change subject: ranap: split mmctx related iu events into own function ......................................................................
ranap: split mmctx related iu events into own function
In preparation of Routing Areas for Iu, split off mmctx related events into an own function. All mmctx related events must contain a valid ctx or are otherwise invalid.
Change-Id: Ie6f131d29da299f09e897240ec5c39a395ce6f1b --- M src/sgsn/gprs_ranap.c 1 file changed, 22 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c index af764de..3252ee6 100644 --- a/src/sgsn/gprs_ranap.c +++ b/src/sgsn/gprs_ranap.c @@ -137,11 +137,17 @@ return -1; }
-int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) +static int sgsn_ranap_iu_event_mmctx(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) { struct sgsn_mm_ctx *mm; int rc = -1;
+ if (!ctx) { + LOGIUP(ctx, LOGL_ERROR, "NULL ctx given for IU event %s\n", + ranap_iu_event_type_str(type)); + return rc; + } + mm = sgsn_mm_ctx_by_ue_ctx(ctx); if (!mm) { LOGIUP(ctx, LOGL_NOTICE, "Cannot find mm ctx for IU event %s\n", @@ -193,6 +199,21 @@ return rc; }
+ +int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) +{ + switch (type) { + case RANAP_IU_EVENT_RAB_ASSIGN: + case RANAP_IU_EVENT_IU_RELEASE: + case RANAP_IU_EVENT_LINK_INVALIDATED: + case RANAP_IU_EVENT_SECURITY_MODE_COMPLETE: + return sgsn_ranap_iu_event_mmctx(ctx, type, data); + default: + LOGP(DRANAP, LOGL_NOTICE, "Iu: Unknown event received: type: %d\n", type); + return -1; + } +} + void sgsn_ranap_iu_free(struct sgsn_mm_ctx *ctx) { if (!ctx)