path: root/include
diff options
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-05 14:38:52 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-31 13:20:00 +0200
commitaae68b2791c636b6a58068bb43cf4c01cfd86c5d (patch)
tree4ce5e04c400afe84f752d49b4d612e5ab4bbc56d /include
parent13850b1e5dc10975bf0452d2b8290bdbe2a8356f (diff)
move openbsc.git's iu.h, iu.c, iu_vty.c here as iu_client
To help split openbsc.git to separate MSC and SGSN repositories, place the common Iu interface related code here in libosmo-ranap. Also apply various improvements while moving (from intermittent code review). The code depends on libosmo-ranap tightly. One reason to want this separate from libosmo-ranap could be that it uses libosmo-sigtran, accepting an sccp instance. However, including in libosmo-ranap is the simplest way to go. The osmo-iuh build depends on libosmo-sigtran anyway because of OsmoHNBGW, and all current users of libosmo-ranap also naturally link libosmo-sigtran already. Apply prefix ranap_iu_ and RANAP_IU_ to allow smooth transition from the openbsc.git iu_ to the libranap ranap_iu_ implementations. Prune unneeded #include statements. Instead of sccp_addr, store an rnc pointer in the ue_conn_ctx. To facilitate, also: - Move iu_rnc struct to iu_client.h (as ranap_iu_rnc). - Instead of sccp_addr, pass rnc to ue_conn_ctx_alloc(). - Pass a local struct new_ue_conn_ctx containing the sccp_addr and conn_id up the RANAP handling stack in case of an InitialUE message. - Separate the InitialUE message handling from cn_ranap_handle_co(), by moving to new and separate cn_ranap_handle_co_initial(), so we can still pass a looked-up ue_conn_ctx to all other cn_ranap_handle_co() code paths. - Allocate the ue_conn_ctx only in ranap_handle_co_initial_ue(), not as early as before. Note that we are not actually ever using the rnc pointer now present in ue_conn_ctx. It could be used for more concise paging, to first page only the RNC where we last saw the subscriber. So far we page all matching LAC/RACs. Tweak error logging: use __func__ instead of writing the function names as string constants. In iu_client_vty.c: - Move the asn.1 debug commands from logging over to the iu node. They are not specific to the logging target. They could qualify for an entirely separate 'asn1' root node, but for simplicity place under 'iu'. - Add the 'asn1' commands to ranap_iu_vty_config_write(), so far missing. - remove the legacy "net." from a VTY error message, it is not known which name the parent node of 'iu' has. Depends: libosmo-sccp I85b46269dbe7909e52873ace3f720f6292a4516c, libosmo-sccp Ie1aedd7894acd69ddc887cd65a8a0df4b888838c Change-Id: I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0
Diffstat (limited to 'include')
2 files changed, 75 insertions, 0 deletions
diff --git a/include/osmocom/ranap/Makefile.am b/include/osmocom/ranap/Makefile.am
index 0f83e03..1606928 100644
--- a/include/osmocom/ranap/Makefile.am
+++ b/include/osmocom/ranap/Makefile.am
@@ -12,6 +12,7 @@ ranap_HEADERS = \
ranap_common_cn.h \
ranap_msg_factory.h \
iu_helpers.h \
+ iu_client.h \
RANAP_AccuracyFulfilmentIndicator.h \
RANAP_AllocationOrRetentionPriority.h \
RANAP_AlternativeRABConfigurationRequest.h \
diff --git a/include/osmocom/ranap/iu_client.h b/include/osmocom/ranap/iu_client.h
new file mode 100644
index 0000000..873b2d2
--- /dev/null
+++ b/include/osmocom/ranap/iu_client.h
@@ -0,0 +1,74 @@
+#pragma once
+#include <stdbool.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/gsm/gsm48.h>
+#include <osmocom/sigtran/sccp_sap.h>
+struct msgb;
+struct osmo_auth_vector;
+struct RANAP_RAB_SetupOrModifiedItemIEs_s;
+struct RANAP_Cause;
+struct ranap_iu_rnc;
+/* Debugging switches from asn1c and osmo-iuh */
+extern int asn_debug;
+extern int asn1_xer_print;
+enum ranap_nsap_addr_enc {
+struct ranap_ue_conn_ctx {
+ struct llist_head list;
+ struct ranap_iu_rnc *rnc;
+ uint32_t conn_id;
+ int integrity_active;
+ struct gprs_ra_id ra_id;
+ enum ranap_nsap_addr_enc rab_assign_addr_enc;
+enum ranap_iu_event_type {
+ RANAP_IU_EVENT_IU_RELEASE, /* An actual Iu Release message was received */
+ RANAP_IU_EVENT_LINK_INVALIDATED, /* A SUA link was lost or closed down */
+extern const struct value_string ranap_iu_event_type_names[];
+static inline const char *ranap_iu_event_type_str(enum ranap_iu_event_type e)
+ return get_value_string(ranap_iu_event_type_names, e);
+/* Implementations of iu_recv_cb_t shall find the ranap_ue_conn_ctx in msg->dst. */
+typedef int (* ranap_iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id,
+ uint16_t *sai);
+typedef int (* ranap_iu_event_cb_t )(struct ranap_ue_conn_ctx *ue_ctx,
+ enum ranap_iu_event_type type, void *data);
+typedef int (* ranap_iu_rab_ass_resp_cb_t )(struct ranap_ue_conn_ctx *ue_ctx, uint8_t rab_id,
+ struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies);
+int ranap_iu_init(void *ctx, int log_subsystem, const char *sccp_user_name, struct osmo_sccp_instance *sccp,
+ ranap_iu_recv_cb_t iu_recv_cb, ranap_iu_event_cb_t iu_event_cb);
+int ranap_iu_tx(struct msgb *msg, uint8_t sapi);
+int ranap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
+int ranap_iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac);
+int ranap_iu_rab_act(struct ranap_ue_conn_ctx *ue_ctx, struct msgb *msg);
+int ranap_iu_rab_deact(struct ranap_ue_conn_ctx *ue_ctx, uint8_t rab_id);
+int ranap_iu_tx_sec_mode_cmd(struct ranap_ue_conn_ctx *uectx, struct osmo_auth_vector *vec,
+ int send_ck, int new_key);
+int ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *ue_ctx, const char *imsi);
+int ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause);
+void ranap_iu_vty_init(int iu_parent_node, enum ranap_nsap_addr_enc *rab_assign_addr_enc);
+int ranap_iu_vty_config_write(struct vty *vty, const char *indent);