aboutsummaryrefslogtreecommitdiffstats
path: root/src/libbsc
diff options
context:
space:
mode:
authorJonathan Santos <jrsantos@jonathanrsantos.com>2011-08-17 15:33:57 -0400
committerJonathan Santos <jrsantos@jonathanrsantos.com>2011-08-17 15:33:57 -0400
commit5a45b156d4165fed159a290c46676d1383ffcc80 (patch)
tree3689fb40b5b432140fd48822973b760af93080a6 /src/libbsc
parent03fd8d014f9871896a86534432c8757d65a576fe (diff)
New upstream version 0.9.14upstream/0.9.14
Diffstat (limited to 'src/libbsc')
-rw-r--r--src/libbsc/Makefile.am7
-rw-r--r--src/libbsc/Makefile.in19
-rw-r--r--src/libbsc/abis_nm.c910
-rw-r--r--src/libbsc/abis_nm_vty.c8
-rw-r--r--src/libbsc/abis_om2000.c598
-rw-r--r--src/libbsc/abis_om2000_vty.c62
-rw-r--r--src/libbsc/abis_rsl.c285
-rw-r--r--src/libbsc/bsc_api.c24
-rw-r--r--src/libbsc/bsc_init.c64
-rw-r--r--src/libbsc/bsc_msc.c74
-rw-r--r--src/libbsc/bsc_rll.c28
-rw-r--r--src/libbsc/bsc_vty.c80
-rw-r--r--src/libbsc/bts_ericsson_rbs2000.c121
-rw-r--r--src/libbsc/bts_hsl_femtocell.c19
-rw-r--r--src/libbsc/bts_init.c29
-rw-r--r--src/libbsc/bts_ipaccess_nanobts.c32
-rw-r--r--src/libbsc/bts_siemens_bs11.c31
-rw-r--r--src/libbsc/bts_unknown.c3
-rw-r--r--src/libbsc/chan_alloc.c34
-rw-r--r--src/libbsc/e1_config.c2
-rw-r--r--src/libbsc/gsm_04_08_utils.c48
-rw-r--r--src/libbsc/gsm_subscriber_base.c2
-rw-r--r--src/libbsc/handover_decision.c16
-rw-r--r--src/libbsc/handover_logic.c36
-rw-r--r--src/libbsc/meas_rep.c1
-rw-r--r--src/libbsc/paging.c76
-rw-r--r--src/libbsc/rest_octets.c10
-rw-r--r--src/libbsc/system_information.c134
28 files changed, 1366 insertions, 1387 deletions
diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am
index de769295..3af4a2a3 100644
--- a/src/libbsc/Makefile.am
+++ b/src/libbsc/Makefile.am
@@ -1,6 +1,6 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
noinst_LIBRARIES = libbsc.a
@@ -18,8 +18,7 @@ libbsc_a_SOURCES = abis_nm.c abis_nm_vty.c \
handover_decision.c handover_logic.c meas_rep.c \
rest_octets.c system_information.c \
e1_config.c \
- transaction.c \
bsc_api.c bsc_msc.c bsc_vty.c \
gsm_04_08_utils.c \
- bsc_init.c
+ bsc_init.c bts_init.c
diff --git a/src/libbsc/Makefile.in b/src/libbsc/Makefile.in
index e5d3d201..a39c86f7 100644
--- a/src/libbsc/Makefile.in
+++ b/src/libbsc/Makefile.in
@@ -35,7 +35,7 @@ POST_UNINSTALL = :
subdir = src/libbsc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -62,9 +62,9 @@ am_libbsc_a_OBJECTS = abis_nm.$(OBJEXT) abis_nm_vty.$(OBJEXT) \
gsm_subscriber_base.$(OBJEXT) handover_decision.$(OBJEXT) \
handover_logic.$(OBJEXT) meas_rep.$(OBJEXT) \
rest_octets.$(OBJEXT) system_information.$(OBJEXT) \
- e1_config.$(OBJEXT) transaction.$(OBJEXT) bsc_api.$(OBJEXT) \
- bsc_msc.$(OBJEXT) bsc_vty.$(OBJEXT) gsm_04_08_utils.$(OBJEXT) \
- bsc_init.$(OBJEXT)
+ e1_config.$(OBJEXT) bsc_api.$(OBJEXT) bsc_msc.$(OBJEXT) \
+ bsc_vty.$(OBJEXT) gsm_04_08_utils.$(OBJEXT) bsc_init.$(OBJEXT) \
+ bts_init.$(OBJEXT)
libbsc_a_OBJECTS = $(am_libbsc_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -121,6 +121,8 @@ LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBOSMOCORE_CFLAGS = @LIBOSMOCORE_CFLAGS@
LIBOSMOCORE_LIBS = @LIBOSMOCORE_LIBS@
+LIBOSMOGSM_CFLAGS = @LIBOSMOGSM_CFLAGS@
+LIBOSMOGSM_LIBS = @LIBOSMOGSM_LIBS@
LIBOSMOSCCP_CFLAGS = @LIBOSMOSCCP_CFLAGS@
LIBOSMOSCCP_LIBS = @LIBOSMOSCCP_LIBS@
LIBOSMOVTY_CFLAGS = @LIBOSMOVTY_CFLAGS@
@@ -190,8 +192,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
noinst_LIBRARIES = libbsc.a
libbsc_a_SOURCES = abis_nm.c abis_nm_vty.c \
abis_om2000.c abis_om2000_vty.c \
@@ -207,10 +209,9 @@ libbsc_a_SOURCES = abis_nm.c abis_nm_vty.c \
handover_decision.c handover_logic.c meas_rep.c \
rest_octets.c system_information.c \
e1_config.c \
- transaction.c \
bsc_api.c bsc_msc.c bsc_vty.c \
gsm_04_08_utils.c \
- bsc_init.c
+ bsc_init.c bts_init.c
all: all-am
@@ -272,6 +273,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsc_vty.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bts_ericsson_rbs2000.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bts_hsl_femtocell.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bts_init.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bts_ipaccess_nanobts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bts_siemens_bs11.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bts_unknown.Po@am__quote@
@@ -285,7 +287,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paging.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rest_octets.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system_information.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transaction.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 0e7fc8d8..494d4cab 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -30,16 +30,16 @@
#include <time.h>
#include <limits.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/gsm/abis_nm.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/abis_nm.h>
#include <openbsc/misdn.h>
#include <openbsc/signal.h>
@@ -48,302 +48,7 @@
#define OM_HEADROOM_SIZE 128
#define IPACC_SEGMENT_SIZE 245
-/* unidirectional messages from BTS to BSC */
-static const enum abis_nm_msgtype reports[] = {
- NM_MT_SW_ACTIVATED_REP,
- NM_MT_TEST_REP,
- NM_MT_STATECHG_EVENT_REP,
- NM_MT_FAILURE_EVENT_REP,
-};
-
-/* messages without ACK/NACK */
-static const enum abis_nm_msgtype no_ack_nack[] = {
- NM_MT_MEAS_RES_REQ,
- NM_MT_STOP_MEAS,
- NM_MT_START_MEAS,
-};
-
-/* Messages related to software load */
-static const enum abis_nm_msgtype sw_load_msgs[] = {
- NM_MT_LOAD_INIT_ACK,
- NM_MT_LOAD_INIT_NACK,
- NM_MT_LOAD_SEG_ACK,
- NM_MT_LOAD_ABORT,
- NM_MT_LOAD_END_ACK,
- NM_MT_LOAD_END_NACK,
- //NM_MT_SW_ACT_REQ,
- NM_MT_ACTIVATE_SW_ACK,
- NM_MT_ACTIVATE_SW_NACK,
- NM_MT_SW_ACTIVATED_REP,
-};
-
-static const enum abis_nm_msgtype nacks[] = {
- NM_MT_LOAD_INIT_NACK,
- NM_MT_LOAD_END_NACK,
- NM_MT_SW_ACT_REQ_NACK,
- NM_MT_ACTIVATE_SW_NACK,
- NM_MT_ESTABLISH_TEI_NACK,
- NM_MT_CONN_TERR_SIGN_NACK,
- NM_MT_DISC_TERR_SIGN_NACK,
- NM_MT_CONN_TERR_TRAF_NACK,
- NM_MT_DISC_TERR_TRAF_NACK,
- NM_MT_CONN_MDROP_LINK_NACK,
- NM_MT_DISC_MDROP_LINK_NACK,
- NM_MT_SET_BTS_ATTR_NACK,
- NM_MT_SET_RADIO_ATTR_NACK,
- NM_MT_SET_CHAN_ATTR_NACK,
- NM_MT_PERF_TEST_NACK,
- NM_MT_SEND_TEST_REP_NACK,
- NM_MT_STOP_TEST_NACK,
- NM_MT_STOP_EVENT_REP_NACK,
- NM_MT_REST_EVENT_REP_NACK,
- NM_MT_CHG_ADM_STATE_NACK,
- NM_MT_CHG_ADM_STATE_REQ_NACK,
- NM_MT_REP_OUTST_ALARMS_NACK,
- NM_MT_CHANGEOVER_NACK,
- NM_MT_OPSTART_NACK,
- NM_MT_REINIT_NACK,
- NM_MT_SET_SITE_OUT_NACK,
- NM_MT_CHG_HW_CONF_NACK,
- NM_MT_GET_ATTR_NACK,
- NM_MT_SET_ALARM_THRES_NACK,
- NM_MT_BS11_BEGIN_DB_TX_NACK,
- NM_MT_BS11_END_DB_TX_NACK,
- NM_MT_BS11_CREATE_OBJ_NACK,
- NM_MT_BS11_DELETE_OBJ_NACK,
-};
-
-static const struct value_string nack_names[] = {
- { NM_MT_LOAD_INIT_NACK, "SOFTWARE LOAD INIT" },
- { NM_MT_LOAD_END_NACK, "SOFTWARE LOAD END" },
- { NM_MT_SW_ACT_REQ_NACK, "SOFTWARE ACTIVATE REQUEST" },
- { NM_MT_ACTIVATE_SW_NACK, "ACTIVATE SOFTWARE" },
- { NM_MT_ESTABLISH_TEI_NACK, "ESTABLISH TEI" },
- { NM_MT_CONN_TERR_SIGN_NACK, "CONNECT TERRESTRIAL SIGNALLING" },
- { NM_MT_DISC_TERR_SIGN_NACK, "DISCONNECT TERRESTRIAL SIGNALLING" },
- { NM_MT_CONN_TERR_TRAF_NACK, "CONNECT TERRESTRIAL TRAFFIC" },
- { NM_MT_DISC_TERR_TRAF_NACK, "DISCONNECT TERRESTRIAL TRAFFIC" },
- { NM_MT_CONN_MDROP_LINK_NACK, "CONNECT MULTI-DROP LINK" },
- { NM_MT_DISC_MDROP_LINK_NACK, "DISCONNECT MULTI-DROP LINK" },
- { NM_MT_SET_BTS_ATTR_NACK, "SET BTS ATTRIBUTE" },
- { NM_MT_SET_RADIO_ATTR_NACK, "SET RADIO ATTRIBUTE" },
- { NM_MT_SET_CHAN_ATTR_NACK, "SET CHANNEL ATTRIBUTE" },
- { NM_MT_PERF_TEST_NACK, "PERFORM TEST" },
- { NM_MT_SEND_TEST_REP_NACK, "SEND TEST REPORT" },
- { NM_MT_STOP_TEST_NACK, "STOP TEST" },
- { NM_MT_STOP_EVENT_REP_NACK, "STOP EVENT REPORT" },
- { NM_MT_REST_EVENT_REP_NACK, "RESET EVENT REPORT" },
- { NM_MT_CHG_ADM_STATE_NACK, "CHANGE ADMINISTRATIVE STATE" },
- { NM_MT_CHG_ADM_STATE_REQ_NACK,
- "CHANGE ADMINISTRATIVE STATE REQUEST" },
- { NM_MT_REP_OUTST_ALARMS_NACK, "REPORT OUTSTANDING ALARMS" },
- { NM_MT_CHANGEOVER_NACK, "CHANGEOVER" },
- { NM_MT_OPSTART_NACK, "OPSTART" },
- { NM_MT_REINIT_NACK, "REINIT" },
- { NM_MT_SET_SITE_OUT_NACK, "SET SITE OUTPUT" },
- { NM_MT_CHG_HW_CONF_NACK, "CHANGE HARDWARE CONFIGURATION" },
- { NM_MT_GET_ATTR_NACK, "GET ATTRIBUTE" },
- { NM_MT_SET_ALARM_THRES_NACK, "SET ALARM THRESHOLD" },
- { NM_MT_BS11_BEGIN_DB_TX_NACK, "BS11 BEGIN DATABASE TRANSMISSION" },
- { NM_MT_BS11_END_DB_TX_NACK, "BS11 END DATABASE TRANSMISSION" },
- { NM_MT_BS11_CREATE_OBJ_NACK, "BS11 CREATE OBJECT" },
- { NM_MT_BS11_DELETE_OBJ_NACK, "BS11 DELETE OBJECT" },
- { 0, NULL }
-};
-
-/* Chapter 9.4.36 */
-static const struct value_string nack_cause_names[] = {
- /* General Nack Causes */
- { NM_NACK_INCORR_STRUCT, "Incorrect message structure" },
- { NM_NACK_MSGTYPE_INVAL, "Invalid message type value" },
- { NM_NACK_OBJCLASS_INVAL, "Invalid Object class value" },
- { NM_NACK_OBJCLASS_NOTSUPP, "Object class not supported" },
- { NM_NACK_BTSNR_UNKN, "BTS no. unknown" },
- { NM_NACK_TRXNR_UNKN, "Baseband Transceiver no. unknown" },
- { NM_NACK_OBJINST_UNKN, "Object Instance unknown" },
- { NM_NACK_ATTRID_INVAL, "Invalid attribute identifier value" },
- { NM_NACK_ATTRID_NOTSUPP, "Attribute identifier not supported" },
- { NM_NACK_PARAM_RANGE, "Parameter value outside permitted range" },
- { NM_NACK_ATTRLIST_INCONSISTENT,"Inconsistency in attribute list" },
- { NM_NACK_SPEC_IMPL_NOTSUPP, "Specified implementation not supported" },
- { NM_NACK_CANT_PERFORM, "Message cannot be performed" },
- /* Specific Nack Causes */
- { NM_NACK_RES_NOTIMPL, "Resource not implemented" },
- { NM_NACK_RES_NOTAVAIL, "Resource not available" },
- { NM_NACK_FREQ_NOTAVAIL, "Frequency not available" },
- { NM_NACK_TEST_NOTSUPP, "Test not supported" },
- { NM_NACK_CAPACITY_RESTR, "Capacity restrictions" },
- { NM_NACK_PHYSCFG_NOTPERFORM, "Physical configuration cannot be performed" },
- { NM_NACK_TEST_NOTINIT, "Test not initiated" },
- { NM_NACK_PHYSCFG_NOTRESTORE, "Physical configuration cannot be restored" },
- { NM_NACK_TEST_NOSUCH, "No such test" },
- { NM_NACK_TEST_NOSTOP, "Test cannot be stopped" },
- { NM_NACK_MSGINCONSIST_PHYSCFG, "Message inconsistent with physical configuration" },
- { NM_NACK_FILE_INCOMPLETE, "Complete file notreceived" },
- { NM_NACK_FILE_NOTAVAIL, "File not available at destination" },
- { NM_NACK_FILE_NOTACTIVATE, "File cannot be activate" },
- { NM_NACK_REQ_NOT_GRANT, "Request not granted" },
- { NM_NACK_WAIT, "Wait" },
- { NM_NACK_NOTH_REPORT_EXIST, "Nothing reportable existing" },
- { NM_NACK_MEAS_NOTSUPP, "Measurement not supported" },
- { NM_NACK_MEAS_NOTSTART, "Measurement not started" },
- { 0, NULL }
-};
-
-static const char *nack_cause_name(u_int8_t cause)
-{
- return get_value_string(nack_cause_names, cause);
-}
-
-/* Chapter 9.4.16: Event Type */
-static const struct value_string event_type_names[] = {
- { NM_EVT_COMM_FAIL, "communication failure" },
- { NM_EVT_QOS_FAIL, "quality of service failure" },
- { NM_EVT_PROC_FAIL, "processing failure" },
- { NM_EVT_EQUIP_FAIL, "equipment failure" },
- { NM_EVT_ENV_FAIL, "environment failure" },
- { 0, NULL }
-};
-
-static const char *event_type_name(u_int8_t cause)
-{
- return get_value_string(event_type_names, cause);
-}
-
-/* Chapter 9.4.63: Perceived Severity */
-static const struct value_string severity_names[] = {
- { NM_SEVER_CEASED, "failure ceased" },
- { NM_SEVER_CRITICAL, "critical failure" },
- { NM_SEVER_MAJOR, "major failure" },
- { NM_SEVER_MINOR, "minor failure" },
- { NM_SEVER_WARNING, "warning level failure" },
- { NM_SEVER_INDETERMINATE, "indeterminate failure" },
- { 0, NULL }
-};
-
-static const char *severity_name(u_int8_t cause)
-{
- return get_value_string(severity_names, cause);
-}
-
-/* Attributes that the BSC can set, not only get, according to Section 9.4 */
-static const enum abis_nm_attr nm_att_settable[] = {
- NM_ATT_ADD_INFO,
- NM_ATT_ADD_TEXT,
- NM_ATT_DEST,
- NM_ATT_EVENT_TYPE,
- NM_ATT_FILE_DATA,
- NM_ATT_GET_ARI,
- NM_ATT_HW_CONF_CHG,
- NM_ATT_LIST_REQ_ATTR,
- NM_ATT_MDROP_LINK,
- NM_ATT_MDROP_NEXT,
- NM_ATT_NACK_CAUSES,
- NM_ATT_OUTST_ALARM,
- NM_ATT_PHYS_CONF,
- NM_ATT_PROB_CAUSE,
- NM_ATT_RAD_SUBC,
- NM_ATT_SOURCE,
- NM_ATT_SPEC_PROB,
- NM_ATT_START_TIME,
- NM_ATT_TEST_DUR,
- NM_ATT_TEST_NO,
- NM_ATT_TEST_REPORT,
- NM_ATT_WINDOW_SIZE,
- NM_ATT_SEVERITY,
- NM_ATT_MEAS_RES,
- NM_ATT_MEAS_TYPE,
-};
-
-const struct tlv_definition nm_att_tlvdef = {
- .def = {
- [NM_ATT_ABIS_CHANNEL] = { TLV_TYPE_FIXED, 3 },
- [NM_ATT_ADD_INFO] = { TLV_TYPE_TL16V },
- [NM_ATT_ADD_TEXT] = { TLV_TYPE_TL16V },
- [NM_ATT_ADM_STATE] = { TLV_TYPE_TV },
- [NM_ATT_ARFCN_LIST]= { TLV_TYPE_TL16V },
- [NM_ATT_AUTON_REPORT] = { TLV_TYPE_TV },
- [NM_ATT_AVAIL_STATUS] = { TLV_TYPE_TL16V },
- [NM_ATT_BCCH_ARFCN] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_BSIC] = { TLV_TYPE_TV },
- [NM_ATT_BTS_AIR_TIMER] = { TLV_TYPE_TV },
- [NM_ATT_CCCH_L_I_P] = { TLV_TYPE_TV },
- [NM_ATT_CCCH_L_T] = { TLV_TYPE_TV },
- [NM_ATT_CHAN_COMB] = { TLV_TYPE_TV },
- [NM_ATT_CONN_FAIL_CRIT] = { TLV_TYPE_TL16V },
- [NM_ATT_DEST] = { TLV_TYPE_TL16V },
- [NM_ATT_EVENT_TYPE] = { TLV_TYPE_TV },
- [NM_ATT_FILE_DATA] = { TLV_TYPE_TL16V },
- [NM_ATT_FILE_ID] = { TLV_TYPE_TL16V },
- [NM_ATT_FILE_VERSION] = { TLV_TYPE_TL16V },
- [NM_ATT_GSM_TIME] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_HSN] = { TLV_TYPE_TV },
- [NM_ATT_HW_CONFIG] = { TLV_TYPE_TL16V },
- [NM_ATT_HW_DESC] = { TLV_TYPE_TL16V },
- [NM_ATT_INTAVE_PARAM] = { TLV_TYPE_TV },
- [NM_ATT_INTERF_BOUND] = { TLV_TYPE_FIXED, 6 },
- [NM_ATT_LIST_REQ_ATTR] = { TLV_TYPE_TL16V },
- [NM_ATT_MAIO] = { TLV_TYPE_TV },
- [NM_ATT_MANUF_STATE] = { TLV_TYPE_TV },
- [NM_ATT_MANUF_THRESH] = { TLV_TYPE_TL16V },
- [NM_ATT_MANUF_ID] = { TLV_TYPE_TL16V },
- [NM_ATT_MAX_TA] = { TLV_TYPE_TV },
- [NM_ATT_MDROP_LINK] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_MDROP_NEXT] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_NACK_CAUSES] = { TLV_TYPE_TV },
- [NM_ATT_NY1] = { TLV_TYPE_TV },
- [NM_ATT_OPER_STATE] = { TLV_TYPE_TV },
- [NM_ATT_OVERL_PERIOD] = { TLV_TYPE_TL16V },
- [NM_ATT_PHYS_CONF] = { TLV_TYPE_TL16V },
- [NM_ATT_POWER_CLASS] = { TLV_TYPE_TV },
- [NM_ATT_POWER_THRESH] = { TLV_TYPE_FIXED, 3 },
- [NM_ATT_PROB_CAUSE] = { TLV_TYPE_FIXED, 3 },
- [NM_ATT_RACH_B_THRESH] = { TLV_TYPE_TV },
- [NM_ATT_LDAVG_SLOTS] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_RAD_SUBC] = { TLV_TYPE_TV },
- [NM_ATT_RF_MAXPOWR_R] = { TLV_TYPE_TV },
- [NM_ATT_SITE_INPUTS] = { TLV_TYPE_TL16V },
- [NM_ATT_SITE_OUTPUTS] = { TLV_TYPE_TL16V },
- [NM_ATT_SOURCE] = { TLV_TYPE_TL16V },
- [NM_ATT_SPEC_PROB] = { TLV_TYPE_TV },
- [NM_ATT_START_TIME] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_T200] = { TLV_TYPE_FIXED, 7 },
- [NM_ATT_TEI] = { TLV_TYPE_TV },
- [NM_ATT_TEST_DUR] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_TEST_NO] = { TLV_TYPE_TV },
- [NM_ATT_TEST_REPORT] = { TLV_TYPE_TL16V },
- [NM_ATT_VSWR_THRESH] = { TLV_TYPE_FIXED, 2 },
- [NM_ATT_WINDOW_SIZE] = { TLV_TYPE_TV },
- [NM_ATT_TSC] = { TLV_TYPE_TV },
- [NM_ATT_SW_CONFIG] = { TLV_TYPE_TL16V },
- [NM_ATT_SEVERITY] = { TLV_TYPE_TV },
- [NM_ATT_GET_ARI] = { TLV_TYPE_TL16V },
- [NM_ATT_HW_CONF_CHG] = { TLV_TYPE_TL16V },
- [NM_ATT_OUTST_ALARM] = { TLV_TYPE_TV },
- [NM_ATT_MEAS_RES] = { TLV_TYPE_TL16V },
- },
-};
-
-static const enum abis_nm_chan_comb chcomb4pchan[] = {
- [GSM_PCHAN_CCCH] = NM_CHANC_mainBCCH,
- [GSM_PCHAN_CCCH_SDCCH4] = NM_CHANC_BCCHComb,
- [GSM_PCHAN_TCH_F] = NM_CHANC_TCHFull,
- [GSM_PCHAN_TCH_H] = NM_CHANC_TCHHalf,
- [GSM_PCHAN_SDCCH8_SACCH8C] = NM_CHANC_SDCCH,
- [GSM_PCHAN_PDCH] = NM_CHANC_IPAC_PDCH,
- [GSM_PCHAN_TCH_F_PDCH] = NM_CHANC_IPAC_TCHFull_PDCH,
- /* FIXME: bounds check */
-};
-
-int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan)
-{
- if (pchan < ARRAY_SIZE(chcomb4pchan))
- return chcomb4pchan[pchan];
-
- return -EINVAL;
-}
-
-int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const u_int8_t *buf, int len)
+int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len)
{
if (!bts->model)
return -EIO;
@@ -373,13 +78,13 @@ static int is_ack_nack(enum abis_nm_msgtype mt)
/* is this msgtype a report ? */
static int is_report(enum abis_nm_msgtype mt)
{
- return is_in_arr(mt, reports, ARRAY_SIZE(reports));
+ return is_in_arr(mt, abis_nm_reports, ARRAY_SIZE(abis_nm_reports));
}
#define MT_ACK(x) (x+1)
#define MT_NACK(x) (x+2)
-static void fill_om_hdr(struct abis_om_hdr *oh, u_int8_t len)
+static void fill_om_hdr(struct abis_om_hdr *oh, uint8_t len)
{
oh->mdisc = ABIS_OM_MDISC_FOM;
oh->placement = ABIS_OM_PLACEMENT_ONLY;
@@ -387,9 +92,9 @@ static void fill_om_hdr(struct abis_om_hdr *oh, u_int8_t len)
oh->length = len;
}
-static void fill_om_fom_hdr(struct abis_om_hdr *oh, u_int8_t len,
- u_int8_t msg_type, u_int8_t obj_class,
- u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr)
+static void fill_om_fom_hdr(struct abis_om_hdr *oh, uint8_t len,
+ uint8_t msg_type, uint8_t obj_class,
+ uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr)
{
struct abis_om_fom_hdr *foh =
(struct abis_om_fom_hdr *) oh->data;
@@ -438,90 +143,6 @@ static int abis_nm_sendmsg_direct(struct gsm_bts *bts, struct msgb *msg)
static int abis_nm_rcvmsg_sw(struct msgb *mb);
-const struct value_string abis_nm_obj_class_names[] = {
- { NM_OC_SITE_MANAGER, "SITE-MANAGER" },
- { NM_OC_BTS, "BTS" },
- { NM_OC_RADIO_CARRIER, "RADIO-CARRIER" },
- { NM_OC_BASEB_TRANSC, "BASEBAND-TRANSCEIVER" },
- { NM_OC_CHANNEL, "CHANNEL" },
- { NM_OC_BS11_ADJC, "ADJC" },
- { NM_OC_BS11_HANDOVER, "HANDOVER" },
- { NM_OC_BS11_PWR_CTRL, "POWER-CONTROL" },
- { NM_OC_BS11_BTSE, "BTSE" },
- { NM_OC_BS11_RACK, "RACK" },
- { NM_OC_BS11_TEST, "TEST" },
- { NM_OC_BS11_ENVABTSE, "ENVABTSE" },
- { NM_OC_BS11_BPORT, "BPORT" },
- { NM_OC_GPRS_NSE, "GPRS-NSE" },
- { NM_OC_GPRS_CELL, "GPRS-CELL" },
- { NM_OC_GPRS_NSVC, "GPRS-NSVC" },
- { NM_OC_BS11, "SIEMENSHW" },
- { 0, NULL }
-};
-
-static const char *obj_class_name(u_int8_t oc)
-{
- return get_value_string(abis_nm_obj_class_names, oc);
-}
-
-const char *nm_opstate_name(u_int8_t os)
-{
- switch (os) {
- case NM_OPSTATE_DISABLED:
- return "Disabled";
- case NM_OPSTATE_ENABLED:
- return "Enabled";
- case NM_OPSTATE_NULL:
- return "NULL";
- default:
- return "RFU";
- }
-}
-
-/* Chapter 9.4.7 */
-static const struct value_string avail_names[] = {
- { 0, "In test" },
- { 1, "Failed" },
- { 2, "Power off" },
- { 3, "Off line" },
- /* Not used */
- { 5, "Dependency" },
- { 6, "Degraded" },
- { 7, "Not installed" },
- { 0xff, "OK" },
- { 0, NULL }
-};
-
-const char *nm_avail_name(u_int8_t avail)
-{
- return get_value_string(avail_names, avail);
-}
-
-static struct value_string test_names[] = {
- /* FIXME: standard test names */
- { NM_IPACC_TESTNO_CHAN_USAGE, "Channel Usage" },
- { NM_IPACC_TESTNO_BCCH_CHAN_USAGE, "BCCH Channel Usage" },
- { NM_IPACC_TESTNO_FREQ_SYNC, "Frequency Synchronization" },
- { NM_IPACC_TESTNO_BCCH_INFO, "BCCH Info" },
- { NM_IPACC_TESTNO_TX_BEACON, "Transmit Beacon" },
- { NM_IPACC_TESTNO_SYSINFO_MONITOR, "System Info Monitor" },
- { NM_IPACC_TESTNO_BCCCH_MONITOR, "BCCH Monitor" },
- { 0, NULL }
-};
-
-const struct value_string abis_nm_adm_state_names[] = {
- { NM_STATE_LOCKED, "Locked" },
- { NM_STATE_UNLOCKED, "Unlocked" },
- { NM_STATE_SHUTDOWN, "Shutdown" },
- { NM_STATE_NULL, "NULL" },
- { 0, NULL }
-};
-
-const char *nm_adm_name(u_int8_t adm)
-{
- return get_value_string(abis_nm_adm_state_names, adm);
-}
-
int nm_is_running(struct gsm_nm_state *s) {
return (s->operational == NM_OPSTATE_ENABLED) && (
(s->availability == NM_AVSTATE_OK) ||
@@ -529,177 +150,32 @@ int nm_is_running(struct gsm_nm_state *s) {
);
}
-static void debugp_foh(struct abis_om_fom_hdr *foh)
-{
- DEBUGP(DNM, "OC=%s(%02x) INST=(%02x,%02x,%02x) ",
- obj_class_name(foh->obj_class), foh->obj_class,
- foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
- foh->obj_inst.ts_nr);
-}
-
-/* obtain the gsm_nm_state data structure for a given object instance */
-static struct gsm_nm_state *
-objclass2nmstate(struct gsm_bts *bts, u_int8_t obj_class,
- struct abis_om_obj_inst *obj_inst)
-{
- struct gsm_bts_trx *trx;
- struct gsm_nm_state *nm_state = NULL;
-
- switch (obj_class) {
- case NM_OC_BTS:
- nm_state = &bts->nm_state;
- break;
- case NM_OC_RADIO_CARRIER:
- if (obj_inst->trx_nr >= bts->num_trx) {
- DEBUGPC(DNM, "TRX %u does not exist ", obj_inst->trx_nr);
- return NULL;
- }
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- nm_state = &trx->nm_state;
- break;
- case NM_OC_BASEB_TRANSC:
- if (obj_inst->trx_nr >= bts->num_trx) {
- DEBUGPC(DNM, "TRX %u does not exist ", obj_inst->trx_nr);
- return NULL;
- }
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- nm_state = &trx->bb_transc.nm_state;
- break;
- case NM_OC_CHANNEL:
- if (obj_inst->trx_nr >= bts->num_trx) {
- DEBUGPC(DNM, "TRX %u does not exist ", obj_inst->trx_nr);
- return NULL;
- }
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- if (obj_inst->ts_nr >= TRX_NR_TS)
- return NULL;
- nm_state = &trx->ts[obj_inst->ts_nr].nm_state;
- break;
- case NM_OC_SITE_MANAGER:
- nm_state = &bts->site_mgr.nm_state;
- break;
- case NM_OC_BS11:
- switch (obj_inst->bts_nr) {
- case BS11_OBJ_CCLK:
- nm_state = &bts->bs11.cclk.nm_state;
- break;
- case BS11_OBJ_BBSIG:
- if (obj_inst->ts_nr > bts->num_trx)
- return NULL;
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- nm_state = &trx->bs11.bbsig.nm_state;
- break;
- case BS11_OBJ_PA:
- if (obj_inst->ts_nr > bts->num_trx)
- return NULL;
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- nm_state = &trx->bs11.pa.nm_state;
- break;
- default:
- return NULL;
- }
- case NM_OC_BS11_RACK:
- nm_state = &bts->bs11.rack.nm_state;
- break;
- case NM_OC_BS11_ENVABTSE:
- if (obj_inst->trx_nr >= ARRAY_SIZE(bts->bs11.envabtse))
- return NULL;
- nm_state = &bts->bs11.envabtse[obj_inst->trx_nr].nm_state;
- break;
- case NM_OC_GPRS_NSE:
- nm_state = &bts->gprs.nse.nm_state;
- break;
- case NM_OC_GPRS_CELL:
- nm_state = &bts->gprs.cell.nm_state;
- break;
- case NM_OC_GPRS_NSVC:
- if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc))
- return NULL;
- nm_state = &bts->gprs.nsvc[obj_inst->trx_nr].nm_state;
- break;
- }
- return nm_state;
-}
-
-/* obtain the in-memory data structure of a given object instance */
-static void *
-objclass2obj(struct gsm_bts *bts, u_int8_t obj_class,
- struct abis_om_obj_inst *obj_inst)
-{
- struct gsm_bts_trx *trx;
- void *obj = NULL;
-
- switch (obj_class) {
- case NM_OC_BTS:
- obj = bts;
- break;
- case NM_OC_RADIO_CARRIER:
- if (obj_inst->trx_nr >= bts->num_trx) {
- DEBUGPC(DNM, "TRX %u does not exist ", obj_inst->trx_nr);
- return NULL;
- }
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- obj = trx;
- break;
- case NM_OC_BASEB_TRANSC:
- if (obj_inst->trx_nr >= bts->num_trx) {
- DEBUGPC(DNM, "TRX %u does not exist ", obj_inst->trx_nr);
- return NULL;
- }
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- obj = &trx->bb_transc;
- break;
- case NM_OC_CHANNEL:
- if (obj_inst->trx_nr >= bts->num_trx) {
- DEBUGPC(DNM, "TRX %u does not exist ", obj_inst->trx_nr);
- return NULL;
- }
- trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
- if (obj_inst->ts_nr >= TRX_NR_TS)
- return NULL;
- obj = &trx->ts[obj_inst->ts_nr];
- break;
- case NM_OC_SITE_MANAGER:
- obj = &bts->site_mgr;
- break;
- case NM_OC_GPRS_NSE:
- obj = &bts->gprs.nse;
- break;
- case NM_OC_GPRS_CELL:
- obj = &bts->gprs.cell;
- break;
- case NM_OC_GPRS_NSVC:
- if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc))
- return NULL;
- obj = &bts->gprs.nsvc[obj_inst->trx_nr];
- break;
- }
- return obj;
-}
-
/* Update the administrative state of a given object in our in-memory data
* structures and send an event to the higher layer */
-static int update_admstate(struct gsm_bts *bts, u_int8_t obj_class,
- struct abis_om_obj_inst *obj_inst, u_int8_t adm_state)
+static int update_admstate(struct gsm_bts *bts, uint8_t obj_class,
+ struct abis_om_obj_inst *obj_inst, uint8_t adm_state)
{
struct gsm_nm_state *nm_state, new_state;
struct nm_statechg_signal_data nsd;
- nsd.obj = objclass2obj(bts, obj_class, obj_inst);
+ memset(&nsd, 0, sizeof(nsd));
+
+ nsd.obj = gsm_objclass2obj(bts, obj_class, obj_inst);
if (!nsd.obj)
return -EINVAL;
- nm_state = objclass2nmstate(bts, obj_class, obj_inst);
+ nm_state = gsm_objclass2nmstate(bts, obj_class, obj_inst);
if (!nm_state)
return -1;
new_state = *nm_state;
new_state.administrative = adm_state;
+ nsd.bts = bts;
nsd.obj_class = obj_class;
nsd.old_state = nm_state;
nsd.new_state = &new_state;
nsd.obj_inst = obj_inst;
- dispatch_signal(SS_NM, S_NM_STATECHG_ADM, &nsd);
+ osmo_signal_dispatch(SS_NM, S_NM_STATECHG_ADM, &nsd);
nm_state->administrative = adm_state;
@@ -718,7 +194,7 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb)
memset(&new_state, 0, sizeof(new_state));
- nm_state = objclass2nmstate(bts, foh->obj_class, &foh->obj_inst);
+ nm_state = gsm_objclass2nmstate(bts, foh->obj_class, &foh->obj_inst);
if (!nm_state) {
DEBUGPC(DNM, "unknown object class\n");
return -EINVAL;
@@ -729,20 +205,24 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb)
abis_nm_tlv_parse(&tp, bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_OPER_STATE)) {
new_state.operational = *TLVP_VAL(&tp, NM_ATT_OPER_STATE);
- DEBUGPC(DNM, "OP_STATE=%s ", nm_opstate_name(new_state.operational));
+ DEBUGPC(DNM, "OP_STATE=%s ",
+ abis_nm_opstate_name(new_state.operational));
}
if (TLVP_PRESENT(&tp, NM_ATT_AVAIL_STATUS)) {
if (TLVP_LEN(&tp, NM_ATT_AVAIL_STATUS) == 0)
new_state.availability = 0xff;
else
new_state.availability = *TLVP_VAL(&tp, NM_ATT_AVAIL_STATUS);
- DEBUGPC(DNM, "AVAIL=%s(%02x) ", nm_avail_name(new_state.availability),
+ DEBUGPC(DNM, "AVAIL=%s(%02x) ",
+ abis_nm_avail_name(new_state.availability),
new_state.availability);
} else
new_state.availability = 0xff;
if (TLVP_PRESENT(&tp, NM_ATT_ADM_STATE)) {
new_state.administrative = *TLVP_VAL(&tp, NM_ATT_ADM_STATE);
- DEBUGPC(DNM, "ADM=%2s ", nm_adm_name(new_state.administrative));
+ DEBUGPC(DNM, "ADM=%2s ",
+ get_value_string(abis_nm_adm_state_names,
+ new_state.administrative));
}
DEBUGPC(DNM, "\n");
@@ -752,12 +232,13 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb)
/* Update the operational state of a given object in our in-memory data
* structures and send an event to the higher layer */
struct nm_statechg_signal_data nsd;
- nsd.obj = objclass2obj(bts, foh->obj_class, &foh->obj_inst);
+ nsd.obj = gsm_objclass2obj(bts, foh->obj_class, &foh->obj_inst);
nsd.obj_class = foh->obj_class;
nsd.old_state = nm_state;
nsd.new_state = &new_state;
nsd.obj_inst = &foh->obj_inst;
- dispatch_signal(SS_NM, S_NM_STATECHG_OPER, &nsd);
+ nsd.bts = bts;
+ osmo_signal_dispatch(SS_NM, S_NM_STATECHG_OPER, &nsd);
nm_state->operational = new_state.operational;
nm_state->availability = new_state.availability;
if (nm_state->administrative == 0)
@@ -783,28 +264,30 @@ static int rx_fail_evt_rep(struct msgb *mb)
const uint8_t *p_val;
char *p_text;
- DEBUGPC(DNM, "Failure Event Report ");
+ LOGPC(DNM, LOGL_ERROR, "Failure Event Report ");
abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE))
- DEBUGPC(DNM, "Type=%s ", event_type_name(*TLVP_VAL(&tp, NM_ATT_EVENT_TYPE)));
+ LOGPC(DNM, LOGL_ERROR, "Type=%s ",
+ abis_nm_event_type_name(*TLVP_VAL(&tp, NM_ATT_EVENT_TYPE)));
if (TLVP_PRESENT(&tp, NM_ATT_SEVERITY))
- DEBUGPC(DNM, "Severity=%s ", severity_name(*TLVP_VAL(&tp, NM_ATT_SEVERITY)));
+ LOGPC(DNM, LOGL_ERROR, "Severity=%s ",
+ abis_nm_severity_name(*TLVP_VAL(&tp, NM_ATT_SEVERITY)));
if (TLVP_PRESENT(&tp, NM_ATT_PROB_CAUSE)) {
p_val = TLVP_VAL(&tp, NM_ATT_PROB_CAUSE);
- DEBUGPC(DNM, "Probable cause= %02X %02X %02X ", p_val[0], p_val[1], p_val[2]);
+ LOGPC(DNM, LOGL_ERROR, "Probable cause= %02X %02X %02X ", p_val[0], p_val[1], p_val[2]);
}
if (TLVP_PRESENT(&tp, NM_ATT_ADD_TEXT)) {
p_val = TLVP_VAL(&tp, NM_ATT_ADD_TEXT);
p_text = talloc_strndup(tall_bsc_ctx, (const char *) p_val, TLVP_LEN(&tp, NM_ATT_ADD_TEXT));
if (p_text) {
- DEBUGPC(DNM, "Additional Text=%s ", p_text);
+ LOGPC(DNM, LOGL_ERROR, "Additional Text=%s ", p_text);
talloc_free(p_text);
}
}
- DEBUGPC(DNM, "\n");
+ LOGPC(DNM, LOGL_ERROR, "\n");
return 0;
}
@@ -812,9 +295,9 @@ static int rx_fail_evt_rep(struct msgb *mb)
static int abis_nm_rcvmsg_report(struct msgb *mb)
{
struct abis_om_fom_hdr *foh = msgb_l3(mb);
- u_int8_t mt = foh->msg_type;
+ uint8_t mt = foh->msg_type;
- debugp_foh(foh);
+ abis_nm_debugp_foh(DNM, foh);
//nmh->cfg->report_cb(mb, foh);
@@ -824,15 +307,15 @@ static int abis_nm_rcvmsg_report(struct msgb *mb)
break;
case NM_MT_SW_ACTIVATED_REP:
DEBUGPC(DNM, "Software Activated Report\n");
- dispatch_signal(SS_NM, S_NM_SW_ACTIV_REP, mb);
+ osmo_signal_dispatch(SS_NM, S_NM_SW_ACTIV_REP, mb);
break;
case NM_MT_FAILURE_EVENT_REP:
rx_fail_evt_rep(mb);
- dispatch_signal(SS_NM, S_NM_FAIL_REP, mb);
+ osmo_signal_dispatch(SS_NM, S_NM_FAIL_REP, mb);
break;
case NM_MT_TEST_REP:
DEBUGPC(DNM, "Test Report\n");
- dispatch_signal(SS_NM, S_NM_TEST_REP, mb);
+ osmo_signal_dispatch(SS_NM, S_NM_TEST_REP, mb);
break;
default:
DEBUGPC(DNM, "reporting NM MT 0x%02x\n", mt);
@@ -844,13 +327,13 @@ static int abis_nm_rcvmsg_report(struct msgb *mb)
}
/* Activate the specified software into the BTS */
-static int ipacc_sw_activate(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8_t i1,
- u_int8_t i2, const u_int8_t *sw_desc, u_int8_t swdesc_len)
+static int ipacc_sw_activate(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1,
+ uint8_t i2, const uint8_t *sw_desc, uint8_t swdesc_len)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t len = swdesc_len;
- u_int8_t *trailer;
+ uint8_t len = swdesc_len;
+ uint8_t *trailer;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, len, NM_MT_ACTIVATE_SW, obj_class, i0, i1, i2);
@@ -861,7 +344,7 @@ static int ipacc_sw_activate(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i
return abis_nm_sendmsg(bts, msg);
}
-static int abis_nm_parse_sw_descr(const u_int8_t *sw_descr, int sw_descr_len)
+static int abis_nm_parse_sw_descr(const uint8_t *sw_descr, int sw_descr_len)
{
static const struct tlv_definition sw_descr_def = {
.def = {
@@ -870,9 +353,9 @@ static int abis_nm_parse_sw_descr(const u_int8_t *sw_descr, int sw_descr_len)
},
};
- u_int8_t tag;
- u_int16_t tag_len;
- const u_int8_t *val;
+ uint8_t tag;
+ uint16_t tag_len;
+ const uint8_t *val;
int ofs = 0, len;
/* Classic TLV parsing doesn't work well with SW_DESCR because of it's
@@ -909,10 +392,10 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
struct tlv_parsed tp;
- const u_int8_t *sw_config;
+ const uint8_t *sw_config;
int ret, sw_config_len, sw_descr_len;
- debugp_foh(foh);
+ abis_nm_debugp_foh(DNM, foh);
DEBUGPC(DNM, "SW Activate Request: ");
@@ -931,7 +414,7 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
DEBUGP(DNM, "SW config not found! Can't continue.\n");
return -EINVAL;
} else {
- DEBUGP(DNM, "Found SW config: %s\n", hexdump(sw_config, sw_config_len));
+ DEBUGP(DNM, "Found SW config: %s\n", osmo_hexdump(sw_config, sw_config_len));
}
/* Use the first SW_DESCR present in SW config */
@@ -952,7 +435,7 @@ static int abis_nm_rx_chg_adm_state_ack(struct msgb *mb)
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
struct tlv_parsed tp;
- u_int8_t adm_state;
+ uint8_t adm_state;
abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
if (!TLVP_PRESENT(&tp, NM_ATT_ADM_STATE))
@@ -973,12 +456,12 @@ static int abis_nm_rx_lmt_event(struct msgb *mb)
abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_BS11_LMT_LOGON_SESSION) &&
TLVP_LEN(&tp, NM_ATT_BS11_LMT_LOGON_SESSION) >= 1) {
- u_int8_t onoff = *TLVP_VAL(&tp, NM_ATT_BS11_LMT_LOGON_SESSION);
+ uint8_t onoff = *TLVP_VAL(&tp, NM_ATT_BS11_LMT_LOGON_SESSION);
DEBUGPC(DNM, "LOG%s ", onoff ? "ON" : "OFF");
}
if (TLVP_PRESENT(&tp, NM_ATT_BS11_LMT_USER_ACC_LEV) &&
TLVP_LEN(&tp, NM_ATT_BS11_LMT_USER_ACC_LEV) >= 1) {
- u_int8_t level = *TLVP_VAL(&tp, NM_ATT_BS11_LMT_USER_ACC_LEV);
+ uint8_t level = *TLVP_VAL(&tp, NM_ATT_BS11_LMT_USER_ACC_LEV);
DEBUGPC(DNM, "Level=%u ", level);
}
if (TLVP_PRESENT(&tp, NM_ATT_BS11_LMT_USER_NAME) &&
@@ -1013,34 +496,34 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
- u_int8_t mt = foh->msg_type;
+ uint8_t mt = foh->msg_type;
int ret = 0;
/* check for unsolicited message */
if (is_report(mt))
return abis_nm_rcvmsg_report(mb);
- if (is_in_arr(mt, sw_load_msgs, ARRAY_SIZE(sw_load_msgs)))
+ if (is_in_arr(mt, abis_nm_sw_load_msgs, ARRAY_SIZE(abis_nm_sw_load_msgs)))
return abis_nm_rcvmsg_sw(mb);
- if (is_in_arr(mt, nacks, ARRAY_SIZE(nacks))) {
+ if (is_in_arr(mt, abis_nm_nacks, ARRAY_SIZE(abis_nm_nacks))) {
struct nm_nack_signal_data nack_data;
struct tlv_parsed tp;
- debugp_foh(foh);
+ abis_nm_debugp_foh(DNM, foh);
- DEBUGPC(DNM, "%s NACK ", get_value_string(nack_names, mt));
+ DEBUGPC(DNM, "%s NACK ", abis_nm_nack_name(mt));
abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
DEBUGPC(DNM, "CAUSE=%s\n",
- nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
+ abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
else
DEBUGPC(DNM, "\n");
nack_data.msg = mb;
nack_data.mt = mt;
- dispatch_signal(SS_NM, S_NM_NACK, &nack_data);
+ osmo_signal_dispatch(SS_NM, S_NM_NACK, &nack_data);
abis_nm_queue_send_next(mb->trx->bts);
return 0;
}
@@ -1075,10 +558,10 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
DEBUGP(DNM, "CONN MDROP LINK ACK\n");
break;
case NM_MT_IPACC_RESTART_ACK:
- dispatch_signal(SS_NM, S_NM_IPACC_RESTART_ACK, NULL);
+ osmo_signal_dispatch(SS_NM, S_NM_IPACC_RESTART_ACK, NULL);
break;
case NM_MT_IPACC_RESTART_NACK:
- dispatch_signal(SS_NM, S_NM_IPACC_RESTART_NACK, NULL);
+ osmo_signal_dispatch(SS_NM, S_NM_IPACC_RESTART_NACK, NULL);
break;
case NM_MT_SET_BTS_ATTR_ACK:
/* The HSL wants an OPSTART _after_ the SI has been set */
@@ -1134,7 +617,7 @@ int abis_nm_rcvmsg(struct msgb *msg)
return -EINVAL;
}
#if 0
- unsigned int l2_len = msg->tail - (u_int8_t *)msgb_l2(msg);
+ unsigned int l2_len = msg->tail - (uint8_t *)msgb_l2(msg);
unsigned int hlen = sizeof(*oh) + sizeof(struct abis_om_fom_hdr);
if (oh->length + hlen > l2_len) {
LOGP(DNM, LOGL_ERROR, "ABIS OML truncated message (%u > %u)\n",
@@ -1215,17 +698,17 @@ struct abis_nm_sw {
int forced;
/* this will become part of the SW LOAD INITIATE */
- u_int8_t obj_class;
- u_int8_t obj_instance[3];
+ uint8_t obj_class;
+ uint8_t obj_instance[3];
- u_int8_t file_id[255];
- u_int8_t file_id_len;
+ uint8_t file_id[255];
+ uint8_t file_id_len;
- u_int8_t file_version[255];
- u_int8_t file_version_len;
+ uint8_t file_version[255];
+ uint8_t file_version_len;
- u_int8_t window_size;
- u_int8_t seg_in_window;
+ uint8_t window_size;
+ uint8_t seg_in_window;
int fd;
FILE *stream;
@@ -1256,7 +739,7 @@ static int sw_load_init(struct abis_nm_sw *sw)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t len = 3*2 + sw->file_id_len + sw->file_version_len;
+ uint8_t len = 3*2 + sw->file_id_len + sw->file_version_len;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, len, NM_MT_LOAD_INIT, sw->obj_class,
@@ -1293,7 +776,7 @@ static int sw_load_segment(struct abis_nm_sw *sw)
char seg_buf[256];
char *line_buf = seg_buf+2;
unsigned char *tlv;
- u_int8_t len;
+ uint8_t len;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
@@ -1314,7 +797,7 @@ static int sw_load_segment(struct abis_nm_sw *sw)
len = strlen(line_buf) + 2;
tlv = msgb_put(msg, TLV_GROSS_LEN(len));
- tlv_put(tlv, NM_ATT_BS11_FILE_DATA, len, (u_int8_t *)seg_buf);
+ tlv_put(tlv, NM_ATT_BS11_FILE_DATA, len, (uint8_t *)seg_buf);
/* BS11 wants CR + LF in excess of the TLV length !?! */
tlv[1] -= 2;
@@ -1322,7 +805,7 @@ static int sw_load_segment(struct abis_nm_sw *sw)
len = strlen(line_buf)+2;
break;
case GSM_BTS_TYPE_NANOBTS: {
- static_assert(sizeof(seg_buf) >= IPACC_SEGMENT_SIZE, buffer_big_enough);
+ osmo_static_assert(sizeof(seg_buf) >= IPACC_SEGMENT_SIZE, buffer_big_enough);
len = read(sw->fd, &seg_buf, IPACC_SEGMENT_SIZE);
if (len < 0) {
perror("read failed");
@@ -1333,7 +816,7 @@ static int sw_load_segment(struct abis_nm_sw *sw)
sw->last_seg = 1;
++sw->seg_in_window;
- msgb_tl16v_put(msg, NM_ATT_IPACC_FILE_DATA, len, (const u_int8_t *) seg_buf);
+ msgb_tl16v_put(msg, NM_ATT_IPACC_FILE_DATA, len, (const uint8_t *) seg_buf);
len += 3;
break;
}
@@ -1355,7 +838,7 @@ static int sw_load_end(struct abis_nm_sw *sw)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t len = 2*2 + sw->file_id_len + sw->file_version_len;
+ uint8_t len = 2*2 + sw->file_id_len + sw->file_version_len;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, len, NM_MT_LOAD_END, sw->obj_class,
@@ -1371,7 +854,7 @@ static int sw_activate(struct abis_nm_sw *sw)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t len = 2*2 + sw->file_id_len + sw->file_version_len;
+ uint8_t len = 2*2 + sw->file_id_len + sw->file_version_len;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, len, NM_MT_ACTIVATE_SW, sw->obj_class,
@@ -1671,7 +1154,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
/* Load the specified software into the BTS */
int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname,
- u_int8_t win_size, int forced,
+ uint8_t win_size, int forced,
gsm_cbfn *cbfn, void *cb_data)
{
struct abis_nm_sw *sw = &g_sw;
@@ -1772,8 +1255,8 @@ int abis_nm_software_activate(struct gsm_bts *bts, const char *fname,
return sw_activate(sw);
}
-static void fill_nm_channel(struct abis_nm_channel *ch, u_int8_t bts_port,
- u_int8_t ts_nr, u_int8_t subslot_nr)
+static void fill_nm_channel(struct abis_nm_channel *ch, uint8_t bts_port,
+ uint8_t ts_nr, uint8_t subslot_nr)
{
ch->attrib = NM_ATT_ABIS_CHANNEL;
ch->bts_port = bts_port;
@@ -1781,13 +1264,13 @@ static void fill_nm_channel(struct abis_nm_channel *ch, u_int8_t bts_port,
ch->subslot = subslot_nr;
}
-int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
- u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot,
- u_int8_t tei)
+int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr,
+ uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot,
+ uint8_t tei)
{
struct abis_om_hdr *oh;
struct abis_nm_channel *ch;
- u_int8_t len = sizeof(*ch) + 2;
+ uint8_t len = sizeof(*ch) + 2;
struct msgb *msg = nm_msgb_alloc();
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
@@ -1804,7 +1287,7 @@ int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
/* connect signalling of one (BTS,TRX) to a particular timeslot on the E1 */
int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx,
- u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot)
+ uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot)
{
struct gsm_bts *bts = trx->bts;
struct abis_om_hdr *oh;
@@ -1829,8 +1312,8 @@ int abis_nm_disc_terr_sign(struct abis_nm_h *h, struct abis_om_obj_inst *inst,
#endif
int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
- u_int8_t e1_port, u_int8_t e1_timeslot,
- u_int8_t e1_subslot)
+ uint8_t e1_port, uint8_t e1_timeslot,
+ uint8_t e1_subslot)
{
struct gsm_bts *bts = ts->trx->bts;
struct abis_om_hdr *oh;
@@ -1854,17 +1337,17 @@ int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
#if 0
int abis_nm_disc_terr_traf(struct abis_nm_h *h, struct abis_om_obj_inst *inst,
struct abis_nm_abis_channel *chan,
- u_int8_t subchan)
+ uint8_t subchan)
{
}
#endif
/* Chapter 8.6.1 */
-int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len)
+int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t *cur;
+ uint8_t *cur;
DEBUGP(DNM, "Set BTS Attr (bts=%d)\n", bts->nr);
@@ -1877,11 +1360,11 @@ int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len)
}
/* Chapter 8.6.2 */
-int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len)
+int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t *cur;
+ uint8_t *cur;
DEBUGP(DNM, "Set TRX Attr (bts=%d,trx=%d)\n", trx->bts->nr, trx->nr);
@@ -1894,7 +1377,7 @@ int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len
return abis_nm_sendmsg(trx->bts, msg);
}
-static int verify_chan_comb(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb)
+static int verify_chan_comb(struct gsm_bts_trx_ts *ts, uint8_t chan_comb)
{
int i;
@@ -2029,13 +1512,13 @@ static int verify_chan_comb(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb)
}
/* Chapter 8.6.3 */
-int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb)
+int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb)
{
struct gsm_bts *bts = ts->trx->bts;
struct abis_om_hdr *oh;
- u_int8_t zero = 0x00;
+ uint8_t zero = 0x00;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t len = 2 + 2;
+ uint8_t len = 2 + 2;
if (bts->type == GSM_BTS_TYPE_BS11)
len += 4 + 2 + 2 + 3;
@@ -2075,20 +1558,23 @@ int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb)
}
}
}
- msgb_tv_put(msg, NM_ATT_TSC, bts->tsc); /* training sequence */
+ if (ts->tsc == -1)
+ msgb_tv_put(msg, NM_ATT_TSC, bts->tsc); /* training sequence */
+ else
+ msgb_tv_put(msg, NM_ATT_TSC, ts->tsc); /* training sequence */
if (bts->type == GSM_BTS_TYPE_BS11)
msgb_tlv_put(msg, 0x59, 1, &zero);
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
- u_int8_t i2, u_int8_t i3, int nack, u_int8_t *attr, int att_len)
+int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1,
+ uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t msgtype = NM_MT_SW_ACT_REQ_ACK;
- u_int8_t len = att_len;
+ uint8_t msgtype = NM_MT_SW_ACT_REQ_ACK;
+ uint8_t len = att_len;
if (nack) {
len += 2;
@@ -2099,7 +1585,7 @@ int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
fill_om_fom_hdr(oh, att_len, msgtype, obj_class, i1, i2, i3);
if (attr) {
- u_int8_t *ptr = msgb_put(msg, att_len);
+ uint8_t *ptr = msgb_put(msg, att_len);
memcpy(ptr, attr, att_len);
}
if (nack)
@@ -2108,11 +1594,11 @@ int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
return abis_nm_sendmsg_direct(bts, msg);
}
-int abis_nm_raw_msg(struct gsm_bts *bts, int len, u_int8_t *rawmsg)
+int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *rawmsg)
{
struct msgb *msg = nm_msgb_alloc();
struct abis_om_hdr *oh;
- u_int8_t *data;
+ uint8_t *data;
oh = (struct abis_om_hdr *) msgb_put(msg, sizeof(*oh));
fill_om_hdr(oh, len);
@@ -2123,7 +1609,7 @@ int abis_nm_raw_msg(struct gsm_bts *bts, int len, u_int8_t *rawmsg)
}
/* Siemens specific commands */
-static int __simple_cmd(struct gsm_bts *bts, u_int8_t msg_type)
+static int __simple_cmd(struct gsm_bts *bts, uint8_t msg_type)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2136,7 +1622,7 @@ static int __simple_cmd(struct gsm_bts *bts, u_int8_t msg_type)
}
/* Chapter 8.9.2 */
-int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8_t i1, u_int8_t i2)
+int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2144,15 +1630,15 @@ int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 0, NM_MT_OPSTART, obj_class, i0, i1, i2);
- debugp_foh((struct abis_om_fom_hdr *) oh->data);
+ abis_nm_debugp_foh(DNM, (struct abis_om_fom_hdr *) oh->data);
DEBUGPC(DNM, "Sending OPSTART\n");
return abis_nm_sendmsg(bts, msg);
}
/* Chapter 8.8.5 */
-int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
- u_int8_t i1, u_int8_t i2, enum abis_nm_adm_state adm_state)
+int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0,
+ uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2164,12 +1650,12 @@ int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_conn_mdrop_link(struct gsm_bts *bts, u_int8_t e1_port0, u_int8_t ts0,
- u_int8_t e1_port1, u_int8_t ts1)
+int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0,
+ uint8_t e1_port1, uint8_t ts1)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t *attr;
+ uint8_t *attr;
DEBUGP(DNM, "CONNECT MDROP LINK E1=(%u,%u) -> E1=(%u, %u)\n",
e1_port0, ts0, e1_port1, ts1);
@@ -2192,13 +1678,13 @@ int abis_nm_conn_mdrop_link(struct gsm_bts *bts, u_int8_t e1_port0, u_int8_t ts0
}
/* Chapter 8.7.1 */
-int abis_nm_perform_test(struct gsm_bts *bts, u_int8_t obj_class,
- u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
- u_int8_t test_nr, u_int8_t auton_report, struct msgb *msg)
+int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class,
+ uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
+ uint8_t test_nr, uint8_t auton_report, struct msgb *msg)
{
struct abis_om_hdr *oh;
- DEBUGP(DNM, "PEFORM TEST %s\n", get_value_string(test_names, test_nr));
+ DEBUGP(DNM, "PEFORM TEST %s\n", abis_nm_test_name(test_nr));
if (!msg)
msg = nm_msgb_alloc();
@@ -2237,12 +1723,12 @@ int abis_nm_bs11_restart(struct gsm_bts *bts)
struct bs11_date_time {
- u_int16_t year;
- u_int8_t month;
- u_int8_t day;
- u_int8_t hour;
- u_int8_t min;
- u_int8_t sec;
+ uint16_t year;
+ uint8_t month;
+ uint8_t day;
+ uint8_t hour;
+ uint8_t min;
+ uint8_t sec;
} __attribute__((packed));
@@ -2275,12 +1761,12 @@ int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin)
}
int abis_nm_bs11_create_object(struct gsm_bts *bts,
- enum abis_bs11_objtype type, u_int8_t idx,
- u_int8_t attr_len, const u_int8_t *attr)
+ enum abis_bs11_objtype type, uint8_t idx,
+ uint8_t attr_len, const uint8_t *attr)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t *cur;
+ uint8_t *cur;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, attr_len, NM_MT_BS11_CREATE_OBJ,
@@ -2292,7 +1778,7 @@ int abis_nm_bs11_create_object(struct gsm_bts *bts,
}
int abis_nm_bs11_delete_object(struct gsm_bts *bts,
- enum abis_bs11_objtype type, u_int8_t idx)
+ enum abis_bs11_objtype type, uint8_t idx)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2304,11 +1790,11 @@ int abis_nm_bs11_delete_object(struct gsm_bts *bts,
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx)
+int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t zero = 0x00;
+ uint8_t zero = 0x00;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 3, NM_MT_BS11_CREATE_OBJ,
@@ -2318,7 +1804,7 @@ int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx)
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx)
+int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2330,7 +1816,7 @@ int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx)
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx)
+int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2342,7 +1828,7 @@ int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx)
return abis_nm_sendmsg(bts, msg);
}
-static const u_int8_t sm_attr[] = { NM_ATT_TEI, NM_ATT_ABIS_CHANNEL };
+static const uint8_t sm_attr[] = { NM_ATT_TEI, NM_ATT_ABIS_CHANNEL };
int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts)
{
struct abis_om_hdr *oh;
@@ -2357,9 +1843,9 @@ int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts)
}
/* like abis_nm_conn_terr_traf + set_tei */
-int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, u_int8_t e1_port,
- u_int8_t e1_timeslot, u_int8_t e1_subslot,
- u_int8_t tei)
+int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port,
+ uint8_t e1_timeslot, uint8_t e1_subslot,
+ uint8_t tei)
{
struct abis_om_hdr *oh;
struct abis_nm_channel *ch;
@@ -2376,7 +1862,7 @@ int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, u_int8_t e1_port,
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level)
+int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2393,7 +1879,7 @@ int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t attr = NM_ATT_BS11_TXPWR;
+ uint8_t attr = NM_ATT_BS11_TXPWR;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 2+sizeof(attr), NM_MT_GET_ATTR,
@@ -2407,7 +1893,7 @@ int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t attr[] = { NM_ATT_BS11_PLL_MODE };
+ uint8_t attr[] = { NM_ATT_BS11_PLL_MODE };
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 2+sizeof(attr), NM_MT_GET_ATTR,
@@ -2421,7 +1907,7 @@ int abis_nm_bs11_get_cclk(struct gsm_bts *bts)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t attr[] = { NM_ATT_BS11_CCLK_ACCURACY,
+ uint8_t attr[] = { NM_ATT_BS11_CCLK_ACCURACY,
NM_ATT_BS11_CCLK_TYPE };
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
@@ -2433,7 +1919,7 @@ int abis_nm_bs11_get_cclk(struct gsm_bts *bts)
}
-//static const u_int8_t bs11_logon_c7[] = { 0x07, 0xd9, 0x01, 0x11, 0x0d, 0x10, 0x20 };
+//static const uint8_t bs11_logon_c7[] = { 0x07, 0xd9, 0x01, 0x11, 0x0d, 0x10, 0x20 };
int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on)
{
@@ -2445,7 +1931,7 @@ int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on)
return abis_nm_bs11_logon(bts, 0x03, "FIELD ", on);
}
-int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on)
+int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2455,16 +1941,16 @@ int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, in
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
if (on) {
- u_int8_t len = 3*2 + sizeof(bdt)
+ uint8_t len = 3*2 + sizeof(bdt)
+ 1 + strlen(name);
fill_om_fom_hdr(oh, len, NM_MT_BS11_LMT_LOGON,
NM_OC_BS11_BTSE, 0xff, 0xff, 0xff);
msgb_tlv_put(msg, NM_ATT_BS11_LMT_LOGIN_TIME,
- sizeof(bdt), (u_int8_t *) &bdt);
+ sizeof(bdt), (uint8_t *) &bdt);
msgb_tlv_put(msg, NM_ATT_BS11_LMT_USER_ACC_LEV,
1, &level);
msgb_tlv_put(msg, NM_ATT_BS11_LMT_USER_NAME,
- strlen(name), (u_int8_t *)name);
+ strlen(name), (uint8_t *)name);
} else {
fill_om_fom_hdr(oh, 0, NM_MT_BS11_LMT_LOGOFF,
NM_OC_BS11_BTSE, 0xff, 0xff, 0xff);
@@ -2485,7 +1971,7 @@ int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password)
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 2+strlen(password), NM_MT_BS11_SET_ATTR,
NM_OC_BS11, BS11_OBJ_TRX1, 0x00, 0x00);
- msgb_tlv_put(msg, NM_ATT_BS11_PASSWORD, 10, (const u_int8_t *)password);
+ msgb_tlv_put(msg, NM_ATT_BS11_PASSWORD, 10, (const uint8_t *)password);
return abis_nm_sendmsg(bts, msg);
}
@@ -2495,7 +1981,7 @@ int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked)
{
struct abis_om_hdr *oh;
struct msgb *msg;
- u_int8_t tlv_value;
+ uint8_t tlv_value;
msg = nm_msgb_alloc();
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
@@ -2518,7 +2004,7 @@ int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value)
{
struct abis_om_hdr *oh;
struct msgb *msg;
- u_int8_t tlv_value[2];
+ uint8_t tlv_value[2];
msg = nm_msgb_alloc();
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
@@ -2545,7 +2031,7 @@ void *tall_fle_ctx;
struct abis_nm_bs11_sw {
struct gsm_bts *bts;
char swl_fname[PATH_MAX];
- u_int8_t win_size;
+ uint8_t win_size;
int forced;
struct llist_head file_list;
gsm_cbfn *user_cb; /* specified by the user */
@@ -2671,7 +2157,7 @@ static int bs11_swload_cbfn(unsigned int hook, unsigned int event,
* files that are part of a software release. We need to upload first
* the list file, and then each file that is listed in the list file */
int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
- u_int8_t win_size, int forced, gsm_cbfn *cbfn)
+ uint8_t win_size, int forced, gsm_cbfn *cbfn)
{
struct abis_nm_bs11_sw *bs11_sw = g_bs11_sw;
struct file_list_entry *fle;
@@ -2701,7 +2187,7 @@ int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
}
#if 0
-static u_int8_t req_attr_btse[] = {
+static uint8_t req_attr_btse[] = {
NM_ATT_ADM_STATE, NM_ATT_BS11_LMT_LOGON_SESSION,
NM_ATT_BS11_LMT_LOGIN_TIME, NM_ATT_BS11_LMT_USER_ACC_LEV,
NM_ATT_BS11_LMT_USER_NAME,
@@ -2712,14 +2198,14 @@ static u_int8_t req_attr_btse[] = {
NM_ATT_BS11_SW_LOAD_STORED };
-static u_int8_t req_attr_btsm[] = {
+static uint8_t req_attr_btsm[] = {
NM_ATT_ABIS_CHANNEL, NM_ATT_TEI, NM_ATT_BS11_ABIS_EXT_TIME,
NM_ATT_ADM_STATE, NM_ATT_AVAIL_STATUS, 0xce, NM_ATT_FILE_ID,
NM_ATT_FILE_VERSION, NM_ATT_OPER_STATE, 0xe8, NM_ATT_BS11_ALL_TEST_CATG,
NM_ATT_SW_DESCR, NM_ATT_GET_ARI };
#endif
-static u_int8_t req_attr[] = {
+static uint8_t req_attr[] = {
NM_ATT_ADM_STATE, NM_ATT_AVAIL_STATUS, 0xa8, NM_ATT_OPER_STATE,
0xd5, 0xa1, NM_ATT_BS11_ESN_FW_CODE_NO, NM_ATT_BS11_ESN_HW_CODE_NO,
0x42, NM_ATT_BS11_ESN_PCB_SERIAL, NM_ATT_BS11_PLL };
@@ -2749,16 +2235,16 @@ int abis_nm_bs11_set_ext_time(struct gsm_bts *bts)
/* SiemensHW CCTRL object */
fill_om_fom_hdr(oh, 2+sizeof(aet), NM_MT_BS11_SET_ATTR, NM_OC_SITE_MANAGER,
0xff, 0xff, 0xff);
- msgb_tlv_put(msg, NM_ATT_BS11_ABIS_EXT_TIME, sizeof(aet), (u_int8_t *) &aet);
+ msgb_tlv_put(msg, NM_ATT_BS11_ABIS_EXT_TIME, sizeof(aet), (uint8_t *) &aet);
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport)
+int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
- u_int8_t attr = NM_ATT_BS11_LINE_CFG;
+ uint8_t attr = NM_ATT_BS11_LINE_CFG;
oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
fill_om_fom_hdr(oh, 2+sizeof(attr), NM_MT_GET_ATTR,
@@ -2768,7 +2254,7 @@ int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport)
return abis_nm_sendmsg(bts, msg);
}
-int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg)
+int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg)
{
struct abis_om_hdr *oh;
struct msgb *msg = nm_msgb_alloc();
@@ -2792,7 +2278,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
struct in_addr addr;
struct abis_om_hdr *oh = msgb_l2(msg);
struct abis_om_fom_hdr *foh;
- u_int8_t idstrlen = oh->data[0];
+ uint8_t idstrlen = oh->data[0];
struct tlv_parsed tp;
struct ipacc_ack_signal_data signal;
@@ -2804,7 +2290,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
foh = (struct abis_om_fom_hdr *) (oh->data + 1 + idstrlen);
abis_nm_tlv_parse(&tp, msg->trx->bts, foh->data, oh->length-sizeof(*foh));
- debugp_foh(foh);
+ abis_nm_debugp_foh(DNM, foh);
DEBUGPC(DNM, "IPACCESS(0x%02x): ", foh->msg_type);
@@ -2819,7 +2305,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
}
if (TLVP_PRESENT(&tp, NM_ATT_IPACC_DST_IP_PORT))
DEBUGPC(DNM, "PORT=%u ",
- ntohs(*((u_int16_t *)
+ ntohs(*((uint16_t *)
TLVP_VAL(&tp, NM_ATT_IPACC_DST_IP_PORT))));
if (TLVP_PRESENT(&tp, NM_ATT_IPACC_STREAM_ID))
DEBUGPC(DNM, "STREAM=0x%02x ",
@@ -2830,7 +2316,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
LOGP(DNM, LOGL_ERROR, "RSL CONNECT NACK ");
if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
DEBUGPC(DNM, " CAUSE=%s\n",
- nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
+ abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
else
DEBUGPC(DNM, "\n");
break;
@@ -2842,7 +2328,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
LOGP(DNM, LOGL_ERROR, "SET NVATTR NACK ");
if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
LOGPC(DNM, LOGL_ERROR, " CAUSE=%s\n",
- nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
+ abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
else
LOGPC(DNM, LOGL_ERROR, "\n");
break;
@@ -2854,7 +2340,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
LOGPC(DNM, LOGL_ERROR, "GET NVATTR NACK ");
if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
LOGPC(DNM, LOGL_ERROR, " CAUSE=%s\n",
- nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
+ abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
else
LOGPC(DNM, LOGL_ERROR, "\n");
break;
@@ -2865,7 +2351,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
LOGPC(DNM, LOGL_ERROR, "SET ATTR NACK ");
if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
LOGPC(DNM, LOGL_ERROR, " CAUSE=%s\n",
- nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
+ abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
else
LOGPC(DNM, LOGL_ERROR, "\n");
break;
@@ -2881,12 +2367,12 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
case NM_MT_IPACC_GET_NVATTR_NACK:
signal.trx = gsm_bts_trx_by_nr(msg->trx->bts, foh->obj_inst.trx_nr);
signal.msg_type = foh->msg_type;
- dispatch_signal(SS_NM, S_NM_IPACC_NACK, &signal);
+ osmo_signal_dispatch(SS_NM, S_NM_IPACC_NACK, &signal);
break;
case NM_MT_IPACC_SET_NVATTR_ACK:
signal.trx = gsm_bts_trx_by_nr(msg->trx->bts, foh->obj_inst.trx_nr);
signal.msg_type = foh->msg_type;
- dispatch_signal(SS_NM, S_NM_IPACC_ACK, &signal);
+ osmo_signal_dispatch(SS_NM, S_NM_IPACC_ACK, &signal);
break;
default:
break;
@@ -2896,15 +2382,15 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
}
/* send an ip-access manufacturer specific message */
-int abis_nm_ipaccess_msg(struct gsm_bts *bts, u_int8_t msg_type,
- u_int8_t obj_class, u_int8_t bts_nr,
- u_int8_t trx_nr, u_int8_t ts_nr,
- u_int8_t *attr, int attr_len)
+int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type,
+ uint8_t obj_class, uint8_t bts_nr,
+ uint8_t trx_nr, uint8_t ts_nr,
+ uint8_t *attr, int attr_len)
{
struct msgb *msg = nm_msgb_alloc();
struct abis_om_hdr *oh;
struct abis_om_fom_hdr *foh;
- u_int8_t *data;
+ uint8_t *data;
/* construct the 12.21 OM header, observe the erroneous length */
oh = (struct abis_om_hdr *) msgb_put(msg, sizeof(*oh));
@@ -2933,7 +2419,7 @@ int abis_nm_ipaccess_msg(struct gsm_bts *bts, u_int8_t msg_type,
}
/* set some attributes in NVRAM */
-int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, u_int8_t *attr,
+int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr,
int attr_len)
{
return abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_SET_NVATTR,
@@ -2942,10 +2428,10 @@ int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, u_int8_t *attr,
}
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
- u_int32_t ip, u_int16_t port, u_int8_t stream)
+ uint32_t ip, uint16_t port, uint8_t stream)
{
struct in_addr ia;
- u_int8_t attr[] = { NM_ATT_IPACC_STREAM_ID, 0,
+ uint8_t attr[] = { NM_ATT_IPACC_STREAM_ID, 0,
NM_ATT_IPACC_DST_IP_PORT, 0, 0,
NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
@@ -2955,7 +2441,7 @@ int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
attr[1] = stream;
attr[3] = port >> 8;
attr[4] = port & 0xff;
- *(u_int32_t *)(attr+6) = ia.s_addr;
+ *(uint32_t *)(attr+6) = ia.s_addr;
/* if ip == 0, we use the default IP */
if (ip == 0)
@@ -2982,28 +2468,28 @@ int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx)
return abis_nm_sendmsg(trx->bts, msg);
}
-int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, u_int8_t obj_class,
- u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
- u_int8_t *attr, u_int8_t attr_len)
+int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class,
+ uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
+ uint8_t *attr, uint8_t attr_len)
{
return abis_nm_ipaccess_msg(bts, NM_MT_IPACC_SET_ATTR,
obj_class, bts_nr, trx_nr, ts_nr,
attr, attr_len);
}
-void abis_nm_ipaccess_cgi(u_int8_t *buf, struct gsm_bts *bts)
+void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts)
{
/* we simply reuse the GSM48 function and overwrite the RAC
* with the Cell ID */
gsm48_ra_id_by_bts(buf, bts);
- *((u_int16_t *)(buf + 5)) = htons(bts->cell_identity);
+ *((uint16_t *)(buf + 5)) = htons(bts->cell_identity);
}
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked)
{
int new_state = locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED;
- trx->nm_state.administrative = new_state;
+ trx->mo.nm_state.administrative = new_state;
if (!trx->bts || !trx->bts->oml_link)
return;
@@ -3021,12 +2507,12 @@ static const struct value_string ipacc_testres_names[] = {
{ 0, NULL }
};
-const char *ipacc_testres_name(u_int8_t res)
+const char *ipacc_testres_name(uint8_t res)
{
return get_value_string(ipacc_testres_names, res);
}
-void ipac_parse_cgi(struct cell_global_id *cid, const u_int8_t *buf)
+void ipac_parse_cgi(struct cell_global_id *cid, const uint8_t *buf)
{
cid->mcc = (buf[0] & 0xf) * 100;
cid->mcc += (buf[0] >> 4) * 10;
@@ -3041,15 +2527,15 @@ void ipac_parse_cgi(struct cell_global_id *cid, const u_int8_t *buf)
cid->mnc += (buf[1] >> 4) * 1;
}
- cid->lac = ntohs(*((u_int16_t *)&buf[3]));
- cid->ci = ntohs(*((u_int16_t *)&buf[5]));
+ cid->lac = ntohs(*((uint16_t *)&buf[3]));
+ cid->ci = ntohs(*((uint16_t *)&buf[5]));
}
/* parse BCCH information IEI from wire format to struct ipac_bcch_info */
-int ipac_parse_bcch_info(struct ipac_bcch_info *binf, u_int8_t *buf)
+int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf)
{
- u_int8_t *cur = buf;
- u_int16_t len;
+ uint8_t *cur = buf;
+ uint16_t len;
memset(binf, 0, sizeof(*binf));
@@ -3057,10 +2543,10 @@ int ipac_parse_bcch_info(struct ipac_bcch_info *binf, u_int8_t *buf)
return -EINVAL;
cur++;
- len = ntohs(*(u_int16_t *)cur);
+ len = ntohs(*(uint16_t *)cur);
cur += 2;
- binf->info_type = ntohs(*(u_int16_t *)cur);
+ binf->info_type = ntohs(*(uint16_t *)cur);
cur += 2;
if (binf->info_type & IPAC_BINF_FREQ_ERR_QUAL)
@@ -3078,15 +2564,15 @@ int ipac_parse_bcch_info(struct ipac_bcch_info *binf, u_int8_t *buf)
cur++;
if (binf->info_type & IPAC_BINF_FREQ_ERR_QUAL)
- binf->freq_err = ntohs(*(u_int16_t *)cur);
+ binf->freq_err = ntohs(*(uint16_t *)cur);
cur += 2;
if (binf->info_type & IPAC_BINF_FRAME_OFFSET)
- binf->frame_offset = ntohs(*(u_int16_t *)cur);
+ binf->frame_offset = ntohs(*(uint16_t *)cur);
cur += 2;
if (binf->info_type & IPAC_BINF_FRAME_NR_OFFSET)
- binf->frame_nr_offset = ntohl(*(u_int32_t *)cur);
+ binf->frame_nr_offset = ntohl(*(uint32_t *)cur);
cur += 4;
#if 0
diff --git a/src/libbsc/abis_nm_vty.c b/src/libbsc/abis_nm_vty.c
index 996a8574..bcbc92d6 100644
--- a/src/libbsc/abis_nm_vty.c
+++ b/src/libbsc/abis_nm_vty.c
@@ -26,10 +26,12 @@
#include <arpa/inet.h>
+#include <osmocom/gsm/abis_nm.h>
+
#include <openbsc/gsm_data.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/debug.h>
#include <openbsc/signal.h>
#include <openbsc/abis_nm.h>
diff --git a/src/libbsc/abis_om2000.c b/src/libbsc/abis_om2000.c
index 805b844c..b636e737 100644
--- a/src/libbsc/abis_om2000.c
+++ b/src/libbsc/abis_om2000.c
@@ -30,10 +30,10 @@
#include <arpa/inet.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/talloc.h>
-#include <osmocore/utils.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/utils.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
@@ -165,30 +165,141 @@ enum abis_om2k_msgtype {
};
enum abis_om2k_dei {
+ OM2K_DEI_ACCORDANCE_IND = 0x00,
OM2K_DEI_BCC = 0x06,
+ OM2K_DEI_BS_AG_BKS_RES = 0x07,
OM2K_DEI_BSIC = 0x09,
+ OM2K_DEI_BA_PA_MFRMS = 0x0a,
+ OM2K_DEI_CBCH_INDICATOR = 0x0b,
+ OM2K_DEI_CCCH_OPTIONS = 0x0c,
OM2K_DEI_CAL_TIME = 0x0d,
OM2K_DEI_COMBINATION = 0x0f,
OM2K_DEI_CON_CONN_LIST = 0x10,
+ OM2K_DEI_DRX_DEV_MAX = 0x12,
OM2K_DEI_END_LIST_NR = 0x13,
+ OM2K_DEI_EXT_COND_MAP_1 = 0x14,
+ OM2K_DEI_EXT_COND_MAP_2 = 0x15,
OM2K_DEI_FILLING_MARKER = 0x1c,
OM2K_DEI_FN_OFFSET = 0x1d,
OM2K_DEI_FREQ_LIST = 0x1e,
OM2K_DEI_FREQ_SPEC_RX = 0x1f,
OM2K_DEI_FREQ_SPEC_TX = 0x20,
OM2K_DEI_HSN = 0x21,
+ OM2K_DEI_ICM_INDICATOR = 0x22,
+ OM2K_DEI_INT_FAULT_MAP_1A = 0x23,
+ OM2K_DEI_INT_FAULT_MAP_1B = 0x24,
+ OM2K_DEI_INT_FAULT_MAP_2A = 0x25,
+ OM2K_DEI_INT_FAULT_MAP_2A_EXT = 0x26,
OM2K_DEI_IS_CONN_LIST = 0x27,
OM2K_DEI_LIST_NR = 0x28,
+ OM2K_DEI_LOCAL_ACCESS = 0x2a,
OM2K_DEI_MAIO = 0x2b,
+ OM2K_DEI_MO_STATE = 0x2c,
+ OM2K_DEI_NY1 = 0x2d,
OM2K_DEI_OP_INFO = 0x2e,
OM2K_DEI_POWER = 0x2f,
+ OM2K_DEI_REASON_CODE = 0x32,
OM2K_DEI_RX_DIVERSITY = 0x33,
+ OM2K_DEI_RESULT_CODE = 0x35,
+ OM2K_DEI_T3105 = 0x38,
OM2K_DEI_TF_MODE = 0x3a,
OM2K_DEI_TS_NR = 0x3c,
+ OM2K_DEI_TSC = 0x3d,
+ OM2K_DEI_BTS_VERSION = 0x40,
+ OM2K_DEI_OML_IWD_VERSION = 0x41,
+ OM2K_DEI_RSL_IWD_VERSION = 0x42,
+ OM2K_DEI_OML_FUNC_MAP_1 = 0x43,
+ OM2K_DEI_OML_FUNC_MAP_2 = 0x44,
+ OM2K_DEI_RSL_FUNC_MAP_1 = 0x45,
+ OM2K_DEI_RSL_FUNC_MAP_2 = 0x46,
OM2K_DEI_EXT_RANGE = 0x47,
+ OM2K_DEI_REQ_IND = 0x48,
+ OM2K_DEI_REPL_UNIT_MAP = 0x50,
+ OM2K_DEI_ICM_BOUND_PARAMS = 0x74,
+ OM2K_DEI_LSC = 0x79,
+ OM2K_DEI_LSC_FILT_TIME = 0x7a,
+ OM2K_DEI_CALL_SUPV_TIME = 0x7b,
+ OM2K_DEI_ICM_CHAN_RATE = 0x7e,
+ OM2K_DEI_HW_INFO_SIG = 0x84,
+ OM2K_DEI_TF_SYNC_SRC = 0x86,
+ OM2K_DEI_TTA = 0x87,
+ OM2K_DEI_CAPA_SIG = 0x8a,
OM2K_DEI_NEGOT_REC1 = 0x90,
OM2K_DEI_NEGOT_REC2 = 0x91,
+ OM2K_DEI_ENCR_ALG = 0x92,
+ OM2K_DEI_INTERF_REJ_COMB = 0x94,
OM2K_DEI_FS_OFFSET = 0x98,
+ OM2K_DEI_EXT_COND_MAP_2_EXT = 0x9c,
+};
+
+const struct tlv_definition om2k_att_tlvdef = {
+ .def = {
+ [OM2K_DEI_ACCORDANCE_IND] = { TLV_TYPE_TV },
+ [OM2K_DEI_BCC] = { TLV_TYPE_TV },
+ [OM2K_DEI_BS_AG_BKS_RES] = { TLV_TYPE_TV },
+ [OM2K_DEI_BSIC] = { TLV_TYPE_TV },
+ [OM2K_DEI_BA_PA_MFRMS] = { TLV_TYPE_TV },
+ [OM2K_DEI_CBCH_INDICATOR] = { TLV_TYPE_TV },
+ [OM2K_DEI_INT_FAULT_MAP_1A] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_INT_FAULT_MAP_1B] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_INT_FAULT_MAP_2A] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_INT_FAULT_MAP_2A_EXT]={ TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_CCCH_OPTIONS] = { TLV_TYPE_TV },
+ [OM2K_DEI_CAL_TIME] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_COMBINATION] = { TLV_TYPE_TV },
+ [OM2K_DEI_CON_CONN_LIST] = { TLV_TYPE_TLV },
+ [OM2K_DEI_DRX_DEV_MAX] = { TLV_TYPE_TV },
+ [OM2K_DEI_END_LIST_NR] = { TLV_TYPE_TV },
+ [OM2K_DEI_EXT_COND_MAP_1] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_EXT_COND_MAP_2] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_FILLING_MARKER] = { TLV_TYPE_TV },
+ [OM2K_DEI_FN_OFFSET] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_FREQ_LIST] = { TLV_TYPE_TLV },
+ [OM2K_DEI_FREQ_SPEC_RX] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_FREQ_SPEC_TX] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_HSN] = { TLV_TYPE_TV },
+ [OM2K_DEI_ICM_INDICATOR] = { TLV_TYPE_TV },
+ [OM2K_DEI_IS_CONN_LIST] = { TLV_TYPE_TLV },
+ [OM2K_DEI_LIST_NR] = { TLV_TYPE_TV },
+ [OM2K_DEI_LOCAL_ACCESS] = { TLV_TYPE_TV },
+ [OM2K_DEI_MAIO] = { TLV_TYPE_TV },
+ [OM2K_DEI_MO_STATE] = { TLV_TYPE_TV },
+ [OM2K_DEI_NY1] = { TLV_TYPE_TV },
+ [OM2K_DEI_OP_INFO] = { TLV_TYPE_TV },
+ [OM2K_DEI_POWER] = { TLV_TYPE_TV },
+ [OM2K_DEI_REASON_CODE] = { TLV_TYPE_TV },
+ [OM2K_DEI_RX_DIVERSITY] = { TLV_TYPE_TV },
+ [OM2K_DEI_RESULT_CODE] = { TLV_TYPE_TV },
+ [OM2K_DEI_T3105] = { TLV_TYPE_TV },
+ [OM2K_DEI_TF_MODE] = { TLV_TYPE_TV },
+ [OM2K_DEI_TS_NR] = { TLV_TYPE_TV },
+ [OM2K_DEI_TSC] = { TLV_TYPE_TV },
+ [OM2K_DEI_BTS_VERSION] = { TLV_TYPE_FIXED, 12 },
+ [OM2K_DEI_OML_IWD_VERSION] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_RSL_IWD_VERSION] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_OML_FUNC_MAP_1] = { TLV_TYPE_TLV },
+ [OM2K_DEI_OML_FUNC_MAP_2] = { TLV_TYPE_TLV },
+ [OM2K_DEI_RSL_FUNC_MAP_1] = { TLV_TYPE_TLV },
+ [OM2K_DEI_RSL_FUNC_MAP_2] = { TLV_TYPE_TLV },
+ [OM2K_DEI_EXT_RANGE] = { TLV_TYPE_TV },
+ [OM2K_DEI_REQ_IND] = { TLV_TYPE_TV },
+ [OM2K_DEI_REPL_UNIT_MAP] = { TLV_TYPE_FIXED, 6 },
+ [OM2K_DEI_ICM_BOUND_PARAMS] = { TLV_TYPE_FIXED, 5 },
+ [OM2K_DEI_LSC] = { TLV_TYPE_TV },
+ [OM2K_DEI_LSC_FILT_TIME] = { TLV_TYPE_TV },
+ [OM2K_DEI_CALL_SUPV_TIME] = { TLV_TYPE_TV },
+ [OM2K_DEI_ICM_CHAN_RATE] = { TLV_TYPE_TV },
+ [OM2K_DEI_HW_INFO_SIG] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_TF_SYNC_SRC] = { TLV_TYPE_TV },
+ [OM2K_DEI_TTA] = { TLV_TYPE_TV },
+ [OM2K_DEI_CAPA_SIG] = { TLV_TYPE_FIXED, 2 },
+ [OM2K_DEI_NEGOT_REC1] = { TLV_TYPE_TLV },
+ [OM2K_DEI_NEGOT_REC2] = { TLV_TYPE_TLV },
+ [OM2K_DEI_ENCR_ALG] = { TLV_TYPE_TV },
+ [OM2K_DEI_INTERF_REJ_COMB] = { TLV_TYPE_TV },
+ [OM2K_DEI_FS_OFFSET] = { TLV_TYPE_FIXED, 5 },
+ [OM2K_DEI_EXT_COND_MAP_2_EXT] = { TLV_TYPE_FIXED, 4 },
+ },
};
static const struct value_string om2k_msgcode_vals[] = {
@@ -214,7 +325,7 @@ static const struct value_string om2k_msgcode_vals[] = {
{ 0x001a, "CON Configuration Result" },
{ 0x001c, "Connect Command" },
{ 0x001e, "Connect Complete" },
- { 0x001f, "Connect Rejecte" },
+ { 0x001f, "Connect Reject" },
{ 0x0028, "Disable Request" },
{ 0x002a, "Disable Request Accept" },
{ 0x002b, "Disable Request Reject" },
@@ -520,6 +631,16 @@ static struct msgb *om2k_msgb_alloc(void)
"OM2000");
}
+static int abis_om2k_tlv_parse(struct tlv_parsed *tp, const uint8_t *buf, int len)
+{
+ return tlv_parse(tp, &om2k_att_tlvdef, buf, len, 0, 0);
+}
+
+static int abis_om2k_msg_tlv_parse(struct tlv_parsed *tp, struct abis_om2k_hdr *oh)
+{
+ return abis_om2k_tlv_parse(tp, oh->data, oh->om.length - 6);
+}
+
static char *om2k_mo_name(const struct abis_om2k_mo *mo)
{
static char mo_buf[64];
@@ -531,6 +652,151 @@ static char *om2k_mo_name(const struct abis_om2k_mo *mo)
return mo_buf;
}
+/* resolve the gsm_nm_state data structure for a given MO */
+static struct gsm_nm_state *
+mo2nm_state(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
+{
+ struct gsm_bts_trx *trx;
+ struct gsm_nm_state *nm_state = NULL;
+
+ switch (mo->class) {
+ case OM2K_MO_CLS_TRXC:
+ trx = gsm_bts_trx_num(bts, mo->assoc_so);
+ if (!trx)
+ return NULL;
+ nm_state = &trx->mo.nm_state;
+ break;
+ case OM2K_MO_CLS_TS:
+ trx = gsm_bts_trx_num(bts, mo->assoc_so);
+ if (!trx)
+ return NULL;
+ if (mo->inst >= ARRAY_SIZE(trx->ts))
+ return NULL;
+ nm_state = &trx->ts[mo->inst].mo.nm_state;
+ break;
+ case OM2K_MO_CLS_TF:
+ nm_state = &bts->rbs2000.tf.mo.nm_state;
+ break;
+ case OM2K_MO_CLS_IS:
+ nm_state = &bts->rbs2000.is.mo.nm_state;
+ break;
+ case OM2K_MO_CLS_CON:
+ nm_state = &bts->rbs2000.con.mo.nm_state;
+ break;
+ case OM2K_MO_CLS_DP:
+ nm_state = &bts->rbs2000.con.mo.nm_state;
+ break;
+ case OM2K_MO_CLS_CF:
+ nm_state = &bts->mo.nm_state;
+ break;
+ case OM2K_MO_CLS_TX:
+ trx = gsm_bts_trx_num(bts, mo->assoc_so);
+ if (!trx)
+ return NULL;
+ break;
+ case OM2K_MO_CLS_RX:
+ trx = gsm_bts_trx_num(bts, mo->assoc_so);
+ if (!trx)
+ return NULL;
+ break;
+ }
+
+ return nm_state;
+}
+
+static void *mo2obj(struct gsm_bts *bts, struct abis_om2k_mo *mo)
+{
+ struct gsm_bts_trx *trx;
+
+ switch (mo->class) {
+ case OM2K_MO_CLS_TX:
+ case OM2K_MO_CLS_RX:
+ case OM2K_MO_CLS_TRXC:
+ return gsm_bts_trx_num(bts, mo->assoc_so);
+ case OM2K_MO_CLS_TS:
+ trx = gsm_bts_trx_num(bts, mo->assoc_so);
+ if (!trx)
+ return NULL;
+ if (mo->inst >= ARRAY_SIZE(trx->ts))
+ return NULL;
+ return &trx->ts[mo->inst];
+ case OM2K_MO_CLS_TF:
+ case OM2K_MO_CLS_IS:
+ case OM2K_MO_CLS_CON:
+ case OM2K_MO_CLS_DP:
+ case OM2K_MO_CLS_CF:
+ return bts;
+ }
+
+ return NULL;
+}
+
+static void update_mo_state(struct gsm_bts *bts, struct abis_om2k_mo *mo,
+ uint8_t mo_state)
+{
+ struct gsm_nm_state *nm_state = mo2nm_state(bts, mo);
+ struct gsm_nm_state new_state;
+ struct nm_statechg_signal_data nsd;
+
+ if (!nm_state)
+ return;
+
+ new_state = *nm_state;
+ /* NOTICE: 12.21 Availability state values != OM2000 */
+ new_state.availability = mo_state;
+
+ memset(&nsd, 0, sizeof(nsd));
+
+ nsd.bts = bts;
+ nsd.obj = mo2obj(bts, mo);
+ nsd.old_state = nm_state;
+ nsd.new_state = &new_state;
+ nsd.om2k_mo = mo;
+
+ osmo_signal_dispatch(SS_NM, S_NM_STATECHG_ADM, &nsd);
+
+ nm_state->availability = new_state.availability;
+}
+
+static void update_op_state(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
+ uint8_t op_state)
+{
+ struct gsm_nm_state *nm_state = mo2nm_state(bts, mo);
+ struct gsm_nm_state new_state;
+
+ if (!nm_state)
+ return;
+
+ new_state = *nm_state;
+ switch (op_state) {
+ case 1:
+ new_state.operational = NM_OPSTATE_ENABLED;
+ break;
+ case 0:
+ new_state.operational = NM_OPSTATE_DISABLED;
+ break;
+ default:
+ new_state.operational = NM_OPSTATE_NULL;
+ break;
+ }
+
+ nm_state->operational = new_state.operational;
+}
+
+static void signal_op_state(struct gsm_bts *bts, struct abis_om2k_mo *mo)
+{
+ struct gsm_nm_state *nm_state = mo2nm_state(bts, mo);
+ struct nm_statechg_signal_data nsd;
+
+ nsd.bts = bts;
+ nsd.obj = mo2obj(bts, mo);
+ nsd.old_state = nm_state;
+ nsd.new_state = nm_state;
+ nsd.om2k_mo = mo;
+
+ osmo_signal_dispatch(SS_NM, S_NM_STATECHG_OPER, &nsd);
+}
+
static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
{
struct abis_om2k_hdr *o2h;
@@ -539,11 +805,13 @@ static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
msg->l2h = msg->data;
o2h = (struct abis_om2k_hdr *) msg->l2h;
+ /* Compute the length in the OML header */
+ o2h->om.length = 6 + msgb_l2len(msg)-sizeof(*o2h);
+
switch (o2h->mo.class) {
case OM2K_MO_CLS_TRXC:
case OM2K_MO_CLS_TX:
case OM2K_MO_CLS_RX:
- case OM2K_MO_CLS_TS:
/* Route through per-TRX OML Link to the appropriate TRX */
to_trx_oml = 1;
msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst);
@@ -553,6 +821,16 @@ static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
return -ENODEV;
}
break;
+ case OM2K_MO_CLS_TS:
+ /* Route through per-TRX OML Link to the appropriate TRX */
+ to_trx_oml = 1;
+ msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.assoc_so);
+ if (!msg->trx) {
+ LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to "
+ "non-existing TRX\n", om2k_mo_name(&o2h->mo));
+ return -ENODEV;
+ }
+ break;
default:
/* Route through the IXU/DXU OML Link */
msg->trx = bts->c0;
@@ -564,12 +842,12 @@ static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
}
static void fill_om2k_hdr(struct abis_om2k_hdr *o2h, const struct abis_om2k_mo *mo,
- uint16_t msg_type, uint8_t attr_len)
+ uint16_t msg_type)
{
o2h->om.mdisc = ABIS_OM_MDISC_FOM;
o2h->om.placement = ABIS_OM_PLACEMENT_ONLY;
o2h->om.sequence = 0;
- o2h->om.length = 6 + attr_len;
+ /* We fill o2h->om.length later during om2k_sendmsg() */
o2h->msg_type = htons(msg_type);
memcpy(&o2h->mo, mo, sizeof(o2h->mo));
}
@@ -587,7 +865,7 @@ static int abis_om2k_cal_time_resp(struct gsm_bts *bts)
struct tm *tm;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &om2k_mo_cf, OM2K_MSGT_CAL_TIME_RESP, 7);
+ fill_om2k_hdr(o2k, &om2k_mo_cf, OM2K_MSGT_CAL_TIME_RESP);
tm_t = time(NULL);
tm = localtime(&tm_t);
@@ -610,7 +888,7 @@ static int abis_om2k_tx_simple(struct gsm_bts *bts, const struct abis_om2k_mo *m
struct abis_om2k_hdr *o2k;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, mo, msg_type, 0);
+ fill_om2k_hdr(o2k, mo, msg_type);
DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo),
get_value_string(om2k_msgcode_vals, msg_type));
@@ -665,31 +943,59 @@ int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
struct abis_om2k_hdr *o2k;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, mo, OM2K_MSGT_OP_INFO, 2);
+ fill_om2k_hdr(o2k, mo, OM2K_MSGT_OP_INFO);
msgb_tv_put(msg, OM2K_DEI_OP_INFO, operational);
DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo),
get_value_string(om2k_msgcode_vals, OM2K_MSGT_OP_INFO));
+ /* we update the state here... and send the signal at ACK */
+ update_op_state(bts, mo, operational);
+
return abis_om2k_sendmsg(bts, msg);
}
-int abis_om2k_tx_is_conf_req(struct gsm_bts *bts, struct om2k_is_conn_grp *cg,
- unsigned int num_cg )
+static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1,
+ uint16_t icp2, uint8_t cont_idx)
+{
+ grp->icp1 = htons(icp1);
+ grp->icp2 = htons(icp2);
+ grp->cont_idx = cont_idx;
+}
+
+int abis_om2k_tx_is_conf_req(struct gsm_bts *bts)
{
struct msgb *msg = om2k_msgb_alloc();
struct abis_om2k_hdr *o2k;
+ struct is_conn_group *grp;
+ unsigned int num_grps = 0, i = 0;
+ struct om2k_is_conn_grp *cg;
+
+ /* count number of groups in linked list */
+ llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
+ num_grps++;
+
+ if (!num_grps)
+ return -EINVAL;
+
+ /* allocate buffer for oml group array */
+ cg = talloc_zero_array(bts, struct om2k_is_conn_grp, num_grps);
+
+ /* fill array with data from linked list */
+ llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
+ om2k_fill_is_conn_grp(&cg[i++], grp->icp1, grp->icp2, grp->ci);
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &om2k_mo_is, OM2K_MSGT_IS_CONF_REQ,
- 2 + 2 + TLV_GROSS_LEN(num_cg * sizeof(*cg)));
+ fill_om2k_hdr(o2k, &om2k_mo_is, OM2K_MSGT_IS_CONF_REQ);
msgb_tv_put(msg, OM2K_DEI_LIST_NR, 1);
msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1);
msgb_tlv_put(msg, OM2K_DEI_IS_CONN_LIST,
- num_cg * sizeof(*cg), (uint8_t *)cg);
+ num_grps * sizeof(*cg), (uint8_t *)cg);
+
+ talloc_free(cg);
return abis_om2k_sendmsg(bts, msg);
}
@@ -701,8 +1007,7 @@ int abis_om2k_tx_con_conf_req(struct gsm_bts *bts, uint8_t *data,
struct abis_om2k_hdr *o2k;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &om2k_mo_con, OM2K_MSGT_CON_CONF_REQ,
- 2 + 2 + TLV_GROSS_LEN(len));
+ fill_om2k_hdr(o2k, &om2k_mo_con, OM2K_MSGT_CON_CONF_REQ);
msgb_tv_put(msg, OM2K_DEI_LIST_NR, 1);
msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1);
@@ -719,7 +1024,7 @@ static void om2k_trx_to_mo(struct abis_om2k_mo *mo,
mo->class = cls;
mo->bts = 0;
mo->inst = trx->nr;
- mo->assoc_so = 0;
+ mo->assoc_so = 255;
}
static void om2k_ts_to_mo(struct abis_om2k_mo *mo,
@@ -741,10 +1046,10 @@ int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx)
om2k_trx_to_mo(&mo, trx, OM2K_MO_CLS_RX);
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &mo, OM2K_MSGT_RX_CONF_REQ, 3+2);
+ fill_om2k_hdr(o2k, &mo, OM2K_MSGT_RX_CONF_REQ);
msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_RX, trx->arfcn);
- msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x03); /* A+B */
+ msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x02); /* A */
return abis_om2k_sendmsg(trx->bts, msg);
}
@@ -759,7 +1064,7 @@ int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx)
om2k_trx_to_mo(&mo, trx, OM2K_MO_CLS_TX);
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TX_CONF_REQ, 3+2+2+2);
+ fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TX_CONF_REQ);
msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_TX, trx->arfcn);
msgb_tv_put(msg, OM2K_DEI_POWER, trx->nominal_power-trx->max_power_red);
@@ -785,10 +1090,10 @@ int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts)
struct abis_om2k_hdr *o2k;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &om2k_mo_tf, OM2K_MSGT_TF_CONF_REQ,
- 2+1+sizeof(fs_offset_undef));
+ fill_om2k_hdr(o2k, &om2k_mo_tf, OM2K_MSGT_TF_CONF_REQ);
msgb_tv_put(msg, OM2K_DEI_TF_MODE, OM2K_TF_MODE_STANDALONE);
+ msgb_tv_put(msg, OM2K_DEI_TF_SYNC_SRC, 0x00);
msgb_tv_fixed_put(msg, OM2K_DEI_FS_OFFSET,
sizeof(fs_offset_undef), fs_offset_undef);
@@ -814,28 +1119,37 @@ static uint8_t pchan2comb(enum gsm_phys_chan_config pchan)
}
}
+static int put_freq_list(uint8_t *buf, uint16_t arfcn)
+{
+ buf[0] = 0x00; /* TX/RX address */
+ buf[1] = (arfcn >> 8);
+ buf[2] = (arfcn & 0xff);
+
+ return 3;
+}
+
/* Compute a frequency list in OM2000 fomrmat */
static int om2k_gen_freq_list(uint8_t *list, struct gsm_bts_trx_ts *ts)
{
uint8_t *cur = list;
+ int len;
if (ts->hopping.enabled) {
unsigned int i;
for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {
- if (bitvec_get_bit_pos(&ts->hopping.arfcns, i)) {
- *cur++ = 0x00;
- *cur++ = i >> 8;
- *cur++ = i & 0xff;
- }
+ if (bitvec_get_bit_pos(&ts->hopping.arfcns, i))
+ cur += put_freq_list(cur, i);
}
- } else {
- *cur++ = 0x00; /* TX/RX address */
- *cur++ = ts->trx->arfcn >> 8;
- *cur++ = ts->trx->arfcn && 0xff;
- }
- return (cur - list);
+ } else
+ cur += put_freq_list(cur, ts->trx->arfcn);
+
+ len = cur - list;
+
+ return len;
}
+const uint8_t icm_bound_params[] = { 0x02, 0x06, 0x0c, 0x16, 0x06 };
+
int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
{
struct msgb *msg = om2k_msgb_alloc();
@@ -846,13 +1160,13 @@ int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
om2k_ts_to_mo(&mo, ts);
+ memset(freq_list, 0, sizeof(freq_list));
freq_list_len = om2k_gen_freq_list(freq_list, ts);
if (freq_list_len < 0)
return freq_list_len;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TS_CONF_REQ,
- 2+2+TLV_GROSS_LEN(freq_list_len)+2+2+2+2+3+2);
+ fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TS_CONF_REQ);
msgb_tv_put(msg, OM2K_DEI_COMBINATION, pchan2comb(ts->pchan));
msgb_tv_put(msg, OM2K_DEI_TS_NR, ts->nr);
@@ -860,10 +1174,62 @@ int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts)
msgb_tv_put(msg, OM2K_DEI_HSN, ts->hopping.hsn);
msgb_tv_put(msg, OM2K_DEI_MAIO, ts->hopping.maio);
msgb_tv_put(msg, OM2K_DEI_BSIC, ts->trx->bts->bsic);
- msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x03); /* A+B */
+ msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x02); /* A */
msgb_tv16_put(msg, OM2K_DEI_FN_OFFSET, 0);
msgb_tv_put(msg, OM2K_DEI_EXT_RANGE, 0); /* Off */
/* Optional: Interference Rejection Combining */
+ msgb_tv_put(msg, OM2K_DEI_INTERF_REJ_COMB, 0x00);
+ switch (ts->pchan) {
+ case GSM_PCHAN_CCCH:
+ msgb_tv_put(msg, OM2K_DEI_BA_PA_MFRMS, 0x06);
+ msgb_tv_put(msg, OM2K_DEI_BS_AG_BKS_RES, 0x01);
+ msgb_tv_put(msg, OM2K_DEI_DRX_DEV_MAX, 0x05);
+ /* Repeat Paging/IMM.ASS: True, Allow Paging Type 3: Yes, Page for 5 seconds (default) */
+ msgb_tv_put(msg, OM2K_DEI_CCCH_OPTIONS, 0x01);
+ break;
+ case GSM_PCHAN_CCCH_SDCCH4:
+ msgb_tv_put(msg, OM2K_DEI_T3105, 0x04);
+ msgb_tv_put(msg, OM2K_DEI_NY1, 35);
+ msgb_tv_put(msg, OM2K_DEI_BA_PA_MFRMS, 0x06);
+ msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0);
+ msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc);
+ msgb_tv_put(msg, OM2K_DEI_BS_AG_BKS_RES, 0x01);
+ msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0);
+ msgb_tv_put(msg, OM2K_DEI_DRX_DEV_MAX, 0x05);
+ /* Repeat Paging/IMM.ASS: True, Allow Paging Type 3: Yes, Page for 5 seconds (default) */
+ msgb_tv_put(msg, OM2K_DEI_CCCH_OPTIONS, 0x01);
+ msgb_tv_fixed_put(msg, OM2K_DEI_ICM_BOUND_PARAMS,
+ sizeof(icm_bound_params), icm_bound_params);
+ break;
+ case GSM_PCHAN_SDCCH8_SACCH8C:
+ msgb_tv_put(msg, OM2K_DEI_T3105, 0x04);
+ msgb_tv_put(msg, OM2K_DEI_NY1, 35);
+ msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0);
+ msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc);
+ /* Disable RF RESOURCE INDICATION on idle channels */
+ msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0);
+ msgb_tv_fixed_put(msg, OM2K_DEI_ICM_BOUND_PARAMS,
+ sizeof(icm_bound_params), icm_bound_params);
+ break;
+ default:
+ msgb_tv_put(msg, OM2K_DEI_T3105, 0x04);
+ msgb_tv_put(msg, OM2K_DEI_NY1, 35);
+ msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc);
+ /* Disable RF RESOURCE INDICATION on idle channels */
+ msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0);
+ msgb_tv_fixed_put(msg, OM2K_DEI_ICM_BOUND_PARAMS,
+ sizeof(icm_bound_params), icm_bound_params);
+ msgb_tv_put(msg, OM2K_DEI_TTA, 10); /* Timer for Time Alignment */
+ if (ts->pchan == GSM_PCHAN_TCH_H)
+ msgb_tv_put(msg, OM2K_DEI_ICM_CHAN_RATE, 1); /* TCH/H */
+ else
+ msgb_tv_put(msg, OM2K_DEI_ICM_CHAN_RATE, 0); /* TCH/F */
+ msgb_tv_put(msg, OM2K_DEI_LSC, 1); /* enabled */
+ msgb_tv_put(msg, OM2K_DEI_LSC_FILT_TIME, 10); /* units of 100ms */
+ msgb_tv_put(msg, OM2K_DEI_CALL_SUPV_TIME, 8);
+ msgb_tv_put(msg, OM2K_DEI_ENCR_ALG, 0x00);
+ break;
+ }
return abis_om2k_sendmsg(ts->trx->bts, msg);
}
@@ -875,7 +1241,7 @@ static int abis_om2k_tx_negot_req_ack(struct gsm_bts *bts, const struct abis_om2
struct abis_om2k_hdr *o2k;
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
- fill_om2k_hdr(o2k, mo, OM2K_MSGT_NEGOT_REQ_ACK, 2+len);
+ fill_om2k_hdr(o2k, mo, OM2K_MSGT_NEGOT_REQ_ACK);
msgb_tlv_put(msg, OM2K_DEI_NEGOT_REC2, len, data);
@@ -968,7 +1334,129 @@ static int om2k_rx_op_info_ack(struct msgb *msg)
{
struct abis_om2k_hdr *o2h = msgb_l2(msg);
- /* FIXME: update Operational state in our structures */
+ /* This Acknowledgement does not contain the actual operational state,
+ * so we signal whatever state we saved when we sent the Op Info
+ * request */
+
+ signal_op_state(msg->trx->bts, &o2h->mo);
+
+ return 0;
+}
+
+const struct value_string om2k_result_strings[] = {
+ { 0x02, "Wrong state or out of sequence" },
+ { 0x03, "File error" },
+ { 0x04, "Fault, unspecified" },
+ { 0x05, "Tuning fault" },
+ { 0x06, "Protocol error" },
+ { 0x07, "MO not connected" },
+ { 0x08, "Parameter error" },
+ { 0x09, "Optional function not supported" },
+ { 0x0a, "Local access state LOCALLY DISCONNECTED" },
+ { 0, NULL }
+};
+
+const struct value_string om2k_accordance_strings[] = {
+ { 0x00, "Data according to request" },
+ { 0x01, "Data not according to request" },
+ { 0x02, "Inconsistent MO data" },
+ { 0x03, "Capability constraint violation" },
+ { 0, NULL }
+};
+
+const struct value_string om2k_mostate_vals[] = {
+ { 0x00, "RESET" },
+ { 0x01, "STARTED" },
+ { 0x02, "ENABLED" },
+ { 0x03, "DISABLED" },
+ { 0, NULL }
+};
+
+static int om2k_rx_nack(struct msgb *msg)
+{
+ struct abis_om2k_hdr *o2h = msgb_l2(msg);
+ uint16_t msg_type = ntohs(o2h->msg_type);
+ struct tlv_parsed tp;
+
+ LOGP(DNM, LOGL_ERROR, "Rx MO=%s %s", om2k_mo_name(&o2h->mo),
+ get_value_string(om2k_msgcode_vals, msg_type));
+
+ abis_om2k_msg_tlv_parse(&tp, o2h);
+ if (TLVP_PRESENT(&tp, OM2K_DEI_REASON_CODE))
+ LOGPC(DNM, LOGL_ERROR, ", Reason 0x%02x",
+ *TLVP_VAL(&tp, OM2K_DEI_REASON_CODE));
+
+ if (TLVP_PRESENT(&tp, OM2K_DEI_RESULT_CODE))
+ LOGPC(DNM, LOGL_ERROR, ", Result %s",
+ get_value_string(om2k_result_strings,
+ *TLVP_VAL(&tp, OM2K_DEI_RESULT_CODE)));
+ LOGPC(DNM, LOGL_ERROR, "\n");
+
+ return 0;
+}
+
+/* Process a Configuration Result message */
+static int process_conf_res(struct gsm_bts *bts, struct msgb *msg)
+{
+ struct abis_om2k_hdr *o2h = msgb_l2(msg);
+ uint16_t msg_type = ntohs(o2h->msg_type);
+ struct nm_om2k_signal_data nsd;
+ struct tlv_parsed tp;
+ uint8_t acc;
+ unsigned int log_level;
+ int ret;
+
+ memset(&nsd, 0, sizeof(nsd));
+
+ abis_om2k_msg_tlv_parse(&tp, o2h);
+ if (!TLVP_PRESENT(&tp, OM2K_DEI_ACCORDANCE_IND))
+ return -EIO;
+
+ acc = *TLVP_VAL(&tp, OM2K_DEI_ACCORDANCE_IND);
+
+ switch (acc) {
+ case 0:
+ log_level = LOGL_DEBUG;
+ ret = 0;
+ break;
+ default:
+ log_level = LOGL_ERROR;
+ ret = -EINVAL;
+ break;
+ }
+
+ LOGP(DNM, log_level, "Rx MO=%s %s, Accordance: %s\n",
+ om2k_mo_name(&o2h->mo),
+ get_value_string(om2k_msgcode_vals, msg_type),
+ get_value_string(om2k_accordance_strings, acc));
+
+ nsd.bts = bts;
+ nsd.obj = mo2obj(bts, &o2h->mo);
+ nsd.om2k_mo = &o2h->mo;
+ nsd.accordance_ind = acc;
+ osmo_signal_dispatch(SS_NM, S_NM_OM2K_CONF_RES, &nsd);
+
+ return ret;
+}
+
+static int process_mo_state(struct gsm_bts *bts, struct msgb *msg)
+{
+ struct abis_om2k_hdr *o2h = msgb_l2(msg);
+ uint16_t msg_type = ntohs(o2h->msg_type);
+ struct tlv_parsed tp;
+ uint8_t mo_state;
+
+ abis_om2k_msg_tlv_parse(&tp, o2h);
+ if (!TLVP_PRESENT(&tp, OM2K_DEI_MO_STATE))
+ return -EIO;
+ mo_state = *TLVP_VAL(&tp, OM2K_DEI_MO_STATE);
+
+ LOGP(DNM, LOGL_DEBUG, "Rx MO=%s %s, MO State: %s\n",
+ om2k_mo_name(&o2h->mo),
+ get_value_string(om2k_msgcode_vals, msg_type),
+ get_value_string(om2k_mostate_vals, mo_state));
+
+ update_mo_state(bts, &o2h->mo, mo_state);
return 0;
}
@@ -1004,7 +1492,7 @@ int abis_om2k_rcvmsg(struct msgb *msg)
DEBUGP(DNM, "Rx MO=%s %s (%s)\n", om2k_mo_name(&o2h->mo),
get_value_string(om2k_msgcode_vals, msg_type),
- hexdump(msg->l2h, msgb_l2len(msg)));
+ osmo_hexdump(msg->l2h, msgb_l2len(msg)));
switch (msg_type) {
case OM2K_MSGT_CAL_TIME_REQ:
@@ -1012,33 +1500,41 @@ int abis_om2k_rcvmsg(struct msgb *msg)
break;
case OM2K_MSGT_FAULT_REP:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_FAULT_REP_ACK);
+ process_mo_state(bts, msg);
break;
case OM2K_MSGT_NEGOT_REQ:
rc = om2k_rx_negot_req(msg);
break;
case OM2K_MSGT_START_RES:
rc = om2k_rx_start_res(msg);
+ process_mo_state(bts, msg);
break;
case OM2K_MSGT_OP_INFO_ACK:
rc = om2k_rx_op_info_ack(msg);
break;
case OM2K_MSGT_IS_CONF_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_IS_CONF_RES_ACK);
+ process_conf_res(bts, msg);
break;
case OM2K_MSGT_CON_CONF_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_CON_CONF_RES_ACK);
+ process_conf_res(bts, msg);
break;
case OM2K_MSGT_TX_CONF_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TX_CONF_RES_ACK);
+ process_conf_res(bts, msg);
break;
case OM2K_MSGT_RX_CONF_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_RX_CONF_RES_ACK);
+ process_conf_res(bts, msg);
break;
case OM2K_MSGT_TS_CONF_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TS_CONF_RES_ACK);
+ process_conf_res(bts, msg);
break;
case OM2K_MSGT_TF_CONF_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TF_CONF_RES_ACK);
+ process_conf_res(bts, msg);
break;
case OM2K_MSGT_CONNECT_COMPL:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_RESET_CMD);
@@ -1048,14 +1544,18 @@ int abis_om2k_rcvmsg(struct msgb *msg)
break;
case OM2K_MSGT_ENABLE_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_ENABLE_RES_ACK);
+ process_mo_state(bts, msg);
break;
case OM2K_MSGT_DISABLE_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_DISABLE_RES_ACK);
+ process_mo_state(bts, msg);
break;
case OM2K_MSGT_TEST_RES:
rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TEST_RES_ACK);
+ process_mo_state(bts, msg);
break;
case OM2K_MSGT_STATUS_RESP:
+ process_mo_state(bts, msg);
break;
case OM2K_MSGT_START_REQ_ACK:
case OM2K_MSGT_CON_CONF_REQ_ACK:
@@ -1068,6 +1568,22 @@ int abis_om2k_rcvmsg(struct msgb *msg)
case OM2K_MSGT_ALARM_STATUS_REQ_ACK:
case OM2K_MSGT_DISABLE_REQ_ACK:
break;
+ case OM2K_MSGT_START_REQ_REJ:
+ case OM2K_MSGT_CONNECT_REJ:
+ case OM2K_MSGT_OP_INFO_REJ:
+ case OM2K_MSGT_DISCONNECT_REJ:
+ case OM2K_MSGT_TEST_REQ_REJ:
+ case OM2K_MSGT_CON_CONF_REQ_REJ:
+ case OM2K_MSGT_IS_CONF_REQ_REJ:
+ case OM2K_MSGT_TX_CONF_REQ_REJ:
+ case OM2K_MSGT_RX_CONF_REQ_REJ:
+ case OM2K_MSGT_TS_CONF_REQ_REJ:
+ case OM2K_MSGT_TF_CONF_REQ_REJ:
+ case OM2K_MSGT_ENABLE_REQ_REJ:
+ case OM2K_MSGT_ALARM_STATUS_REQ_REJ:
+ case OM2K_MSGT_DISABLE_REQ_REJ:
+ rc = om2k_rx_nack(msg);
+ break;
default:
LOGP(DNM, LOGL_NOTICE, "Rx unhandled OM2000 msg %s\n",
get_value_string(om2k_msgcode_vals, msg_type));
diff --git a/src/libbsc/abis_om2000_vty.c b/src/libbsc/abis_om2000_vty.c
index 5ebb2a39..704f9559 100644
--- a/src/libbsc/abis_om2000_vty.c
+++ b/src/libbsc/abis_om2000_vty.c
@@ -27,9 +27,9 @@
#include <arpa/inet.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/debug.h>
#include <openbsc/signal.h>
#include <openbsc/abis_om2000.h>
@@ -324,21 +324,6 @@ DEFUN(om2k_con_list_tei, om2k_con_list_tei_cmd,
return CMD_SUCCESS;
}
-static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1,
- uint16_t icp2, uint8_t cont_idx)
-{
- grp->icp1 = htons(icp1);
- grp->icp2 = htons(icp2);
- grp->cont_idx = cont_idx;
-}
-
-struct is_conn_group {
- struct llist_head list;
- uint16_t icp1;
- uint16_t icp2;
- uint8_t ci;
-};
-
DEFUN(cfg_bts_is_conn_list, cfg_bts_is_conn_list_cmd,
"is-connection-list (add|del) <0-2047> <0-2047> <0-255>",
"Interface Switch Connnection List\n"
@@ -375,41 +360,6 @@ DEFUN(cfg_bts_is_conn_list, cfg_bts_is_conn_list_cmd,
}
-DEFUN(om2k_is_conf_req, om2k_is_conf_req_cmd,
- "is-conf-req",
- "Send IS Configuration Request\n")
-{
- struct oml_node_state *oms = vty->index;
- struct gsm_bts *bts = oms->bts;
- struct is_conn_group *grp;
- unsigned int num_grps = 0, i = 0;
- struct om2k_is_conn_grp *o2grps;
-
- /* count number of groups in linked list */
- llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
- num_grps++;
-
- if (!num_grps) {
- vty_out(vty, "%% No IS connection groups configured!%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- /* allocate buffer for oml group array */
- o2grps = talloc_zero_array(bts, struct om2k_is_conn_grp, num_grps);
-
- /* fill array with data from linked list */
- llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
- om2k_fill_is_conn_grp(&o2grps[i++], grp->icp1, grp->icp2, grp->ci);
-
- /* send the actual OML request */
- abis_om2k_tx_is_conf_req(oms->bts, o2grps, num_grps);
-
- talloc_free(o2grps);
-
- return CMD_SUCCESS;
-}
-
DEFUN(om2k_conf_req, om2k_conf_req_cmd,
"configuration-request",
"Send the configuration request for current MO\n")
@@ -420,6 +370,9 @@ DEFUN(om2k_conf_req, om2k_conf_req_cmd,
struct gsm_bts_trx_ts *ts = NULL;
switch (oms->mo.class) {
+ case OM2K_MO_CLS_IS:
+ abis_om2k_tx_is_conf_req(bts);
+ break;
case OM2K_MO_CLS_TS:
trx = gsm_bts_trx_by_nr(bts, oms->mo.assoc_so);
if (!trx) {
@@ -449,7 +402,7 @@ DEFUN(om2k_conf_req, om2k_conf_req_cmd,
abis_om2k_tx_rx_conf_req(trx);
break;
case OM2K_MO_CLS_TX:
- abis_om2k_tx_rx_conf_req(trx);
+ abis_om2k_tx_tx_conf_req(trx);
break;
default:
break;
@@ -503,7 +456,6 @@ int abis_om2k_vty_init(void)
install_element(OM2K_NODE, &om2k_op_info_cmd);
install_element(OM2K_NODE, &om2k_test_cmd);
install_element(OM2K_NODE, &om2k_conf_req_cmd);
- install_element(OM2K_NODE, &om2k_is_conf_req_cmd);
install_element(OM2K_NODE, &om2k_con_list_dec_cmd);
install_element(OM2K_NODE, &om2k_con_list_tei_cmd);
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 9a4dc5b4..8356bd9a 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -23,31 +23,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_04_08.h>
-#include <osmocore/gsm_utils.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/bsc_rll.h>
#include <openbsc/debug.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/paging.h>
#include <openbsc/signal.h>
#include <openbsc/meas_rep.h>
#include <openbsc/rtp_proxy.h>
-#include <osmocore/rsl.h>
+#include <osmocom/gsm/rsl.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#define RSL_ALLOC_SIZE 1024
#define RSL_ALLOC_HEADROOM 128
-#define MAX(a, b) (a) >= (b) ? (a) : (b)
-
static int rsl_send_imm_assignment(struct gsm_lchan *lchan);
static void send_lchan_signal(int sig_no, struct gsm_lchan *lchan,
@@ -56,10 +53,10 @@ static void send_lchan_signal(int sig_no, struct gsm_lchan *lchan,
struct lchan_signal_data sig;
sig.lchan = lchan;
sig.mr = resp;
- dispatch_signal(SS_LCHAN, sig_no, &sig);
+ osmo_signal_dispatch(SS_LCHAN, sig_no, &sig);
}
-static u_int8_t mdisc_by_msgtype(u_int8_t msg_type)
+static uint8_t mdisc_by_msgtype(uint8_t msg_type)
{
/* mask off the transparent bit ? */
msg_type &= 0xfe;
@@ -79,7 +76,7 @@ static u_int8_t mdisc_by_msgtype(u_int8_t msg_type)
}
static inline void init_dchan_hdr(struct abis_rsl_dchan_hdr *dh,
- u_int8_t msg_type)
+ uint8_t msg_type)
{
dh->c.msg_discr = mdisc_by_msgtype(msg_type);
dh->c.msg_type = msg_type;
@@ -87,12 +84,12 @@ static inline void init_dchan_hdr(struct abis_rsl_dchan_hdr *dh,
}
/* determine logical channel based on TRX and channel number IE */
-struct gsm_lchan *lchan_lookup(struct gsm_bts_trx *trx, u_int8_t chan_nr)
+struct gsm_lchan *lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr)
{
struct gsm_lchan *lchan;
- u_int8_t ts_nr = chan_nr & 0x07;
- u_int8_t cbits = chan_nr >> 3;
- u_int8_t lch_idx;
+ uint8_t ts_nr = chan_nr & 0x07;
+ uint8_t cbits = chan_nr >> 3;
+ uint8_t lch_idx;
struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
if (cbits == 0x01) {
@@ -137,78 +134,16 @@ struct gsm_lchan *lchan_lookup(struct gsm_bts_trx *trx, u_int8_t chan_nr)
return lchan;
}
-/* See Table 10.5.25 of GSM04.08 */
-static u_int8_t ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr)
-{
- u_int8_t cbits, chan_nr;
-
- switch (ts->pchan) {
- case GSM_PCHAN_TCH_F:
- case GSM_PCHAN_PDCH:
- case GSM_PCHAN_TCH_F_PDCH:
- cbits = 0x01;
- break;
- case GSM_PCHAN_TCH_H:
- cbits = 0x02;
- cbits += lchan_nr;
- break;
- case GSM_PCHAN_CCCH_SDCCH4:
- cbits = 0x04;
- cbits += lchan_nr;
- break;
- case GSM_PCHAN_SDCCH8_SACCH8C:
- cbits = 0x08;
- cbits += lchan_nr;
- break;
- default:
- case GSM_PCHAN_CCCH:
- cbits = 0x10;
- break;
- }
-
- chan_nr = (cbits << 3) | (ts->nr & 0x7);
-
- return chan_nr;
-}
-
-u_int8_t lchan2chan_nr(const struct gsm_lchan *lchan)
-{
- return ts2chan_nr(lchan->ts, lchan->nr);
-}
-
/* As per TS 03.03 Section 2.2, the IMSI has 'not more than 15 digits' */
-u_int64_t str_to_imsi(const char *imsi_str)
+uint64_t str_to_imsi(const char *imsi_str)
{
- u_int64_t ret;
+ uint64_t ret;
ret = strtoull(imsi_str, NULL, 10);
return ret;
}
-/* Table 5 Clause 7 TS 05.02 */
-unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res)
-{
- if (!bs_ccch_sdcch_comb)
- return 9 - bs_ag_blks_res;
- else
- return 3 - bs_ag_blks_res;
-}
-
-/* Chapter 6.5.2 of TS 05.02 */
-unsigned int get_ccch_group(u_int64_t imsi, unsigned int bs_cc_chans,
- unsigned int n_pag_blocks)
-{
- return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) / n_pag_blocks;
-}
-
-/* Chapter 6.5.2 of TS 05.02 */
-unsigned int get_paging_group(u_int64_t imsi, unsigned int bs_cc_chans,
- int n_pag_blocks)
-{
- return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks;
-}
-
static struct msgb *rsl_msgb_alloc(void)
{
return msgb_alloc_headroom(RSL_ALLOC_SIZE, RSL_ALLOC_HEADROOM,
@@ -216,7 +151,7 @@ static struct msgb *rsl_msgb_alloc(void)
}
#define MACBLOCK_SIZE 23
-static void pad_macblock(u_int8_t *out, const u_int8_t *in, int len)
+static void pad_macblock(uint8_t *out, const uint8_t *in, int len)
{
memcpy(out, in, len);
@@ -225,7 +160,7 @@ static void pad_macblock(u_int8_t *out, const u_int8_t *in, int len)
}
/* Chapter 9.3.7: Encryption Information */
-static int build_encr_info(u_int8_t *out, struct gsm_lchan *lchan)
+static int build_encr_info(uint8_t *out, struct gsm_lchan *lchan)
{
*out++ = lchan->encr.alg_id & 0xff;
if (lchan->encr.key_len)
@@ -233,7 +168,7 @@ static int build_encr_info(u_int8_t *out, struct gsm_lchan *lchan)
return lchan->encr.key_len + 1;
}
-static void print_rsl_cause(int lvl, const u_int8_t *cause_v, u_int8_t cause_len)
+static void print_rsl_cause(int lvl, const uint8_t *cause_v, uint8_t cause_len)
{
int i;
@@ -244,8 +179,8 @@ static void print_rsl_cause(int lvl, const u_int8_t *cause_v, u_int8_t cause_len
}
/* Send a BCCH_INFO message as per Chapter 8.5.1 */
-int rsl_bcch_info(struct gsm_bts_trx *trx, u_int8_t type,
- const u_int8_t *data, int len)
+int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type,
+ const uint8_t *data, int len)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg = rsl_msgb_alloc();
@@ -262,8 +197,8 @@ int rsl_bcch_info(struct gsm_bts_trx *trx, u_int8_t type,
return abis_rsl_sendmsg(msg);
}
-int rsl_sacch_filling(struct gsm_bts_trx *trx, u_int8_t type,
- const u_int8_t *data, int len)
+int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type,
+ const uint8_t *data, int len)
{
struct abis_rsl_common_hdr *ch;
struct msgb *msg = rsl_msgb_alloc();
@@ -280,12 +215,12 @@ int rsl_sacch_filling(struct gsm_bts_trx *trx, u_int8_t type,
return abis_rsl_sendmsg(msg);
}
-int rsl_sacch_info_modify(struct gsm_lchan *lchan, u_int8_t type,
- const u_int8_t *data, int len)
+int rsl_sacch_info_modify(struct gsm_lchan *lchan, uint8_t type,
+ const uint8_t *data, int len)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg = rsl_msgb_alloc();
- u_int8_t chan_nr = lchan2chan_nr(lchan);
+ uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_SACCH_INFO_MODIFY);
@@ -303,7 +238,7 @@ int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg;
- u_int8_t chan_nr = lchan2chan_nr(lchan);
+ uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
db = abs(db);
if (db > 30)
@@ -330,7 +265,7 @@ int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg;
- u_int8_t chan_nr = lchan2chan_nr(lchan);
+ uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
int ctl_lvl;
ctl_lvl = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, dbm);
@@ -421,12 +356,12 @@ static int channel_mode_from_lchan(struct rsl_ie_chan_mode *cm,
/* Chapter 8.4.1 */
#if 0
-int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr,
- u_int8_t act_type,
+int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr,
+ uint8_t act_type,
struct rsl_ie_chan_mode *chan_mode,
struct rsl_ie_chan_ident *chan_ident,
- u_int8_t bs_power, u_int8_t ms_power,
- u_int8_t ta)
+ uint8_t bs_power, uint8_t ms_power,
+ uint8_t ta)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg = rsl_msgb_alloc();
@@ -438,12 +373,12 @@ int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr,
msgb_tv_put(msg, RSL_IE_ACT_TYPE, act_type);
/* For compatibility with Phase 1 */
msgb_tlv_put(msg, RSL_IE_CHAN_MODE, sizeof(*chan_mode),
- (u_int8_t *) chan_mode);
+ (uint8_t *) chan_mode);
msgb_tlv_put(msg, RSL_IE_CHAN_IDENT, 4,
- (u_int8_t *) chan_ident);
+ (uint8_t *) chan_ident);
#if 0
msgb_tlv_put(msg, RSL_IE_ENCR_INFO, 1,
- (u_int8_t *) &encr_info);
+ (uint8_t *) &encr_info);
#endif
msgb_tv_put(msg, RSL_IE_BS_POWER, bs_power);
msgb_tv_put(msg, RSL_IE_MS_POWER, ms_power);
@@ -455,15 +390,15 @@ int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr,
}
#endif
-int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
- u_int8_t ta, u_int8_t ho_ref)
+int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
+ uint8_t ta, uint8_t ho_ref)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg;
int rc;
uint8_t *len;
- u_int8_t chan_nr = lchan2chan_nr(lchan);
+ uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
struct rsl_ie_chan_mode cm;
struct gsm48_chan_desc cd;
@@ -481,7 +416,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
msgb_tv_put(msg, RSL_IE_ACT_TYPE, act_type);
msgb_tlv_put(msg, RSL_IE_CHAN_MODE, sizeof(cm),
- (u_int8_t *) &cm);
+ (uint8_t *) &cm);
/*
* The Channel Identification is needed for Phase1 phones
@@ -505,7 +440,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
*len = msgb_l3len(msg);
if (lchan->encr.alg_id > RSL_ENC_ALG_A5(0)) {
- u_int8_t encr_info[MAX_A5_KEY_LEN+2];
+ uint8_t encr_info[MAX_A5_KEY_LEN+2];
rc = build_encr_info(encr_info, lchan);
if (rc > 0)
msgb_tlv_put(msg, RSL_IE_ENCR_INFO, rc, encr_info);
@@ -526,7 +461,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR)
msgb_tlv_put(msg, RSL_IE_MR_CONFIG, sizeof(lchan->mr_conf),
- (u_int8_t *) &lchan->mr_conf);
+ (uint8_t *) &lchan->mr_conf);
msg->trx = lchan->ts->trx;
@@ -540,7 +475,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
struct msgb *msg;
int rc;
- u_int8_t chan_nr = lchan2chan_nr(lchan);
+ uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
struct rsl_ie_chan_mode cm;
rc = channel_mode_from_lchan(&cm, lchan);
@@ -553,10 +488,10 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
dh->chan_nr = chan_nr;
msgb_tlv_put(msg, RSL_IE_CHAN_MODE, sizeof(cm),
- (u_int8_t *) &cm);
+ (uint8_t *) &cm);
if (lchan->encr.alg_id > RSL_ENC_ALG_A5(0)) {
- u_int8_t encr_info[MAX_A5_KEY_LEN+2];
+ uint8_t encr_info[MAX_A5_KEY_LEN+2];
rc = build_encr_info(encr_info, lchan);
if (rc > 0)
msgb_tlv_put(msg, RSL_IE_ENCR_INFO, rc, encr_info);
@@ -564,7 +499,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) {
msgb_tlv_put(msg, RSL_IE_MR_CONFIG, sizeof(lchan->mr_conf),
- (u_int8_t *) &lchan->mr_conf);
+ (uint8_t *) &lchan->mr_conf);
}
msg->trx = lchan->ts->trx;
@@ -577,9 +512,9 @@ int rsl_encryption_cmd(struct msgb *msg)
{
struct abis_rsl_dchan_hdr *dh;
struct gsm_lchan *lchan = msg->lchan;
- u_int8_t chan_nr = lchan2chan_nr(lchan);
- u_int8_t encr_info[MAX_A5_KEY_LEN+2];
- u_int8_t l3_len = msg->len;
+ uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
+ uint8_t encr_info[MAX_A5_KEY_LEN+2];
+ uint8_t l3_len = msg->len;
int rc;
/* First push the L3 IE tag and length */
@@ -612,7 +547,7 @@ int rsl_deact_sacch(struct gsm_lchan *lchan)
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_DEACTIVATE_SACCH);
- dh->chan_nr = lchan2chan_nr(lchan);
+ dh->chan_nr = gsm_lchan2chan_nr(lchan);
msg->lchan = lchan;
msg->trx = lchan->ts->trx;
@@ -654,7 +589,7 @@ static int rsl_rf_chan_release(struct gsm_lchan *lchan, int error)
msg = rsl_msgb_alloc();
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_RF_CHAN_REL);
- dh->chan_nr = lchan2chan_nr(lchan);
+ dh->chan_nr = gsm_lchan2chan_nr(lchan);
msg->lchan = lchan;
msg->trx = lchan->ts->trx;
@@ -670,7 +605,7 @@ static int rsl_rf_chan_release(struct gsm_lchan *lchan, int error)
rsl_lchan_set_state(lchan, LCHAN_S_REL_ERR);
lchan->error_timer.data = lchan;
lchan->error_timer.cb = error_timeout_cb;
- bsc_schedule_timer(&lchan->error_timer,
+ osmo_timer_schedule(&lchan->error_timer,
msg->trx->bts->network->T3111 + 2, 0);
}
@@ -695,7 +630,7 @@ static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan)
LOGP(DRSL, LOGL_NOTICE, "%s CHAN REL ACK but state %s\n",
gsm_lchan_name(lchan),
gsm_lchans_name(lchan->state));
- bsc_del_timer(&lchan->T3111);
+ osmo_timer_del(&lchan->T3111);
/* we have an error timer pending to release that */
if (lchan->state != LCHAN_S_REL_ERR)
rsl_lchan_set_state(lchan, LCHAN_S_NONE);
@@ -704,8 +639,8 @@ static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan)
return 0;
}
-int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len,
- u_int8_t *ms_ident, u_int8_t chan_needed)
+int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len,
+ uint8_t *ms_ident, uint8_t chan_needed)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg = rsl_msgb_alloc();
@@ -723,7 +658,7 @@ int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len,
return abis_rsl_sendmsg(msg);
}
-int imsi_str2bcd(u_int8_t *bcd_out, const char *str_in)
+int imsi_str2bcd(uint8_t *bcd_out, const char *str_in)
{
int i, len = strlen(str_in);
@@ -741,11 +676,11 @@ int imsi_str2bcd(u_int8_t *bcd_out, const char *str_in)
}
/* Chapter 8.5.6 */
-int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val)
+int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val)
{
struct msgb *msg = rsl_msgb_alloc();
struct abis_rsl_dchan_hdr *dh;
- u_int8_t buf[MACBLOCK_SIZE];
+ uint8_t buf[MACBLOCK_SIZE];
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_IMMEDIATE_ASSIGN_CMD);
@@ -776,11 +711,11 @@ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci)
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_SIEMENS_MRPCI);
dh->c.msg_discr = ABIS_RSL_MDISC_DED_CHAN;
- dh->chan_nr = lchan2chan_nr(lchan);
- msgb_tv_put(msg, RSL_IE_SIEMENS_MRPCI, *(u_int8_t *)mrpci);
+ dh->chan_nr = gsm_lchan2chan_nr(lchan);
+ msgb_tv_put(msg, RSL_IE_SIEMENS_MRPCI, *(uint8_t *)mrpci);
DEBUGP(DRSL, "%s TX Siemens MRPCI 0x%02x\n",
- gsm_lchan_name(lchan), *(u_int8_t *)mrpci);
+ gsm_lchan_name(lchan), *(uint8_t *)mrpci);
msg->trx = lchan->ts->trx;
@@ -790,14 +725,14 @@ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci)
/* Send "DATA REQUEST" message with given L3 Info payload */
/* Chapter 8.3.1 */
-int rsl_data_request(struct msgb *msg, u_int8_t link_id)
+int rsl_data_request(struct msgb *msg, uint8_t link_id)
{
if (msg->lchan == NULL) {
LOGP(DRSL, LOGL_ERROR, "cannot send DATA REQUEST to unknown lchan\n");
return -EINVAL;
}
- rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, lchan2chan_nr(msg->lchan),
+ rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, gsm_lchan2chan_nr(msg->lchan),
link_id, 1);
msg->trx = msg->lchan->ts->trx;
@@ -807,11 +742,11 @@ int rsl_data_request(struct msgb *msg, u_int8_t link_id)
/* Send "ESTABLISH REQUEST" message with given L3 Info payload */
/* Chapter 8.3.1 */
-int rsl_establish_request(struct gsm_lchan *lchan, u_int8_t link_id)
+int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id)
{
struct msgb *msg;
- msg = rsl_rll_simple(RSL_MT_EST_REQ, lchan2chan_nr(lchan),
+ msg = rsl_rll_simple(RSL_MT_EST_REQ, gsm_lchan2chan_nr(lchan),
link_id, 0);
msg->trx = lchan->ts->trx;
@@ -823,12 +758,12 @@ int rsl_establish_request(struct gsm_lchan *lchan, u_int8_t link_id)
RELEASE CONFIRM, which we in turn use to trigger RSL CHANNEL RELEASE,
which in turn is acknowledged by RSL CHANNEL RELEASE ACK, which calls
lchan_free() */
-int rsl_release_request(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t reason)
+int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason)
{
struct msgb *msg;
- msg = rsl_rll_simple(RSL_MT_REL_REQ, lchan2chan_nr(lchan),
+ msg = rsl_rll_simple(RSL_MT_REL_REQ, gsm_lchan2chan_nr(lchan),
link_id, 0);
/* 0 is normal release, 1 is local end */
msgb_tv_put(msg, RSL_IE_RELEASE_MODE, reason);
@@ -889,7 +824,7 @@ static int rsl_rx_chan_act_nack(struct msgb *msg)
rsl_tlv_parse(&tp, dh->data, msgb_l2len(msg)-sizeof(*dh));
if (TLVP_PRESENT(&tp, RSL_IE_CAUSE)) {
- const u_int8_t *cause = TLVP_VAL(&tp, RSL_IE_CAUSE);
+ const uint8_t *cause = TLVP_VAL(&tp, RSL_IE_CAUSE);
print_rsl_cause(LOGL_ERROR, cause,
TLVP_LEN(&tp, RSL_IE_CAUSE));
if (*cause != RSL_ERR_RCH_ALR_ACTV_ALLOC)
@@ -923,7 +858,7 @@ static int rsl_rx_conn_fail(struct msgb *msg)
LOGPC(DRSL, LOGL_NOTICE, "\n");
/* FIXME: only free it after channel release ACK */
- counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rf_fail);
+ osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rf_fail);
return rsl_rf_chan_release(msg->lchan, 1);
}
@@ -982,8 +917,8 @@ static int rsl_rx_meas_res(struct msgb *msg)
struct abis_rsl_dchan_hdr *dh = msgb_l2(msg);
struct tlv_parsed tp;
struct gsm_meas_rep *mr = lchan_next_meas_rep(msg->lchan);
- u_int8_t len;
- const u_int8_t *val;
+ uint8_t len;
+ const uint8_t *val;
int rc;
/* check if this channel is actually active */
@@ -1034,7 +969,7 @@ static int rsl_rx_meas_res(struct msgb *msg)
mr->ms_l1.ta = val[1];
}
if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
- msg->l3h = (u_int8_t *) TLVP_VAL(&tp, RSL_IE_L3_INFO);
+ msg->l3h = (uint8_t *) TLVP_VAL(&tp, RSL_IE_L3_INFO);
rc = gsm48_parse_meas_rep(mr, msg);
if (rc < 0)
return rc;
@@ -1247,11 +1182,11 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
enum gsm_chan_t lctype;
enum gsm_chreq_reason_t chreq_reason;
struct gsm_lchan *lchan;
- u_int8_t rqd_ta;
+ uint8_t rqd_ta;
int is_lu;
- u_int16_t arfcn;
- u_int8_t ts_number, subch;
+ uint16_t arfcn;
+ uint8_t ts_number, subch;
/* parse request reference to be used in immediate assign */
if (rqd_hdr->data[0] != RSL_IE_REQ_REFERENCE)
@@ -1269,7 +1204,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
lctype = get_ctype_by_chreq(bts->network, rqd_ref->ra);
chreq_reason = get_reason_by_chreq(rqd_ref->ra, bts->network->neci);
- counter_inc(bts->network->stats.chreq.total);
+ osmo_counter_inc(bts->network->stats.chreq.total);
/*
* We want LOCATION UPDATES to succeed and will assign a TCH
@@ -1282,7 +1217,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
if (!lchan) {
LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: no resources for %s 0x%x\n",
msg->lchan->ts->trx->bts->nr, gsm_lchant_name(lctype), rqd_ref->ra);
- counter_inc(bts->network->stats.chreq.no_channel);
+ osmo_counter_inc(bts->network->stats.chreq.no_channel);
/* FIXME gather multiple CHAN RQD and reject up to 4 at the same time */
if (bts->network->T3122)
rsl_send_imm_ass_rej(bts, 1, rqd_ref, bts->network->T3122 & 0xff);
@@ -1329,7 +1264,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
static int rsl_send_imm_assignment(struct gsm_lchan *lchan)
{
struct gsm_bts *bts = lchan->ts->trx->bts;
- u_int8_t buf[GSM_MACBLOCK_LEN];
+ uint8_t buf[GSM_MACBLOCK_LEN];
struct gsm48_imm_ass *ia = (struct gsm48_imm_ass *) buf;
/* create IMMEDIATE ASSIGN 04.08 messge */
@@ -1355,20 +1290,20 @@ static int rsl_send_imm_assignment(struct gsm_lchan *lchan)
/* Start timer T3101 to wait for GSM48_MT_RR_PAG_RESP */
lchan->T3101.cb = t3101_expired;
lchan->T3101.data = lchan;
- bsc_schedule_timer(&lchan->T3101, bts->network->T3101, 0);
+ osmo_timer_schedule(&lchan->T3101, bts->network->T3101, 0);
/* send IMMEDIATE ASSIGN CMD on RSL to BTS (to send on CCCH to MS) */
- return rsl_imm_assign_cmd(bts, sizeof(*ia)+ia->mob_alloc_len, (u_int8_t *) ia);
+ return rsl_imm_assign_cmd(bts, sizeof(*ia)+ia->mob_alloc_len, (uint8_t *) ia);
}
/* MS has requested a channel on the RACH */
static int rsl_rx_ccch_load(struct msgb *msg)
{
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
- u_int16_t pg_buf_space;
- u_int16_t rach_slot_count = -1;
- u_int16_t rach_busy_count = -1;
- u_int16_t rach_access_count = -1;
+ uint16_t pg_buf_space;
+ uint16_t rach_slot_count = -1;
+ uint16_t rach_busy_count = -1;
+ uint16_t rach_access_count = -1;
switch (rslh->data[0]) {
case RSL_IE_PAGING_LOAD:
@@ -1428,7 +1363,7 @@ static int abis_rsl_rx_cchan(struct msgb *msg)
static int rsl_rx_rll_err_ind(struct msgb *msg)
{
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- u_int8_t *rlm_cause = rllh->data;
+ uint8_t *rlm_cause = rllh->data;
LOGP(DRLL, LOGL_ERROR, "%s ERROR INDICATION cause=%s\n",
gsm_lchan_name(msg->lchan),
@@ -1437,7 +1372,7 @@ static int rsl_rx_rll_err_ind(struct msgb *msg)
rll_indication(msg->lchan, rllh->link_id, BSC_RLLR_IND_ERR_IND);
if (rlm_cause[1] == RLL_CAUSE_T200_EXPIRED) {
- counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rll_err);
+ osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rll_err);
return rsl_rf_chan_release(msg->lchan, 1);
}
@@ -1467,7 +1402,7 @@ static void rsl_handle_release(struct gsm_lchan *lchan)
lchan->T3111.cb = t3111_expired;
lchan->T3111.data = lchan;
bts = lchan->ts->trx->bts;
- bsc_schedule_timer(&lchan->T3111, bts->network->T3111, 0);
+ osmo_timer_schedule(&lchan->T3111, bts->network->T3111, 0);
}
/* ESTABLISH INDICATION, LOCATION AREA UPDATE REQUEST
@@ -1481,7 +1416,7 @@ static int abis_rsl_rx_rll(struct msgb *msg)
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
int rc = 0;
char *ts_name;
- u_int8_t sapi = rllh->link_id & 7;
+ uint8_t sapi = rllh->link_id & 7;
msg->lchan = lchan_lookup(msg->trx, rllh->chan_nr);
ts_name = gsm_lchan_name(msg->lchan);
@@ -1501,7 +1436,7 @@ static int abis_rsl_rx_rll(struct msgb *msg)
DEBUGPC(DRLL, "ESTABLISH INDICATION\n");
/* lchan is established, stop T3101 */
msg->lchan->sapis[rllh->link_id & 0x7] = LCHAN_SAPI_MS;
- bsc_del_timer(&msg->lchan->T3101);
+ osmo_timer_del(&msg->lchan->T3101);
if (msgb_l2len(msg) >
sizeof(struct abis_rsl_common_hdr) + sizeof(*rllh) &&
rllh->data[0] == RSL_IE_L3_INFO) {
@@ -1546,7 +1481,7 @@ static int abis_rsl_rx_rll(struct msgb *msg)
return rc;
}
-static u_int8_t ipa_smod_s_for_lchan(struct gsm_lchan *lchan)
+static uint8_t ipa_smod_s_for_lchan(struct gsm_lchan *lchan)
{
switch (lchan->tch_mode) {
case GSM48_CMODE_SPEECH_V1:
@@ -1583,7 +1518,7 @@ static u_int8_t ipa_smod_s_for_lchan(struct gsm_lchan *lchan)
return 0;
}
-static u_int8_t ipa_rtp_pt_for_lchan(struct gsm_lchan *lchan)
+static uint8_t ipa_rtp_pt_for_lchan(struct gsm_lchan *lchan)
{
struct gsm_network *net = lchan->ts->trx->bts->network;
@@ -1631,23 +1566,23 @@ static u_int8_t ipa_rtp_pt_for_lchan(struct gsm_lchan *lchan)
static void ipac_parse_rtp(struct gsm_lchan *lchan, struct tlv_parsed *tv)
{
struct in_addr ip;
- u_int16_t port, conn_id;
+ uint16_t port, conn_id;
if (TLVP_PRESENT(tv, RSL_IE_IPAC_LOCAL_IP)) {
- ip.s_addr = *((u_int32_t *) TLVP_VAL(tv, RSL_IE_IPAC_LOCAL_IP));
+ ip.s_addr = *((uint32_t *) TLVP_VAL(tv, RSL_IE_IPAC_LOCAL_IP));
DEBUGPC(DRSL, "LOCAL_IP=%s ", inet_ntoa(ip));
lchan->abis_ip.bound_ip = ntohl(ip.s_addr);
}
if (TLVP_PRESENT(tv, RSL_IE_IPAC_LOCAL_PORT)) {
- port = *((u_int16_t *) TLVP_VAL(tv, RSL_IE_IPAC_LOCAL_PORT));
+ port = *((uint16_t *) TLVP_VAL(tv, RSL_IE_IPAC_LOCAL_PORT));
port = ntohs(port);
DEBUGPC(DRSL, "LOCAL_PORT=%u ", port);
lchan->abis_ip.bound_port = port;
}
if (TLVP_PRESENT(tv, RSL_IE_IPAC_CONN_ID)) {
- conn_id = *((u_int16_t *) TLVP_VAL(tv, RSL_IE_IPAC_CONN_ID));
+ conn_id = *((uint16_t *) TLVP_VAL(tv, RSL_IE_IPAC_CONN_ID));
conn_id = ntohs(conn_id);
DEBUGPC(DRSL, "CON_ID=%u ", conn_id);
lchan->abis_ip.conn_id = conn_id;
@@ -1668,13 +1603,13 @@ static void ipac_parse_rtp(struct gsm_lchan *lchan, struct tlv_parsed *tv)
}
if (TLVP_PRESENT(tv, RSL_IE_IPAC_REMOTE_IP)) {
- ip.s_addr = *((u_int32_t *) TLVP_VAL(tv, RSL_IE_IPAC_REMOTE_IP));
+ ip.s_addr = *((uint32_t *) TLVP_VAL(tv, RSL_IE_IPAC_REMOTE_IP));
DEBUGPC(DRSL, "REMOTE_IP=%s ", inet_ntoa(ip));
lchan->abis_ip.connect_ip = ntohl(ip.s_addr);
}
if (TLVP_PRESENT(tv, RSL_IE_IPAC_REMOTE_PORT)) {
- port = *((u_int16_t *) TLVP_VAL(tv, RSL_IE_IPAC_REMOTE_PORT));
+ port = *((uint16_t *) TLVP_VAL(tv, RSL_IE_IPAC_REMOTE_PORT));
port = ntohs(port);
DEBUGPC(DRSL, "REMOTE_PORT=%u ", port);
lchan->abis_ip.connect_port = port;
@@ -1689,7 +1624,7 @@ int rsl_ipacc_crcx(struct gsm_lchan *lchan)
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_IPAC_CRCX);
dh->c.msg_discr = ABIS_RSL_MDISC_IPACCESS;
- dh->chan_nr = lchan2chan_nr(lchan);
+ dh->chan_nr = gsm_lchan2chan_nr(lchan);
/* 0x1- == receive-only, 0x-1 == EFR codec */
lchan->abis_ip.speech_mode = 0x10 | ipa_smod_s_for_lchan(lchan);
@@ -1706,18 +1641,18 @@ int rsl_ipacc_crcx(struct gsm_lchan *lchan)
return abis_rsl_sendmsg(msg);
}
-int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip, u_int16_t port,
- u_int8_t rtp_payload2)
+int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip, uint16_t port,
+ uint8_t rtp_payload2)
{
struct msgb *msg = rsl_msgb_alloc();
struct abis_rsl_dchan_hdr *dh;
- u_int32_t *att_ip;
+ uint32_t *att_ip;
struct in_addr ia;
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_IPAC_MDCX);
dh->c.msg_discr = ABIS_RSL_MDISC_IPACCESS;
- dh->chan_nr = lchan2chan_nr(lchan);
+ dh->chan_nr = gsm_lchan2chan_nr(lchan);
/* we need to store these now as MDCX_ACK does not return them :( */
lchan->abis_ip.rtp_payload2 = rtp_payload2;
@@ -1736,7 +1671,7 @@ int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip, u_int16_t port,
msgb_tv16_put(msg, RSL_IE_IPAC_CONN_ID, lchan->abis_ip.conn_id);
msgb_v_put(msg, RSL_IE_IPAC_REMOTE_IP);
- att_ip = (u_int32_t *) msgb_put(msg, sizeof(ip));
+ att_ip = (uint32_t *) msgb_put(msg, sizeof(ip));
*att_ip = ia.s_addr;
msgb_tv16_put(msg, RSL_IE_IPAC_REMOTE_PORT, port);
msgb_tv_put(msg, RSL_IE_IPAC_SPEECH_MODE, lchan->abis_ip.speech_mode);
@@ -1767,7 +1702,7 @@ int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act)
{
struct msgb *msg = rsl_msgb_alloc();
struct abis_rsl_dchan_hdr *dh;
- u_int8_t msg_type;
+ uint8_t msg_type;
if (act)
msg_type = RSL_MT_IPAC_PDCH_ACT;
@@ -1777,7 +1712,7 @@ int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act)
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, msg_type);
dh->c.msg_discr = ABIS_RSL_MDISC_DED_CHAN;
- dh->chan_nr = ts2chan_nr(ts, 0);
+ dh->chan_nr = gsm_ts2chan_nr(ts, 0);
DEBUGP(DRSL, "%s IPAC_PDCH_%sACT\n", gsm_ts_name(ts),
act ? "" : "DE");
@@ -1807,7 +1742,7 @@ static int abis_rsl_rx_ipacc_crcx_ack(struct msgb *msg)
ipac_parse_rtp(lchan, &tv);
- dispatch_signal(SS_ABISIP, S_ABISIP_CRCX_ACK, msg->lchan);
+ osmo_signal_dispatch(SS_ABISIP, S_ABISIP_CRCX_ACK, msg->lchan);
return 0;
}
@@ -1824,7 +1759,7 @@ static int abis_rsl_rx_ipacc_mdcx_ack(struct msgb *msg)
rsl_tlv_parse(&tv, dh->data, msgb_l2len(msg)-sizeof(*dh));
ipac_parse_rtp(lchan, &tv);
- dispatch_signal(SS_ABISIP, S_ABISIP_MDCX_ACK, msg->lchan);
+ osmo_signal_dispatch(SS_ABISIP, S_ABISIP_MDCX_ACK, msg->lchan);
return 0;
}
@@ -1840,7 +1775,7 @@ static int abis_rsl_rx_ipacc_dlcx_ind(struct msgb *msg)
print_rsl_cause(LOGL_DEBUG, TLVP_VAL(&tv, RSL_IE_CAUSE),
TLVP_LEN(&tv, RSL_IE_CAUSE));
- dispatch_signal(SS_ABISIP, S_ABISIP_DLCX_IND, msg->lchan);
+ osmo_signal_dispatch(SS_ABISIP, S_ABISIP_DLCX_IND, msg->lchan);
return 0;
}
@@ -1936,18 +1871,6 @@ int abis_rsl_rcvmsg(struct msgb *msg)
return rc;
}
-/* From Table 10.5.33 of GSM 04.08 */
-int rsl_number_of_paging_subchannels(struct gsm_bts *bts)
-{
- if (bts->si_common.chan_desc.ccch_conf == RSL_BCCH_CCCH_CONF_1_C) {
- return MAX(1, (3 - bts->si_common.chan_desc.bs_ag_blks_res))
- * (bts->si_common.chan_desc.bs_pa_mfrms + 2);
- } else {
- return (9 - bts->si_common.chan_desc.bs_ag_blks_res)
- * (bts->si_common.chan_desc.bs_pa_mfrms + 2);
- }
-}
-
int rsl_sms_cb_command(struct gsm_bts *bts, uint8_t chan_number,
uint8_t cb_command, const uint8_t *data, int len)
{
diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c
index 0f09aecd..70d64139 100644
--- a/src/libbsc/bsc_api.c
+++ b/src/libbsc/bsc_api.c
@@ -32,9 +32,9 @@
#include <openbsc/debug.h>
#include <openbsc/gsm_04_08.h>
-#include <osmocore/protocol/gsm_08_08.h>
+#include <osmocom/gsm/protocol/gsm_08_08.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#define GSM0808_T10_VALUE 6, 0
@@ -47,9 +47,9 @@ static void handle_chan_ack(struct gsm_subscriber_connection *conn, struct bsc_a
static void handle_chan_nack(struct gsm_subscriber_connection *conn, struct bsc_api *bsc, struct gsm_lchan *lchan);
/* GSM 08.08 3.2.2.33 */
-static u_int8_t lchan_to_chosen_channel(struct gsm_lchan *lchan)
+static uint8_t lchan_to_chosen_channel(struct gsm_lchan *lchan)
{
- u_int8_t channel_mode = 0, channel = 0;
+ uint8_t channel_mode = 0, channel = 0;
switch (lchan->tch_mode) {
case GSM48_CMODE_SPEECH_V1:
@@ -95,7 +95,7 @@ static u_int8_t lchan_to_chosen_channel(struct gsm_lchan *lchan)
return channel_mode << 4 | channel;
}
-static u_int8_t chan_mode_to_speech(struct gsm_lchan *lchan)
+static uint8_t chan_mode_to_speech(struct gsm_lchan *lchan)
{
int mode = 0;
@@ -325,7 +325,7 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
/* we will now start the timer to complete the assignment */
conn->T10.cb = assignment_t10_timeout;
conn->T10.data = conn;
- bsc_schedule_timer(&conn->T10, GSM0808_T10_VALUE);
+ osmo_timer_schedule(&conn->T10, GSM0808_T10_VALUE);
return 0;
error:
@@ -358,7 +358,7 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn,
}
/* swap channels */
- bsc_del_timer(&conn->T10);
+ osmo_timer_del(&conn->T10);
lchan_release(conn->lchan, 0, 1);
conn->lchan = conn->secondary_lchan;
@@ -387,7 +387,7 @@ static void handle_ass_fail(struct gsm_subscriber_connection *conn,
}
/* stop the timer and release it */
- bsc_del_timer(&conn->T10);
+ osmo_timer_del(&conn->T10);
lchan_release(conn->secondary_lchan, 0, 1);
conn->secondary_lchan = NULL;
@@ -435,7 +435,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
handle_ass_fail(conn, msg);
break;
case GSM48_MT_RR_CHAN_MODE_MODIF_ACK:
- bsc_del_timer(&conn->T10);
+ osmo_timer_del(&conn->T10);
rc = gsm48_rx_rr_modif_ack(msg);
if (rc < 0 && api->assign_fail) {
api->assign_fail(conn,
@@ -536,7 +536,7 @@ int gsm0808_clear(struct gsm_subscriber_connection *conn)
conn->ho_lchan = NULL;
conn->bts = NULL;
- bsc_del_timer(&conn->T10);
+ osmo_timer_del(&conn->T10);
return 0;
}
@@ -621,7 +621,7 @@ static void handle_release(struct gsm_subscriber_connection *conn,
int destruct = 1;
if (conn->secondary_lchan == lchan) {
- bsc_del_timer(&conn->T10);
+ osmo_timer_del(&conn->T10);
conn->secondary_lchan = NULL;
bsc->assign_fail(conn,
@@ -671,5 +671,5 @@ static void handle_chan_nack(struct gsm_subscriber_connection *conn,
static __attribute__((constructor)) void on_dso_load_bsc(void)
{
- register_signal_handler(SS_LCHAN, bsc_handle_lchan_signal, NULL);
+ osmo_signal_register_handler(SS_LCHAN, bsc_handle_lchan_signal, NULL);
}
diff --git a/src/libbsc/bsc_init.c b/src/libbsc/bsc_init.c
index 0072bb6f..1be8cb7a 100644
--- a/src/libbsc/bsc_init.c
+++ b/src/libbsc/bsc_init.c
@@ -20,7 +20,7 @@
*/
#include <openbsc/gsm_data.h>
-#include <osmocore/gsm_utils.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/abis_nm.h>
@@ -31,13 +31,12 @@
#include <openbsc/paging.h>
#include <openbsc/signal.h>
#include <openbsc/chan_alloc.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/ipaccess.h>
/* global pointer to the gsm network data structure */
extern struct gsm_network *bsc_gsmnet;
-
-static void patch_nm_tables(struct gsm_bts *bts);
+extern int hsl_setup(struct gsm_network *gsmnet);
/* Callback function for NACK on the OML NM */
static int oml_msg_nack(struct nm_nack_signal_data *nack)
@@ -83,7 +82,7 @@ int bsc_shutdown_net(struct gsm_network *net)
llist_for_each_entry(bts, &net->bts_list, list) {
LOGP(DNM, LOGL_NOTICE, "shutting down OML for BTS %u\n", bts->nr);
- dispatch_signal(SS_GLOBAL, S_GLOBAL_BTS_CLOSE_OM, bts);
+ osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_BTS_CLOSE_OM, bts);
}
return 0;
@@ -102,8 +101,8 @@ static int generate_and_rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i
si_len = rc;
}
- DEBUGP(DRR, "SI%s: %s\n", gsm_sitype_name(i),
- hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN));
+ DEBUGP(DRR, "SI%s: %s\n", get_value_string(osmo_sitype_strs, i),
+ osmo_hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN));
switch (i) {
case SYSINFO_TYPE_5:
@@ -116,22 +115,22 @@ static int generate_and_rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i
/* This assumes a combined BCCH and TCH on TS1...7 */
for (j = 0; j < 4; j++)
rsl_sacch_info_modify(&trx->ts[0].lchan[j],
- gsm_sitype2rsl(i),
+ osmo_sitype2rsl(i),
GSM_BTS_SI(bts, i), si_len);
for (j = 1; j < 8; j++) {
rsl_sacch_info_modify(&trx->ts[j].lchan[0],
- gsm_sitype2rsl(i),
+ osmo_sitype2rsl(i),
GSM_BTS_SI(bts, i), si_len);
rsl_sacch_info_modify(&trx->ts[j].lchan[1],
- gsm_sitype2rsl(i),
+ osmo_sitype2rsl(i),
GSM_BTS_SI(bts, i), si_len);
}
} else
- rc = rsl_sacch_filling(trx, gsm_sitype2rsl(i),
+ rc = rsl_sacch_filling(trx, osmo_sitype2rsl(i),
GSM_BTS_SI(bts, i), rc);
break;
default:
- rc = rsl_bcch_info(trx, gsm_sitype2rsl(i),
+ rc = rsl_bcch_info(trx, osmo_sitype2rsl(i),
GSM_BTS_SI(bts, i), rc);
break;
}
@@ -276,9 +275,9 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
LOGP(DMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", isd->link_type, trx);
if (isd->link_type == E1INP_SIGN_OML)
- counter_inc(trx->bts->network->stats.bts.oml_fail);
+ osmo_counter_inc(trx->bts->network->stats.bts.oml_fail);
else if (isd->link_type == E1INP_SIGN_RSL)
- counter_inc(trx->bts->network->stats.bts.rsl_fail);
+ osmo_counter_inc(trx->bts->network->stats.bts.rsl_fail);
/*
* free all allocated channels. change the nm_state so the
@@ -293,15 +292,9 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
lchan_free(&ts->lchan[lchan_no]);
lchan_reset(&ts->lchan[lchan_no]);
}
-
- ts->nm_state.operational = 0;
- ts->nm_state.availability = 0;
}
- trx->nm_state.operational = 0;
- trx->nm_state.availability = 0;
- trx->bb_transc.nm_state.operational = 0;
- trx->bb_transc.nm_state.availability = 0;
+ gsm_bts_mo_reset(trx->bts);
abis_nm_clear_queue(trx->bts);
break;
@@ -316,6 +309,14 @@ static int bootstrap_bts(struct gsm_bts *bts)
{
int i, n;
+ if (bts->model->start && !bts->model->started) {
+ int ret = bts->model->start(bts->network);
+ if (ret < 0)
+ return ret;
+
+ bts->model->started = true;
+ }
+
/* FIXME: What about secondary TRX of a BTS? What about a BTS that has TRX
* in different bands? Why is 'band' a parameter of the BTS and not of the TRX? */
switch (bts->band) {
@@ -405,8 +406,6 @@ static int bootstrap_bts(struct gsm_bts *bts)
bts->si_common.ncc_permitted = 0xff;
- paging_init(bts);
-
return 0;
}
@@ -437,12 +436,15 @@ int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, struct msgb *),
if (rc < 0)
return rc;
- register_signal_handler(SS_NM, nm_sig_cb, NULL);
- register_signal_handler(SS_INPUT, inp_sig_cb, NULL);
+ osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL);
+ osmo_signal_register_handler(SS_INPUT, inp_sig_cb, NULL);
llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
rc = bootstrap_bts(bts);
-
+ if (rc < 0) {
+ LOGP(DNM, LOGL_FATAL, "Error bootstrapping BTS\n");
+ return rc;
+ }
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_HSL_FEMTO:
@@ -451,16 +453,10 @@ int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, struct msgb *),
rc = e1_reconfig_bts(bts);
break;
}
-
if (rc < 0) {
- fprintf(stderr, "Error in E1 input driver setup\n");
- exit (1);
+ LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");
+ return rc;
}
}
-
- /* initialize nanoBTS support omce */
- rc = ipaccess_setup(bsc_gsmnet);
- rc = hsl_setup(bsc_gsmnet);
-
return 0;
}
diff --git a/src/libbsc/bsc_msc.c b/src/libbsc/bsc_msc.c
index 508697ab..e9ffce39 100644
--- a/src/libbsc/bsc_msc.c
+++ b/src/libbsc/bsc_msc.c
@@ -23,8 +23,8 @@
#include <openbsc/debug.h>
#include <openbsc/ipaccess.h>
-#include <osmocore/write_queue.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/write_queue.h>
+#include <osmocom/core/talloc.h>
#include <arpa/inet.h>
#include <sys/socket.h>
@@ -36,13 +36,13 @@
static void connection_loss(struct bsc_msc_connection *con)
{
- struct bsc_fd *fd;
+ struct osmo_fd *fd;
fd = &con->write_queue.bfd;
close(fd->fd);
fd->fd = -1;
- fd->cb = write_queue_bfd_cb;
+ fd->cb = osmo_wqueue_bfd_cb;
fd->when = 0;
con->is_connected = 0;
@@ -59,12 +59,12 @@ static void msc_con_timeout(void *_con)
}
/* called in the case of a non blocking connect */
-static int msc_connection_connect(struct bsc_fd *fd, unsigned int what)
+static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
{
int rc;
int val;
struct bsc_msc_connection *con;
- struct write_queue *queue;
+ struct osmo_wqueue *queue;
socklen_t len = sizeof(val);
@@ -73,11 +73,11 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what)
return -1;
}
- queue = container_of(fd, struct write_queue, bfd);
+ queue = container_of(fd, struct osmo_wqueue, bfd);
con = container_of(queue, struct bsc_msc_connection, write_queue);
/* From here on we will either be connected or reconnect */
- bsc_del_timer(&con->timeout_timer);
+ osmo_timer_del(&con->timeout_timer);
/* check the socket state */
rc = getsockopt(fd->fd, SOL_SOCKET, SO_ERROR, &val, &len);
@@ -92,7 +92,7 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what)
/* go to full operation */
- fd->cb = write_queue_bfd_cb;
+ fd->cb = osmo_wqueue_bfd_cb;
fd->when = BSC_FD_READ | BSC_FD_EXCEPT;
con->is_connected = 1;
@@ -102,11 +102,11 @@ static int msc_connection_connect(struct bsc_fd *fd, unsigned int what)
return 0;
error:
- bsc_unregister_fd(fd);
+ osmo_fd_unregister(fd);
connection_loss(con);
return -1;
}
-static void setnonblocking(struct bsc_fd *fd)
+static void setnonblocking(struct osmo_fd *fd)
{
int flags;
@@ -130,11 +130,24 @@ static void setnonblocking(struct bsc_fd *fd)
int bsc_msc_connect(struct bsc_msc_connection *con)
{
- struct bsc_fd *fd;
+ struct bsc_msc_dest *dest;
+ struct osmo_fd *fd;
struct sockaddr_in sin;
int on = 1, ret;
- LOGP(DMSC, LOGL_NOTICE, "Attempting to connect MSC at %s:%d\n", con->ip, con->port);
+ if (llist_empty(con->dests)) {
+ LOGP(DMSC, LOGL_ERROR, "No MSC connections configured.\n");
+ connection_loss(con);
+ return -1;
+ }
+
+ /* move to the next connection */
+ dest = (struct bsc_msc_dest *) con->dests->next;
+ llist_del(&dest->list);
+ llist_add_tail(&dest->list, con->dests);
+
+ LOGP(DMSC, LOGL_NOTICE, "Attempting to connect MSC at %s:%d\n",
+ dest->ip, dest->port);
con->is_connected = 0;
@@ -152,15 +165,15 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
/* set the socket priority */
ret = setsockopt(fd->fd, IPPROTO_IP, IP_TOS,
- &con->prio, sizeof(con->prio));
+ &dest->dscp, sizeof(dest->dscp));
if (ret != 0)
- LOGP(DMSC, LOGL_ERROR, "Failed to set prio to %d. %s\n",
- con->prio, strerror(errno));
+ LOGP(DMSC, LOGL_ERROR, "Failed to set DSCP to %d. %s\n",
+ dest->dscp, strerror(errno));
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
- sin.sin_port = htons(con->port);
- inet_aton(con->ip, &sin.sin_addr);
+ sin.sin_port = htons(dest->port);
+ inet_aton(dest->ip, &sin.sin_addr);
setsockopt(fd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
ret = connect(fd->fd, (struct sockaddr *) &sin, sizeof(sin));
@@ -171,20 +184,20 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
fd->cb = msc_connection_connect;
con->timeout_timer.cb = msc_con_timeout;
con->timeout_timer.data = con;
- bsc_schedule_timer(&con->timeout_timer, 20, 0);
+ osmo_timer_schedule(&con->timeout_timer, 20, 0);
} else if (ret < 0) {
perror("Connection failed");
connection_loss(con);
return ret;
} else {
fd->when = BSC_FD_READ | BSC_FD_EXCEPT;
- fd->cb = write_queue_bfd_cb;
+ fd->cb = osmo_wqueue_bfd_cb;
con->is_connected = 1;
if (con->connected)
con->connected(con);
}
- ret = bsc_register_fd(fd);
+ ret = osmo_fd_register(fd);
if (ret < 0) {
perror("Registering the fd failed");
close(fd->fd);
@@ -194,7 +207,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
return ret;
}
-struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio)
+struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dests)
{
struct bsc_msc_connection *con;
@@ -204,20 +217,19 @@ struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio)
return NULL;
}
- con->ip = ip;
- con->port = port;
- con->prio = prio;
- write_queue_init(&con->write_queue, 100);
+ con->dests = dests;
+ con->write_queue.bfd.fd = -1;
+ osmo_wqueue_init(&con->write_queue, 100);
return con;
}
void bsc_msc_lost(struct bsc_msc_connection *con)
{
- write_queue_clear(&con->write_queue);
- bsc_del_timer(&con->timeout_timer);
+ osmo_wqueue_clear(&con->write_queue);
+ osmo_timer_del(&con->timeout_timer);
if (con->write_queue.bfd.fd >= 0)
- bsc_unregister_fd(&con->write_queue.bfd);
+ osmo_fd_unregister(&con->write_queue.bfd);
connection_loss(con);
}
@@ -234,7 +246,7 @@ void bsc_msc_schedule_connect(struct bsc_msc_connection *con)
LOGP(DMSC, LOGL_NOTICE, "Attempting to reconnect to the MSC.\n");
con->reconnect_timer.cb = reconnect_msc;
con->reconnect_timer.data = con;
- bsc_schedule_timer(&con->reconnect_timer, 5, 0);
+ osmo_timer_schedule(&con->reconnect_timer, 5, 0);
}
struct msgb *bsc_msc_id_get_resp(const char *token)
@@ -254,6 +266,6 @@ struct msgb *bsc_msc_id_get_resp(const char *token)
msg->l2h = msgb_v_put(msg, IPAC_MSGT_ID_RESP);
msgb_l16tv_put(msg, strlen(token) + 1,
- IPAC_IDTAG_UNITNAME, (u_int8_t *) token);
+ IPAC_IDTAG_UNITNAME, (uint8_t *) token);
return msg;
}
diff --git a/src/libbsc/bsc_rll.c b/src/libbsc/bsc_rll.c
index 722f3faf..d12aeeec 100644
--- a/src/libbsc/bsc_rll.c
+++ b/src/libbsc/bsc_rll.c
@@ -23,9 +23,9 @@
#include <errno.h>
#include <openbsc/debug.h>
-#include <osmocore/talloc.h>
-#include <osmocore/timer.h>
-#include <osmocore/linuxlist.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/linuxlist.h>
#include <openbsc/bsc_rll.h>
#include <openbsc/gsm_data.h>
#include <openbsc/chan_alloc.h>
@@ -34,12 +34,12 @@
struct bsc_rll_req {
struct llist_head list;
- struct timer_list timer;
+ struct osmo_timer_list timer;
struct gsm_lchan *lchan;
- u_int8_t link_id;
+ uint8_t link_id;
- void (*cb)(struct gsm_lchan *lchan, u_int8_t link_id,
+ void (*cb)(struct gsm_lchan *lchan, uint8_t link_id,
void *data, enum bsc_rllr_ind);
void *data;
};
@@ -64,13 +64,13 @@ static void timer_cb(void *_rllr)
}
/* establish a RLL connection with given SAPI / priority */
-int rll_establish(struct gsm_lchan *lchan, u_int8_t sapi,
- void (*cb)(struct gsm_lchan *, u_int8_t, void *,
+int rll_establish(struct gsm_lchan *lchan, uint8_t sapi,
+ void (*cb)(struct gsm_lchan *, uint8_t, void *,
enum bsc_rllr_ind),
void *data)
{
struct bsc_rll_req *rllr = talloc_zero(tall_bsc_ctx, struct bsc_rll_req);
- u_int8_t link_id;
+ uint8_t link_id;
if (!rllr)
return -ENOMEM;
@@ -92,7 +92,7 @@ int rll_establish(struct gsm_lchan *lchan, u_int8_t sapi,
rllr->timer.cb = &timer_cb;
rllr->timer.data = rllr;
- bsc_schedule_timer(&rllr->timer, 10, 0);
+ osmo_timer_schedule(&rllr->timer, 10, 0);
/* send the RSL RLL ESTablish REQuest */
return rsl_establish_request(rllr->lchan, rllr->link_id);
@@ -100,14 +100,14 @@ int rll_establish(struct gsm_lchan *lchan, u_int8_t sapi,
/* Called from RSL code in case we have received an indication regarding
* any RLL link */
-void rll_indication(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t type)
+void rll_indication(struct gsm_lchan *lchan, uint8_t link_id, uint8_t type)
{
struct bsc_rll_req *rllr, *rllr2;
llist_for_each_entry_safe(rllr, rllr2, &bsc_rll_reqs, list) {
if (rllr->lchan == lchan &&
(rllr->link_id & LINKID_MASK) == (link_id & LINKID_MASK)) {
- bsc_del_timer(&rllr->timer);
+ osmo_timer_del(&rllr->timer);
complete_rllr(rllr, type);
return;
}
@@ -127,7 +127,7 @@ static int rll_lchan_signal(unsigned int subsys, unsigned int signal,
llist_for_each_entry_safe(rllr, rllr2, &bsc_rll_reqs, list) {
if (rllr->lchan == challoc->lchan) {
- bsc_del_timer(&rllr->timer);
+ osmo_timer_del(&rllr->timer);
complete_rllr(rllr, BSC_RLLR_IND_ERR_IND);
}
}
@@ -137,5 +137,5 @@ static int rll_lchan_signal(unsigned int subsys, unsigned int signal,
static __attribute__((constructor)) void on_dso_load_rll(void)
{
- register_signal_handler(SS_CHALLOC, rll_lchan_signal, NULL);
+ osmo_signal_register_handler(SS_CHALLOC, rll_lchan_signal, NULL);
}
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index c0909db5..971cdf70 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -19,7 +19,6 @@
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/buffer.h>
@@ -29,17 +28,18 @@
#include <arpa/inet.h>
-#include <osmocore/linuxlist.h>
+#include <osmocom/core/linuxlist.h>
#include <openbsc/gsm_data.h>
#include <openbsc/e1_input.h>
#include <openbsc/abis_nm.h>
#include <openbsc/abis_om2000.h>
-#include <osmocore/utils.h>
-#include <osmocore/gsm_utils.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/gsm/abis_nm.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/meas_rep.h>
#include <openbsc/db.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/vty.h>
#include <openbsc/gprs_ns.h>
#include <openbsc/system_information.h>
@@ -133,8 +133,8 @@ static int dummy_config_write(struct vty *v)
static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
{
vty_out(vty,"Oper '%s', Admin %u, Avail '%s'%s",
- nm_opstate_name(nms->operational), nms->administrative,
- nm_avail_name(nms->availability), VTY_NEWLINE);
+ abis_nm_opstate_name(nms->operational), nms->administrative,
+ abis_nm_avail_name(nms->availability), VTY_NEWLINE);
}
static void dump_pchan_load_vty(struct vty *vty, char *prefix,
@@ -189,7 +189,7 @@ static void net_dump_vty(struct vty *vty, struct gsm_network *net)
dump_pchan_load_vty(vty, " ", &pl);
/* show rf */
- if (net->msc_data)
+ if (net->msc_data && net->msc_data->rf_ctl)
vty_out(vty, " Last RF Command: %s%s",
net->msc_data->rf_ctl->last_state_command,
VTY_NEWLINE);
@@ -256,10 +256,11 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
else if (bts->type == GSM_BTS_TYPE_HSL_FEMTO)
vty_out(vty, " Serial Number: %lu%s", bts->hsl.serno, VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &bts->nm_state);
+ net_dump_nmstate(vty, &bts->mo.nm_state);
vty_out(vty, " Site Mgr NM State: ");
- net_dump_nmstate(vty, &bts->site_mgr.nm_state);
- vty_out(vty, " Paging: FIXME pending requests, %u free slots%s",
+ net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
+ vty_out(vty, " Paging: %u pending requests, %u free slots%s",
+ paging_pending_requests_nr(bts),
bts->paging.available_slots, VTY_NEWLINE);
if (is_ipaccess_bts(bts)) {
vty_out(vty, " OML Link state: %s.%s",
@@ -332,6 +333,8 @@ static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link
static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
{
vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
+ if (ts->tsc != -1 && ts->tsc != ts->trx->bts->tsc)
+ vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE);
if (ts->pchan != GSM_PCHAN_NONE)
vty_out(vty, " phys_chan_config %s%s",
gsm_pchan_name(ts->pchan), VTY_NEWLINE);
@@ -365,7 +368,7 @@ static void config_write_trx_single(struct vty *vty, struct gsm_bts_trx *trx)
vty_out(vty, " description %s%s", trx->description,
VTY_NEWLINE);
vty_out(vty, " rf_locked %u%s",
- trx->nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
+ trx->mo.nm_state.administrative == NM_STATE_LOCKED ? 1 : 0,
VTY_NEWLINE);
vty_out(vty, " arfcn %u%s", trx->arfcn, VTY_NEWLINE);
vty_out(vty, " nominal power %u%s", trx->nominal_power, VTY_NEWLINE);
@@ -495,7 +498,7 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
get_value_string(osmo_sitype_strs, i), VTY_NEWLINE);
vty_out(vty, " system-information %s static %s%s",
get_value_string(osmo_sitype_strs, i),
- hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
+ osmo_osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])),
VTY_NEWLINE);
}
}
@@ -616,9 +619,9 @@ static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
trx->nominal_power, trx->max_power_red,
trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &trx->nm_state);
+ net_dump_nmstate(vty, &trx->mo.nm_state);
vty_out(vty, " Baseband Transceiver NM State: ");
- net_dump_nmstate(vty, &trx->bb_transc.nm_state);
+ net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
if (is_ipaccess_bts(trx->bts)) {
vty_out(vty, " ip.access stream ID: 0x%02x%s",
trx->rsl_tei, VTY_NEWLINE);
@@ -684,15 +687,15 @@ DEFUN(show_trx,
static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
{
- vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s",
+ vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u",
ts->trx->bts->nr, ts->trx->nr, ts->nr,
- gsm_pchan_name(ts->pchan));
+ gsm_pchan_name(ts->pchan), ts->tsc);
if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
vty_out(vty, " (%s mode)",
ts->flags & TS_F_PDCH_MODE ? "PDCH" : "TCH/F");
vty_out(vty, "%s", VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &ts->nm_state);
+ net_dump_nmstate(vty, &ts->mo.nm_state);
if (!is_ipaccess_bts(ts->trx->bts))
vty_out(vty, " E1 Line %u, Timeslot %u, Subslot %u%s",
ts->e1_link.e1_nr, ts->e1_link.e1_ts,
@@ -1439,8 +1442,8 @@ DEFUN(cfg_bts,
return CMD_WARNING;
} else if (bts_nr == gsmnet->num_bts) {
/* allocate a new one */
- bts = gsm_bts_alloc(gsmnet, GSM_BTS_TYPE_UNKNOWN,
- HARDCODED_TSC, HARDCODED_BSIC);
+ bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
+ HARDCODED_TSC, HARDCODED_BSIC);
} else
bts = gsm_bts_num(gsmnet, bts_nr);
@@ -2171,7 +2174,7 @@ DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd,
memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type]));
/* Parse the user-specified SI in hex format, [partially] overwriting padding */
- rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
+ rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0]));
if (rc < 0 || rc > sizeof(bts->si_buf[0])) {
vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -2427,6 +2430,18 @@ DEFUN(cfg_ts_pchan,
return CMD_SUCCESS;
}
+DEFUN(cfg_ts_tsc,
+ cfg_ts_tsc_cmd,
+ "training_sequence_code <0-7>",
+ "Training Sequence Code")
+{
+ struct gsm_bts_trx_ts *ts = vty->index;
+
+ ts->tsc = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
#define HOPPING_STR "Configure frequency hopping\n"
DEFUN(cfg_ts_hopping,
@@ -2518,18 +2533,18 @@ DEFUN(cfg_ts_e1_subslot,
void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
{
vty_out(vty, "Channel Requests : %lu total, %lu no channel%s",
- counter_get(net->stats.chreq.total),
- counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
+ osmo_counter_get(net->stats.chreq.total),
+ osmo_counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
vty_out(vty, "Channel Failures : %lu rf_failures, %lu rll failures%s",
- counter_get(net->stats.chan.rf_fail),
- counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
+ osmo_counter_get(net->stats.chan.rf_fail),
+ osmo_counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
vty_out(vty, "Paging : %lu attempted, %lu complete, %lu expired%s",
- counter_get(net->stats.paging.attempted),
- counter_get(net->stats.paging.completed),
- counter_get(net->stats.paging.expired), VTY_NEWLINE);
+ osmo_counter_get(net->stats.paging.attempted),
+ osmo_counter_get(net->stats.paging.completed),
+ osmo_counter_get(net->stats.paging.expired), VTY_NEWLINE);
vty_out(vty, "BTS failures : %lu OML, %lu RSL%s",
- counter_get(net->stats.bts.oml_fail),
- counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
+ osmo_counter_get(net->stats.bts.oml_fail),
+ osmo_counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
}
DEFUN(logging_fltr_imsi,
@@ -2650,7 +2665,7 @@ DEFUN(pdch_act, pdch_act_cmd,
extern int bsc_vty_init_extra(void);
extern const char *openbsc_copyright;
-int bsc_vty_init(void)
+int bsc_vty_init(const struct log_info *cat)
{
install_element_ve(&show_net_cmd);
install_element_ve(&show_bts_cmd);
@@ -2666,7 +2681,7 @@ int bsc_vty_init(void)
install_element_ve(&show_paging_cmd);
- logging_vty_add_cmds();
+ logging_vty_add_cmds(cat);
install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
install_element(CONFIG_NODE, &cfg_net_cmd);
@@ -2779,6 +2794,7 @@ int bsc_vty_init(void)
install_element(TS_NODE, &ournode_exit_cmd);
install_element(TS_NODE, &ournode_end_cmd);
install_element(TS_NODE, &cfg_ts_pchan_cmd);
+ install_element(TS_NODE, &cfg_ts_tsc_cmd);
install_element(TS_NODE, &cfg_ts_hopping_cmd);
install_element(TS_NODE, &cfg_ts_hsn_cmd);
install_element(TS_NODE, &cfg_ts_maio_cmd);
diff --git a/src/libbsc/bts_ericsson_rbs2000.c b/src/libbsc/bts_ericsson_rbs2000.c
index 27d5ce6f..9c98a9fe 100644
--- a/src/libbsc/bts_ericsson_rbs2000.c
+++ b/src/libbsc/bts_ericsson_rbs2000.c
@@ -19,13 +19,13 @@
*
*/
-#include <sys/types.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_om2000.h>
+#include <openbsc/abis_nm.h>
#include <openbsc/e1_input.h>
#include <openbsc/signal.h>
@@ -40,9 +40,12 @@ static void bootstrap_om_bts(struct gsm_bts *bts)
static void bootstrap_om_trx(struct gsm_bts_trx *trx)
{
+ struct abis_om2k_mo trx_mo = { OM2K_MO_CLS_TRXC, 0, 255, trx->nr };
+
LOGP(DNM, LOGL_NOTICE, "bootstrapping OML for TRX %u/%u\n",
trx->bts->nr, trx->nr);
- /* FIXME */
+
+ abis_om2k_tx_reset_cmd(trx->bts, &trx_mo);
}
static int shutdown_om(struct gsm_bts *bts)
@@ -137,19 +140,119 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
return 0;
}
+static void nm_statechg_evt(unsigned int signal,
+ struct nm_statechg_signal_data *nsd)
+{
+ struct abis_om2k_mo mo;
+
+ if (nsd->bts->type != GSM_BTS_TYPE_RBS2000)
+ return;
+
+ switch (nsd->om2k_mo->class) {
+ case OM2K_MO_CLS_CF:
+ if (nsd->new_state->operational != NM_OPSTATE_ENABLED ||
+ nsd->new_state->availability != OM2K_MO_S_STARTED)
+ break;
+ /* CF has started, we can trigger IS and TF start */
+ abis_om2k_tx_connect_cmd(nsd->bts, &om2k_mo_is);
+ abis_om2k_tx_connect_cmd(nsd->bts, &om2k_mo_tf);
+ break;
+ case OM2K_MO_CLS_IS:
+ if (nsd->new_state->availability == OM2K_MO_S_ENABLED) {
+ /* IS is enabled, we can proceed with TRXC/RX/TX/TS */
+ break;
+ }
+ if (nsd->new_state->operational != NM_OPSTATE_ENABLED)
+ break;
+ /* IS has started, we can configure + enable it */
+ abis_om2k_tx_is_conf_req(nsd->bts);
+ break;
+ case OM2K_MO_CLS_TF:
+ if (nsd->new_state->operational != NM_OPSTATE_ENABLED ||
+ nsd->new_state->availability == OM2K_MO_S_DISABLED)
+ break;
+ if (nsd->new_state->availability == OM2K_MO_S_STARTED) {
+ /* TF has started, configure + enable it */
+ abis_om2k_tx_is_conf_req(nsd->bts);
+ }
+ break;
+ case OM2K_MO_CLS_TRXC:
+ if (nsd->new_state->availability != OM2K_MO_S_STARTED)
+ break;
+ /* TRXC is started, connect the TX and RX objects */
+ memcpy(&mo, nsd->om2k_mo, sizeof(mo));
+ mo.class = OM2K_MO_CLS_TX;
+ abis_om2k_tx_connect_cmd(nsd->bts, &mo);
+ mo.class = OM2K_MO_CLS_RX;
+ abis_om2k_tx_connect_cmd(nsd->bts, &mo);
+ break;
+ case OM2K_MO_CLS_RX:
+ if (nsd->new_state->operational != NM_OPSTATE_ENABLED ||
+ nsd->new_state->availability != OM2K_MO_S_STARTED)
+ break;
+ /* RX is started, configure + enable it */
+ abis_om2k_tx_rx_conf_req(nsd->obj);
+ break;
+ case OM2K_MO_CLS_TX:
+ if (nsd->new_state->operational != NM_OPSTATE_ENABLED ||
+ nsd->new_state->availability != OM2K_MO_S_STARTED)
+ break;
+ /* RX is started, configure + enable it */
+ abis_om2k_tx_tx_conf_req(nsd->obj);
+ break;
+ }
+}
+
+static void nm_conf_res(struct nm_om2k_signal_data *nsd)
+{
+ switch (nsd->om2k_mo->class) {
+ case OM2K_MO_CLS_IS:
+ case OM2K_MO_CLS_TF:
+ case OM2K_MO_CLS_RX:
+ case OM2K_MO_CLS_TX:
+ /* If configuration was a success, enable it */
+ abis_om2k_tx_enable_req(nsd->bts, nsd->om2k_mo);
+ break;
+ }
+}
+
+static int nm_sig_cb(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ if (subsys != SS_NM)
+ return 0;
+
+ switch (signal) {
+ case S_NM_STATECHG_OPER:
+ case S_NM_STATECHG_ADM:
+ nm_statechg_evt(signal, signal_data);
+ break;
+ case S_NM_OM2K_CONF_RES:
+ nm_conf_res(signal_data);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static void config_write_bts(struct vty *vty, struct gsm_bts *bts)
{
abis_om2k_config_write_bts(vty, bts);
}
+static int bts_model_rbs2k_start(struct gsm_network *net);
+
static struct gsm_bts_model model_rbs2k = {
.type = GSM_BTS_TYPE_RBS2000,
.name = "rbs2000",
+ .start = bts_model_rbs2k_start,
.oml_rcvmsg = &abis_om2k_rcvmsg,
.config_write_bts = &config_write_bts,
};
-int bts_model_rbs2k_init(void)
+static int bts_model_rbs2k_start(struct gsm_network *net)
{
model_rbs2k.features.data = &model_rbs2k._features_data[0];
model_rbs2k.features.data_len = sizeof(model_rbs2k._features_data);
@@ -157,8 +260,14 @@ int bts_model_rbs2k_init(void)
gsm_btsmodel_set_feature(&model_rbs2k, BTS_FEAT_HOPPING);
gsm_btsmodel_set_feature(&model_rbs2k, BTS_FEAT_HSCSD);
- register_signal_handler(SS_INPUT, inp_sig_cb, NULL);
- register_signal_handler(SS_GLOBAL, gbl_sig_cb, NULL);
+ osmo_signal_register_handler(SS_INPUT, inp_sig_cb, NULL);
+ osmo_signal_register_handler(SS_GLOBAL, gbl_sig_cb, NULL);
+ osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL);
+
+ return 0;
+}
+int bts_model_rbs2k_init(void)
+{
return gsm_bts_model_register(&model_rbs2k);
}
diff --git a/src/libbsc/bts_hsl_femtocell.c b/src/libbsc/bts_hsl_femtocell.c
index e01634c3..f9436935 100644
--- a/src/libbsc/bts_hsl_femtocell.c
+++ b/src/libbsc/bts_hsl_femtocell.c
@@ -20,19 +20,21 @@
*
*/
-#include <sys/types.h>
#include <arpa/inet.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_nm.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/signal.h>
#include <openbsc/e1_input.h>
+static int bts_model_hslfemto_start(struct gsm_network *net);
+
static struct gsm_bts_model model_hslfemto = {
.type = GSM_BTS_TYPE_HSL_FEMTO,
+ .start = bts_model_hslfemto_start,
.nm_att_tlvdef = {
.def = {
/* no HSL specific OML attributes that we know of */
@@ -140,7 +142,8 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
case S_INP_TEI_UP:
switch (isd->link_type) {
case E1INP_SIGN_OML:
- hslfemto_bootstrap_om(isd->trx->bts);
+ if (isd->trx->bts->type == GSM_BTS_TYPE_HSL_FEMTO)
+ hslfemto_bootstrap_om(isd->trx->bts);
break;
}
}
@@ -148,7 +151,7 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
return 0;
}
-int bts_model_hslfemto_init(void)
+static int bts_model_hslfemto_start(struct gsm_network *net)
{
model_hslfemto.features.data = &model_hslfemto._features_data[0];
model_hslfemto.features.data_len = sizeof(model_hslfemto._features_data);
@@ -156,7 +159,13 @@ int bts_model_hslfemto_init(void)
gsm_btsmodel_set_feature(&model_hslfemto, BTS_FEAT_GPRS);
gsm_btsmodel_set_feature(&model_hslfemto, BTS_FEAT_EGPRS);
- register_signal_handler(SS_INPUT, inp_sig_cb, NULL);
+ osmo_signal_register_handler(SS_INPUT, inp_sig_cb, NULL);
+
+ /* Call A-bis input driver, start socket for OML and RSL. */
+ return hsl_setup(net);
+}
+int bts_model_hslfemto_init(void)
+{
return gsm_bts_model_register(&model_hslfemto);
}
diff --git a/src/libbsc/bts_init.c b/src/libbsc/bts_init.c
new file mode 100644
index 00000000..87bdde06
--- /dev/null
+++ b/src/libbsc/bts_init.c
@@ -0,0 +1,29 @@
+/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <openbsc/bss.h>
+
+int bts_init(void)
+{
+ bts_model_bs11_init();
+ bts_model_rbs2k_init();
+ bts_model_nanobts_init();
+ bts_model_hslfemto_init();
+ /* Your new BTS here. */
+ return 0;
+}
diff --git a/src/libbsc/bts_ipaccess_nanobts.c b/src/libbsc/bts_ipaccess_nanobts.c
index 25dc0c8a..e756f2a8 100644
--- a/src/libbsc/bts_ipaccess_nanobts.c
+++ b/src/libbsc/bts_ipaccess_nanobts.c
@@ -19,18 +19,21 @@
*
*/
-#include <sys/types.h>
#include <arpa/inet.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/gsm_data.h>
#include <openbsc/signal.h>
#include <openbsc/abis_nm.h>
+#include <openbsc/e1_input.h> /* for ipaccess_setup() */
+
+static int bts_model_nanobts_start(struct gsm_network *net);
static struct gsm_bts_model model_nanobts = {
.type = GSM_BTS_TYPE_NANOBTS,
.name = "nanobts",
+ .start = bts_model_nanobts_start,
.oml_rcvmsg = &abis_nm_rcvmsg,
.nm_att_tlvdef = {
.def = {
@@ -182,8 +185,8 @@ static void patch_32(uint8_t *data, const uint32_t val)
*/
static void patch_nm_tables(struct gsm_bts *bts)
{
- u_int8_t arfcn_low = bts->c0->arfcn & 0xff;
- u_int8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
+ uint8_t arfcn_low = bts->c0->arfcn & 0xff;
+ uint8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
/* patch ARFCN into BTS Attributes */
nanobts_attr_bts[42] &= 0xf0;
@@ -196,8 +199,8 @@ static void patch_nm_tables(struct gsm_bts *bts)
}
if (bts->rach_ldavg_slots != -1) {
- u_int8_t avg_high = bts->rach_ldavg_slots & 0xff;
- u_int8_t avg_low = (bts->rach_ldavg_slots >> 8) & 0x0f;
+ uint8_t avg_high = bts->rach_ldavg_slots & 0xff;
+ uint8_t avg_low = (bts->rach_ldavg_slots >> 8) & 0x0f;
nanobts_attr_bts[35] = avg_high;
nanobts_attr_bts[36] = avg_low;
@@ -249,7 +252,7 @@ static void patch_nm_tables(struct gsm_bts *bts)
/* Callback function to be called whenever we get a GSM 12.21 state change event */
static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
{
- u_int8_t obj_class = nsd->obj_class;
+ uint8_t obj_class = nsd->obj_class;
void *obj = nsd->obj;
struct gsm_nm_state *new_state = nsd->new_state;
@@ -258,6 +261,9 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
struct gsm_bts_trx_ts *ts;
struct gsm_bts_gprs_nsvc *nsvc;
+ if (nsd->bts->type != GSM_BTS_TYPE_NANOBTS)
+ return 0;
+
/* This event-driven BTS setup is currently only required on nanoBTS */
/* S_NM_STATECHG_ADM is called after we call chg_adm_state() and would create
@@ -396,7 +402,7 @@ static int sw_activ_rep(struct msgb *mb)
* This code is here to make sure that on start
* a TRX remains locked.
*/
- int rc_state = trx->nm_state.administrative;
+ int rc_state = trx->mo.nm_state.administrative;
/* Patch ARFCN into radio attribute */
nanobts_attr_radio[5] &= 0xf0;
nanobts_attr_radio[5] |= trx->arfcn >> 8;
@@ -433,7 +439,7 @@ static int nm_sig_cb(unsigned int subsys, unsigned int signal,
return 0;
}
-int bts_model_nanobts_init(void)
+static int bts_model_nanobts_start(struct gsm_network *net)
{
model_nanobts.features.data = &model_nanobts._features_data[0];
model_nanobts.features.data_len = sizeof(model_nanobts._features_data);
@@ -441,7 +447,13 @@ int bts_model_nanobts_init(void)
gsm_btsmodel_set_feature(&model_nanobts, BTS_FEAT_GPRS);
gsm_btsmodel_set_feature(&model_nanobts, BTS_FEAT_EGPRS);
- register_signal_handler(SS_NM, nm_sig_cb, NULL);
+ osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL);
+ /* Call A-bis input driver, start server sockets for OML and RSL. */
+ return ipaccess_setup(net);
+}
+
+int bts_model_nanobts_init(void)
+{
return gsm_bts_model_register(&model_nanobts);
}
diff --git a/src/libbsc/bts_siemens_bs11.c b/src/libbsc/bts_siemens_bs11.c
index 5a5f8830..df4a1dc2 100644
--- a/src/libbsc/bts_siemens_bs11.c
+++ b/src/libbsc/bts_siemens_bs11.c
@@ -19,9 +19,8 @@
*
*/
-#include <sys/types.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
@@ -29,9 +28,12 @@
#include <openbsc/e1_input.h>
#include <openbsc/signal.h>
+static int bts_model_bs11_start(struct gsm_network *net);
+
static struct gsm_bts_model model_bs11 = {
.type = GSM_BTS_TYPE_BS11,
.name = "bs11",
+ .start = bts_model_bs11_start,
.oml_rcvmsg = &abis_nm_rcvmsg,
.nm_att_tlvdef = {
.def = {
@@ -346,8 +348,8 @@ static unsigned char bs11_attr_radio[] =
*/
static void patch_nm_tables(struct gsm_bts *bts)
{
- u_int8_t arfcn_low = bts->c0->arfcn & 0xff;
- u_int8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
+ uint8_t arfcn_low = bts->c0->arfcn & 0xff;
+ uint8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
/* patch ARFCN into BTS Attributes */
bs11_attr_bts[69] &= 0xf0;
@@ -364,8 +366,8 @@ static void patch_nm_tables(struct gsm_bts *bts)
bs11_attr_bts[33] = bts->rach_b_thresh & 0xff;
if (bts->rach_ldavg_slots != -1) {
- u_int8_t avg_high = bts->rach_ldavg_slots & 0xff;
- u_int8_t avg_low = (bts->rach_ldavg_slots >> 8) & 0x0f;
+ uint8_t avg_high = bts->rach_ldavg_slots & 0xff;
+ uint8_t avg_low = (bts->rach_ldavg_slots >> 8) & 0x0f;
bs11_attr_bts[35] = avg_high;
bs11_attr_bts[36] = avg_low;
@@ -425,9 +427,9 @@ static void nm_reconfig_trx(struct gsm_bts_trx *trx)
abis_nm_set_radio_attr(trx, bs11_attr_radio,
sizeof(bs11_attr_radio));
else {
- u_int8_t trx1_attr_radio[sizeof(bs11_attr_radio)];
- u_int8_t arfcn_low = trx->arfcn & 0xff;
- u_int8_t arfcn_high = (trx->arfcn >> 8) & 0x0f;
+ uint8_t trx1_attr_radio[sizeof(bs11_attr_radio)];
+ uint8_t arfcn_low = trx->arfcn & 0xff;
+ uint8_t arfcn_high = (trx->arfcn >> 8) & 0x0f;
memcpy(trx1_attr_radio, bs11_attr_radio,
sizeof(trx1_attr_radio));
@@ -576,7 +578,7 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
return 0;
}
-int bts_model_bs11_init(void)
+static int bts_model_bs11_start(struct gsm_network *net)
{
model_bs11.features.data = &model_bs11._features_data[0];
model_bs11.features.data_len = sizeof(model_bs11._features_data);
@@ -584,8 +586,13 @@ int bts_model_bs11_init(void)
gsm_btsmodel_set_feature(&model_bs11, BTS_FEAT_HOPPING);
gsm_btsmodel_set_feature(&model_bs11, BTS_FEAT_HSCSD);
- register_signal_handler(SS_INPUT, inp_sig_cb, NULL);
- register_signal_handler(SS_GLOBAL, gbl_sig_cb, NULL);
+ osmo_signal_register_handler(SS_INPUT, inp_sig_cb, NULL);
+ osmo_signal_register_handler(SS_GLOBAL, gbl_sig_cb, NULL);
+ return 0;
+}
+
+int bts_model_bs11_init(void)
+{
return gsm_bts_model_register(&model_bs11);
}
diff --git a/src/libbsc/bts_unknown.c b/src/libbsc/bts_unknown.c
index f9545995..f1135294 100644
--- a/src/libbsc/bts_unknown.c
+++ b/src/libbsc/bts_unknown.c
@@ -19,10 +19,9 @@
*
*/
-#include <sys/types.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/abis_nm.h>
static struct gsm_bts_model model_unknown = {
diff --git a/src/libbsc/chan_alloc.c b/src/libbsc/chan_alloc.c
index 167381b3..c0bdc1be 100644
--- a/src/libbsc/chan_alloc.c
+++ b/src/libbsc/chan_alloc.c
@@ -32,13 +32,13 @@
#include <openbsc/debug.h>
#include <openbsc/signal.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
static int ts_is_usable(struct gsm_bts_trx_ts *ts)
{
/* FIXME: How does this behave for BS-11 ? */
if (is_ipaccess_bts(ts->trx->bts)) {
- if (!nm_is_running(&ts->nm_state))
+ if (!nm_is_running(&ts->mo.nm_state))
return 0;
}
@@ -49,8 +49,8 @@ int trx_is_usable(struct gsm_bts_trx *trx)
{
/* FIXME: How does this behave for BS-11 ? */
if (is_ipaccess_bts(trx->bts)) {
- if (!nm_is_running(&trx->nm_state) ||
- !nm_is_running(&trx->bb_transc.nm_state))
+ if (!nm_is_running(&trx->mo.nm_state) ||
+ !nm_is_running(&trx->bb_transc.mo.nm_state))
return 0;
}
@@ -143,7 +143,7 @@ void ts_free(struct gsm_bts_trx_ts *ts)
ts->pchan = GSM_PCHAN_NONE;
}
-static const u_int8_t subslots_per_pchan[] = {
+static const uint8_t subslots_per_pchan[] = {
[GSM_PCHAN_NONE] = 0,
[GSM_PCHAN_CCCH] = 0,
[GSM_PCHAN_CCCH_SDCCH4] = 4,
@@ -284,7 +284,7 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
struct challoc_signal_data sig;
sig.bts = bts;
sig.type = type;
- dispatch_signal(SS_CHALLOC, S_CHALLOC_ALLOC_FAIL, &sig);
+ osmo_signal_dispatch(SS_CHALLOC, S_CHALLOC_ALLOC_FAIL, &sig);
}
return lchan;
@@ -306,12 +306,12 @@ void lchan_free(struct gsm_lchan *lchan)
/* We might kill an active channel... */
sig.lchan = lchan;
sig.mr = NULL;
- dispatch_signal(SS_LCHAN, S_LCHAN_UNEXPECTED_RELEASE, &sig);
+ osmo_signal_dispatch(SS_LCHAN, S_LCHAN_UNEXPECTED_RELEASE, &sig);
}
/* stop the timer */
- bsc_del_timer(&lchan->T3101);
+ osmo_timer_del(&lchan->T3101);
/* clear cached measuement reports */
lchan->meas_rep_idx = 0;
@@ -330,7 +330,7 @@ void lchan_free(struct gsm_lchan *lchan)
sig.lchan = lchan;
sig.bts = lchan->ts->trx->bts;
- dispatch_signal(SS_CHALLOC, S_CHALLOC_FREED, &sig);
+ osmo_signal_dispatch(SS_CHALLOC, S_CHALLOC_FREED, &sig);
if (lchan->conn) {
LOGP(DRLL, LOGL_ERROR, "the subscriber connection should be gone.\n");
@@ -356,9 +356,9 @@ void lchan_free(struct gsm_lchan *lchan)
*/
void lchan_reset(struct gsm_lchan *lchan)
{
- bsc_del_timer(&lchan->T3101);
- bsc_del_timer(&lchan->T3111);
- bsc_del_timer(&lchan->error_timer);
+ osmo_timer_del(&lchan->T3101);
+ osmo_timer_del(&lchan->T3111);
+ osmo_timer_del(&lchan->error_timer);
lchan->type = GSM_LCHAN_NONE;
lchan->state = LCHAN_S_NONE;
@@ -370,7 +370,7 @@ static int _lchan_release_next_sapi(struct gsm_lchan *lchan)
int sapi;
for (sapi = 1; sapi < ARRAY_SIZE(lchan->sapis); ++sapi) {
- u_int8_t link_id;
+ uint8_t link_id;
if (lchan->sapis[sapi] == LCHAN_SAPI_UNUSED)
continue;
@@ -401,7 +401,7 @@ static void _lchan_handle_release(struct gsm_lchan *lchan)
}
/* called from abis rsl */
-int rsl_lchan_rll_release(struct gsm_lchan *lchan, u_int8_t link_id)
+int rsl_lchan_rll_release(struct gsm_lchan *lchan, uint8_t link_id)
{
if (lchan->state != LCHAN_S_REL_REQ)
return -1;
@@ -465,8 +465,8 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
int i;
/* skip administratively deactivated tranxsceivers */
- if (!nm_is_running(&trx->nm_state) ||
- !nm_is_running(&trx->bb_transc.nm_state))
+ if (!nm_is_running(&trx->mo.nm_state) ||
+ !nm_is_running(&trx->bb_transc.mo.nm_state))
continue;
for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
@@ -475,7 +475,7 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
int j;
/* skip administratively deactivated timeslots */
- if (!nm_is_running(&ts->nm_state))
+ if (!nm_is_running(&ts->mo.nm_state))
continue;
for (j = 0; j < subslots_per_pchan[ts->pchan]; j++) {
diff --git a/src/libbsc/e1_config.c b/src/libbsc/e1_config.c
index 958839dc..bd6ebba9 100644
--- a/src/libbsc/e1_config.c
+++ b/src/libbsc/e1_config.c
@@ -29,7 +29,7 @@
#include <openbsc/trau_mux.h>
#include <openbsc/misdn.h>
#include <openbsc/ipaccess.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/debug.h>
#define SAPI_L2ML 0
diff --git a/src/libbsc/gsm_04_08_utils.c b/src/libbsc/gsm_04_08_utils.c
index 6d12cc08..17bce85a 100644
--- a/src/libbsc/gsm_04_08_utils.c
+++ b/src/libbsc/gsm_04_08_utils.c
@@ -27,8 +27,8 @@
#include <errno.h>
#include <netinet/in.h>
-#include <osmocore/msgb.h>
-#include <osmocore/gsm48.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/gsm48.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/debug.h>
@@ -52,8 +52,8 @@ static int gsm48_sendmsg(struct msgb *msg)
/* Section 9.1.8 / Table 9.9 */
struct chreq {
- u_int8_t val;
- u_int8_t mask;
+ uint8_t val;
+ uint8_t mask;
enum chreq_type type;
};
@@ -134,7 +134,7 @@ static const enum gsm_chreq_reason_t reason_by_chreq[] = {
};
/* verify that the two tables match */
-static_assert(sizeof(ctype_by_chreq) ==
+osmo_static_assert(sizeof(ctype_by_chreq) ==
sizeof(((struct gsm_network *) NULL)->ctype_by_chreq), assert_size);
/*
@@ -166,7 +166,7 @@ void gsm_net_update_ctype(struct gsm_network *network)
}
}
-enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, u_int8_t ra)
+enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, uint8_t ra)
{
int i;
int length;
@@ -190,7 +190,7 @@ enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, u_int8_t ra)
return GSM_LCHAN_SDCCH;
}
-enum gsm_chreq_reason_t get_reason_by_chreq(u_int8_t ra, int neci)
+enum gsm_chreq_reason_t get_reason_by_chreq(uint8_t ra, int neci)
{
int i;
int length;
@@ -218,7 +218,7 @@ int gsm48_send_rr_release(struct gsm_lchan *lchan)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
- u_int8_t *cause;
+ uint8_t *cause;
msg->lchan = lchan;
gh->proto_discr = GSM48_PDISC_RR;
@@ -239,7 +239,7 @@ int gsm48_send_rr_release(struct gsm_lchan *lchan)
}
int send_siemens_mrpci(struct gsm_lchan *lchan,
- u_int8_t *classmark2_lv)
+ uint8_t *classmark2_lv)
{
struct rsl_mrpci mrpci;
@@ -260,7 +260,7 @@ int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_
if (length < 1 + *classmark2_lv)
return -1;
- u_int8_t *mi_lv = classmark2_lv + *classmark2_lv + 1;
+ uint8_t *mi_lv = classmark2_lv + *classmark2_lv + 1;
if (length < 2 + *classmark2_lv + mi_lv[0])
return -2;
@@ -269,11 +269,11 @@ int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_
}
int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length,
- char *mi_string, u_int8_t *mi_type)
+ char *mi_string, uint8_t *mi_type)
{
static const uint32_t classmark_offset =
offsetof(struct gsm48_pag_resp, classmark2);
- u_int8_t *classmark2_lv = (uint8_t *) &resp->classmark2;
+ uint8_t *classmark2_lv = (uint8_t *) &resp->classmark2;
return gsm48_extract_mi(classmark2_lv, length - classmark_offset,
mi_string, mi_type);
}
@@ -283,7 +283,7 @@ int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn,
{
struct gsm_bts *bts = msg->lchan->ts->trx->bts;
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t *classmark2_lv = gh->data + 1;
+ uint8_t *classmark2_lv = gh->data + 1;
if (is_siemens_bts(bts))
send_siemens_mrpci(msg->lchan, classmark2_lv);
@@ -300,7 +300,7 @@ int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn,
subscr = conn->subscr;
}
- counter_inc(bts->network->stats.paging.completed);
+ osmo_counter_inc(bts->network->stats.paging.completed);
/* Stop paging on the bts we received the paging response */
paging_request_stop(conn->bts, subscr, conn, msg);
@@ -312,7 +312,7 @@ int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
- u_int8_t ciph_mod_set;
+ uint8_t ciph_mod_set;
msg->lchan = lchan;
@@ -343,9 +343,9 @@ static void gsm48_cell_desc(struct gsm48_cell_desc *cd,
void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
const struct gsm_lchan *lchan)
{
- u_int16_t arfcn = lchan->ts->trx->arfcn & 0x3ff;
+ uint16_t arfcn = lchan->ts->trx->arfcn & 0x3ff;
- cd->chan_nr = lchan2chan_nr(lchan);
+ cd->chan_nr = gsm_lchan2chan_nr(lchan);
if (!lchan->ts->hopping.enabled) {
cd->h0.tsc = lchan->ts->trx->bts->tsc;
cd->h0.h = 0;
@@ -364,7 +364,7 @@ void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
/* Chapter 9.1.15: Handover Command */
int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan,
- u_int8_t power_command, u_int8_t ho_ref)
+ uint8_t power_command, uint8_t ho_ref)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
@@ -403,7 +403,7 @@ int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan,
}
/* Chapter 9.1.2: Assignment Command */
-int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, u_int8_t power_command)
+int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_command)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
@@ -443,7 +443,7 @@ int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan,
LOGP(DRR, LOGL_ERROR, "BUG: Using multirate codec "
"without multirate config.\n");
} else {
- u_int8_t *data = msgb_put(msg, 4);
+ uint8_t *data = msgb_put(msg, 4);
data[0] = GSM48_IE_MUL_RATE_CFG;
data[1] = 0x2;
memcpy(&data[2], &lchan->mr_conf, 2);
@@ -454,7 +454,7 @@ int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan,
}
/* 9.1.5 Channel mode modify: Modify the mode on the MS side */
-int gsm48_tx_chan_mode_modify(struct gsm_lchan *lchan, u_int8_t mode)
+int gsm48_tx_chan_mode_modify(struct gsm_lchan *lchan, uint8_t mode)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
@@ -479,7 +479,7 @@ int gsm48_tx_chan_mode_modify(struct gsm_lchan *lchan, u_int8_t mode)
LOGP(DRR, LOGL_ERROR, "BUG: Using multirate codec "
"without multirate config.\n");
} else {
- u_int8_t *data = msgb_put(msg, 4);
+ uint8_t *data = msgb_put(msg, 4);
data[0] = GSM48_IE_MUL_RATE_CFG;
data[1] = 0x2;
memcpy(&data[2], &lchan->mr_conf, 2);
@@ -489,7 +489,7 @@ int gsm48_tx_chan_mode_modify(struct gsm_lchan *lchan, u_int8_t mode)
return gsm48_sendmsg(msg);
}
-int gsm48_lchan_modify(struct gsm_lchan *lchan, u_int8_t lchan_mode)
+int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode)
{
int rc;
@@ -547,7 +547,7 @@ int gsm48_rx_rr_modif_ack(struct msgb *msg)
int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t *data = gh->data;
+ uint8_t *data = gh->data;
struct gsm_bts *bts = msg->lchan->ts->trx->bts;
struct bitvec *nbv = &bts->si_common.neigh_list;
struct gsm_meas_rep_cell *mrc;
diff --git a/src/libbsc/gsm_subscriber_base.c b/src/libbsc/gsm_subscriber_base.c
index caf84e7b..11afb358 100644
--- a/src/libbsc/gsm_subscriber_base.c
+++ b/src/libbsc/gsm_subscriber_base.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <assert.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/debug.h>
diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c
index d3f843af..24c0f79c 100644
--- a/src/libbsc/handover_decision.c
+++ b/src/libbsc/handover_decision.c
@@ -24,18 +24,18 @@
#include <stdlib.h>
#include <errno.h>
-#include <osmocore/msgb.h>
+#include <osmocom/core/msgb.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/meas_rep.h>
#include <openbsc/signal.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/handover.h>
-#include <osmocore/gsm_utils.h>
+#include <osmocom/gsm/gsm_utils.h>
/* issue handover to a cell identified by ARFCN and BSIC */
static int handover_to_arfcn_bsic(struct gsm_lchan *lchan,
- u_int16_t arfcn, u_int8_t bsic)
+ uint16_t arfcn, uint8_t bsic)
{
struct gsm_bts *new_bts;
@@ -53,7 +53,7 @@ static int handover_to_arfcn_bsic(struct gsm_lchan *lchan,
/* did we get a RXLEV for a given cell in the given report? */
static int rxlev_for_cell_in_rep(struct gsm_meas_rep *mr,
- u_int16_t arfcn, u_int8_t bsic)
+ uint16_t arfcn, uint8_t bsic)
{
int i;
@@ -93,7 +93,7 @@ static int neigh_meas_avg(struct neigh_meas_proc *nmp, int window)
static struct neigh_meas_proc *find_evict_neigh(struct gsm_lchan *lchan)
{
int j, worst = 999999;
- struct neigh_meas_proc *nmp_worst;
+ struct neigh_meas_proc *nmp_worst = NULL;
/* first try to find an empty/unused slot */
for (j = 0; j < ARRAY_SIZE(lchan->neigh_meas); j++) {
@@ -106,7 +106,7 @@ static struct neigh_meas_proc *find_evict_neigh(struct gsm_lchan *lchan)
for (j = 0; j < ARRAY_SIZE(lchan->neigh_meas); j++) {
struct neigh_meas_proc *nmp = &lchan->neigh_meas[j];
int avg = neigh_meas_avg(nmp, MAX_WIN_NEIGH_AVG);
- if (avg < worst) {
+ if (!nmp_worst || avg < worst) {
worst = avg;
nmp_worst = nmp;
}
@@ -293,5 +293,5 @@ static int ho_dec_sig_cb(unsigned int subsys, unsigned int signal,
void on_dso_load_ho_dec(void)
{
- register_signal_handler(SS_LCHAN, ho_dec_sig_cb, NULL);
+ osmo_signal_register_handler(SS_LCHAN, ho_dec_sig_cb, NULL);
}
diff --git a/src/libbsc/handover_logic.c b/src/libbsc/handover_logic.c
index c2e3f8c7..0f1582e1 100644
--- a/src/libbsc/handover_logic.c
+++ b/src/libbsc/handover_logic.c
@@ -28,16 +28,16 @@
#include <time.h>
#include <netinet/in.h>
-#include <osmocore/msgb.h>
+#include <osmocom/core/msgb.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/gsm_utils.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/signal.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/transaction.h>
#include <openbsc/rtp_proxy.h>
@@ -47,9 +47,9 @@ struct bsc_handover {
struct gsm_lchan *old_lchan;
struct gsm_lchan *new_lchan;
- struct timer_list T3103;
+ struct osmo_timer_list T3103;
- u_int8_t ho_ref;
+ uint8_t ho_ref;
};
static LLIST_HEAD(bsc_handovers);
@@ -85,7 +85,7 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
{
struct gsm_lchan *new_lchan;
struct bsc_handover *ho;
- static u_int8_t ho_ref;
+ static uint8_t ho_ref;
int rc;
/* don't attempt multiple handovers for the same lchan at
@@ -96,7 +96,7 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
DEBUGP(DHO, "(old_lchan on BTS %u, new BTS %u)\n",
old_lchan->ts->trx->bts->nr, bts->nr);
- counter_inc(bts->network->stats.handover.attempted);
+ osmo_counter_inc(bts->network->stats.handover.attempted);
if (!old_lchan->conn) {
LOGP(DHO, LOGL_ERROR, "Old lchan lacks connection data.\n");
@@ -106,7 +106,7 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
new_lchan = lchan_alloc(bts, old_lchan->type, 0);
if (!new_lchan) {
LOGP(DHO, LOGL_NOTICE, "No free channel\n");
- counter_inc(bts->network->stats.handover.no_channel);
+ osmo_counter_inc(bts->network->stats.handover.no_channel);
return -ENOSPC;
}
@@ -170,7 +170,7 @@ void bsc_clear_handover(struct gsm_subscriber_connection *conn, int free_lchan)
if (free_lchan)
lchan_release(ho->new_lchan, 0, 1);
- bsc_del_timer(&ho->T3103);
+ osmo_timer_del(&ho->T3103);
llist_del(&ho->list);
talloc_free(ho);
}
@@ -182,7 +182,7 @@ static void ho_T3103_cb(void *_ho)
struct gsm_network *net = ho->new_lchan->ts->trx->bts->network;
DEBUGP(DHO, "HO T3103 expired\n");
- counter_inc(net->stats.handover.timeout);
+ osmo_counter_inc(net->stats.handover.timeout);
ho->new_lchan->conn->ho_lchan = NULL;
ho->new_lchan->conn = NULL;
@@ -214,7 +214,7 @@ static int ho_chan_activ_ack(struct gsm_lchan *new_lchan)
* 04.08 HANDOVER COMPLETE or 04.08 HANDOVER FAIL */
ho->T3103.cb = ho_T3103_cb;
ho->T3103.data = ho;
- bsc_schedule_timer(&ho->T3103, 10, 0);
+ osmo_timer_schedule(&ho->T3103, 10, 0);
/* create a RTP connection */
if (is_ipaccess_bts(new_lchan->ts->trx->bts))
@@ -262,9 +262,9 @@ static int ho_gsm48_ho_compl(struct gsm_lchan *new_lchan)
ho->old_lchan->ts->trx->bts->nr, new_lchan->ts->trx->bts->nr,
ho->old_lchan->ts->trx->arfcn, new_lchan->ts->trx->arfcn);
- counter_inc(net->stats.handover.completed);
+ osmo_counter_inc(net->stats.handover.completed);
- bsc_del_timer(&ho->T3103);
+ osmo_timer_del(&ho->T3103);
/* Replace the ho lchan with the primary one */
if (ho->old_lchan != new_lchan->conn->lchan)
@@ -300,9 +300,9 @@ static int ho_gsm48_ho_fail(struct gsm_lchan *old_lchan)
return -ENODEV;
}
- counter_inc(net->stats.handover.failed);
+ osmo_counter_inc(net->stats.handover.failed);
- bsc_del_timer(&ho->T3103);
+ osmo_timer_del(&ho->T3103);
llist_del(&ho->list);
/* release the channel and forget about it */
@@ -344,7 +344,7 @@ static int ho_ipac_crcx_ack(struct gsm_lchan *new_lchan)
sig_ho.old_lchan = ho->old_lchan;
sig_ho.new_lchan = new_lchan;
- dispatch_signal(SS_HO, S_HANDOVER_ACK, &sig_ho);
+ osmo_signal_dispatch(SS_HO, S_HANDOVER_ACK, &sig_ho);
return 0;
}
@@ -388,6 +388,6 @@ static int ho_logic_sig_cb(unsigned int subsys, unsigned int signal,
static __attribute__((constructor)) void on_dso_load_ho_logic(void)
{
- register_signal_handler(SS_LCHAN, ho_logic_sig_cb, NULL);
- register_signal_handler(SS_ABISIP, ho_logic_sig_cb, NULL);
+ osmo_signal_register_handler(SS_LCHAN, ho_logic_sig_cb, NULL);
+ osmo_signal_register_handler(SS_ABISIP, ho_logic_sig_cb, NULL);
}
diff --git a/src/libbsc/meas_rep.c b/src/libbsc/meas_rep.c
index 788a9bae..808103d2 100644
--- a/src/libbsc/meas_rep.c
+++ b/src/libbsc/meas_rep.c
@@ -19,7 +19,6 @@
*
*/
-#include <sys/types.h>
#include <openbsc/gsm_data.h>
#include <openbsc/meas_rep.h>
diff --git a/src/libbsc/paging.c b/src/libbsc/paging.c
index 65025457..4dfa9216 100644
--- a/src/libbsc/paging.c
+++ b/src/libbsc/paging.c
@@ -38,8 +38,11 @@
#include <stdlib.h>
#include <assert.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/gsm/gsm48.h>
+#include <osmocom/gsm/gsm0502.h>
+
#include <openbsc/paging.h>
-#include <osmocore/talloc.h>
#include <openbsc/debug.h>
#include <openbsc/signal.h>
#include <openbsc/abis_rsl.h>
@@ -51,29 +54,13 @@ void *tall_paging_ctx;
#define PAGING_TIMER 0, 500000
-static unsigned int calculate_group(struct gsm_bts *bts, struct gsm_subscriber *subscr)
-{
- int ccch_conf;
- int bs_cc_chans;
- int blocks;
- unsigned int group;
-
- ccch_conf = bts->si_common.chan_desc.ccch_conf;
- bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf);
- /* code word + 2, as 2 channels equals 0x0 */
- blocks = rsl_number_of_paging_subchannels(bts);
- group = get_paging_group(str_to_imsi(subscr->imsi),
- bs_cc_chans, blocks);
- return group;
-}
-
/*
* Kill one paging request update the internal list...
*/
static void paging_remove_request(struct gsm_bts_paging_state *paging_bts,
struct gsm_paging_request *to_be_deleted)
{
- bsc_del_timer(&to_be_deleted->T3113);
+ osmo_timer_del(&to_be_deleted->T3113);
llist_del(&to_be_deleted->entry);
subscr_put(to_be_deleted->subscr);
talloc_free(to_be_deleted);
@@ -81,9 +68,10 @@ static void paging_remove_request(struct gsm_bts_paging_state *paging_bts,
static void page_ms(struct gsm_paging_request *request)
{
- u_int8_t mi[128];
+ uint8_t mi[128];
unsigned int mi_len;
unsigned int page_group;
+ struct gsm_bts *bts = request->bts;
LOGP(DPAG, LOGL_INFO, "Going to send paging commands: imsi: '%s' tmsi: '0x%x'\n",
request->subscr->imsi, request->subscr->tmsi);
@@ -93,8 +81,9 @@ static void page_ms(struct gsm_paging_request *request)
else
mi_len = gsm48_generate_mid_from_tmsi(mi, request->subscr->tmsi);
- page_group = calculate_group(request->bts, request->subscr);
- gsm0808_page(request->bts, page_group, mi_len, mi, request->chan_type);
+ page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+ str_to_imsi(request->subscr->imsi));
+ gsm0808_page(bts, page_group, mi_len, mi, request->chan_type);
}
static void paging_schedule_if_needed(struct gsm_bts_paging_state *paging_bts)
@@ -102,8 +91,8 @@ static void paging_schedule_if_needed(struct gsm_bts_paging_state *paging_bts)
if (llist_empty(&paging_bts->pending_requests))
return;
- if (!bsc_timer_pending(&paging_bts->work_timer))
- bsc_schedule_timer(&paging_bts->work_timer, PAGING_TIMER);
+ if (!osmo_timer_pending(&paging_bts->work_timer))
+ osmo_timer_schedule(&paging_bts->work_timer, PAGING_TIMER);
}
@@ -192,7 +181,7 @@ static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_b
if (paging_bts->available_slots == 0) {
paging_bts->credit_timer.cb = paging_give_credit;
paging_bts->credit_timer.data = paging_bts;
- bsc_schedule_timer(&paging_bts->credit_timer, 5, 0);
+ osmo_timer_schedule(&paging_bts->credit_timer, 5, 0);
return;
}
@@ -215,7 +204,7 @@ static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_b
llist_add_tail(&request->entry, &paging_bts->pending_requests);
skip_paging:
- bsc_schedule_timer(&paging_bts->work_timer, PAGING_TIMER);
+ osmo_timer_schedule(&paging_bts->work_timer, PAGING_TIMER);
}
static void paging_worker(void *data)
@@ -225,8 +214,11 @@ static void paging_worker(void *data)
paging_handle_pending_requests(paging_bts);
}
-void paging_init(struct gsm_bts *bts)
+static void paging_init_if_needed(struct gsm_bts *bts)
{
+ if (bts->paging.bts)
+ return;
+
bts->paging.bts = bts;
INIT_LLIST_HEAD(&bts->paging.pending_requests);
bts->paging.work_timer.cb = paging_worker;
@@ -259,7 +251,7 @@ static void paging_T3113_expired(void *data)
req, req->subscr->imsi);
/* must be destroyed before calling cbfn, to prevent double free */
- counter_inc(req->bts->network->stats.paging.expired);
+ osmo_counter_inc(req->bts->network->stats.paging.expired);
cbfn_param = req->cbfn_param;
cbfn = req->cbfn;
@@ -295,7 +287,7 @@ static int _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
req->cbfn_param = data;
req->T3113.cb = paging_T3113_expired;
req->T3113.data = req;
- bsc_schedule_timer(&req->T3113, bts->network->T3113, 0);
+ osmo_timer_schedule(&req->T3113, bts->network->T3113, 0);
llist_add_tail(&req->entry, &bts_entry->pending_requests);
paging_schedule_if_needed(bts_entry);
@@ -308,7 +300,7 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
struct gsm_bts *bts = NULL;
int num_pages = 0;
- counter_inc(network->stats.paging.attempted);
+ osmo_counter_inc(network->stats.paging.attempted);
/* start paging subscriber on all BTS within Location Area */
do {
@@ -322,6 +314,9 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
if (!trx_is_usable(bts->c0))
continue;
+ /* maybe it is the first time we use it */
+ paging_init_if_needed(bts);
+
num_pages++;
/* Trigger paging, pass any error to caller */
@@ -331,7 +326,7 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
} while (1);
if (num_pages == 0)
- counter_inc(network->stats.paging.detached);
+ osmo_counter_inc(network->stats.paging.detached);
return num_pages;
}
@@ -345,6 +340,8 @@ static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *sub
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req, *req2;
+ paging_init_if_needed(bts);
+
llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests,
entry) {
if (req->subscr == subscr) {
@@ -387,9 +384,24 @@ void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr,
} while (1);
}
-void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots)
+void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots)
{
- bsc_del_timer(&bts->paging.credit_timer);
+ paging_init_if_needed(bts);
+
+ osmo_timer_del(&bts->paging.credit_timer);
bts->paging.available_slots = free_slots;
paging_schedule_if_needed(&bts->paging);
}
+
+unsigned int paging_pending_requests_nr(struct gsm_bts *bts)
+{
+ unsigned int requests = 0;
+ struct gsm_paging_request *req;
+
+ paging_init_if_needed(bts);
+
+ llist_for_each_entry(req, &bts->paging.pending_requests, entry)
+ ++requests;
+
+ return requests;
+}
diff --git a/src/libbsc/rest_octets.c b/src/libbsc/rest_octets.c
index 084f1449..0545426c 100644
--- a/src/libbsc/rest_octets.c
+++ b/src/libbsc/rest_octets.c
@@ -26,11 +26,11 @@
#include <errno.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/bitvec.h>
+#include <osmocom/core/bitvec.h>
#include <openbsc/rest_octets.h>
/* generate SI1 rest octets */
-int rest_octets_si1(u_int8_t *data, u_int8_t *nch_pos)
+int rest_octets_si1(uint8_t *data, uint8_t *nch_pos)
{
struct bitvec bv;
@@ -88,7 +88,7 @@ static void append_gprs_ind(struct bitvec *bv,
/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
-int rest_octets_si3(u_int8_t *data, const struct gsm48_si_ro_info *si3)
+int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3)
{
struct bitvec bv;
@@ -136,7 +136,7 @@ static int append_lsa_params(struct bitvec *bv,
}
/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
-int rest_octets_si4(u_int8_t *data, const struct gsm48_si_ro_info *si4)
+int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4)
{
struct bitvec bv;
@@ -366,7 +366,7 @@ static void append_gprs_pwr_ctrl_pars(struct bitvec *bv,
}
/* Generate SI13 Rest Octests (04.08 Chapter 10.5.2.37b) */
-int rest_octets_si13(u_int8_t *data, const struct gsm48_si13_info *si13)
+int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13)
{
struct bitvec bv;
diff --git a/src/libbsc/system_information.c b/src/libbsc/system_information.c
index dc719388..353b3dd9 100644
--- a/src/libbsc/system_information.c
+++ b/src/libbsc/system_information.c
@@ -23,40 +23,23 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
-#include <sys/types.h>
#include <netinet/in.h>
+#include <osmocom/core/bitvec.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/sysinfo.h>
+
+#include <openbsc/debug.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/rest_octets.h>
-#include <osmocore/bitvec.h>
-#include <osmocore/utils.h>
-#include <openbsc/debug.h>
-
-#define GSM48_CELL_CHAN_DESC_SIZE 16
-#define GSM_MACBLOCK_PADDING 0x2b
-
-/* verify the sizes of the system information type structs */
-/* rest octets are not part of the struct */
-static_assert(sizeof(struct gsm48_system_information_type_header) == 3, _si_header_size);
-static_assert(sizeof(struct gsm48_rach_control) == 3, _si_rach_control);
-static_assert(sizeof(struct gsm48_system_information_type_1) == 22, _si1_size);
-static_assert(sizeof(struct gsm48_system_information_type_2) == 23, _si2_size);
-static_assert(sizeof(struct gsm48_system_information_type_3) == 19, _si3_size);
-static_assert(sizeof(struct gsm48_system_information_type_4) == 13, _si4_size);
-
-/* bs11 forgot the l2 len, 0-6 rest octets */
-static_assert(sizeof(struct gsm48_system_information_type_5) == 18, _si5_size);
-static_assert(sizeof(struct gsm48_system_information_type_6) == 11, _si6_size);
-
-static_assert(sizeof(struct gsm48_system_information_type_13) == 3, _si13_size);
/* Frequency Lists as per TS 04.08 10.5.2.13 */
/* 10.5.2.13.2: Bit map 0 format */
-static int freq_list_bm0_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
+static int freq_list_bm0_set_arfcn(uint8_t *chan_list, unsigned int arfcn)
{
unsigned int byte, bit;
@@ -77,7 +60,7 @@ static int freq_list_bm0_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
}
/* 10.5.2.13.7: Variable bit map format */
-static int freq_list_bmrel_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
+static int freq_list_bmrel_set_arfcn(uint8_t *chan_list, unsigned int arfcn)
{
unsigned int byte, bit;
unsigned int min_arfcn;
@@ -110,7 +93,7 @@ static int freq_list_bmrel_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
}
/* generate a cell channel list as per Section 10.5.2.1b of 04.08 */
-static int bitvec2freq_list(u_int8_t *chan_list, struct bitvec *bv,
+static int bitvec2freq_list(uint8_t *chan_list, struct bitvec *bv,
const struct gsm_bts *bts)
{
int i, rc, min = 1024, max = -1;
@@ -171,7 +154,7 @@ static int bitvec2freq_list(u_int8_t *chan_list, struct bitvec *bv,
}
/* generate a cell channel list as per Section 10.5.2.1b of 04.08 */
-static int generate_cell_chan_list(u_int8_t *chan_list, struct gsm_bts *bts)
+static int generate_cell_chan_list(uint8_t *chan_list, struct gsm_bts *bts)
{
struct gsm_bts_trx *trx;
struct bitvec *bv = &bts->si_common.cell_alloc;
@@ -199,7 +182,7 @@ static int generate_cell_chan_list(u_int8_t *chan_list, struct gsm_bts *bts)
}
/* generate a cell channel list as per Section 10.5.2.1b of 04.08 */
-static int generate_bcch_chan_list(u_int8_t *chan_list, struct gsm_bts *bts, int si5)
+static int generate_bcch_chan_list(uint8_t *chan_list, struct gsm_bts *bts, int si5)
{
struct gsm_bts *cur_bts;
struct bitvec *bv;
@@ -226,7 +209,7 @@ static int generate_bcch_chan_list(u_int8_t *chan_list, struct gsm_bts *bts, int
return bitvec2freq_list(chan_list, bv, bts);
}
-static int generate_si1(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si1(uint8_t *output, struct gsm_bts *bts)
{
int rc;
struct gsm48_system_information_type_1 *si1 =
@@ -251,7 +234,7 @@ static int generate_si1(u_int8_t *output, struct gsm_bts *bts)
return sizeof(*si1) + rc;
}
-static int generate_si2(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si2(uint8_t *output, struct gsm_bts *bts)
{
int rc;
struct gsm48_system_information_type_2 *si2 =
@@ -298,7 +281,7 @@ static struct gsm48_si_ro_info si_info = {
.break_ind = 0,
};
-static int generate_si3(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si3(uint8_t *output, struct gsm_bts *bts)
{
int rc;
struct gsm48_system_information_type_3 *si3 =
@@ -329,7 +312,7 @@ static int generate_si3(u_int8_t *output, struct gsm_bts *bts)
return sizeof(*si3) + rc;
}
-static int generate_si4(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si4(uint8_t *output, struct gsm_bts *bts)
{
int rc;
struct gsm48_system_information_type_4 *si4 =
@@ -362,7 +345,7 @@ static int generate_si4(u_int8_t *output, struct gsm_bts *bts)
return sizeof(*si4) + rc;
}
-static int generate_si5(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si5(uint8_t *output, struct gsm_bts *bts)
{
struct gsm48_system_information_type_5 *si5;
int rc, l2_plen = 18;
@@ -394,7 +377,7 @@ static int generate_si5(u_int8_t *output, struct gsm_bts *bts)
return l2_plen;
}
-static int generate_si6(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si6(uint8_t *output, struct gsm_bts *bts)
{
struct gsm48_system_information_type_6 *si6;
int l2_plen = 11;
@@ -468,7 +451,7 @@ static struct gsm48_si13_info si13_default = {
},
};
-static int generate_si13(u_int8_t *output, struct gsm_bts *bts)
+static int generate_si13(uint8_t *output, struct gsm_bts *bts)
{
struct gsm48_system_information_type_13 *si13 =
(struct gsm48_system_information_type_13 *) output;
@@ -492,54 +475,6 @@ static int generate_si13(u_int8_t *output, struct gsm_bts *bts)
return sizeof (*si13) + ret;
}
-static const uint8_t sitype2rsl[_MAX_SYSINFO_TYPE] = {
- [SYSINFO_TYPE_1] = RSL_SYSTEM_INFO_1,
- [SYSINFO_TYPE_2] = RSL_SYSTEM_INFO_2,
- [SYSINFO_TYPE_3] = RSL_SYSTEM_INFO_3,
- [SYSINFO_TYPE_4] = RSL_SYSTEM_INFO_4,
- [SYSINFO_TYPE_5] = RSL_SYSTEM_INFO_5,
- [SYSINFO_TYPE_6] = RSL_SYSTEM_INFO_6,
- [SYSINFO_TYPE_7] = RSL_SYSTEM_INFO_7,
- [SYSINFO_TYPE_8] = RSL_SYSTEM_INFO_8,
- [SYSINFO_TYPE_9] = RSL_SYSTEM_INFO_9,
- [SYSINFO_TYPE_10] = RSL_SYSTEM_INFO_10,
- [SYSINFO_TYPE_13] = RSL_SYSTEM_INFO_13,
- [SYSINFO_TYPE_16] = RSL_SYSTEM_INFO_16,
- [SYSINFO_TYPE_17] = RSL_SYSTEM_INFO_17,
- [SYSINFO_TYPE_18] = RSL_SYSTEM_INFO_18,
- [SYSINFO_TYPE_19] = RSL_SYSTEM_INFO_19,
- [SYSINFO_TYPE_20] = RSL_SYSTEM_INFO_20,
- [SYSINFO_TYPE_2bis] = RSL_SYSTEM_INFO_2bis,
- [SYSINFO_TYPE_2ter] = RSL_SYSTEM_INFO_2ter,
- [SYSINFO_TYPE_2quater] = RSL_SYSTEM_INFO_2quater,
- [SYSINFO_TYPE_5bis] = RSL_SYSTEM_INFO_5bis,
- [SYSINFO_TYPE_5ter] = RSL_SYSTEM_INFO_5ter,
-};
-
-static const uint8_t rsl2sitype[0xff] = {
- [RSL_SYSTEM_INFO_1] = SYSINFO_TYPE_1,
- [RSL_SYSTEM_INFO_2] = SYSINFO_TYPE_2,
- [RSL_SYSTEM_INFO_3] = SYSINFO_TYPE_3,
- [RSL_SYSTEM_INFO_4] = SYSINFO_TYPE_4,
- [RSL_SYSTEM_INFO_5] = SYSINFO_TYPE_5,
- [RSL_SYSTEM_INFO_6] = SYSINFO_TYPE_6,
- [RSL_SYSTEM_INFO_7] = SYSINFO_TYPE_7,
- [RSL_SYSTEM_INFO_8] = SYSINFO_TYPE_8,
- [RSL_SYSTEM_INFO_9] = SYSINFO_TYPE_9,
- [RSL_SYSTEM_INFO_10] = SYSINFO_TYPE_10,
- [RSL_SYSTEM_INFO_13] = SYSINFO_TYPE_13,
- [RSL_SYSTEM_INFO_16] = SYSINFO_TYPE_16,
- [RSL_SYSTEM_INFO_17] = SYSINFO_TYPE_17,
- [RSL_SYSTEM_INFO_18] = SYSINFO_TYPE_18,
- [RSL_SYSTEM_INFO_19] = SYSINFO_TYPE_19,
- [RSL_SYSTEM_INFO_20] = SYSINFO_TYPE_20,
- [RSL_SYSTEM_INFO_2bis] = SYSINFO_TYPE_2bis,
- [RSL_SYSTEM_INFO_2ter] = SYSINFO_TYPE_2ter,
- [RSL_SYSTEM_INFO_2quater] = SYSINFO_TYPE_2quater,
- [RSL_SYSTEM_INFO_5bis] = SYSINFO_TYPE_5bis,
- [RSL_SYSTEM_INFO_5ter] = SYSINFO_TYPE_5ter,
-};
-
typedef int (*gen_si_fn_t)(uint8_t *output, struct gsm_bts *bts);
static const gen_si_fn_t gen_si_fn[_MAX_SYSINFO_TYPE] = {
@@ -552,41 +487,6 @@ static const gen_si_fn_t gen_si_fn[_MAX_SYSINFO_TYPE] = {
[SYSINFO_TYPE_13] = &generate_si13,
};
-const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE] = {
- { SYSINFO_TYPE_1, "1" },
- { SYSINFO_TYPE_2, "2" },
- { SYSINFO_TYPE_3, "3" },
- { SYSINFO_TYPE_4, "4" },
- { SYSINFO_TYPE_5, "5" },
- { SYSINFO_TYPE_6, "6" },
- { SYSINFO_TYPE_7, "7" },
- { SYSINFO_TYPE_8, "8" },
- { SYSINFO_TYPE_9, "9" },
- { SYSINFO_TYPE_10, "10" },
- { SYSINFO_TYPE_13, "13" },
- { SYSINFO_TYPE_16, "16" },
- { SYSINFO_TYPE_17, "17" },
- { SYSINFO_TYPE_18, "18" },
- { SYSINFO_TYPE_19, "19" },
- { SYSINFO_TYPE_20, "20" },
- { SYSINFO_TYPE_2bis, "2bis" },
- { SYSINFO_TYPE_2ter, "2ter" },
- { SYSINFO_TYPE_2quater, "2quater" },
- { SYSINFO_TYPE_5bis, "5bis" },
- { SYSINFO_TYPE_5ter, "5ter" },
- { 0, NULL }
-};
-
-uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type)
-{
- return sitype2rsl[si_type];
-}
-
-const char *gsm_sitype_name(enum osmo_sysinfo_type si_type)
-{
- return get_value_string(osmo_sitype_strs, si_type);
-}
-
int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type)
{
gen_si_fn_t gen_si;