From 21adb2bcd1801c6103fde7f598d8309fcbbbd6c8 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 15 Mar 2018 12:55:46 +0100 Subject: [PATCH] cosmetic: use enum ranap_nsap_addr_enc instead of int The only reason to use int instead of the enum was the lack of header iu_client.h when not building with Iu support. Rather use the configure result properly, include the header when Iu support is built and use the proper enum. Omit the entire iu sub-struct when building without Iu. Add LIBOSMORANAP_CFLAGS to libvlr, in order to find the iu_client.h header (now also included from gsm_data.h). Rationale: Instead of using a questionable typecast from int* to enum*, we can now use the enum member directly without needing to silence compiler warnings. Change-Id: Ic9f8bf53f4b605c166e84cd7edd90c10fe7d7a1f --- include/osmocom/msc/gsm_data.h | 9 ++++++++- src/libmsc/msc_vty.c | 10 +++++++++- src/libvlr/Makefile.am | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index c5e7aaf12..73047eeb9 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -23,6 +23,11 @@ /* TS 48.008 DLCI containing DCCH/ACCH + SAPI */ #define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3] +#include "../../bscconfig.h" +#if BUILD_IU +#include +#endif + /** annotations for msgb ownership */ #define __uses @@ -311,12 +316,14 @@ struct gsm_network { struct mgcp_client *client; } mgw; +#if BUILD_IU struct { /* CS7 instance id number (set via VTY) */ uint32_t cs7_instance; - int rab_assign_addr_enc; + enum ranap_nsap_addr_enc rab_assign_addr_enc; struct osmo_sccp_instance *sccp; } iu; +#endif struct { /* CS7 instance id number (set via VTY) */ diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c index 84d4d1416..d10028eef 100644 --- a/src/libmsc/msc_vty.c +++ b/src/libmsc/msc_vty.c @@ -380,8 +380,14 @@ DEFUN(cfg_msc_cs7_instance_iu, "cs7-instance-iu <0-15>", "Set SS7 to be used by the Iu-Interface.\n" "SS7 instance reference number\n") { +#if BUILD_IU gsmnet->iu.cs7_instance = atoi(argv[0]); return CMD_SUCCESS; +#else + vty_out(vty, "WARNING: 'cs7-instance-iu' without effect: built without Iu support%s", + VTY_NEWLINE); + return CMD_WARNING; +#endif } DEFUN(cfg_msc_auth_tuple_max_reuse_count, cfg_msc_auth_tuple_max_reuse_count_cmd, @@ -437,8 +443,10 @@ static int config_write_msc(struct vty *vty) vty_out(vty, " cs7-instance-a %u%s", gsmnet->a.cs7_instance, VTY_NEWLINE); +#if BUILD_IU vty_out(vty, " cs7-instance-iu %u%s", gsmnet->iu.cs7_instance, VTY_NEWLINE); +#endif if (gsmnet->vlr->cfg.auth_tuple_max_reuse_count) vty_out(vty, " auth-tuple-max-reuse-count %d%s", @@ -1422,7 +1430,7 @@ void msc_vty_init(struct gsm_network *msc_network) mgcp_client_vty_init(msc_network, MSC_NODE, &msc_network->mgw.conf); #ifdef BUILD_IU - ranap_iu_vty_init(MSC_NODE, (enum ranap_nsap_addr_enc*)&msc_network->iu.rab_assign_addr_enc); + ranap_iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc); #endif osmo_fsm_vty_add_cmds(); diff --git a/src/libvlr/Makefile.am b/src/libvlr/Makefile.am index e3d5cedf8..1408f6cd0 100644 --- a/src/libvlr/Makefile.am +++ b/src/libvlr/Makefile.am @@ -6,6 +6,7 @@ AM_CFLAGS= \ $(LIBOSMOSCCP_CFLAGS) \ $(LIBOSMOMGCPCLIENT_CFLAGS) \ $(LIBOSMOABIS_CFLAGS) \ + $(LIBOSMORANAP_CFLAGS) \ $(COVERAGE_CFLAGS) \ $(NULL)