Move event callback to gprs_gmm

This commit is contained in:
Daniel Willmann
2016-03-16 18:38:58 +01:00
parent d04db9d907
commit 5e611021b0
2 changed files with 37 additions and 29 deletions

View File

@@ -38,9 +38,11 @@
#include <osmocom/core/signal.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/crypt/auth.h>
#include <osmocom/gsm/apn.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/ranap/ranap_ies_defs.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
@@ -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);

View File

@@ -37,6 +37,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/crypt/auth.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <openbsc/gsm_04_08_gprs.h>
@@ -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)
{