diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-07-05 15:19:52 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2017-08-30 14:12:37 +0200 |
commit | a7a3947b9bd82e30124baab5c71925f20228ad9a (patch) | |
tree | 8ff1590450428ec95acff27a6c615498fcdd719b /src/gprs | |
parent | e0437166ffd44cce0515b0f1ce26d0a979ef48c2 (diff) |
move libiu to osmo-iuh/libosmo-ranap
Remove libiu here, use the functions from libosmo-ranap instead, by applying
the ranap_ / RANAP_ prefix.
Corresponding change-id in osmo-iuh.git is I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0
To be able to run the msc_vlr tests for RAN_UTRAN_IU without Iu client headers
available, add iu_dummy.h, containing mere function signatures that match
iu_dummy.c and a mostly empty struct ranap_ue_conn_ctx.
Make sure we can build with and without --enable-iu: include osmo-iuh headers
only with --enable-iu.
Change-Id: Ib8c4fcdb4766c5e575618b95ce16dce51063206b
Diffstat (limited to 'src/gprs')
-rw-r--r-- | src/gprs/Makefile.am | 1 | ||||
-rw-r--r-- | src/gprs/gprs_gmm.c | 47 | ||||
-rw-r--r-- | src/gprs/gprs_sgsn.c | 11 | ||||
-rw-r--r-- | src/gprs/sgsn_libgtp.c | 6 | ||||
-rw-r--r-- | src/gprs/sgsn_main.c | 9 | ||||
-rw-r--r-- | src/gprs/sgsn_vty.c | 6 |
6 files changed, 50 insertions, 30 deletions
diff --git a/src/gprs/Makefile.am b/src/gprs/Makefile.am index e05eb79ff..39a4c12a7 100644 --- a/src/gprs/Makefile.am +++ b/src/gprs/Makefile.am @@ -106,7 +106,6 @@ osmo_sgsn_LDADD = \ $(NULL) if BUILD_IU osmo_sgsn_LDADD += \ - $(top_builddir)/src/libiu/libiu.a \ $(LIBOSMOSIGTRAN_LIBS) \ $(LIBOSMORANAP_LIBS) \ $(LIBASN1C_LIBS) \ diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 15e2fedf6..032137f0b 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -52,6 +52,7 @@ #ifdef BUILD_IU #include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_msg_factory.h> +#include <osmocom/ranap/iu_client.h> #endif #include <openbsc/debug.h> @@ -67,7 +68,6 @@ #include <openbsc/gprs_subscriber.h> #include <openbsc/sgsn.h> #include <openbsc/signal.h> -#include <openbsc/iu.h> #include <openbsc/gprs_sndcp.h> #include <pdp.h> @@ -174,7 +174,7 @@ void mmctx_set_mm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state) #ifdef BUILD_IU 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, enum iu_event_type type, void *data) +int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data) { struct sgsn_mm_ctx *mm; int rc = -1; @@ -188,14 +188,14 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void * } switch (type) { - case IU_EVENT_RAB_ASSIGN: + case RANAP_IU_EVENT_RAB_ASSIGN: REQUIRE_MM rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data); break; - case IU_EVENT_IU_RELEASE: + case RANAP_IU_EVENT_IU_RELEASE: /* fall thru */ - case IU_EVENT_LINK_INVALIDATED: - /* Clean up ue_conn_ctx here */ + case RANAP_IU_EVENT_LINK_INVALIDATED: + /* Clean up ranap_ue_conn_ctx here */ if (mm) LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); else @@ -205,7 +205,7 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void * mmctx_set_pmm_state(mm, PMM_IDLE); rc = 0; break; - case IU_EVENT_SECURITY_MODE_COMPLETE: + case RANAP_IU_EVENT_SECURITY_MODE_COMPLETE: REQUIRE_MM /* Continue authentication here */ mm->iu.ue_ctx->integrity_active = 1; @@ -262,16 +262,16 @@ static int gsm48_gmm_sendmsg(struct msgb *msg, int command, rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_SIG_OUT]); #ifdef BUILD_IU if (mm->ran_type == MM_CTX_T_UTRAN_Iu) - return iu_tx(msg, GPRS_SAPI_GMM); + return ranap_iu_tx(msg, GPRS_SAPI_GMM); #endif } #ifdef BUILD_IU - /* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb mode + /* In Iu mode, msg->dst contains the ranap_ue_conn_ctx pointer, in Gb mode * dst is empty. */ /* FIXME: have a more explicit indicator for Iu messages */ if (msg->dst) - return iu_tx(msg, GPRS_SAPI_GMM); + return ranap_iu_tx(msg, GPRS_SAPI_GMM); #endif /* caller needs to provide TLLI, BVCI and NSEI */ @@ -296,9 +296,12 @@ static void msgid2mmctx(struct sgsn_mm_ctx *mm, const struct msgb *msg) /* In case a Iu connection is reconnected we need to update the ue ctx */ mm->iu.ue_ctx = msg->dst; if (mm->ran_type == MM_CTX_T_UTRAN_Iu - && mm->iu.ue_ctx) + && mm->iu.ue_ctx) { +#ifdef BUILD_IU mm->iu.ue_ctx->rab_assign_addr_enc = sgsn->cfg.iu.rab_assign_addr_enc; +#endif + } } /* Store BVCI/NSEI in MM context */ @@ -1048,7 +1051,7 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) /* The MS is authorized */ #ifdef BUILD_IU if (ctx->ran_type == MM_CTX_T_UTRAN_Iu && !ctx->iu.ue_ctx->integrity_active) { - rc = iu_tx_sec_mode_cmd(ctx->iu.ue_ctx, &ctx->auth_triplet, 0, ctx->iu.new_key); + rc = ranap_iu_tx_sec_mode_cmd(ctx->iu.ue_ctx, &ctx->auth_triplet.vec, 0, ctx->iu.new_key); ctx->iu.new_key = 0; return rc; } @@ -1259,14 +1262,20 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg, * with a foreign TLLI (P-TMSI that was allocated to the MS before), * or with random TLLI. */ - /* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb mode + /* In Iu mode, msg->dst contains the ranap_ue_conn_ctx pointer, in Gb mode * dst is empty. */ /* FIXME: have a more explicit indicator for Iu messages */ if (!msg->dst) { /* Gb mode */ cid = bssgp_parse_cell_id(&ra_id, msgb_bcid(msg)); - } else - ra_id = ((struct ue_conn_ctx*)msg->dst)->ra_id; + } else { +#ifdef BUILD_IU + ra_id = ((struct ranap_ue_conn_ctx*)msg->dst)->ra_id; +#else + LOGMMCTXP(LOGL_ERROR, ctx, "Cannot handle Iu Attach Request, built without Iu support\n"); + return -ENOTSUP; +#endif + } /* MS network capability 10.5.5.12 */ msnc_len = *cur++; @@ -1627,7 +1636,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, * is an optimization to avoid the RA reject (impl detached) * below, which will cause a new attach cycle. */ /* Look-up the MM context based on old RA-ID and TLLI */ - /* In Iu mode, msg->dst contains the ue_conn_ctx pointer, in Gb + /* In Iu mode, msg->dst contains the ranap_ue_conn_ctx pointer, in Gb * mode dst is empty. */ /* FIXME: have a more explicit indicator for Iu messages */ if (!msg->dst) { @@ -2905,12 +2914,12 @@ int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp) { struct msgb *msg; struct sgsn_mm_ctx *mm = pdp->mm; - struct ue_conn_ctx *uectx; + struct ranap_ue_conn_ctx *uectx; uint32_t ggsn_ip; bool use_x213_nsap; uectx = mm->iu.ue_ctx; - use_x213_nsap = (uectx->rab_assign_addr_enc == NSAP_ADDR_ENC_X213); + use_x213_nsap = (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213); /* Get the IP address for ggsn user plane */ memcpy(&ggsn_ip, pdp->lib->gsnru.v, pdp->lib->gsnru.l); @@ -2923,6 +2932,6 @@ int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp) msg = ranap_new_msg_rab_assign_data(rab_id, ggsn_ip, pdp->lib->teid_gn, use_x213_nsap); msg->l2h = msg->data; - return iu_rab_act(uectx, msg); + return ranap_iu_rab_act(uectx, msg); } #endif diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index 43eeaaa9b..de79afb1a 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -40,7 +40,6 @@ #include <openbsc/gprs_utils.h> #include <openbsc/signal.h> #include "openbsc/gprs_llc.h" -#include <openbsc/iu.h> #include <pdp.h> @@ -48,6 +47,12 @@ #include <openssl/rand.h> +#include "../../bscconfig.h" + +#if BUILD_IU +#include <osmocom/ranap/iu_client.h> +#endif + #define GPRS_LLME_CHECK_TICK 30 extern struct sgsn_instance *sgsn; @@ -246,6 +251,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli, /* Allocate a new SGSN MM context */ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx) { +#if BUILD_IU struct sgsn_mm_ctx *ctx; ctx = talloc_zero(tall_bsc_ctx, struct sgsn_mm_ctx); @@ -274,6 +280,9 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx) llist_add(&ctx->list, &sgsn_mm_ctxts); return ctx; +#else + return NULL; +#endif } diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c index 7ff8ece5b..90b4d1636 100644 --- a/src/gprs/sgsn_libgtp.c +++ b/src/gprs/sgsn_libgtp.c @@ -52,7 +52,7 @@ #include <openbsc/gprs_sndcp.h> #ifdef BUILD_IU -#include <openbsc/iu.h> +#include <osmocom/ranap/iu_client.h> #include <osmocom/ranap/ranap_ies_defs.h> #endif @@ -548,7 +548,7 @@ static int delete_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) } else { #ifdef BUILD_IU /* Deactivate radio bearer */ - iu_rab_deact(pctx->mm->iu.ue_ctx, 1); + ranap_iu_rab_deact(pctx->mm->iu.ue_ctx, 1); #else return -ENOTSUP; #endif @@ -687,7 +687,7 @@ static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len) #ifdef BUILD_IU /* Ignore the packet for now and page the UE to get the RAB * reestablished */ - iu_page_ps(mm->imsi, &mm->p_tmsi, mm->ra.lac, mm->ra.rac); + ranap_iu_page_ps(mm->imsi, &mm->p_tmsi, mm->ra.lac, mm->ra.rac); return 0; #else diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c index d56af0ed4..25ee632cc 100644 --- a/src/gprs/sgsn_main.c +++ b/src/gprs/sgsn_main.c @@ -58,7 +58,6 @@ #include <openbsc/sgsn.h> #include <openbsc/gprs_llc.h> #include <openbsc/gprs_gmm.h> -#include <openbsc/iu.h> #include <osmocom/ctrl/control_if.h> #include <osmocom/ctrl/ports.h> @@ -69,6 +68,10 @@ #include "../../bscconfig.h" +#if BUILD_IU +#include <osmocom/ranap/iu_client.h> +#endif + #define _GNU_SOURCE #include <getopt.h> @@ -322,7 +325,7 @@ static const struct log_info gprs_log_info = { .num_cat = ARRAY_SIZE(gprs_categories), }; -int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void *data); +int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data); int main(int argc, char **argv) { @@ -451,7 +454,7 @@ int main(int argc, char **argv) return 8; } - iu_init(tall_bsc_ctx, sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event); + ranap_iu_init(tall_bsc_ctx, DRANAP, "OsmoSGSN-IuPS", sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event); #endif if (daemonize) { diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c index cf44cc420..3a5b2ca64 100644 --- a/src/gprs/sgsn_vty.c +++ b/src/gprs/sgsn_vty.c @@ -48,7 +48,7 @@ #include "../../bscconfig.h" #ifdef BUILD_IU -#include <openbsc/iu.h> +#include <osmocom/ranap/iu_client.h> #endif static struct sgsn_config *g_cfg = NULL; @@ -291,7 +291,7 @@ static int config_write_sgsn(struct vty *vty) vty_out(vty, " no compression v42bis%s", VTY_NEWLINE); #ifdef BUILD_IU - iu_vty_config_write(vty, " "); + ranap_iu_vty_config_write(vty, " "); #endif return CMD_SUCCESS; @@ -1285,7 +1285,7 @@ int sgsn_vty_init(struct sgsn_config *cfg) install_element(SGSN_NODE, &cfg_comp_v42bisp_cmd); #ifdef BUILD_IU - iu_vty_init(SGSN_NODE, &g_cfg->iu.rab_assign_addr_enc); + ranap_iu_vty_init(SGSN_NODE, &g_cfg->iu.rab_assign_addr_enc); #endif return 0; } |