From 5e611021b03f541b579f1b1fd5b421d41a7ec60a Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Wed, 16 Mar 2016 18:38:58 +0100 Subject: Move event callback to gprs_gmm --- openbsc/src/gprs/gprs_gmm.c | 34 ++++++++++++++++++++++++++++++++++ openbsc/src/gprs/sgsn_libgtp.c | 32 +++----------------------------- 2 files changed, 37 insertions(+), 29 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index e7ce0ee5d..cb61593f8 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -38,9 +38,11 @@ #include #include #include +#include #include #include +#include #include #include @@ -98,6 +100,38 @@ static const struct tlv_definition gsm48_sm_att_tlvdef = { static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx); +int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies); +int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, int type, void *data) +{ + struct sgsn_mm_ctx *mm; + int rc = -1; + + mm = sgsn_mm_ctx_by_ue_ctx(ctx); + if (!mm) { + LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type); + return rc; + } + + switch (type) { + case IU_EVENT_RAB_ASSIGN: + rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data); + break; + case IU_EVENT_IU_RELEASE: + /* Clean up ue_conn_ctx here */ + LOGMMCTXP(LOGL_INFO, mm, "IU release\n", type); + break; + case IU_EVENT_SECURITY_MODE_COMPLETE: + /* Continue authentication here */ + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Unknown event received: %i\n", type); + rc = -1; + break; + } + return rc; +} + + /* Our implementation, should be kept in SGSN */ static void mmctx_timer_cb(void *_mm); diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index 1077cce5d..3d3173a11 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -393,22 +394,18 @@ reject: } /* Callback for RAB assignment response */ -int sgsn_ranap_rab_ass_resp(struct ue_conn_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies) +int sgsn_ranap_rab_ass_resp(struct sgsn_mm_ctx *ctx, RANAP_RAB_SetupOrModifiedItemIEs_t *setup_ies) { uint8_t rab_id; - struct sgsn_mm_ctx *mm; struct sgsn_pdp_ctx *pdp = NULL; uint32_t gtp_tei; RANAP_RAB_SetupOrModifiedItem_t *item = &setup_ies->raB_SetupOrModifiedItem; rab_id = item->rAB_ID.buf[0]; - mm = sgsn_mm_ctx_by_ue_ctx(ctx); - /* XXX: Error handling */ - if (item->iuTransportAssociation->present == RANAP_IuTransportAssociation_PR_gTP_TEI) { gtp_tei = asn1str_to_u32(&item->iuTransportAssociation->choice.gTP_TEI); - pdp = sgsn_pdp_ctx_by_tei(mm, gtp_tei); + pdp = sgsn_pdp_ctx_by_tei(ctx, gtp_tei); } if (!pdp) { @@ -429,29 +426,6 @@ int sgsn_ranap_rab_ass_resp(struct ue_conn_ctx *ctx, RANAP_RAB_SetupOrModifiedIt } -int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, int type, void *data) -{ - int rc = -1; - - switch (type) { - case IU_EVENT_RAB_ASSIGN: - rc = sgsn_ranap_rab_ass_resp(ctx, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data); - break; - case IU_EVENT_IU_RELEASE: - /* Clean up ue_conn_ctx here */ - break; - case IU_EVENT_SECURITY_MODE_COMPLETE: - /* Continue authentication here */ - break; - default: - LOGP(DRANAP, LOGL_NOTICE, "Unknown event received: %i\n", type); - rc = -1; - break; - } - return rc; -} - - /* Confirmation of a PDP Context Delete */ static int delete_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) { -- cgit v1.2.3