aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmsc')
-rw-r--r--src/libmsc/Makefile.am3
-rw-r--r--src/libmsc/Makefile.in11
-rw-r--r--src/libmsc/auth.c6
-rw-r--r--src/libmsc/db.c28
-rw-r--r--src/libmsc/gsm_04_08.c167
-rw-r--r--src/libmsc/gsm_04_11.c138
-rw-r--r--src/libmsc/gsm_04_80.c16
-rw-r--r--src/libmsc/gsm_subscriber.c10
-rw-r--r--src/libmsc/mncc.c3
-rw-r--r--src/libmsc/mncc_builtin.c9
-rw-r--r--src/libmsc/mncc_sock.c36
-rw-r--r--src/libmsc/rrlp.c13
-rw-r--r--src/libmsc/silent_call.c12
-rw-r--r--src/libmsc/sms_queue.c18
-rw-r--r--src/libmsc/token_auth.c14
-rw-r--r--src/libmsc/transaction.c151
-rw-r--r--src/libmsc/vty_interface_layer3.c84
17 files changed, 441 insertions, 278 deletions
diff --git a/src/libmsc/Makefile.am b/src/libmsc/Makefile.am
index 7d895c39..8d5034c7 100644
--- a/src/libmsc/Makefile.am
+++ b/src/libmsc/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_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_CFLAGS) $(COVERAGE_LDFLAGS)
noinst_LIBRARIES = libmsc.a
@@ -15,5 +15,6 @@ libmsc_a_SOURCES = auth.c \
token_auth.c \
ussd.c \
vty_interface_layer3.c \
+ transaction.c \
osmo_msc.c
diff --git a/src/libmsc/Makefile.in b/src/libmsc/Makefile.in
index 1ebc0320..2214259d 100644
--- a/src/libmsc/Makefile.in
+++ b/src/libmsc/Makefile.in
@@ -35,7 +35,7 @@ POST_UNINSTALL = :
subdir = src/libmsc
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
@@ -58,7 +58,8 @@ am_libmsc_a_OBJECTS = auth.$(OBJEXT) db.$(OBJEXT) gsm_04_08.$(OBJEXT) \
gsm_subscriber.$(OBJEXT) mncc.$(OBJEXT) mncc_builtin.$(OBJEXT) \
mncc_sock.$(OBJEXT) rrlp.$(OBJEXT) silent_call.$(OBJEXT) \
sms_queue.$(OBJEXT) token_auth.$(OBJEXT) ussd.$(OBJEXT) \
- vty_interface_layer3.$(OBJEXT) osmo_msc.$(OBJEXT)
+ vty_interface_layer3.$(OBJEXT) transaction.$(OBJEXT) \
+ osmo_msc.$(OBJEXT)
libmsc_a_OBJECTS = $(am_libmsc_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -115,6 +116,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@
@@ -185,7 +188,7 @@ 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_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_CFLAGS) $(COVERAGE_LDFLAGS)
noinst_LIBRARIES = libmsc.a
libmsc_a_SOURCES = auth.c \
db.c \
@@ -198,6 +201,7 @@ libmsc_a_SOURCES = auth.c \
token_auth.c \
ussd.c \
vty_interface_layer3.c \
+ transaction.c \
osmo_msc.c
all: all-am
@@ -262,6 +266,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/silent_call.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sms_queue.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token_auth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transaction.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ussd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vty_interface_layer3.Po@am__quote@
diff --git a/src/libmsc/auth.c b/src/libmsc/auth.c
index e09bde5f..10d8edf6 100644
--- a/src/libmsc/auth.c
+++ b/src/libmsc/auth.c
@@ -25,7 +25,7 @@
#include <openbsc/auth.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/comp128.h>
+#include <osmocom/gsm/comp128.h>
#include <stdlib.h>
@@ -38,7 +38,7 @@ _use_xor(struct gsm_auth_info *ainfo, struct gsm_auth_tuple *atuple)
if ((l > A38_XOR_MAX_KEY_LEN) || (l < A38_XOR_MIN_KEY_LEN)) {
LOGP(DMM, LOGL_ERROR, "Invalid XOR key (len=%d) %s\n",
ainfo->a3a8_ki_len,
- hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len));
+ osmo_hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len));
return -1;
}
@@ -56,7 +56,7 @@ _use_comp128_v1(struct gsm_auth_info *ainfo, struct gsm_auth_tuple *atuple)
if (ainfo->a3a8_ki_len != A38_COMP128_KEY_LEN) {
LOGP(DMM, LOGL_ERROR, "Invalid COMP128v1 key (len=%d) %s\n",
ainfo->a3a8_ki_len,
- hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len));
+ osmo_hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len));
return -1;
}
diff --git a/src/libmsc/db.c b/src/libmsc/db.c
index 95a7d36f..1ddd3fdf 100644
--- a/src/libmsc/db.c
+++ b/src/libmsc/db.c
@@ -34,9 +34,9 @@
#include <openbsc/db.h>
#include <openbsc/debug.h>
-#include <osmocore/talloc.h>
-#include <osmocore/statistics.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/statistics.h>
+#include <osmocom/core/rate_ctr.h>
static char *db_basename = NULL;
static char *db_dirname = NULL;
@@ -297,7 +297,7 @@ struct gsm_subscriber *db_create_subscriber(struct gsm_network *net, char *imsi)
return subscr;
}
-static_assert(sizeof(unsigned char) == sizeof(struct gsm48_classmark1), classmark1_size);
+osmo_static_assert(sizeof(unsigned char) == sizeof(struct gsm48_classmark1), classmark1_size);
static int get_equipment_by_subscr(struct gsm_subscriber *subscr)
{
@@ -737,17 +737,17 @@ int db_sync_equipment(struct gsm_equipment *equip)
dbi_result result;
unsigned char *cm2, *cm3;
char *q_imei;
- u_int8_t classmark1;
+ uint8_t classmark1;
memcpy(&classmark1, &equip->classmark1, sizeof(classmark1));
DEBUGP(DDB, "Sync Equipment IMEI=%s, classmark1=%02x",
equip->imei, classmark1);
if (equip->classmark2_len)
DEBUGPC(DDB, ", classmark2=%s",
- hexdump(equip->classmark2, equip->classmark2_len));
+ osmo_hexdump(equip->classmark2, equip->classmark2_len));
if (equip->classmark3_len)
DEBUGPC(DDB, ", classmark3=%s",
- hexdump(equip->classmark3, equip->classmark3_len));
+ osmo_hexdump(equip->classmark3, equip->classmark3_len));
DEBUGPC(DDB, "\n");
dbi_conn_quote_binary_copy(conn, equip->classmark2,
@@ -821,7 +821,7 @@ int db_subscriber_alloc_tmsi(struct gsm_subscriber *subscriber)
int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber)
{
dbi_result result = NULL;
- u_int32_t try;
+ uint32_t try;
for (;;) {
try = (rand()%(GSM_MAX_EXTEN-GSM_MIN_EXTEN+1)+GSM_MIN_EXTEN);
@@ -855,10 +855,10 @@ int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber)
* an error.
*/
-int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, u_int32_t *token)
+int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t *token)
{
dbi_result result;
- u_int32_t try;
+ uint32_t try;
for (;;) {
try = rand();
@@ -1060,7 +1060,7 @@ static struct gsm_sms *sms_from_result(struct gsm_network *net, dbi_result resul
sms->user_data_len = dbi_result_get_field_length(result, "user_data");
user_data = dbi_result_get_binary(result, "user_data");
if (sms->user_data_len > sizeof(sms->user_data))
- sms->user_data_len = (u_int8_t) sizeof(sms->user_data);
+ sms->user_data_len = (uint8_t) sizeof(sms->user_data);
memcpy(sms->user_data, user_data, sms->user_data_len);
text = dbi_result_get_string(result, "text");
@@ -1219,8 +1219,8 @@ int db_sms_inc_deliver_attempts(struct gsm_sms *sms)
}
int db_apdu_blob_store(struct gsm_subscriber *subscr,
- u_int8_t apdu_id_flags, u_int8_t len,
- u_int8_t *apdu)
+ uint8_t apdu_id_flags, uint8_t len,
+ uint8_t *apdu)
{
dbi_result result;
unsigned char *q_apdu;
@@ -1242,7 +1242,7 @@ int db_apdu_blob_store(struct gsm_subscriber *subscr,
return 0;
}
-int db_store_counter(struct counter *ctr)
+int db_store_counter(struct osmo_counter *ctr)
{
dbi_result result;
char *q_name;
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 2b61aa9b..a6ed3e83 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -49,31 +49,31 @@
#include <openbsc/silent_call.h>
#include <openbsc/bsc_api.h>
#include <openbsc/osmo_msc.h>
-#include <osmocore/bitvec.h>
+#include <osmocom/core/bitvec.h>
-#include <osmocore/gsm48.h>
-#include <osmocore/gsm0480.h>
-#include <osmocore/gsm_utils.h>
-#include <osmocore/msgb.h>
-#include <osmocore/talloc.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/gsm48.h>
+#include <osmocom/gsm/gsm0480.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/gsm/tlv.h>
void *tall_locop_ctx;
void *tall_authciphop_ctx;
-int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, u_int32_t tmsi);
+int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, uint32_t tmsi);
static int gsm48_tx_simple(struct gsm_subscriber_connection *conn,
- u_int8_t pdisc, u_int8_t msg_type);
+ uint8_t pdisc, uint8_t msg_type);
static void schedule_reject(struct gsm_subscriber_connection *conn);
static void release_anchor(struct gsm_subscriber_connection *conn);
struct gsm_lai {
- u_int16_t mcc;
- u_int16_t mnc;
- u_int16_t lac;
+ uint16_t mcc;
+ uint16_t mnc;
+ uint16_t lac;
};
-static u_int32_t new_callref = 0x80000001;
+static uint32_t new_callref = 0x80000001;
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg)
{
@@ -243,7 +243,7 @@ static void release_loc_updating_req(struct gsm_subscriber_connection *conn)
/* No need to keep the connection up */
release_anchor(conn);
- bsc_del_timer(&conn->loc_operation->updating_timer);
+ osmo_timer_del(&conn->loc_operation->updating_timer);
talloc_free(conn->loc_operation);
conn->loc_operation = NULL;
msc_release_connection(conn);
@@ -356,12 +356,12 @@ void gsm0408_clear_all_trans(struct gsm_network *net, int protocol)
}
/* Chapter 9.2.14 : Send LOCATION UPDATING REJECT */
-int gsm0408_loc_upd_rej(struct gsm_subscriber_connection *conn, u_int8_t cause)
+int gsm0408_loc_upd_rej(struct gsm_subscriber_connection *conn, uint8_t cause)
{
struct gsm_bts *bts = conn->bts;
struct msgb *msg;
- counter_inc(bts->network->stats.loc_upd_resp.reject);
+ osmo_counter_inc(bts->network->stats.loc_upd_resp.reject);
msg = gsm48_create_loc_upd_rej(cause);
if (!msg) {
@@ -380,13 +380,13 @@ int gsm0408_loc_upd_rej(struct gsm_subscriber_connection *conn, u_int8_t cause)
}
/* Chapter 9.2.13 : Send LOCATION UPDATE ACCEPT */
-int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, u_int32_t tmsi)
+int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, uint32_t tmsi)
{
struct gsm_bts *bts = conn->bts;
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
struct gsm48_loc_area_id *lai;
- u_int8_t *mid;
+ uint8_t *mid;
msg->lchan = conn->lchan;
@@ -403,13 +403,13 @@ int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, u_int32_t tmsi)
DEBUGP(DMM, "-> LOCATION UPDATE ACCEPT\n");
- counter_inc(bts->network->stats.loc_upd_resp.accept);
+ osmo_counter_inc(bts->network->stats.loc_upd_resp.accept);
return gsm48_conn_sendmsg(msg, conn, NULL);
}
/* Transmit Chapter 9.2.10 Identity Request */
-static int mm_tx_identity_req(struct gsm_subscriber_connection *conn, u_int8_t id_type)
+static int mm_tx_identity_req(struct gsm_subscriber_connection *conn, uint8_t id_type)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
@@ -432,14 +432,14 @@ static int mm_rx_id_resp(struct gsm_subscriber_connection *conn, struct msgb *ms
struct gsm_lchan *lchan = msg->lchan;
struct gsm_bts *bts = lchan->ts->trx->bts;
struct gsm_network *net = bts->network;
- u_int8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK;
+ uint8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK;
char mi_string[GSM48_MI_SIZE];
gsm48_mi_to_string(mi_string, sizeof(mi_string), &gh->data[1], gh->data[0]);
DEBUGP(DMM, "IDENTITY RESPONSE: mi_type=0x%02x MI(%s)\n",
mi_type, mi_string);
- dispatch_signal(SS_SUBSCR, S_SUBSCR_IDENTITY, gh->data);
+ osmo_signal_dispatch(SS_SUBSCR, S_SUBSCR_IDENTITY, gh->data);
switch (mi_type) {
case GSM_MI_TYPE_IMSI:
@@ -483,10 +483,10 @@ static void schedule_reject(struct gsm_subscriber_connection *conn)
{
conn->loc_operation->updating_timer.cb = loc_upd_rej_cb;
conn->loc_operation->updating_timer.data = conn;
- bsc_schedule_timer(&conn->loc_operation->updating_timer, 5, 0);
+ osmo_timer_schedule(&conn->loc_operation->updating_timer, 5, 0);
}
-static const char *lupd_name(u_int8_t type)
+static const char *lupd_name(uint8_t type)
{
switch (type) {
case GSM48_LUPD_NORMAL:
@@ -507,7 +507,7 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
struct gsm48_loc_upd_req *lu;
struct gsm_subscriber *subscr = NULL;
struct gsm_bts *bts = conn->bts;
- u_int8_t mi_type;
+ uint8_t mi_type;
char mi_string[GSM48_MI_SIZE];
int rc;
@@ -520,17 +520,17 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
DEBUGPC(DMM, "mi_type=0x%02x MI(%s) type=%s ", mi_type, mi_string,
lupd_name(lu->type));
- dispatch_signal(SS_SUBSCR, S_SUBSCR_IDENTITY, &lu->mi_len);
+ osmo_signal_dispatch(SS_SUBSCR, S_SUBSCR_IDENTITY, &lu->mi_len);
switch (lu->type) {
case GSM48_LUPD_NORMAL:
- counter_inc(bts->network->stats.loc_upd_type.normal);
+ osmo_counter_inc(bts->network->stats.loc_upd_type.normal);
break;
case GSM48_LUPD_IMSI_ATT:
- counter_inc(bts->network->stats.loc_upd_type.attach);
+ osmo_counter_inc(bts->network->stats.loc_upd_type.attach);
break;
case GSM48_LUPD_PERIODIC:
- counter_inc(bts->network->stats.loc_upd_type.periodic);
+ osmo_counter_inc(bts->network->stats.loc_upd_type.periodic);
break;
}
@@ -604,7 +604,7 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
}
#if 0
-static u_int8_t to_bcd8(u_int8_t val)
+static uint8_t to_bcd8(uint8_t val)
{
return ((val / 10) << 4) | (val % 10);
}
@@ -616,7 +616,7 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn)
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
struct gsm_network *net = conn->bts->network;
- u_int8_t *ptr8;
+ uint8_t *ptr8;
int name_len, name_pad;
#if 0
time_t cur_t;
@@ -639,7 +639,7 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn)
ptr8[1] = name_len*2 +1;
ptr8[2] = 0x90; /* UCS2, no spare bits, no CI */
- ptr16 = (u_int16_t *) msgb_put(msg, name_len*2);
+ ptr16 = (uint16_t *) msgb_put(msg, name_len*2);
for (i = 0; i < name_len; i++)
ptr16[i] = htons(net->name_long[i]);
@@ -665,12 +665,12 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn)
#if 0
name_len = strlen(net->name_short);
/* 10.5.3.5a */
- ptr8 = (u_int8_t *) msgb_put(msg, 3);
+ ptr8 = (uint8_t *) msgb_put(msg, 3);
ptr8[0] = GSM48_IE_NAME_SHORT;
ptr8[1] = name_len*2 + 1;
ptr8[2] = 0x90; /* UCS2, no spare bits, no CI */
- ptr16 = (u_int16_t *) msgb_put(msg, name_len*2);
+ ptr16 = (uint16_t *) msgb_put(msg, name_len*2);
for (i = 0; i < name_len; i++)
ptr16[i] = htons(net->name_short[i]);
#endif
@@ -679,7 +679,7 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn)
if (name_pad > 0)
name_len++;
/* 10.5.3.5a */
- ptr8 = (u_int8_t *) msgb_put(msg, 3);
+ ptr8 = (uint8_t *) msgb_put(msg, 3);
ptr8[0] = GSM48_IE_NAME_SHORT;
ptr8[1] = name_len +1;
ptr8[2] = 0x80 | name_pad; /* Cell Broadcast DCS, no CI */
@@ -714,13 +714,13 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn)
}
/* Section 9.2.2 */
-int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, u_int8_t *rand, int key_seq)
+int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
struct gsm48_auth_req *ar = (struct gsm48_auth_req *) msgb_put(msg, sizeof(*ar));
- DEBUGP(DMM, "-> AUTH REQ (rand = %s)\n", hexdump(rand, 16));
+ DEBUGP(DMM, "-> AUTH REQ (rand = %s)\n", osmo_hexdump(rand, 16));
msg->lchan = conn->lchan;
gh->proto_discr = GSM48_PDISC_MM;
@@ -804,7 +804,7 @@ static int _gsm48_rx_mm_serv_req_sec_cb(
*/
static int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
- u_int8_t mi_type;
+ uint8_t mi_type;
char mi_string[GSM48_MI_SIZE];
struct gsm_bts *bts = conn->bts;
@@ -813,10 +813,10 @@ static int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct m
struct gsm48_service_request *req =
(struct gsm48_service_request *)gh->data;
/* unfortunately in Phase1 the classmark2 length is variable */
- u_int8_t classmark2_len = gh->data[1];
- u_int8_t *classmark2 = gh->data+2;
- u_int8_t mi_len = *(classmark2 + classmark2_len);
- u_int8_t *mi = (classmark2 + classmark2_len + 1);
+ uint8_t classmark2_len = gh->data[1];
+ uint8_t *classmark2 = gh->data+2;
+ uint8_t mi_len = *(classmark2 + classmark2_len);
+ uint8_t *mi = (classmark2 + classmark2_len + 1);
DEBUGP(DMM, "<- CM SERVICE REQUEST ");
if (msg->data_len < sizeof(struct gsm48_service_request*)) {
@@ -842,7 +842,7 @@ static int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct m
DEBUGPC(DMM, "serv_type=0x%02x mi_type=0x%02x M(%s)\n",
req->cm_service_type, mi_type, mi_string);
- dispatch_signal(SS_SUBSCR, S_SUBSCR_IDENTITY, (classmark2 + classmark2_len));
+ osmo_signal_dispatch(SS_SUBSCR, S_SUBSCR_IDENTITY, (classmark2 + classmark2_len));
if (is_siemens_bts(bts))
send_siemens_mrpci(msg->lchan, classmark2-1);
@@ -878,7 +878,7 @@ static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
struct gsm48_hdr *gh = msgb_l3(msg);
struct gsm48_imsi_detach_ind *idi =
(struct gsm48_imsi_detach_ind *) gh->data;
- u_int8_t mi_type = idi->mi[0] & GSM_MI_TYPE_MASK;
+ uint8_t mi_type = idi->mi[0] & GSM_MI_TYPE_MASK;
char mi_string[GSM48_MI_SIZE];
struct gsm_subscriber *subscr = NULL;
@@ -886,7 +886,7 @@ static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
DEBUGP(DMM, "IMSI DETACH INDICATION: mi_type=0x%02x MI(%s): ",
mi_type, mi_string);
- counter_inc(bts->network->stats.loc_upd_type.detach);
+ osmo_counter_inc(bts->network->stats.loc_upd_type.detach);
switch (mi_type) {
case GSM_MI_TYPE_TMSI:
@@ -942,7 +942,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct
struct gsm_network *net = conn->bts->network;
DEBUGP(DMM, "MM AUTHENTICATION RESPONSE (sres = %s): ",
- hexdump(ar->sres, 4));
+ osmo_hexdump(ar->sres, 4));
/* Safety check */
if (!conn->sec_operation) {
@@ -956,7 +956,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct
gsm_cbfn *cb = conn->sec_operation->cb;
DEBUGPC(DMM, "Invalid (expected %s)\n",
- hexdump(conn->sec_operation->atuple.sres, 4));
+ osmo_hexdump(conn->sec_operation->atuple.sres, 4));
if (cb)
cb(GSM_HOOK_RR_SECURITY, GSM_SECURITY_AUTH_FAILED,
@@ -1025,8 +1025,8 @@ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct m
struct gsm_bts *bts = conn->bts;
struct gsm48_hdr *gh = msgb_l3(msg);
struct gsm48_pag_resp *resp;
- u_int8_t *classmark2_lv = gh->data + 1;
- u_int8_t mi_type;
+ uint8_t *classmark2_lv = gh->data + 1;
+ uint8_t mi_type;
char mi_string[GSM48_MI_SIZE];
struct gsm_subscriber *subscr = NULL;
int rc = 0;
@@ -1068,8 +1068,8 @@ static int gsm48_rx_rr_classmark(struct gsm_subscriber_connection *conn, struct
struct gsm48_hdr *gh = msgb_l3(msg);
struct gsm_subscriber *subscr = conn->subscr;
unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
- u_int8_t cm2_len, cm3_len = 0;
- u_int8_t *cm2, *cm3 = NULL;
+ uint8_t cm2_len, cm3_len = 0;
+ uint8_t *cm2, *cm3 = NULL;
DEBUGP(DRR, "CLASSMARK CHANGE ");
@@ -1136,16 +1136,16 @@ static int gsm48_rx_rr_meas_rep(struct msgb *msg)
static int gsm48_rx_rr_app_info(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t apdu_id_flags;
- u_int8_t apdu_len;
- u_int8_t *apdu_data;
+ uint8_t apdu_id_flags;
+ uint8_t apdu_len;
+ uint8_t *apdu_data;
apdu_id_flags = gh->data[0];
apdu_len = gh->data[1];
apdu_data = gh->data+2;
DEBUGP(DNM, "RX APPLICATION INFO id/flags=0x%02x apdu_len=%u apdu=%s",
- apdu_id_flags, apdu_len, hexdump(apdu_data, apdu_len));
+ apdu_id_flags, apdu_len, osmo_hexdump(apdu_data, apdu_len));
return db_apdu_blob_store(conn->subscr, apdu_id_flags, apdu_len, apdu_data);
}
@@ -1190,7 +1190,7 @@ static int gsm48_rx_rr_ho_compl(struct msgb *msg)
sig.lchan = msg->lchan;
sig.mr = NULL;
- dispatch_signal(SS_LCHAN, S_LCHAN_HANDOVER_COMPL, &sig);
+ osmo_signal_dispatch(SS_LCHAN, S_LCHAN_HANDOVER_COMPL, &sig);
/* FIXME: release old channel */
return 0;
@@ -1207,7 +1207,7 @@ static int gsm48_rx_rr_ho_fail(struct msgb *msg)
sig.lchan = msg->lchan;
sig.mr = NULL;
- dispatch_signal(SS_LCHAN, S_LCHAN_HANDOVER_FAIL, &sig);
+ osmo_signal_dispatch(SS_LCHAN, S_LCHAN_HANDOVER_FAIL, &sig);
/* FIXME: release allocated new channel */
return 0;
@@ -1256,8 +1256,8 @@ static int gsm0408_rcv_rr(struct gsm_subscriber_connection *conn, struct msgb *m
return rc;
}
-int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, u_int8_t apdu_id,
- u_int8_t apdu_len, const u_int8_t *apdu)
+int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id,
+ uint8_t apdu_len, const uint8_t *apdu)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
@@ -1300,7 +1300,7 @@ static int gsm48_cc_tx_status(struct gsm_trans *trans, void *arg)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
- u_int8_t *cause, *call_state;
+ uint8_t *cause, *call_state;
gh->msg_type = GSM48_MT_CC_STATUS;
@@ -1316,7 +1316,7 @@ static int gsm48_cc_tx_status(struct gsm_trans *trans, void *arg)
}
static int gsm48_tx_simple(struct gsm_subscriber_connection *conn,
- u_int8_t pdisc, u_int8_t msg_type)
+ uint8_t pdisc, uint8_t msg_type)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
@@ -1331,9 +1331,9 @@ static int gsm48_tx_simple(struct gsm_subscriber_connection *conn,
static void gsm48_stop_cc_timer(struct gsm_trans *trans)
{
- if (bsc_timer_pending(&trans->cc.timer)) {
+ if (osmo_timer_pending(&trans->cc.timer)) {
DEBUGP(DCC, "stopping pending timer T%x\n", trans->cc.Tcurrent);
- bsc_del_timer(&trans->cc.timer);
+ osmo_timer_del(&trans->cc.timer);
trans->cc.Tcurrent = 0;
}
}
@@ -1377,7 +1377,7 @@ static int mncc_recvmsg(struct gsm_network *net, struct gsm_trans *trans,
}
int mncc_release_ind(struct gsm_network *net, struct gsm_trans *trans,
- u_int32_t callref, int location, int value)
+ uint32_t callref, int location, int value)
{
struct gsm_mncc rel;
@@ -1475,7 +1475,7 @@ static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event,
return 0;
}
-static int tch_recv_mncc(struct gsm_network *net, u_int32_t callref, int enable);
+static int tch_recv_mncc(struct gsm_network *net, uint32_t callref, int enable);
/* handle audio path for handover */
static int handle_ho_signal(unsigned int subsys, unsigned int signal,
@@ -1633,6 +1633,7 @@ static int tch_map(struct gsm_lchan *lchan, struct gsm_lchan *remote_lchan)
}
break;
case GSM_BTS_TYPE_BS11:
+ case GSM_BTS_TYPE_RBS2000:
trau_mux_map_lchan(lchan, remote_lchan);
break;
default:
@@ -1644,7 +1645,7 @@ static int tch_map(struct gsm_lchan *lchan, struct gsm_lchan *remote_lchan)
}
/* bridge channels of two transactions */
-static int tch_bridge(struct gsm_network *net, u_int32_t *refs)
+static int tch_bridge(struct gsm_network *net, uint32_t *refs)
{
struct gsm_trans *trans1 = trans_find_by_callref(net, refs[0]);
struct gsm_trans *trans2 = trans_find_by_callref(net, refs[1]);
@@ -1660,7 +1661,7 @@ static int tch_bridge(struct gsm_network *net, u_int32_t *refs)
}
/* enable receive of channels to MNCC upqueue */
-static int tch_recv_mncc(struct gsm_network *net, u_int32_t callref, int enable)
+static int tch_recv_mncc(struct gsm_network *net, uint32_t callref, int enable)
{
struct gsm_trans *trans;
struct gsm_lchan *lchan;
@@ -1702,6 +1703,7 @@ static int tch_recv_mncc(struct gsm_network *net, u_int32_t callref, int enable)
net, 0);
break;
case GSM_BTS_TYPE_BS11:
+ case GSM_BTS_TYPE_RBS2000:
if (enable)
return trau_recv_lchan(lchan, callref);
return trau_mux_unmap(NULL, callref);
@@ -1814,14 +1816,14 @@ static void gsm48_start_cc_timer(struct gsm_trans *trans, int current,
DEBUGP(DCC, "starting timer T%x with %d seconds\n", current, sec);
trans->cc.timer.cb = gsm48_cc_timeout;
trans->cc.timer.data = trans;
- bsc_schedule_timer(&trans->cc.timer, sec, micro);
+ osmo_timer_schedule(&trans->cc.timer, sec, micro);
trans->cc.Tcurrent = current;
}
static int gsm48_cc_rx_setup(struct gsm_trans *trans, struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t msg_type = gh->msg_type & 0xbf;
+ uint8_t msg_type = gh->msg_type & 0xbf;
unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
struct tlv_parsed tp;
struct gsm_mncc setup;
@@ -1890,7 +1892,7 @@ static int gsm48_cc_rx_setup(struct gsm_trans *trans, struct msgb *msg)
subscr_name(trans->subscr), trans->subscr->extension,
setup.called.number);
- counter_inc(trans->subscr->net->stats.call.mo_setup);
+ osmo_counter_inc(trans->subscr->net->stats.call.mo_setup);
/* indicate setup to MNCC */
mncc_recvmsg(trans->subscr->net, trans, MNCC_SETUP_IND, &setup);
@@ -1967,7 +1969,7 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
new_cc_state(trans, GSM_CSTATE_CALL_PRESENT);
- counter_inc(trans->subscr->net->stats.call.mt_setup);
+ osmo_counter_inc(trans->subscr->net->stats.call.mt_setup);
return gsm48_conn_sendmsg(msg, trans->conn, trans);
}
@@ -2188,7 +2190,7 @@ static int gsm48_cc_rx_connect(struct gsm_trans *trans, struct msgb *msg)
}
new_cc_state(trans, GSM_CSTATE_CONNECT_REQUEST);
- counter_inc(trans->subscr->net->stats.call.mt_connect);
+ osmo_counter_inc(trans->subscr->net->stats.call.mt_connect);
return mncc_recvmsg(trans->subscr->net, trans, MNCC_SETUP_CNF, &connect);
}
@@ -2201,7 +2203,7 @@ static int gsm48_cc_rx_connect_ack(struct gsm_trans *trans, struct msgb *msg)
gsm48_stop_cc_timer(trans);
new_cc_state(trans, GSM_CSTATE_ACTIVE);
- counter_inc(trans->subscr->net->stats.call.mo_connect_ack);
+ osmo_counter_inc(trans->subscr->net->stats.call.mo_connect_ack);
memset(&connect_ack, 0, sizeof(struct gsm_mncc));
connect_ack.callref = trans->callref;
@@ -2880,7 +2882,7 @@ static int _gsm48_lchan_modify(struct gsm_trans *trans, void *arg)
}
static struct downstate {
- u_int32_t states;
+ uint32_t states;
int type;
int (*rout) (struct gsm_trans *trans, void *arg);
} downstatelist[] = {
@@ -2986,6 +2988,7 @@ int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg)
}
return rtp_send_frame(trans->conn->lchan->abis_ip.rtp_socket, arg);
case GSM_BTS_TYPE_BS11:
+ case GSM_BTS_TYPE_RBS2000:
return trau_send_frame(trans->conn->lchan, arg);
default:
DEBUGP(DCC, "Unknown BTS type %u\n", bts->type);
@@ -3151,7 +3154,7 @@ int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg)
static struct datastate {
- u_int32_t states;
+ uint32_t states;
int type;
int (*rout) (struct gsm_trans *trans, struct msgb *msg);
} datastatelist[] = {
@@ -3207,8 +3210,8 @@ static struct datastate {
static int gsm0408_rcv_cc(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t msg_type = gh->msg_type & 0xbf;
- u_int8_t transaction_id = ((gh->proto_discr & 0xf0) ^ 0x80) >> 4; /* flip */
+ uint8_t msg_type = gh->msg_type & 0xbf;
+ uint8_t transaction_id = ((gh->proto_discr & 0xf0) ^ 0x80) >> 4; /* flip */
struct gsm_trans *trans = NULL;
int i, rc = 0;
@@ -3266,7 +3269,7 @@ static void release_anchor(struct gsm_subscriber_connection *conn)
if (!conn->anch_operation)
return;
- bsc_del_timer(&conn->anch_operation->timeout);
+ osmo_timer_del(&conn->anch_operation->timeout);
talloc_free(conn->anch_operation);
conn->anch_operation = NULL;
}
@@ -3287,7 +3290,7 @@ int gsm0408_new_conn(struct gsm_subscriber_connection *conn)
conn->anch_operation->timeout.data = conn;
conn->anch_operation->timeout.cb = anchor_timeout;
- bsc_schedule_timer(&conn->anch_operation->timeout, 5, 0);
+ osmo_timer_schedule(&conn->anch_operation->timeout, 5, 0);
return 0;
}
@@ -3295,7 +3298,7 @@ int gsm0408_new_conn(struct gsm_subscriber_connection *conn)
int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t pdisc = gh->proto_discr & 0x0f;
+ uint8_t pdisc = gh->proto_discr & 0x0f;
int rc = 0;
if (silent_call_reroute(conn, msg))
@@ -3340,6 +3343,6 @@ int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg)
*/
static __attribute__((constructor)) void on_dso_load_0408(void)
{
- register_signal_handler(SS_HO, handle_ho_signal, NULL);
- register_signal_handler(SS_ABISIP, handle_abisip_signal, NULL);
+ osmo_signal_register_handler(SS_HO, handle_ho_signal, NULL);
+ osmo_signal_register_handler(SS_ABISIP, handle_abisip_signal, NULL);
}
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 812e758c..ba72c37b 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -32,19 +32,19 @@
#include <time.h>
#include <netinet/in.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/db.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/gsm_04_11.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/signal.h>
#include <openbsc/db.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/transaction.h>
#include <openbsc/paging.h>
#include <openbsc/bsc_rll.h>
@@ -55,7 +55,7 @@
#define GSM411_ALLOC_HEADROOM 128
void *tall_gsms_ctx;
-static u_int32_t new_callref = 0x40000001;
+static uint32_t new_callref = 0x40000001;
static const struct value_string cp_cause_strs[] = {
{ GSM411_CP_CAUSE_NET_FAIL, "Network Failure" },
@@ -151,7 +151,7 @@ static void send_signal(int sig_no,
sig.trans = trans;
sig.sms = sms;
sig.paging_result = paging_result;
- dispatch_signal(SS_SMS, sig_no, &sig);
+ osmo_signal_dispatch(SS_SMS, sig_no, &sig);
}
/*
@@ -173,9 +173,9 @@ struct msgb *gsm411_msgb_alloc(void)
"GSM 04.11");
}
-static int gsm411_sendmsg(struct gsm_subscriber_connection *conn, struct msgb *msg, u_int8_t link_id)
+static int gsm411_sendmsg(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t link_id)
{
- DEBUGP(DSMS, "GSM4.11 TX %s\n", hexdump(msg->data, msg->len));
+ DEBUGP(DSMS, "GSM4.11 TX %s\n", osmo_hexdump(msg->data, msg->len));
msg->l3h = msg->data;
return gsm0808_submit_dtap(conn, msg, link_id, 1);
}
@@ -192,7 +192,7 @@ static void cp_timer_expired(void *data)
/* Prefix msg with a 04.08/04.11 CP header */
static int gsm411_cp_sendmsg(struct msgb *msg, struct gsm_trans *trans,
- u_int8_t msg_type)
+ uint8_t msg_type)
{
struct gsm48_hdr *gh;
@@ -210,7 +210,7 @@ static int gsm411_cp_sendmsg(struct msgb *msg, struct gsm_trans *trans,
trans->sms.cp_timer.data = trans;
trans->sms.cp_timer.cb = cp_timer_expired;
/* 5.3.2.1: Set Timer TC1A */
- bsc_schedule_timer(&trans->sms.cp_timer, GSM411_TMR_TC1A);
+ osmo_timer_schedule(&trans->sms.cp_timer, GSM411_TMR_TC1A);
DEBUGP(DSMS, "TX: CP-DATA ");
break;
case GSM411_MT_CP_ACK:
@@ -228,10 +228,10 @@ static int gsm411_cp_sendmsg(struct msgb *msg, struct gsm_trans *trans,
/* Prefix msg with a RP-DATA header and send as CP-DATA */
static int gsm411_rp_sendmsg(struct msgb *msg, struct gsm_trans *trans,
- u_int8_t rp_msg_type, u_int8_t rp_msg_ref)
+ uint8_t rp_msg_type, uint8_t rp_msg_ref)
{
struct gsm411_rp_hdr *rp;
- u_int8_t len = msg->len;
+ uint8_t len = msg->len;
/* GSM 04.11 RP-DATA header */
rp = (struct gsm411_rp_hdr *)msgb_push(msg, sizeof(*rp));
@@ -243,9 +243,9 @@ static int gsm411_rp_sendmsg(struct msgb *msg, struct gsm_trans *trans,
}
/* Turn int into semi-octet representation: 98 => 0x89 */
-static u_int8_t bcdify(u_int8_t value)
+static uint8_t bcdify(uint8_t value)
{
- u_int8_t ret;
+ uint8_t ret;
ret = value / 10;
ret |= (value % 10) << 4;
@@ -254,9 +254,9 @@ static u_int8_t bcdify(u_int8_t value)
}
/* Turn semi-octet representation into int: 0x89 => 98 */
-static u_int8_t unbcdify(u_int8_t value)
+static uint8_t unbcdify(uint8_t value)
{
- u_int8_t ret;
+ uint8_t ret;
if ((value & 0x0F) > 9 || (value >> 4) > 9)
LOGP(DSMS, LOGL_ERROR,
@@ -269,7 +269,7 @@ static u_int8_t unbcdify(u_int8_t value)
}
/* Generate 03.40 TP-SCTS */
-static void gsm340_gen_scts(u_int8_t *scts, time_t time)
+static void gsm340_gen_scts(uint8_t *scts, time_t time)
{
struct tm *tm = localtime(&time);
@@ -283,11 +283,11 @@ static void gsm340_gen_scts(u_int8_t *scts, time_t time)
}
/* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */
-static time_t gsm340_scts(u_int8_t *scts)
+static time_t gsm340_scts(uint8_t *scts)
{
struct tm tm;
- u_int8_t yr = unbcdify(*scts++);
+ uint8_t yr = unbcdify(*scts++);
if (yr <= 80)
tm.tm_year = 100 + yr;
@@ -315,10 +315,10 @@ static unsigned long gsm340_vp_default(void)
}
/* Decode validity period format 'relative' */
-static unsigned long gsm340_vp_relative(u_int8_t *sms_vp)
+static unsigned long gsm340_vp_relative(uint8_t *sms_vp)
{
/* Chapter 9.2.3.12.1 */
- u_int8_t vp;
+ uint8_t vp;
unsigned long minutes;
vp = *(sms_vp);
@@ -334,7 +334,7 @@ static unsigned long gsm340_vp_relative(u_int8_t *sms_vp)
}
/* Decode validity period format 'absolute' */
-static unsigned long gsm340_vp_absolute(u_int8_t *sms_vp)
+static unsigned long gsm340_vp_absolute(uint8_t *sms_vp)
{
/* Chapter 9.2.3.12.2 */
time_t expires, now;
@@ -350,9 +350,9 @@ static unsigned long gsm340_vp_absolute(u_int8_t *sms_vp)
}
/* Decode validity period format 'relative in integer representation' */
-static unsigned long gsm340_vp_relative_integer(u_int8_t *sms_vp)
+static unsigned long gsm340_vp_relative_integer(uint8_t *sms_vp)
{
- u_int8_t vp;
+ uint8_t vp;
unsigned long minutes;
vp = *(sms_vp);
if (vp == 0) {
@@ -365,7 +365,7 @@ static unsigned long gsm340_vp_relative_integer(u_int8_t *sms_vp)
}
/* Decode validity period format 'relative in semi-octet representation' */
-static unsigned long gsm340_vp_relative_semioctet(u_int8_t *sms_vp)
+static unsigned long gsm340_vp_relative_semioctet(uint8_t *sms_vp)
{
unsigned long minutes;
minutes = unbcdify(*sms_vp++)*60; /* hours */
@@ -375,9 +375,9 @@ static unsigned long gsm340_vp_relative_semioctet(u_int8_t *sms_vp)
}
/* decode validity period. return minutes */
-static unsigned long gsm340_validity_period(u_int8_t sms_vpf, u_int8_t *sms_vp)
+static unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp)
{
- u_int8_t fi; /* functionality indicator */
+ uint8_t fi; /* functionality indicator */
switch (sms_vpf) {
case GSM340_TP_VPF_RELATIVE:
@@ -413,9 +413,9 @@ static unsigned long gsm340_validity_period(u_int8_t sms_vpf, u_int8_t *sms_vp)
}
/* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */
-enum sms_alphabet gsm338_get_sms_alphabet(u_int8_t dcs)
+enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs)
{
- u_int8_t cgbits = dcs >> 4;
+ uint8_t cgbits = dcs >> 4;
enum sms_alphabet alpha = DCS_NONE;
if ((cgbits & 0xc) == 0) {
@@ -463,7 +463,7 @@ static int gsm340_rx_sms_submit(struct msgb *msg, struct gsm_sms *gsms)
}
/* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */
-static int gsm340_gen_oa(u_int8_t *oa, unsigned int oa_len,
+static int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len,
struct gsm_subscriber *subscr)
{
int len_in_bytes;
@@ -482,10 +482,10 @@ static int gsm340_gen_oa(u_int8_t *oa, unsigned int oa_len,
* returns total size of TPDU */
static int gsm340_gen_tpdu(struct msgb *msg, struct gsm_sms *sms)
{
- u_int8_t *smsp;
- u_int8_t oa[12]; /* max len per 03.40 */
- u_int8_t oa_len = 0;
- u_int8_t octet_len;
+ uint8_t *smsp;
+ uint8_t oa[12]; /* max len per 03.40 */
+ uint8_t oa_len = 0;
+ uint8_t octet_len;
unsigned int old_msg_len = msg->len;
/* generate first octet with masked bits */
@@ -552,15 +552,15 @@ static int gsm340_gen_tpdu(struct msgb *msg, struct gsm_sms *sms)
* return value > 0: RP CAUSE for ERROR; < 0: silent error; 0 = success */
static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
- u_int8_t *smsp = msgb_sms(msg);
+ uint8_t *smsp = msgb_sms(msg);
struct gsm_sms *gsms;
- u_int8_t sms_mti, sms_mms, sms_vpf, sms_alphabet, sms_rp;
- u_int8_t *sms_vp;
- u_int8_t da_len_bytes;
- u_int8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */
+ uint8_t sms_mti, sms_mms, sms_vpf, sms_alphabet, sms_rp;
+ uint8_t *sms_vp;
+ uint8_t da_len_bytes;
+ uint8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */
int rc = 0;
- counter_inc(conn->bts->network->stats.sms.submitted);
+ osmo_counter_inc(conn->bts->network->stats.sms.submitted);
gsms = sms_alloc();
if (!gsms)
@@ -645,7 +645,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
gsms->protocol_id, gsms->data_coding_scheme, gsms->dest_addr,
gsms->user_data_len,
sms_alphabet == DCS_7BIT_DEFAULT ? gsms->text :
- hexdump(gsms->user_data, gsms->user_data_len));
+ osmo_hexdump(gsms->user_data, gsms->user_data_len));
gsms->validity_minutes = gsm340_validity_period(sms_vpf, sms_vp);
@@ -656,7 +656,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
gsms->receiver = subscr_get_by_extension(conn->bts->network, gsms->dest_addr);
if (!gsms->receiver) {
rc = 1; /* cause 1: unknown subscriber */
- counter_inc(conn->bts->network->stats.sms.no_receiver);
+ osmo_counter_inc(conn->bts->network->stats.sms.no_receiver);
goto out;
}
@@ -685,7 +685,7 @@ out:
return rc;
}
-static int gsm411_send_rp_ack(struct gsm_trans *trans, u_int8_t msg_ref)
+static int gsm411_send_rp_ack(struct gsm_trans *trans, uint8_t msg_ref)
{
struct msgb *msg = gsm411_msgb_alloc();
@@ -695,7 +695,7 @@ static int gsm411_send_rp_ack(struct gsm_trans *trans, u_int8_t msg_ref)
}
static int gsm411_send_rp_error(struct gsm_trans *trans,
- u_int8_t msg_ref, u_int8_t cause)
+ uint8_t msg_ref, uint8_t cause)
{
struct msgb *msg = gsm411_msgb_alloc();
@@ -710,9 +710,9 @@ static int gsm411_send_rp_error(struct gsm_trans *trans,
/* Receive a 04.11 TPDU inside RP-DATA / user data */
static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
struct gsm411_rp_hdr *rph,
- u_int8_t src_len, u_int8_t *src,
- u_int8_t dst_len, u_int8_t *dst,
- u_int8_t tpdu_len, u_int8_t *tpdu)
+ uint8_t src_len, uint8_t *src,
+ uint8_t dst_len, uint8_t *dst,
+ uint8_t tpdu_len, uint8_t *tpdu)
{
int rc = 0;
@@ -728,7 +728,7 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
}
msg->l4h = tpdu;
- DEBUGP(DSMS, "DST(%u,%s)\n", dst_len, hexdump(dst, dst_len));
+ DEBUGP(DSMS, "DST(%u,%s)\n", dst_len, osmo_hexdump(dst, dst_len));
rc = gsm340_rx_tpdu(trans->conn, msg);
if (rc == 0)
@@ -743,8 +743,8 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
static int gsm411_rx_rp_data(struct msgb *msg, struct gsm_trans *trans,
struct gsm411_rp_hdr *rph)
{
- u_int8_t src_len, dst_len, rpud_len;
- u_int8_t *src = NULL, *dst = NULL , *rp_ud = NULL;
+ uint8_t src_len, dst_len, rpud_len;
+ uint8_t *src = NULL, *dst = NULL , *rp_ud = NULL;
/* in the MO case, this should always be zero length */
src_len = rph->data[0];
@@ -812,8 +812,8 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans,
{
struct gsm_network *net = trans->conn->bts->network;
struct gsm_sms *sms = trans->sms.sms;
- u_int8_t cause_len = rph->data[0];
- u_int8_t cause = rph->data[1];
+ uint8_t cause_len = rph->data[0];
+ uint8_t cause = rph->data[1];
/* Error in response to MT RP_DATA, i.e. the MS did not
* successfully receive the SMS. We need to investigate
@@ -846,10 +846,10 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans,
* to store this in our database and wait for a SMMA message */
/* FIXME */
send_signal(S_SMS_MEM_EXCEEDED, trans, sms, 0);
- counter_inc(net->stats.sms.rp_err_mem);
+ osmo_counter_inc(net->stats.sms.rp_err_mem);
} else {
send_signal(S_SMS_UNKNOWN_ERROR, trans, sms, 0);
- counter_inc(net->stats.sms.rp_err_other);
+ osmo_counter_inc(net->stats.sms.rp_err_other);
}
sms_free(sms);
@@ -886,7 +886,7 @@ static int gsm411_rx_cp_data(struct msgb *msg, struct gsm48_hdr *gh,
struct gsm_trans *trans)
{
struct gsm411_rp_hdr *rp_data = (struct gsm411_rp_hdr*)&gh->data;
- u_int8_t msg_type = rp_data->msg_type & 0x07;
+ uint8_t msg_type = rp_data->msg_type & 0x07;
int rc = 0;
switch (msg_type) {
@@ -936,10 +936,10 @@ static int gsm411_tx_cp_ack(struct gsm_trans *trans)
return rc;
}
-static int gsm411_tx_cp_error(struct gsm_trans *trans, u_int8_t cause)
+static int gsm411_tx_cp_error(struct gsm_trans *trans, uint8_t cause)
{
struct msgb *msg = gsm411_msgb_alloc();
- u_int8_t *causep;
+ uint8_t *causep;
LOGP(DSMS, LOGL_NOTICE, "TX CP-ERROR, cause %d (%s)\n", cause,
get_value_string(cp_cause_strs, cause));
@@ -955,8 +955,8 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn,
struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t msg_type = gh->msg_type;
- u_int8_t transaction_id = ((gh->proto_discr >> 4) ^ 0x8); /* flip */
+ uint8_t msg_type = gh->msg_type;
+ uint8_t transaction_id = ((gh->proto_discr >> 4) ^ 0x8); /* flip */
struct gsm_trans *trans;
int rc = 0;
@@ -1008,7 +1008,7 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn,
DEBUGP(DSMS, "Implicit CP-ACK for trans_id=%x\n", i);
/* Finish it for good */
- bsc_del_timer(&ptrans->sms.cp_timer);
+ osmo_timer_del(&ptrans->sms.cp_timer);
ptrans->sms.cp_state = GSM411_CPS_IDLE;
trans_free(ptrans);
}
@@ -1039,7 +1039,7 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn,
/* 5.2.3.2.4: MT state exists when SMC has received CP-ACK */
trans->sms.cp_state = GSM411_CPS_MM_ESTABLISHED;
/* Stop TC1* after CP-ACK has been received */
- bsc_del_timer(&trans->sms.cp_timer);
+ osmo_timer_del(&trans->sms.cp_timer);
if (!trans->sms.is_mt) {
/* FIXME: we have sent one CP-DATA, which was now
@@ -1052,7 +1052,7 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn,
case GSM411_MT_CP_ERROR:
DEBUGPC(DSMS, "RX SMS CP-ERROR, cause %d (%s)\n", gh->data[0],
get_value_string(cp_cause_strs, gh->data[0]));
- bsc_del_timer(&trans->sms.cp_timer);
+ osmo_timer_del(&trans->sms.cp_timer);
trans->sms.cp_state = GSM411_CPS_IDLE;
trans_free(trans);
break;
@@ -1074,8 +1074,8 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms)
{
struct msgb *msg = gsm411_msgb_alloc();
struct gsm_trans *trans;
- u_int8_t *data, *rp_ud_len;
- u_int8_t msg_ref = 42;
+ uint8_t *data, *rp_ud_len;
+ uint8_t msg_ref = 42;
int transaction_id;
int rc;
@@ -1108,7 +1108,7 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms)
trans->conn = conn;
/* Hardcode SMSC Originating Address for now */
- data = (u_int8_t *)msgb_put(msg, 8);
+ data = (uint8_t *)msgb_put(msg, 8);
data[0] = 0x07; /* originator length == 7 */
data[1] = 0x91; /* type of number: international, ISDN */
data[2] = 0x44; /* 447785016005 */
@@ -1119,11 +1119,11 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms)
data[7] = 0x50;
/* Hardcoded Destination Address */
- data = (u_int8_t *)msgb_put(msg, 1);
+ data = (uint8_t *)msgb_put(msg, 1);
data[0] = 0; /* destination length == 0 */
/* obtain a pointer for the rp_ud_len, so we can fill it later */
- rp_ud_len = (u_int8_t *)msgb_put(msg, 1);
+ rp_ud_len = (uint8_t *)msgb_put(msg, 1);
/* generate the 03.40 TPDU */
rc = gsm340_gen_tpdu(msg, sms);
@@ -1139,7 +1139,7 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms)
DEBUGP(DSMS, "TX: SMS DELIVER\n");
- counter_inc(conn->bts->network->stats.sms.delivered);
+ osmo_counter_inc(conn->bts->network->stats.sms.delivered);
db_sms_inc_deliver_attempts(trans->sms.sms);
return gsm411_rp_sendmsg(msg, trans, GSM411_MT_RP_DATA_MT, msg_ref);
@@ -1208,7 +1208,7 @@ void _gsm411_sms_trans_free(struct gsm_trans *trans)
trans->sms.sms = NULL;
}
- bsc_del_timer(&trans->sms.cp_timer);
+ osmo_timer_del(&trans->sms.cp_timer);
}
void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn)
diff --git a/src/libmsc/gsm_04_80.c b/src/libmsc/gsm_04_80.c
index 494c319f..39738a5e 100644
--- a/src/libmsc/gsm_04_80.c
+++ b/src/libmsc/gsm_04_80.c
@@ -34,12 +34,12 @@
#include <openbsc/gsm_04_80.h>
#include <openbsc/bsc_api.h>
-#include <osmocore/gsm0480.h>
-#include <osmocore/gsm_utils.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
+#include <osmocom/gsm/gsm0480.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
-static inline unsigned char *msgb_wrap_with_TL(struct msgb *msgb, u_int8_t tag)
+static inline unsigned char *msgb_wrap_with_TL(struct msgb *msgb, uint8_t tag)
{
uint8_t *data = msgb_push(msgb, 2);
@@ -48,8 +48,8 @@ static inline unsigned char *msgb_wrap_with_TL(struct msgb *msgb, u_int8_t tag)
return data;
}
-static inline unsigned char *msgb_push_TLV1(struct msgb *msgb, u_int8_t tag,
- u_int8_t value)
+static inline unsigned char *msgb_push_TLV1(struct msgb *msgb, uint8_t tag,
+ uint8_t value)
{
uint8_t *data = msgb_push(msgb, 3);
@@ -67,7 +67,7 @@ int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
- u_int8_t *ptr8;
+ uint8_t *ptr8;
int response_len;
/* First put the payload text into the message */
diff --git a/src/libmsc/gsm_subscriber.c b/src/libmsc/gsm_subscriber.c
index db61f25a..f9eebc86 100644
--- a/src/libmsc/gsm_subscriber.c
+++ b/src/libmsc/gsm_subscriber.c
@@ -26,7 +26,7 @@
#include <string.h>
#include <assert.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <osmocom/vty/vty.h>
@@ -97,7 +97,7 @@ static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event,
sig_data.bts = conn ? conn->bts : NULL;
sig_data.conn = conn;
sig_data.paging_result = event;
- dispatch_signal(
+ osmo_signal_dispatch(
SS_PAGING,
event == GSM_PAGING_SUCCEEDED ?
S_PAGING_SUCCEEDED : S_PAGING_EXPIRED,
@@ -266,7 +266,7 @@ void subscr_put_channel(struct gsm_subscriber *subscr)
struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net,
- u_int32_t tmsi)
+ uint32_t tmsi)
{
char tmsi_string[14];
struct gsm_subscriber *subscr;
@@ -337,7 +337,7 @@ int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason)
subscr_name(s), s->lac);
rc = db_sync_subscriber(s);
db_subscriber_update(s);
- dispatch_signal(SS_SUBSCR, S_SUBSCR_ATTACHED, s);
+ osmo_signal_dispatch(SS_SUBSCR, S_SUBSCR_ATTACHED, s);
break;
case GSM_SUBSCRIBER_UPDATE_DETACHED:
/* Only detach if we are currently in this area */
@@ -346,7 +346,7 @@ int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason)
LOGP(DMM, LOGL_INFO, "Subscriber %s DETACHED\n", subscr_name(s));
rc = db_sync_subscriber(s);
db_subscriber_update(s);
- dispatch_signal(SS_SUBSCR, S_SUBSCR_DETACHED, s);
+ osmo_signal_dispatch(SS_SUBSCR, S_SUBSCR_DETACHED, s);
break;
default:
fprintf(stderr, "subscr_update with unknown reason: %d\n",
diff --git a/src/libmsc/mncc.c b/src/libmsc/mncc.c
index 3630b91b..b4847722 100644
--- a/src/libmsc/mncc.c
+++ b/src/libmsc/mncc.c
@@ -25,12 +25,11 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <sys/types.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/debug.h>
#include <openbsc/mncc.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/transaction.h>
#include <openbsc/rtp_proxy.h>
diff --git a/src/libmsc/mncc_builtin.c b/src/libmsc/mncc_builtin.c
index 0226b274..105f1dd9 100644
--- a/src/libmsc/mncc_builtin.c
+++ b/src/libmsc/mncc_builtin.c
@@ -26,12 +26,11 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <sys/types.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/debug.h>
#include <openbsc/mncc.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/transaction.h>
#include <openbsc/rtp_proxy.h>
@@ -40,7 +39,7 @@ void *tall_call_ctx;
static LLIST_HEAD(call_list);
-static u_int32_t new_callref = 0x00000001;
+static uint32_t new_callref = 0x00000001;
static void free_call(struct gsm_call *call)
{
@@ -50,7 +49,7 @@ static void free_call(struct gsm_call *call)
}
-static struct gsm_call *get_call_ref(u_int32_t callref)
+static struct gsm_call *get_call_ref(uint32_t callref)
{
struct gsm_call *callt;
@@ -168,7 +167,7 @@ static int mncc_setup_cnf(struct gsm_call *call, int msg_type,
struct gsm_mncc connect_ack, frame_recv;
struct gsm_network *net = call->net;
struct gsm_call *remote;
- u_int32_t refs[2];
+ uint32_t refs[2];
/* acknowledge connect */
memset(&connect_ack, 0, sizeof(struct gsm_mncc));
diff --git a/src/libmsc/mncc_sock.c b/src/libmsc/mncc_sock.c
index 2eef7c86..5ef9922d 100644
--- a/src/libmsc/mncc_sock.c
+++ b/src/libmsc/mncc_sock.c
@@ -26,13 +26,12 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/protocol/gsm_04_08.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <openbsc/debug.h>
#include <openbsc/mncc.h>
@@ -40,8 +39,8 @@
struct mncc_sock_state {
struct gsm_network *net;
- struct bsc_fd listen_bfd; /* fd for listen socket */
- struct bsc_fd conn_bfd; /* fd for connection to lcr */
+ struct osmo_fd listen_bfd; /* fd for listen socket */
+ struct osmo_fd conn_bfd; /* fd for connection to lcr */
};
/* FIXME: avoid this */
@@ -86,17 +85,17 @@ void mncc_sock_write_pending(void)
}
/* FIXME: move this to libosmocore */
-int osmo_unixsock_listen(struct bsc_fd *bfd, int type, const char *path);
+int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path);
static void mncc_sock_close(struct mncc_sock_state *state)
{
- struct bsc_fd *bfd = &state->conn_bfd;
+ struct osmo_fd *bfd = &state->conn_bfd;
LOGP(DMNCC, LOGL_NOTICE, "MNCC Socket has LOST connection\n");
close(bfd->fd);
bfd->fd = -1;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
/* re-enable the generation of ACCEPT for new connections */
state->listen_bfd.when |= BSC_FD_READ;
@@ -113,7 +112,7 @@ static void mncc_sock_close(struct mncc_sock_state *state)
}
}
-static int mncc_sock_read(struct bsc_fd *bfd)
+static int mncc_sock_read(struct osmo_fd *bfd)
{
struct mncc_sock_state *state = (struct mncc_sock_state *)bfd->data;
struct gsm_mncc *mncc_prim;
@@ -150,7 +149,7 @@ close:
return -1;
}
-static int mncc_sock_write(struct bsc_fd *bfd)
+static int mncc_sock_write(struct osmo_fd *bfd)
{
struct mncc_sock_state *state = bfd->data;
struct gsm_network *net = state->net;
@@ -190,7 +189,7 @@ close:
return -1;
}
-static int mncc_sock_cb(struct bsc_fd *bfd, unsigned int flags)
+static int mncc_sock_cb(struct osmo_fd *bfd, unsigned int flags)
{
int rc = 0;
@@ -206,10 +205,10 @@ static int mncc_sock_cb(struct bsc_fd *bfd, unsigned int flags)
}
/* accept a new connection */
-static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags)
+static int mncc_sock_accept(struct osmo_fd *bfd, unsigned int flags)
{
struct mncc_sock_state *state = (struct mncc_sock_state *)bfd->data;
- struct bsc_fd *conn_bfd = &state->conn_bfd;
+ struct osmo_fd *conn_bfd = &state->conn_bfd;
struct sockaddr_un un_addr;
socklen_t len;
int rc;
@@ -235,11 +234,10 @@ static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags)
conn_bfd->cb = mncc_sock_cb;
conn_bfd->data = state;
- if (bsc_register_fd(conn_bfd) != 0) {
+ if (osmo_fd_register(conn_bfd) != 0) {
LOGP(DMNCC, LOGL_ERROR, "Failed to register new connection fd\n");
close(conn_bfd->fd);
conn_bfd->fd = -1;
- state->listen_bfd.when |= ~BSC_FD_READ;
return -1;
}
@@ -253,7 +251,7 @@ static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags)
int mncc_sock_init(struct gsm_network *net)
{
struct mncc_sock_state *state;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
int rc;
state = talloc_zero(tall_bsc_ctx, struct mncc_sock_state);
@@ -277,7 +275,7 @@ int mncc_sock_init(struct gsm_network *net)
bfd->cb = mncc_sock_accept;
bfd->data = state;
- rc = bsc_register_fd(bfd);
+ rc = osmo_fd_register(bfd);
if (rc < 0) {
LOGP(DMNCC, LOGL_ERROR, "Could not register listen fd: %d\n", rc);
close(bfd->fd);
@@ -291,7 +289,7 @@ int mncc_sock_init(struct gsm_network *net)
}
/* FIXME: move this to libosmocore */
-int osmo_unixsock_listen(struct bsc_fd *bfd, int type, const char *path)
+int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path)
{
struct sockaddr_un local;
unsigned int namelen;
diff --git a/src/libmsc/rrlp.c b/src/libmsc/rrlp.c
index ae5ca478..161456a0 100644
--- a/src/libmsc/rrlp.c
+++ b/src/libmsc/rrlp.c
@@ -20,7 +20,6 @@
*/
-#include <sys/types.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/signal.h>
@@ -29,20 +28,20 @@
/* RRLP msPositionReq, nsBased,
* Accuracy=60, Method=gps, ResponseTime=2, oneSet */
-static const u_int8_t ms_based_pos_req[] = { 0x40, 0x01, 0x78, 0xa8 };
+static const uint8_t ms_based_pos_req[] = { 0x40, 0x01, 0x78, 0xa8 };
/* RRLP msPositionReq, msBasedPref,
Accuracy=60, Method=gpsOrEOTD, ResponseTime=5, multipleSets */
-static const u_int8_t ms_pref_pos_req[] = { 0x40, 0x02, 0x79, 0x50 };
+static const uint8_t ms_pref_pos_req[] = { 0x40, 0x02, 0x79, 0x50 };
/* RRLP msPositionReq, msAssistedPref,
Accuracy=60, Method=gpsOrEOTD, ResponseTime=5, multipleSets */
-static const u_int8_t ass_pref_pos_req[] = { 0x40, 0x03, 0x79, 0x50 };
+static const uint8_t ass_pref_pos_req[] = { 0x40, 0x03, 0x79, 0x50 };
static int send_rrlp_req(struct gsm_subscriber_connection *conn)
{
struct gsm_network *net = conn->bts->network;
- const u_int8_t *req;
+ const uint8_t *req;
switch (net->rrlp.mode) {
case RRLP_MODE_MS_BASED:
@@ -100,6 +99,6 @@ static int paging_sig_cb(unsigned int subsys, unsigned int signal,
void on_dso_load_rrlp(void)
{
- register_signal_handler(SS_SUBSCR, subscr_sig_cb, NULL);
- register_signal_handler(SS_PAGING, paging_sig_cb, NULL);
+ osmo_signal_register_handler(SS_SUBSCR, subscr_sig_cb, NULL);
+ osmo_signal_register_handler(SS_PAGING, paging_sig_cb, NULL);
}
diff --git a/src/libmsc/silent_call.c b/src/libmsc/silent_call.c
index 64ebdfdb..6a188c89 100644
--- a/src/libmsc/silent_call.c
+++ b/src/libmsc/silent_call.c
@@ -24,7 +24,7 @@
#include <unistd.h>
#include <errno.h>
-#include <osmocore/msgb.h>
+#include <osmocom/core/msgb.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/paging.h>
@@ -56,13 +56,13 @@ static int paging_cb_silent(unsigned int hooknum, unsigned int event,
conn->lchan->ts->nr, conn->lchan->ts->trx->arfcn);
conn->silent_call = 1;
/* increment lchan reference count */
- dispatch_signal(SS_SCALL, S_SCALL_SUCCESS, &sigdata);
+ osmo_signal_dispatch(SS_SCALL, S_SCALL_SUCCESS, &sigdata);
break;
case GSM_PAGING_EXPIRED:
case GSM_PAGING_BUSY:
case GSM_PAGING_OOM:
DEBUGP(DSMS, "expired\n");
- dispatch_signal(SS_SCALL, S_SCALL_EXPIRED, &sigdata);
+ osmo_signal_dispatch(SS_SCALL, S_SCALL_EXPIRED, &sigdata);
break;
default:
rc = -EINVAL;
@@ -80,8 +80,8 @@ int silent_call_rx(struct gsm_subscriber_connection *conn, struct msgb *msg)
}
struct msg_match {
- u_int8_t pdisc;
- u_int8_t msg_type;
+ uint8_t pdisc;
+ uint8_t msg_type;
};
/* list of messages that are handled inside OpenBSC, even in a silent call */
@@ -94,7 +94,7 @@ static const struct msg_match silent_call_accept[] = {
int silent_call_reroute(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct gsm48_hdr *gh = msgb_l3(msg);
- u_int8_t pdisc = gh->proto_discr & 0x0f;
+ uint8_t pdisc = gh->proto_discr & 0x0f;
int i;
/* if we're not part of a silent call, never reroute */
diff --git a/src/libmsc/sms_queue.c b/src/libmsc/sms_queue.c
index 079755d2..30fa5f09 100644
--- a/src/libmsc/sms_queue.c
+++ b/src/libmsc/sms_queue.c
@@ -37,7 +37,7 @@
#include <openbsc/gsm_subscriber.h>
#include <openbsc/signal.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <osmocom/vty/vty.h>
@@ -54,8 +54,8 @@ struct gsm_sms_pending {
};
struct gsm_sms_queue {
- struct timer_list resend_pending;
- struct timer_list push_queue;
+ struct osmo_timer_list resend_pending;
+ struct osmo_timer_list push_queue;
struct gsm_network *network;
int max_fail;
int max_pending;
@@ -129,10 +129,10 @@ static void sms_pending_resend(struct gsm_sms_pending *pending)
pending->resend = 1;
smsq = pending->subscr->net->sms_queue;
- if (bsc_timer_pending(&smsq->resend_pending))
+ if (osmo_timer_pending(&smsq->resend_pending))
return;
- bsc_schedule_timer(&smsq->resend_pending, 1, 0);
+ osmo_timer_schedule(&smsq->resend_pending, 1, 0);
}
static void sms_pending_failed(struct gsm_sms_pending *pending, int paging_error)
@@ -288,10 +288,10 @@ static void sms_submit_pending(void *_data)
*/
int sms_queue_trigger(struct gsm_sms_queue *smsq)
{
- if (bsc_timer_pending(&smsq->push_queue))
+ if (osmo_timer_pending(&smsq->push_queue))
return 0;
- bsc_schedule_timer(&smsq->push_queue, 1, 0);
+ osmo_timer_schedule(&smsq->push_queue, 1, 0);
return 0;
}
@@ -303,8 +303,8 @@ int sms_queue_start(struct gsm_network *network, int max_pending)
return -1;
}
- register_signal_handler(SS_SUBSCR, sms_subscr_cb, network);
- register_signal_handler(SS_SMS, sms_sms_cb, network);
+ osmo_signal_register_handler(SS_SUBSCR, sms_subscr_cb, network);
+ osmo_signal_register_handler(SS_SMS, sms_sms_cb, network);
network->sms_queue = sms;
INIT_LLIST_HEAD(&sms->pending_sms);
diff --git a/src/libmsc/token_auth.c b/src/libmsc/token_auth.c
index 3404dd4e..cf26ba8d 100644
--- a/src/libmsc/token_auth.c
+++ b/src/libmsc/token_auth.c
@@ -20,7 +20,7 @@
*/
#include <stdio.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/signal.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_04_11.h>
@@ -32,7 +32,7 @@
#define TOKEN_SMS_TEXT "HAR 2009 GSM. Register at http://har2009.gnumonks.org/ " \
"Your IMSI is %s, auth token is %08X, phone no is %s."
-static char *build_sms_string(struct gsm_subscriber *subscr, u_int32_t token)
+static char *build_sms_string(struct gsm_subscriber *subscr, uint32_t token)
{
char *sms_str;
unsigned int len;
@@ -63,7 +63,7 @@ static int token_subscr_cb(unsigned int subsys, unsigned int signal,
return 0;
if (subscr->flags & GSM_SUBSCRIBER_FIRST_CONTACT) {
- u_int32_t token;
+ uint32_t token;
char *sms_str;
/* we've seen this subscriber for the first time. */
@@ -97,7 +97,7 @@ unauth:
if (rc) {
struct gsm_subscriber_connection *conn = connection_for_subscr(subscr);
if (conn) {
- u_int8_t auth_rand[16];
+ uint8_t auth_rand[16];
/* kick the subscriber off the network */
gsm48_tx_mm_auth_req(conn, auth_rand, 0);
gsm48_tx_mm_auth_rej(conn);
@@ -116,7 +116,7 @@ static int token_sms_cb(unsigned int subsys, unsigned int signal,
struct sms_signal_data *sig = signal_data;
struct gsm_sms *sms = sig->sms;;
struct gsm_subscriber_connection *conn;
- u_int8_t auth_rand[16];
+ uint8_t auth_rand[16];
if (signal != S_SMS_DELIVERED)
@@ -148,6 +148,6 @@ static int token_sms_cb(unsigned int subsys, unsigned int signal,
//static __attribute__((constructor)) void on_dso_load_token(void)
void on_dso_load_token(void)
{
- register_signal_handler(SS_SUBSCR, token_subscr_cb, NULL);
- register_signal_handler(SS_SMS, token_sms_cb, NULL);
+ osmo_signal_register_handler(SS_SUBSCR, token_subscr_cb, NULL);
+ osmo_signal_register_handler(SS_SMS, token_sms_cb, NULL);
}
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
new file mode 100644
index 00000000..8a181b76
--- /dev/null
+++ b/src/libmsc/transaction.c
@@ -0,0 +1,151 @@
+/* GSM 04.07 Transaction handling */
+
+/* (C) 2009 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/transaction.h>
+#include <openbsc/gsm_data.h>
+#include <openbsc/mncc.h>
+#include <openbsc/debug.h>
+#include <osmocom/core/talloc.h>
+#include <openbsc/gsm_subscriber.h>
+#include <openbsc/gsm_04_08.h>
+#include <openbsc/mncc.h>
+#include <openbsc/paging.h>
+#include <openbsc/osmo_msc.h>
+
+void *tall_trans_ctx;
+
+void _gsm48_cc_trans_free(struct gsm_trans *trans);
+
+struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
+ uint8_t proto, uint8_t trans_id)
+{
+ struct gsm_trans *trans;
+ struct gsm_network *net = subscr->net;
+
+ llist_for_each_entry(trans, &net->trans_list, entry) {
+ if (trans->subscr == subscr &&
+ trans->protocol == proto &&
+ trans->transaction_id == trans_id)
+ return trans;
+ }
+ return NULL;
+}
+
+struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
+ uint32_t callref)
+{
+ struct gsm_trans *trans;
+
+ llist_for_each_entry(trans, &net->trans_list, entry) {
+ if (trans->callref == callref)
+ return trans;
+ }
+ return NULL;
+}
+
+struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
+ uint8_t protocol, uint8_t trans_id,
+ uint32_t callref)
+{
+ struct gsm_trans *trans;
+
+ DEBUGP(DCC, "subscr=%p, subscr->net=%p\n", subscr, subscr->net);
+
+ trans = talloc_zero(tall_trans_ctx, struct gsm_trans);
+ if (!trans)
+ return NULL;
+
+ trans->subscr = subscr;
+ subscr_get(trans->subscr);
+
+ trans->protocol = protocol;
+ trans->transaction_id = trans_id;
+ trans->callref = callref;
+
+ llist_add_tail(&trans->entry, &subscr->net->trans_list);
+
+ return trans;
+}
+
+void trans_free(struct gsm_trans *trans)
+{
+ switch (trans->protocol) {
+ case GSM48_PDISC_CC:
+ _gsm48_cc_trans_free(trans);
+ break;
+ case GSM48_PDISC_SMS:
+ _gsm411_sms_trans_free(trans);
+ break;
+ }
+
+ /* FIXME: implement a sane way to stop this. */
+ if (!trans->conn && trans->paging_request) {
+ LOGP(DNM, LOGL_ERROR,
+ "Transaction freed while paging for sub: %llu\n",
+ trans->subscr->id);
+ trans->paging_request = NULL;
+ }
+
+ if (trans->subscr)
+ subscr_put(trans->subscr);
+
+ llist_del(&trans->entry);
+
+ if (trans->conn)
+ msc_release_connection(trans->conn);
+
+
+ talloc_free(trans);
+}
+
+/* allocate an unused transaction ID for the given subscriber
+ * in the given protocol using the ti_flag specified */
+int trans_assign_trans_id(struct gsm_subscriber *subscr,
+ uint8_t protocol, uint8_t ti_flag)
+{
+ struct gsm_network *net = subscr->net;
+ struct gsm_trans *trans;
+ unsigned int used_tid_bitmask = 0;
+ int i, j, h;
+
+ if (ti_flag)
+ ti_flag = 0x8;
+
+ /* generate bitmask of already-used TIDs for this (subscr,proto) */
+ llist_for_each_entry(trans, &net->trans_list, entry) {
+ if (trans->subscr != subscr ||
+ trans->protocol != protocol ||
+ trans->transaction_id == 0xff)
+ continue;
+ used_tid_bitmask |= (1 << trans->transaction_id);
+ }
+
+ /* find a new one, trying to go in a 'circular' pattern */
+ for (h = 6; h > 0; h--)
+ if (used_tid_bitmask & (1 << (h | ti_flag)))
+ break;
+ for (i = 0; i < 7; i++) {
+ j = ((h + i) % 7) | ti_flag;
+ if ((used_tid_bitmask & (1 << j)) == 0)
+ return j;
+ }
+
+ return -1;
+}
diff --git a/src/libmsc/vty_interface_layer3.c b/src/libmsc/vty_interface_layer3.c
index a38d15bb..f31f05b1 100644
--- a/src/libmsc/vty_interface_layer3.c
+++ b/src/libmsc/vty_interface_layer3.c
@@ -1,6 +1,6 @@
/* OpenBSC interface to quagga VTY */
/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
- * (C) 2009 by Holger Hans Peter Freyther
+ * (C) 2009-2011 by Holger Hans Peter Freyther
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
-#include <sys/types.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/buffer.h>
@@ -29,17 +28,17 @@
#include <arpa/inet.h>
-#include <osmocore/linuxlist.h>
+#include <osmocom/core/linuxlist.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/silent_call.h>
#include <openbsc/gsm_04_11.h>
#include <openbsc/e1_input.h>
#include <openbsc/abis_nm.h>
-#include <osmocore/gsm_utils.h>
-#include <osmocore/utils.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/core/utils.h>
#include <openbsc/db.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/vty.h>
@@ -75,7 +74,7 @@ static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr,
vty_out(vty, " A3A8 algorithm id: %d%s",
ainfo.auth_algo, VTY_NEWLINE);
vty_out(vty, " A3A8 Ki: %s%s",
- hexdump(ainfo.a3a8_ki, ainfo.a3a8_ki_len),
+ osmo_hexdump(ainfo.a3a8_ki, ainfo.a3a8_ki_len),
VTY_NEWLINE);
}
@@ -86,13 +85,13 @@ static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr,
vty_out(vty, " seq # : %d%s",
atuple.key_seq, VTY_NEWLINE);
vty_out(vty, " RAND : %s%s",
- hexdump(atuple.rand, sizeof(atuple.rand)),
+ osmo_hexdump(atuple.rand, sizeof(atuple.rand)),
VTY_NEWLINE);
vty_out(vty, " SRES : %s%s",
- hexdump(atuple.sres, sizeof(atuple.sres)),
+ osmo_hexdump(atuple.sres, sizeof(atuple.sres)),
VTY_NEWLINE);
vty_out(vty, " Kc : %s%s",
- hexdump(atuple.kc, sizeof(atuple.kc)),
+ osmo_hexdump(atuple.kc, sizeof(atuple.kc)),
VTY_NEWLINE);
}
if (pending)
@@ -142,7 +141,7 @@ DEFUN(sms_send_pend,
}
static int _send_sms_str(struct gsm_subscriber *receiver, char *str,
- u_int8_t tp_pid)
+ uint8_t tp_pid)
{
struct gsm_sms *sms;
@@ -456,7 +455,7 @@ DEFUN(ena_subscr_extension,
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
struct gsm_subscriber *subscr =
get_subscr_by_argv(gsmnet, argv[0], argv[1]);
- const char *name = argv[2];
+ const char *ext = argv[2];
if (!subscr) {
vty_out(vty, "%% No subscriber found for %s %s%s",
@@ -464,7 +463,7 @@ DEFUN(ena_subscr_extension,
return CMD_WARNING;
}
- strncpy(subscr->extension, name, sizeof(subscr->name));
+ strncpy(subscr->extension, ext, sizeof(subscr->extension));
db_sync_subscriber(subscr);
subscr_put(subscr);
@@ -576,13 +575,17 @@ DEFUN(ena_subscr_a3a8,
} else {
/* Unknown method */
subscr_put(subscr);
+ vty_out(vty, "%% Unknown auth method %s%s",
+ alg_str, VTY_NEWLINE);
return CMD_WARNING;
}
if (ki_str) {
- rc = hexparse(ki_str, ainfo.a3a8_ki, sizeof(ainfo.a3a8_ki));
+ rc = osmo_hexparse(ki_str, ainfo.a3a8_ki, sizeof(ainfo.a3a8_ki));
if ((rc > maxlen) || (rc < minlen)) {
subscr_put(subscr);
+ vty_out(vty, "%% Wrong Ki `%s'%s",
+ ki_str, VTY_NEWLINE);
return CMD_WARNING;
}
ainfo.a3a8_ki_len = rc;
@@ -590,6 +593,7 @@ DEFUN(ena_subscr_a3a8,
ainfo.a3a8_ki_len = 0;
if (minlen) {
subscr_put(subscr);
+ vty_out(vty, "%% Missing Ki argument%s", VTY_NEWLINE);
return CMD_WARNING;
}
}
@@ -602,7 +606,11 @@ DEFUN(ena_subscr_a3a8,
db_sync_lastauthtuple_for_subscr(NULL, subscr);
subscr_put(subscr);
- return rc ? CMD_WARNING : CMD_SUCCESS;
+ if (rc) {
+ vty_out(vty, "%% Operation has failed%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ return CMD_SUCCESS;
}
DEFUN(subscriber_purge,
@@ -665,37 +673,37 @@ DEFUN(show_stats,
openbsc_vty_print_statistics(vty, 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, "Location Update : %lu attach, %lu normal, %lu periodic%s",
- counter_get(net->stats.loc_upd_type.attach),
- counter_get(net->stats.loc_upd_type.normal),
- counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
+ osmo_counter_get(net->stats.loc_upd_type.attach),
+ osmo_counter_get(net->stats.loc_upd_type.normal),
+ osmo_counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
vty_out(vty, "IMSI Detach Indications : %lu%s",
- counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
+ osmo_counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
- counter_get(net->stats.loc_upd_resp.accept),
- counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
+ osmo_counter_get(net->stats.loc_upd_resp.accept),
+ osmo_counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
vty_out(vty, "Handover : %lu attempted, %lu no_channel, %lu timeout, "
"%lu completed, %lu failed%s",
- counter_get(net->stats.handover.attempted),
- counter_get(net->stats.handover.no_channel),
- counter_get(net->stats.handover.timeout),
- counter_get(net->stats.handover.completed),
- counter_get(net->stats.handover.failed), VTY_NEWLINE);
+ osmo_counter_get(net->stats.handover.attempted),
+ osmo_counter_get(net->stats.handover.no_channel),
+ osmo_counter_get(net->stats.handover.timeout),
+ osmo_counter_get(net->stats.handover.completed),
+ osmo_counter_get(net->stats.handover.failed), VTY_NEWLINE);
vty_out(vty, "SMS MO : %lu submitted, %lu no receiver%s",
- counter_get(net->stats.sms.submitted),
- counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
+ osmo_counter_get(net->stats.sms.submitted),
+ osmo_counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
vty_out(vty, "SMS MT : %lu delivered, %lu no memory, %lu other error%s",
- counter_get(net->stats.sms.delivered),
- counter_get(net->stats.sms.rp_err_mem),
- counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
+ osmo_counter_get(net->stats.sms.delivered),
+ osmo_counter_get(net->stats.sms.rp_err_mem),
+ osmo_counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
vty_out(vty, "MO Calls : %lu setup, %lu connect ack%s",
- counter_get(net->stats.call.mo_setup),
- counter_get(net->stats.call.mo_connect_ack), VTY_NEWLINE);
+ osmo_counter_get(net->stats.call.mo_setup),
+ osmo_counter_get(net->stats.call.mo_connect_ack), VTY_NEWLINE);
vty_out(vty, "MT Calls : %lu setup, %lu connect%s",
- counter_get(net->stats.call.mt_setup),
- counter_get(net->stats.call.mt_connect), VTY_NEWLINE);
+ osmo_counter_get(net->stats.call.mt_setup),
+ osmo_counter_get(net->stats.call.mt_connect), VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -756,7 +764,7 @@ DEFUN(smsqueue_fail,
int bsc_vty_init_extra(void)
{
- register_signal_handler(SS_SCALL, scall_cbfn, NULL);
+ osmo_signal_register_handler(SS_SCALL, scall_cbfn, NULL);
install_element_ve(&show_subscr_cmd);
install_element_ve(&show_subscr_cache_cmd);