aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gprs')
-rw-r--r--src/gprs/Makefile.am4
-rw-r--r--src/gprs/Makefile.in8
-rw-r--r--src/gprs/crc24.c5
-rw-r--r--src/gprs/gb_proxy.c5
-rw-r--r--src/gprs/gb_proxy_main.c37
-rw-r--r--src/gprs/gb_proxy_vty.c3
-rw-r--r--src/gprs/gprs_gmm.c32
-rw-r--r--src/gprs/gprs_llc.c8
-rw-r--r--src/gprs/gprs_llc_vty.c10
-rw-r--r--src/gprs/gprs_sgsn.c8
-rw-r--r--src/gprs/gprs_sndcp.c8
-rw-r--r--src/gprs/gprs_sndcp.h4
-rw-r--r--src/gprs/gprs_sndcp_vty.c10
-rw-r--r--src/gprs/sgsn_libgtp.c17
-rw-r--r--src/gprs/sgsn_main.c37
-rw-r--r--src/gprs/sgsn_vty.c8
16 files changed, 98 insertions, 106 deletions
diff --git a/src/gprs/Makefile.am b/src/gprs/Makefile.am
index 16c2200e..b6eccee9 100644
--- a/src/gprs/Makefile.am
+++ b/src/gprs/Makefile.am
@@ -1,6 +1,6 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
-AM_CFLAGS=-Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS=-Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(COVERAGE_LDFLAGS)
noinst_HEADERS = gprs_sndcp.h
diff --git a/src/gprs/Makefile.in b/src/gprs/Makefile.in
index 99ea7391..a32ab4de 100644
--- a/src/gprs/Makefile.in
+++ b/src/gprs/Makefile.in
@@ -40,7 +40,7 @@ subdir = src/gprs
DIST_COMMON = $(noinst_HEADERS) $(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
@@ -120,6 +120,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@
@@ -189,8 +191,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 -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(COVERAGE_LDFLAGS)
+AM_CFLAGS = -Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
+AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(COVERAGE_LDFLAGS)
noinst_HEADERS = gprs_sndcp.h
osmo_gbproxy_SOURCES = gb_proxy.c gb_proxy_main.c gb_proxy_vty.c
osmo_gbproxy_LDADD = $(top_builddir)/src/libgb/libgb.a \
diff --git a/src/gprs/crc24.c b/src/gprs/crc24.c
index 4d65e6ee..1a420ed6 100644
--- a/src/gprs/crc24.c
+++ b/src/gprs/crc24.c
@@ -19,11 +19,10 @@
*
*/
-#include <sys/types.h>
#include <openbsc/crc24.h>
/* CRC24 table - FCS */
-static const u_int32_t tbl_crc24[256] = {
+static const uint32_t tbl_crc24[256] = {
0x00000000, 0x00d6a776, 0x00f64557, 0x0020e221, 0x00b78115, 0x00612663, 0x0041c442, 0x00976334,
0x00340991, 0x00e2aee7, 0x00c24cc6, 0x0014ebb0, 0x00838884, 0x00552ff2, 0x0075cdd3, 0x00a36aa5,
0x00681322, 0x00beb454, 0x009e5675, 0x0048f103, 0x00df9237, 0x00093541, 0x0029d760, 0x00ff7016,
@@ -60,7 +59,7 @@ static const u_int32_t tbl_crc24[256] = {
#define INIT_CRC24 0xffffff
-u_int32_t crc24_calc(u_int32_t fcs, u_int8_t *cp, unsigned int len)
+uint32_t crc24_calc(uint32_t fcs, uint8_t *cp, unsigned int len)
{
while (len--)
fcs = (fcs >> 8) ^ tbl_crc24[(fcs ^ *cp++) & 0xff];
diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c
index 8df93a9c..1261ccca 100644
--- a/src/gprs/gb_proxy.c
+++ b/src/gprs/gb_proxy.c
@@ -27,11 +27,10 @@
#include <errno.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <arpa/inet.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
diff --git a/src/gprs/gb_proxy_main.c b/src/gprs/gb_proxy_main.c
index b53e9857..028f9896 100644
--- a/src/gprs/gb_proxy_main.c
+++ b/src/gprs/gb_proxy_main.c
@@ -28,15 +28,15 @@
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/rate_ctr.h>
-#include <osmocore/process.h>
+#include <osmocom/core/application.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/process.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
@@ -47,6 +47,7 @@
#include <osmocom/vty/command.h>
#include <osmocom/vty/telnet_interface.h>
+#include <osmocom/vty/logging.h>
#include "../../bscconfig.h"
@@ -64,7 +65,6 @@ const char *openbsc_copyright =
"This is free software: you are free to change and redistribute it.\r\n"
"There is NO WARRANTY, to the extent permitted by law.\r\n";
-static struct log_target *stderr_target;
static char *config_file = "osmo_gbproxy.cfg";
struct gbproxy_config gbcfg;
static int daemonize = 0;
@@ -74,7 +74,7 @@ extern struct gbprox_peer *gbprox_peer_sgsn;
/* call-back function for the NS protocol */
static int proxy_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
- struct msgb *msg, u_int16_t bvci)
+ struct msgb *msg, uint16_t bvci)
{
int rc = 0;
@@ -98,7 +98,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
- dispatch_signal(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
+ osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
break;
@@ -162,10 +162,10 @@ static void handle_options(int argc, char **argv)
print_help();
exit(0);
case 's':
- log_set_use_color(stderr_target, 0);
+ log_set_use_color(osmo_stderr_target, 0);
break;
case 'd':
- log_parse_category_mask(stderr_target, optarg);
+ log_parse_category_mask(osmo_stderr_target, optarg);
break;
case 'D':
daemonize = 1;
@@ -174,10 +174,10 @@ static void handle_options(int argc, char **argv)
config_file = strdup(optarg);
break;
case 'T':
- log_set_print_timestamp(stderr_target, 1);
+ log_set_print_timestamp(osmo_stderr_target, 1);
break;
case 'e':
- log_set_log_level(stderr_target, atoi(optarg));
+ log_set_log_level(osmo_stderr_target, atoi(optarg));
break;
case 'V':
print_version(1);
@@ -212,16 +212,13 @@ int main(int argc, char **argv)
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
- signal(SIGPIPE, SIG_IGN);
+ osmo_init_ignore_signals();
- log_init(&log_info);
- stderr_target = log_target_create_stderr();
- log_add_target(stderr_target);
- log_set_all_filter(stderr_target, 1);
+ osmo_init_logging(&log_info);
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
- logging_vty_add_cmds();
+ logging_vty_add_cmds(&log_info);
gbproxy_vty_init();
handle_options(argc, argv);
@@ -239,7 +236,7 @@ int main(int argc, char **argv)
}
gbcfg.nsi = bssgp_nsi;
gprs_ns_vty_init(bssgp_nsi);
- register_signal_handler(SS_NS, &gbprox_signal, NULL);
+ osmo_signal_register_handler(SS_NS, &gbprox_signal, NULL);
rc = gbproxy_parse_config(config_file, &gbcfg);
if (rc < 0) {
@@ -279,7 +276,7 @@ int main(int argc, char **argv)
gbprox_reset_persistent_nsvcs(bssgp_nsi);
while (1) {
- rc = bsc_select_main(0);
+ rc = osmo_select_main(0);
if (rc < 0)
exit(3);
}
diff --git a/src/gprs/gb_proxy_vty.c b/src/gprs/gb_proxy_vty.c
index 05f5b1e4..1aa4ff50 100644
--- a/src/gprs/gb_proxy_vty.c
+++ b/src/gprs/gb_proxy_vty.c
@@ -18,12 +18,11 @@
*
*/
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/debug.h>
#include <openbsc/gb_proxy.h>
diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index 949cd96e..46c49318 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -31,12 +31,12 @@
#include <arpa/inet.h>
#include <openbsc/db.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/gsm_utils.h>
-#include <osmocore/signal.h>
-#include <osmocore/talloc.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/core/signal.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/rate_ctr.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
@@ -208,7 +208,7 @@ static void mmctx_timer_cb(void *_mm);
static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
unsigned int seconds)
{
- if (bsc_timer_pending(&mm->timer))
+ if (osmo_timer_pending(&mm->timer))
LOGP(DMM, LOGL_ERROR, "Starting MM timer %u while old "
"timer %u pending\n", T, mm->T);
mm->T = T;
@@ -218,7 +218,7 @@ static void mmctx_timer_start(struct sgsn_mm_ctx *mm, unsigned int T,
mm->timer.data = mm;
mm->timer.cb = &mmctx_timer_cb;
- bsc_schedule_timer(&mm->timer, seconds, 0);
+ osmo_timer_schedule(&mm->timer, seconds, 0);
}
static void mmctx_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T)
@@ -226,7 +226,7 @@ static void mmctx_timer_stop(struct sgsn_mm_ctx *mm, unsigned int T)
if (mm->T != T)
LOGP(DMM, LOGL_ERROR, "Stopping MM timer %u but "
"%u is running\n", T, mm->T);
- bsc_del_timer(&mm->timer);
+ osmo_timer_del(&mm->timer);
}
/* Send a message through the underlying layer */
@@ -463,7 +463,7 @@ static int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm, uint8_t *rand,
uint8_t *m_rand, *m_cksn;
DEBUGP(DMM, "<- GPRS AUTH AND CIPHERING REQ (rand = %s)\n",
- hexdump(rand, 16));
+ osmo_hexdump(rand, 16));
mmctx2msgid(msg, mm);
@@ -1087,7 +1087,7 @@ static void mmctx_timer_cb(void *_mm)
/* FIXME */
break;
}
- bsc_schedule_timer(&mm->timer, GSM0408_T3350_SECS, 0);
+ osmo_timer_schedule(&mm->timer, GSM0408_T3350_SECS, 0);
break;
case 3360: /* waiting for AUTH AND CIPH RESP */
if (mm->num_T_exp >= 5) {
@@ -1096,7 +1096,7 @@ static void mmctx_timer_cb(void *_mm)
break;
}
/* FIXME: re-transmit the respective msg and re-start timer */
- bsc_schedule_timer(&mm->timer, GSM0408_T3360_SECS, 0);
+ osmo_timer_schedule(&mm->timer, GSM0408_T3360_SECS, 0);
break;
case 3370: /* waiting for IDENTITY RESPONSE */
if (mm->num_T_exp >= 5) {
@@ -1107,7 +1107,7 @@ static void mmctx_timer_cb(void *_mm)
}
/* re-tranmit IDENTITY REQUEST and re-start timer */
gsm48_tx_gmm_id_req(mm, mm->t3370_id_type);
- bsc_schedule_timer(&mm->timer, GSM0408_T3370_SECS, 0);
+ osmo_timer_schedule(&mm->timer, GSM0408_T3370_SECS, 0);
break;
default:
LOGP(DMM, LOGL_ERROR, "timer expired in unknown mode %u\n",
@@ -1122,7 +1122,7 @@ static void pdpctx_timer_cb(void *_mm);
static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
unsigned int seconds)
{
- if (bsc_timer_pending(&pdp->timer))
+ if (osmo_timer_pending(&pdp->timer))
LOGP(DMM, LOGL_ERROR, "Starting MM timer %u while old "
"timer %u pending\n", T, pdp->T);
pdp->T = T;
@@ -1132,7 +1132,7 @@ static void pdpctx_timer_start(struct sgsn_pdp_ctx *pdp, unsigned int T,
pdp->timer.data = pdp;
pdp->timer.cb = &pdpctx_timer_cb;
- bsc_schedule_timer(&pdp->timer, seconds, 0);
+ osmo_timer_schedule(&pdp->timer, seconds, 0);
}
@@ -1457,7 +1457,7 @@ static void pdpctx_timer_cb(void *_pdp)
break;
}
gsm48_tx_gsm_deact_pdp_req(pdp, GSM_CAUSE_NET_FAIL);
- bsc_schedule_timer(&pdp->timer, GSM0408_T3395_SECS, 0);
+ osmo_timer_schedule(&pdp->timer, GSM0408_T3395_SECS, 0);
break;
default:
LOGP(DMM, LOGL_ERROR, "timer expired in unknown mode %u\n",
diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c
index 7991f4c1..f7408ef9 100644
--- a/src/gprs/gprs_llc.c
+++ b/src/gprs/gprs_llc.c
@@ -22,10 +22,10 @@
#include <errno.h>
#include <stdint.h>
-#include <osmocore/msgb.h>
-#include <osmocore/linuxlist.h>
-#include <osmocore/timer.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
diff --git a/src/gprs/gprs_llc_vty.c b/src/gprs/gprs_llc_vty.c
index d4f743b0..ab526992 100644
--- a/src/gprs/gprs_llc_vty.c
+++ b/src/gprs/gprs_llc_vty.c
@@ -27,11 +27,11 @@
#include <arpa/inet.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/rate_ctr.h>
#include <openbsc/debug.h>
#include <openbsc/signal.h>
#include <openbsc/gprs_llc.h>
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index 44365541..85f71050 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -21,10 +21,10 @@
#include <stdint.h>
-#include <osmocore/linuxlist.h>
-#include <osmocore/talloc.h>
-#include <osmocore/timer.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/rate_ctr.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/debug.h>
#include <openbsc/gprs_sgsn.h>
diff --git a/src/gprs/gprs_sndcp.c b/src/gprs/gprs_sndcp.c
index 4f421e45..1307fe54 100644
--- a/src/gprs/gprs_sndcp.c
+++ b/src/gprs/gprs_sndcp.c
@@ -23,10 +23,10 @@
#include <errno.h>
#include <stdint.h>
-#include <osmocore/msgb.h>
-#include <osmocore/linuxlist.h>
-#include <osmocore/timer.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/talloc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
diff --git a/src/gprs/gprs_sndcp.h b/src/gprs/gprs_sndcp.h
index e9a50be1..fef871aa 100644
--- a/src/gprs/gprs_sndcp.h
+++ b/src/gprs/gprs_sndcp.h
@@ -2,7 +2,7 @@
#define _INT_SNDCP_H
#include <stdint.h>
-#include <osmocore/linuxlist.h>
+#include <osmocom/core/linuxlist.h>
/* A fragment queue header, maintaining list of fragments for one N-PDU */
struct defrag_state {
@@ -20,7 +20,7 @@ struct defrag_state {
/* linked list of defrag_queue_entry: one for each fragment */
struct llist_head frag_list;
- struct timer_list timer;
+ struct osmo_timer_list timer;
};
/* See 6.7.1.2 Reassembly */
diff --git a/src/gprs/gprs_sndcp_vty.c b/src/gprs/gprs_sndcp_vty.c
index 5a755d5f..28fdc635 100644
--- a/src/gprs/gprs_sndcp_vty.c
+++ b/src/gprs/gprs_sndcp_vty.c
@@ -27,11 +27,11 @@
#include <arpa/inet.h>
#include <openbsc/gsm_data.h>
-#include <osmocore/msgb.h>
-#include <osmocore/tlv.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/rate_ctr.h>
#include <openbsc/debug.h>
#include <openbsc/signal.h>
#include <openbsc/gprs_llc.h>
diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index 7b10a45a..f193aa30 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -29,14 +29,13 @@
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/rate_ctr.h>
#include <openbsc/gsm_04_08_gprs.h>
#include <openbsc/signal.h>
@@ -506,7 +505,7 @@ int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi,
}
/* libgtp select loop integration */
-static int sgsn_gtp_fd_cb(struct bsc_fd *fd, unsigned int what)
+static int sgsn_gtp_fd_cb(struct osmo_fd *fd, unsigned int what)
{
struct sgsn_instance *sgi = fd->data;
int rc;
@@ -539,7 +538,7 @@ static void sgsn_gtp_tmr_start(struct sgsn_instance *sgi)
gtp_retranstimeout(sgi->gsn, &next);
/* re-schedule the timer */
- bsc_schedule_timer(&sgi->gtp_timer, next.tv_sec, next.tv_usec/1000);
+ osmo_timer_schedule(&sgi->gtp_timer, next.tv_sec, next.tv_usec/1000);
}
/* timer callback for libgtp retransmissions and ping */
@@ -571,7 +570,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi)
sgi->gtp_fd0.data = sgi;
sgi->gtp_fd0.when = BSC_FD_READ;
sgi->gtp_fd0.cb = sgsn_gtp_fd_cb;
- rc = bsc_register_fd(&sgi->gtp_fd0);
+ rc = osmo_fd_register(&sgi->gtp_fd0);
if (rc < 0)
return rc;
@@ -580,7 +579,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi)
sgi->gtp_fd1c.data = sgi;
sgi->gtp_fd1c.when = BSC_FD_READ;
sgi->gtp_fd1c.cb = sgsn_gtp_fd_cb;
- bsc_register_fd(&sgi->gtp_fd1c);
+ osmo_fd_register(&sgi->gtp_fd1c);
if (rc < 0)
return rc;
@@ -589,7 +588,7 @@ int sgsn_gtp_init(struct sgsn_instance *sgi)
sgi->gtp_fd1u.data = sgi;
sgi->gtp_fd1u.when = BSC_FD_READ;
sgi->gtp_fd1u.cb = sgsn_gtp_fd_cb;
- bsc_register_fd(&sgi->gtp_fd1u);
+ osmo_fd_register(&sgi->gtp_fd1u);
if (rc < 0)
return rc;
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index c59265fb..bfa2e52c 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -28,18 +28,19 @@
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/rate_ctr.h>
-#include <osmocore/logging.h>
-#include <osmocore/process.h>
+#include <osmocom/core/application.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/process.h>
#include <osmocom/vty/telnet_interface.h>
+#include <osmocom/vty/logging.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
@@ -62,7 +63,6 @@ void subscr_put() { abort(); }
void *tall_bsc_ctx;
struct gprs_ns_inst *sgsn_nsi;
-static struct log_target *stderr_target;
static int daemonize = 0;
const char *openbsc_copyright =
"Copyright (C) 2010 Harald Welte and On-Waves\r\n"
@@ -80,7 +80,7 @@ struct sgsn_instance *sgsn = &sgsn_inst;
/* call-back function for the NS protocol */
static int sgsn_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
- struct msgb *msg, u_int16_t bvci)
+ struct msgb *msg, uint16_t bvci)
{
int rc = 0;
@@ -105,7 +105,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
- dispatch_signal(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
+ osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
break;
@@ -174,10 +174,10 @@ static void handle_options(int argc, char **argv)
print_help();
exit(0);
case 's':
- log_set_use_color(stderr_target, 0);
+ log_set_use_color(osmo_stderr_target, 0);
break;
case 'd':
- log_parse_category_mask(stderr_target, optarg);
+ log_parse_category_mask(osmo_stderr_target, optarg);
break;
case 'D':
daemonize = 1;
@@ -186,10 +186,10 @@ static void handle_options(int argc, char **argv)
sgsn_inst.config_file = strdup(optarg);
break;
case 'T':
- log_set_print_timestamp(stderr_target, 1);
+ log_set_print_timestamp(osmo_stderr_target, 1);
break;
case 'e':
- log_set_log_level(stderr_target, atoi(optarg));
+ log_set_log_level(osmo_stderr_target, atoi(optarg));
break;
default:
/* ignore */
@@ -211,16 +211,13 @@ int main(int argc, char **argv)
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
- signal(SIGPIPE, SIG_IGN);
- log_init(&log_info);
- stderr_target = log_target_create_stderr();
- log_add_target(stderr_target);
- log_set_all_filter(stderr_target, 1);
+ osmo_init_ignore_signals();
+ osmo_init_logging(&log_info);
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
- logging_vty_add_cmds();
+ logging_vty_add_cmds(&log_info);
sgsn_vty_init();
handle_options(argc, argv);
@@ -279,7 +276,7 @@ int main(int argc, char **argv)
}
while (1) {
- rc = bsc_select_main(0);
+ rc = osmo_select_main(0);
if (rc < 0)
exit(3);
}
diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 74669ffb..4c9cf284 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -18,14 +18,13 @@
*
*/
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <osmocore/talloc.h>
-#include <osmocore/utils.h>
-#include <osmocore/rate_ctr.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/core/rate_ctr.h>
#include <openbsc/debug.h>
#include <openbsc/sgsn.h>
@@ -36,6 +35,7 @@
#include <osmocom/vty/command.h>
#include <osmocom/vty/vty.h>
+#include <osmocom/vty/misc.h>
#include <pdp.h>