aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-07-31 05:25:35 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-04 06:08:40 +0800
commitcbf7d18bb9319e2069c3cd48fd227ba3e29e9c1d (patch)
tree7c5da93176e0299a3839061c7351524a49f98524
parent9ed3e1b3f37f446206ad0f438ffdecf588a32590 (diff)
Use libosmocore instead of the old temporary laF0rge1 lib..
-rw-r--r--configure.ac7
-rw-r--r--include/Makefile.am2
-rw-r--r--include/bsc_data.h8
-rw-r--r--include/bss_patch.h2
-rw-r--r--include/bssap_sccp.h2
-rw-r--r--include/cellmgr_debug.h17
-rw-r--r--include/ipaccess.h2
-rw-r--r--include/mgcp/mgcp.h2
-rw-r--r--include/mgcp/mgcp_internal.h6
-rw-r--r--include/mgcp_ss7.h4
-rw-r--r--include/mtp_data.h9
-rw-r--r--include/mtp_level3.h1
-rw-r--r--include/mtp_pcap.h2
-rw-r--r--include/openbsc_nat/bssap.h2
-rw-r--r--include/openbsc_nat/tlv.h2
-rw-r--r--include/thread.h4
-rw-r--r--include/udp_input.h2
-rw-r--r--include/write_queue.h48
-rw-r--r--src/Makefile.am15
-rw-r--r--src/bss_patch.c2
-rw-r--r--src/bssap_sccp.c4
-rw-r--r--src/input/ipaccess.c6
-rw-r--r--src/link_udp.c4
-rw-r--r--src/main.c78
-rw-r--r--src/mgcp/mgcp_network.c9
-rw-r--r--src/mgcp/mgcp_protocol.c12
-rw-r--r--src/mgcp_ss7.c52
-rw-r--r--src/msc_conn.c5
-rw-r--r--src/mtp_layer3.c4
-rw-r--r--src/snmp_mtp.c2
-rw-r--r--src/thread.c2
-rw-r--r--src/write_queue.c91
-rw-r--r--tests/patching/Makefile.am4
-rw-r--r--tests/patching/patching_test.c4
34 files changed, 162 insertions, 254 deletions
diff --git a/configure.ac b/configure.ac
index 7ed1171..518b0bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,11 +19,14 @@ dnl Check for the SNMP header
AC_CHECK_HEADERS([net-snmp/net-snmp-config.h])
dnl Checks for typedefs, structures and compiler characteristics
-PKG_CHECK_MODULES([LAFORGE], [liblaf0rge1])
-PKG_CHECK_MODULES([SCCP], [libsccp])
+PKG_CHECK_MODULES([LIBOSMOCORE], [libosmocore])
+PKG_CHECK_MODULES([LIBOSMOSCCP], [libosmo-sccp])
+PKG_CHECK_MODULES([LIBOSMOVTY], [libosmovty])
#PKG_CHECK_MODULES([NEXUSWARE_C7], [nexusware-c7])
#PKG_CHECK_MODULES([NEXUSWARE_UNIPORTE], [nexusware-uniporte])
+AC_SUBST(UNIPORTE, [-DNO_UNIPORTE])
+
AC_OUTPUT(
include/Makefile
include/mgcp/Makefile
diff --git a/include/Makefile.am b/include/Makefile.am
index 7a2960e..8b1dd4b 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,5 +1,5 @@
noinst_HEADERS = mtp_level3.h mtp_data.h ipaccess.h thread.h mtp_pcap.h \
- mgcp_ss7.h bss_patch.h write_queue.h bssap_sccp.h bsc_data.h udp_input.h \
+ mgcp_ss7.h bss_patch.h bssap_sccp.h bsc_data.h udp_input.h \
snmp_mtp.h
SUBDIRS = mgcp openbsc_nat
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 9b5bbfd..8418dab 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -23,13 +23,13 @@
#ifndef BSC_DATA_H
#define BSC_DATA_H
-#include <laf0rge1/linuxlist.h>
-#include <laf0rge1/select.h>
-#include <laf0rge1/timer.h>
+#include <osmocore/linuxlist.h>
+#include <osmocore/select.h>
+#include <osmocore/timer.h>
+#include <osmocore/write_queue.h>
#include <sccp/sccp.h>
-#include "write_queue.h"
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/include/bss_patch.h b/include/bss_patch.h
index 43dc5f1..7d83ac9 100644
--- a/include/bss_patch.h
+++ b/include/bss_patch.h
@@ -22,7 +22,7 @@
#ifndef bss_patch_h
#define bss_patch_h
-#include <laf0rge1/msgb.h>
+#include <osmocore/msgb.h>
#include <sccp/sccp.h>
diff --git a/include/bssap_sccp.h b/include/bssap_sccp.h
index f2dd45c..91e678e 100644
--- a/include/bssap_sccp.h
+++ b/include/bssap_sccp.h
@@ -21,7 +21,7 @@
#ifndef bssap_sccp_h
#define bssap_sccp_h
-#include <sys/types.h>
+#include <stdint.h>
#include <sccp/sccp_types.h>
struct msgb *create_clear_command(struct sccp_source_reference *dest_ref);
diff --git a/include/cellmgr_debug.h b/include/cellmgr_debug.h
new file mode 100644
index 0000000..3d22cab
--- /dev/null
+++ b/include/cellmgr_debug.h
@@ -0,0 +1,17 @@
+#ifndef CELLMGR_DEBUG_H
+#define CELLMGR_DEBUG_H
+
+#define DEBUG
+#include <osmocore/logging.h>
+
+/* Debuag Areas of the code */
+enum {
+ DINP,
+ DMSC,
+ DSCCP,
+ DMGCP,
+};
+
+extern const struct log_info log_info;
+
+#endif
diff --git a/include/ipaccess.h b/include/ipaccess.h
index ca12eed..4cf3a28 100644
--- a/include/ipaccess.h
+++ b/include/ipaccess.h
@@ -1,7 +1,7 @@
#ifndef _IPACCESS_H
#define _IPACCESS_H
-#include <laf0rge1/linuxlist.h>
+#include <osmocore/linuxlist.h>
#define IPA_TCP_PORT_OML 3002
#define IPA_TCP_PORT_RSL 3003
diff --git a/include/mgcp/mgcp.h b/include/mgcp/mgcp.h
index 914571a..9bbf554 100644
--- a/include/mgcp/mgcp.h
+++ b/include/mgcp/mgcp.h
@@ -24,7 +24,7 @@
#ifndef OPENBSC_MGCP_H
#define OPENBSC_MGCP_H
-#include <laf0rge1/msgb.h>
+#include <osmocore/msgb.h>
#include <arpa/inet.h>
diff --git a/include/mgcp/mgcp_internal.h b/include/mgcp/mgcp_internal.h
index d1a6523..ab6217d 100644
--- a/include/mgcp/mgcp_internal.h
+++ b/include/mgcp/mgcp_internal.h
@@ -24,14 +24,10 @@
#ifndef OPENBSC_MGCP_DATA_H
#define OPENBSC_MGCP_DATA_H
-#include <laf0rge1/select.h>
+#include <osmocore/select.h>
#define CI_UNUSED 0
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#endif
-
enum mgcp_connection_mode {
MGCP_CONN_NONE = 0,
MGCP_CONN_RECV_ONLY = 1,
diff --git a/include/mgcp_ss7.h b/include/mgcp_ss7.h
index 3c9b4b7..2779962 100644
--- a/include/mgcp_ss7.h
+++ b/include/mgcp_ss7.h
@@ -23,9 +23,9 @@
#ifndef mgcp_ss7_h
#define mgcp_ss7_h
-#include <laf0rge1/timer.h>
+#include <osmocore/timer.h>
+#include <osmocore/write_queue.h>
-#include "write_queue.h"
#include "thread.h"
diff --git a/include/mtp_data.h b/include/mtp_data.h
index 7006953..b8f6af0 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -21,8 +21,9 @@
#ifndef mtp_data_h
#define mtp_data_h
-#include <laf0rge1/msgb.h>
-#include <laf0rge1/timer.h>
+#include <osmocore/msgb.h>
+#include <osmocore/timer.h>
+#include <osmocore/utils.h>
/* MTP Level3 timers */
@@ -81,8 +82,4 @@ void mtp_link_restart(struct mtp_link *link);
void mtp_link_slta_recv(struct mtp_link *link);
void mtp_link_sccp_down(struct mtp_link *link);
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#endif
-
#endif
diff --git a/include/mtp_level3.h b/include/mtp_level3.h
index ad00c1a..a7cdd45 100644
--- a/include/mtp_level3.h
+++ b/include/mtp_level3.h
@@ -23,6 +23,7 @@
#ifndef mtp_level3_h
#define mtp_level3_h
+#include <stdint.h>
#include <endian.h>
#include <sys/types.h>
diff --git a/include/mtp_pcap.h b/include/mtp_pcap.h
index 1b7334a..5e8f7d3 100644
--- a/include/mtp_pcap.h
+++ b/include/mtp_pcap.h
@@ -21,7 +21,7 @@
#ifndef mtp_pcap_h
#define mtp_pcap_h
-#include <sys/types.h>
+#include <stdint.h>
int mtp_pcap_write_header(int fd);
int mtp_pcap_write_msu(int fd, const uint8_t *data, int length);
diff --git a/include/openbsc_nat/bssap.h b/include/openbsc_nat/bssap.h
index 4986f9d..68e4d00 100644
--- a/include/openbsc_nat/bssap.h
+++ b/include/openbsc_nat/bssap.h
@@ -5,7 +5,7 @@
#include <stdlib.h>
-#include <laf0rge1/msgb.h>
+#include <osmocore/msgb.h>
#include <sccp/sccp.h>
struct gsm_network;
diff --git a/include/openbsc_nat/tlv.h b/include/openbsc_nat/tlv.h
index 88bd9af..e2d4b88 100644
--- a/include/openbsc_nat/tlv.h
+++ b/include/openbsc_nat/tlv.h
@@ -4,7 +4,7 @@
#include <sys/types.h>
#include <string.h>
-#include <laf0rge1/msgb.h>
+#include <osmocore/msgb.h>
/* Terminology / wording
tag length value (in bits)
diff --git a/include/thread.h b/include/thread.h
index f23cae7..2db8118 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -21,8 +21,8 @@
#ifndef thread_h
#define thread_h
-#include <laf0rge1/linuxlist.h>
-#include <laf0rge1/select.h>
+#include <osmocore/linuxlist.h>
+#include <osmocore/select.h>
#include <pthread.h>
diff --git a/include/udp_input.h b/include/udp_input.h
index 1715733..b11448b 100644
--- a/include/udp_input.h
+++ b/include/udp_input.h
@@ -24,7 +24,7 @@
#define c7_udp_input_h
#include <stdint.h>
-#include "write_queue.h"
+#include <osmocore/write_queue.h>
#define UDP_FORMAT_SIMPLE_UDP 2
#define UDP_FORMAT_SIMPLE_TCP 3
diff --git a/include/write_queue.h b/include/write_queue.h
deleted file mode 100644
index 45191e0..0000000
--- a/include/write_queue.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/* Generic write queue implementation */
-#ifndef write_queue_h
-#define write_queue_h
-
-#include <laf0rge1/select.h>
-#include <laf0rge1/msgb.h>
-
-struct write_queue {
- struct bsc_fd bfd;
- unsigned int max_length;
- unsigned int current_length;
-
- unsigned int paused;
-
- struct llist_head msg_queue;
-
- int (*read_cb)(struct bsc_fd *fd);
- int (*write_cb)(struct bsc_fd *fd, struct msgb *msg);
-};
-
-void write_queue_init(struct write_queue *queue, int max_length);
-int write_queue_enqueue(struct write_queue *queue, struct msgb *data);
-int write_queue_bfd_cb(struct bsc_fd *fd, unsigned int what);
-
-void write_queue_pause(struct write_queue *queue);
-void write_queue_unpause(struct write_queue *queue);
-
-#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 472c6ba..5872598 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,15 +1,16 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include
-AM_CFLAGS=-Wall $(LAFORGE_CFLAGS) $(SCCP_CFLAGS) \
- $(NEXUSWARE_C7_CFLAGS) $(NEXUSWARE_UNIPORTE_CFLAGS)
+AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(LIBOSMOVTY_CFLAGS) \
+ $(NEXUSWARE_C7_CFLAGS) $(NEXUSWARE_UNIPORTE_CFLAGS) $(UNIPORTE)
sbin_PROGRAMS = cellmgr_ng mgcp_mgw
-mgcp_mgw_SOURCES = mgcp_ss7.c write_queue.c mgcp/mgcp_protocol.c mgcp/mgcp_network.c thread.c
-mgcp_mgw_LDADD = $(LAFORGE_LIBS) $(NEXUSWARE_C7_LIBS) $(NEXUSWARE_UNIPORTE_LIBS) -lvty -lpthread
+mgcp_mgw_SOURCES = mgcp_ss7.c mgcp/mgcp_protocol.c mgcp/mgcp_network.c thread.c
+mgcp_mgw_LDADD = $(LAFORGE_LIBS) $(NEXUSWARE_C7_LIBS) $(NEXUSWARE_UNIPORTE_LIBS) \
+ $(LIBOSMOVTY_LIBS) $(LIBOSMOCORE_LIBS) -lpthread
cellmgr_ng_SOURCES = main.c mtp_layer3.c thread.c input/ipaccess.c pcap.c \
bss_patch.c \
- openbsc_nat/bssap.c openbsc_nat/tlv_parser.c write_queue.c bssap_sccp.c \
+ openbsc_nat/bssap.c openbsc_nat/tlv_parser.c bssap_sccp.c \
msc_conn.c link_udp.c snmp_mtp.c
-cellmgr_ng_LDADD = $(LAFORGE_LIBS) $(SCCP_LIBS) $(NEXUSWARE_C7_LIBS) \
- -lpthread -lnetsnmp -lcrypto -lvty
+cellmgr_ng_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \
+ -lpthread -lnetsnmp -lcrypto
diff --git a/src/bss_patch.c b/src/bss_patch.c
index c4deeb2..5ae58aa 100644
--- a/src/bss_patch.c
+++ b/src/bss_patch.c
@@ -21,12 +21,12 @@
*/
#include <bss_patch.h>
+#include <cellmgr_debug.h>
#include <string.h>
#include <openbsc_nat/bssap.h>
#include <openbsc_nat/tlv.h>
-#include <laf0rge1/debug.h>
#include <sccp/sccp.h>
#include <arpa/inet.h>
diff --git a/src/bssap_sccp.c b/src/bssap_sccp.c
index e6b7271..3f4a8dd 100644
--- a/src/bssap_sccp.c
+++ b/src/bssap_sccp.c
@@ -21,9 +21,9 @@
*/
#include <bssap_sccp.h>
+#include <cellmgr_debug.h>
-#include <laf0rge1/msgb.h>
-#include <laf0rge1/debug.h>
+#include <osmocore/msgb.h>
#include <openbsc_nat/bssap.h>
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index b603015..1c0f1ae 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -32,9 +32,9 @@
#include <sys/ioctl.h>
#include <arpa/inet.h>
-#include <laf0rge1/select.h>
-#include <laf0rge1/msgb.h>
-#include <laf0rge1/talloc.h>
+#include <osmocore/select.h>
+#include <osmocore/msgb.h>
+#include <osmocore/talloc.h>
#include <ipaccess.h>
diff --git a/src/link_udp.c b/src/link_udp.c
index 17c90ac..f0532ac 100644
--- a/src/link_udp.c
+++ b/src/link_udp.c
@@ -25,9 +25,9 @@
#include <mtp_data.h>
#include <mtp_pcap.h>
#include <snmp_mtp.h>
+#include <cellmgr_debug.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/talloc.h>
+#include <osmocore/talloc.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/src/main.c b/src/main.c
index cb78653..1f5be89 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,12 +27,12 @@
#include <bssap_sccp.h>
#include <bsc_data.h>
#include <snmp_mtp.h>
+#include <cellmgr_debug.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/talloc.h>
+#include <osmocore/talloc.h>
-#include <vty/command.h>
-#include <vty/vty.h>
+#include <osmocom/vty/command.h>
+#include <osmocom/vty/vty.h>
#include <openbsc_nat/bssap.h>
@@ -54,7 +54,7 @@
#endif
#include <getopt.h>
-static struct debug_target *stderr_target;
+static struct log_target *stderr_target;
static int dpc = 1;
static int opc = 0;
@@ -66,6 +66,12 @@ static int once = 0;
static int flood = 0;
static struct timer_list flood_timer;
+static struct vty_app_info vty_info = {
+ .name = "Cellmgr-ng",
+ .version = "0.0.1",
+ .go_parent_cb = NULL,
+};
+
/*
* One SCCP connection.
* Use for connection tracking and fixups...
@@ -816,19 +822,21 @@ int main(int argc, char **argv)
mtp_link_init();
thread_init();
- debug_init();
- stderr_target = debug_target_create_stderr();
- debug_add_target(stderr_target);
+ log_init(&log_info);
+ stderr_target = log_target_create_stderr();
+ log_add_target(stderr_target);
/* enable filters */
- debug_set_all_filter(stderr_target, 1);
- debug_set_category_filter(stderr_target, DINP, 1, LOGL_INFO);
- debug_set_category_filter(stderr_target, DSCCP, 1, LOGL_INFO);
- debug_set_category_filter(stderr_target, DMSC, 1, LOGL_INFO);
- debug_set_category_filter(stderr_target, DMGCP, 1, LOGL_INFO);
- debug_set_print_timestamp(stderr_target, 1);
- debug_set_use_color(stderr_target, 0);
+ log_set_all_filter(stderr_target, 1);
+ log_set_category_filter(stderr_target, DINP, 1, LOGL_INFO);
+ log_set_category_filter(stderr_target, DSCCP, 1, LOGL_INFO);
+ log_set_category_filter(stderr_target, DMSC, 1, LOGL_INFO);
+ log_set_category_filter(stderr_target, DMGCP, 1, LOGL_INFO);
+ log_set_print_timestamp(stderr_target, 1);
+ log_set_use_color(stderr_target, 0);
+
+ sccp_set_log_area(DSCCP);
bsc.setup = 0;
bsc.msc_address = "127.0.0.1";
@@ -846,7 +854,7 @@ int main(int argc, char **argv)
srand(time(NULL));
cell_vty_init();
- if (vty_read_config_file(config) < 0) {
+ if (vty_read_config_file(config, NULL) < 0) {
fprintf(stderr, "Failed to read the VTY config.\n");
return -1;
}
@@ -902,8 +910,12 @@ int main(int argc, char **argv)
}
/* vty code */
+enum cellmgr_node {
+ CELLMGR_NODE = _LAST_OSMOVTY_NODE,
+};
+
static struct cmd_node cell_node = {
- GSMNET_NODE,
+ CELLMGR_NODE,
"%s(cellmgr)#",
1,
};
@@ -916,7 +928,7 @@ static int config_write_cell()
DEFUN(cfg_cell, cfg_cell_cmd,
"cellmgr", "Configure the Cellmgr")
{
- vty->node = GSMNET_NODE;
+ vty->node = CELLMGR_NODE;
return CMD_SUCCESS;
}
@@ -1054,25 +1066,25 @@ DEFUN(cfg_msc_time, cfg_msc_time_cmd,
static void cell_vty_init(void)
{
cmd_init(1);
- vty_init();
+ vty_init(&vty_info);
install_element(CONFIG_NODE, &cfg_cell_cmd);
install_node(&cell_node, config_write_cell);
- install_element(GSMNET_NODE, &cfg_net_dpc_cmd);
- install_element(GSMNET_NODE, &cfg_net_opc_cmd);
- install_element(GSMNET_NODE, &cfg_udp_dst_ip_cmd);
- install_element(GSMNET_NODE, &cfg_udp_dst_port_cmd);
- install_element(GSMNET_NODE, &cfg_udp_src_port_cmd);
- install_element(GSMNET_NODE, &cfg_udp_reset_cmd);
- install_element(GSMNET_NODE, &cfg_sltm_once_cmd);
- install_element(GSMNET_NODE, &cfg_msc_ip_cmd);
- install_element(GSMNET_NODE, &cfg_msc_token_cmd);
- install_element(GSMNET_NODE, &cfg_msc_ip_dscp_cmd);
- install_element(GSMNET_NODE, &cfg_msc_ip_tos_cmd);
- install_element(GSMNET_NODE, &cfg_ping_time_cmd);
- install_element(GSMNET_NODE, &cfg_pong_time_cmd);
- install_element(GSMNET_NODE, &cfg_msc_time_cmd);
+ install_element(CELLMGR_NODE, &cfg_net_dpc_cmd);
+ install_element(CELLMGR_NODE, &cfg_net_opc_cmd);
+ install_element(CELLMGR_NODE, &cfg_udp_dst_ip_cmd);
+ install_element(CELLMGR_NODE, &cfg_udp_dst_port_cmd);
+ install_element(CELLMGR_NODE, &cfg_udp_src_port_cmd);
+ install_element(CELLMGR_NODE, &cfg_udp_reset_cmd);
+ install_element(CELLMGR_NODE, &cfg_sltm_once_cmd);
+ install_element(CELLMGR_NODE, &cfg_msc_ip_cmd);
+ install_element(CELLMGR_NODE, &cfg_msc_token_cmd);
+ install_element(CELLMGR_NODE, &cfg_msc_ip_dscp_cmd);
+ install_element(CELLMGR_NODE, &cfg_msc_ip_tos_cmd);
+ install_element(CELLMGR_NODE, &cfg_ping_time_cmd);
+ install_element(CELLMGR_NODE, &cfg_pong_time_cmd);
+ install_element(CELLMGR_NODE, &cfg_msc_time_cmd);
}
void subscr_put() {}
diff --git a/src/mgcp/mgcp_network.c b/src/mgcp/mgcp_network.c
index 1ea5f99..0c86de5 100644
--- a/src/mgcp/mgcp_network.c
+++ b/src/mgcp/mgcp_network.c
@@ -34,10 +34,11 @@
#include <mgcp/mgcp.h>
#include <mgcp/mgcp_internal.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/msgb.h>
-#include <laf0rge1/talloc.h>
-#include <laf0rge1/select.h>
+#include <cellmgr_debug.h>
+
+#include <osmocore/msgb.h>
+#include <osmocore/talloc.h>
+#include <osmocore/select.h>
#warning "Make use of the rtp proxy code"
diff --git a/src/mgcp/mgcp_protocol.c b/src/mgcp/mgcp_protocol.c
index ea99543..618503e 100644
--- a/src/mgcp/mgcp_protocol.c
+++ b/src/mgcp/mgcp_protocol.c
@@ -30,13 +30,17 @@
#include <limits.h>
#include <unistd.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/msgb.h>
-#include <laf0rge1/talloc.h>
-#include <laf0rge1/select.h>
+#include <cellmgr_debug.h>
+
#include <mgcp/mgcp.h>
#include <mgcp/mgcp_internal.h>
+#include <osmocore/msgb.h>
+#include <osmocore/talloc.h>
+#include <osmocore/select.h>
+#include <osmocore/utils.h>
+
+
/**
* Macro for tokenizing MGCP messages and SDP in one go.
*
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c
index 36421c6..89aaeac 100644
--- a/src/mgcp_ss7.c
+++ b/src/mgcp_ss7.c
@@ -24,15 +24,14 @@
#include <mgcp/mgcp.h>
#include <mgcp/mgcp_internal.h>
-#include <write_queue.h>
+#include <cellmgr_debug.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/select.h>
-#include <laf0rge1/talloc.h>
-#include <laf0rge1/timer.h>
+#include <osmocore/select.h>
+#include <osmocore/talloc.h>
+#include <osmocore/timer.h>
-#include <vty/command.h>
-#include <vty/vty.h>
+#include <osmocom/vty/command.h>
+#include <osmocom/vty/vty.h>
/* uniporte includes */
#ifndef NO_UNIPORTE
@@ -55,7 +54,7 @@
#endif
#include <getopt.h>
-static struct debug_target *stderr_target;
+static struct log_target *stderr_target;
static int payload = 126;
static int number_endpoints = 32;
static char *mgw_ip = "172.18.0.30";
@@ -766,26 +765,26 @@ static void handle_options(int argc, char **argv)
int main(int argc, char **argv)
{
struct mgcp_ss7 *mgcp;
- debug_init();
- stderr_target = debug_target_create_stderr();
- debug_add_target(stderr_target);
+ log_init(&log_info);
+ stderr_target = log_target_create_stderr();
+ log_add_target(stderr_target);
/* enable filters */
- debug_set_all_filter(stderr_target, 1);
- debug_set_category_filter(stderr_target, DINP, 1, LOGL_INFO);
- debug_set_category_filter(stderr_target, DSCCP, 1, LOGL_INFO);
- debug_set_category_filter(stderr_target, DMSC, 1, LOGL_INFO);
- debug_set_category_filter(stderr_target, DMGCP, 1, LOGL_INFO);
- debug_set_print_timestamp(stderr_target, 1);
- debug_set_use_color(stderr_target, 0);
+ log_set_all_filter(stderr_target, 1);
+ log_set_category_filter(stderr_target, DINP, 1, LOGL_INFO);
+ log_set_category_filter(stderr_target, DSCCP, 1, LOGL_INFO);
+ log_set_category_filter(stderr_target, DMSC, 1, LOGL_INFO);
+ log_set_category_filter(stderr_target, DMGCP, 1, LOGL_INFO);
+ log_set_print_timestamp(stderr_target, 1);
+ log_set_use_color(stderr_target, 0);
handle_options(argc, argv);
signal(SIGPIPE, SIG_IGN);
mgcp_mgw_vty_init();
- if (vty_read_config_file(config_file) < 0) {
+ if (vty_read_config_file(config_file, NULL) < 0) {
fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file);
return -1;
}
@@ -805,6 +804,10 @@ int main(int argc, char **argv)
}
/* VTY code */
+enum cellmgr_node {
+ MGCP_NODE = _LAST_OSMOVTY_NODE,
+};
+
struct cmd_node mgcp_node = {
MGCP_NODE,
"%s(mgcp)#",
@@ -918,10 +921,17 @@ static int config_write_mgcp()
return CMD_SUCCESS;
}
+static struct vty_app_info vty_info = {
+ .name = "mgcp_ss7",
+ .version = "0.0.1",
+ .go_parent_cb = NULL,
+};
+
+
static void mgcp_mgw_vty_init(void)
{
cmd_init(1);
- vty_init();
+ vty_init(&vty_info);
install_element(CONFIG_NODE, &cfg_mgcp_cmd);
install_node(&mgcp_node, config_write_mgcp);
@@ -937,3 +947,5 @@ static void mgcp_mgw_vty_init(void)
void subscr_put() {}
void vty_event() {}
+
+const char *openbsc_copyright = "";
diff --git a/src/msc_conn.c b/src/msc_conn.c
index 75b981b..b569bf1 100644
--- a/src/msc_conn.c
+++ b/src/msc_conn.c
@@ -25,9 +25,10 @@
#include <bssap_sccp.h>
#include <ipaccess.h>
#include <mtp_data.h>
+#include <cellmgr_debug.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/tlv.h>
+#include <osmocore/tlv.h>
+#include <osmocore/utils.h>
#include <arpa/inet.h>
#include <sys/socket.h>
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index 446e0e9..113cabd 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -21,9 +21,9 @@
*/
#include <mtp_data.h>
#include <mtp_level3.h>
+#include <cellmgr_debug.h>
-#include <laf0rge1/debug.h>
-#include <laf0rge1/talloc.h>
+#include <osmocore/talloc.h>
#include <sccp/sccp.h>
diff --git a/src/snmp_mtp.c b/src/snmp_mtp.c
index d2ff495..3e69a64 100644
--- a/src/snmp_mtp.c
+++ b/src/snmp_mtp.c
@@ -19,7 +19,7 @@
*
*/
#include <snmp_mtp.h>
-#include <laf0rge1/talloc.h>
+#include <osmocore/talloc.h>
static void add_pdu_var(netsnmp_pdu *pdu, const char *mib_name, int id, const char *value)
{
diff --git a/src/thread.c b/src/thread.c
index 8175a49..9563fd5 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -20,7 +20,7 @@
*/
#include <thread.h>
-#include <laf0rge1/talloc.h>
+#include <osmocore/talloc.h>
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/src/write_queue.c b/src/write_queue.c
deleted file mode 100644
index ac529a3..0000000
--- a/src/write_queue.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Generic write queue implementation */
-/*
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include <write_queue.h>
-
-#include <laf0rge1/debug.h>
-
-int write_queue_bfd_cb(struct bsc_fd *fd, unsigned int what)
-{
- struct write_queue *queue;
-
- queue = container_of(fd, struct write_queue, bfd);
-
- if (what & BSC_FD_READ)
- queue->read_cb(fd);
-
- if (what & BSC_FD_WRITE) {
- struct msgb *msg;
-
- fd->when &= ~BSC_FD_WRITE;
- msg = msgb_dequeue(&queue->msg_queue);
- if (!msg)
- return -1;
-
- --queue->current_length;
- queue->write_cb(fd, msg);
- msgb_free(msg);
-
- if (!llist_empty(&queue->msg_queue))
- fd->when |= BSC_FD_WRITE;
- }
-
- return 0;
-}
-
-void write_queue_init(struct write_queue *queue, int max_length)
-{
- queue->max_length = max_length;
- queue->current_length = 0;
- queue->read_cb = NULL;
- queue->write_cb = NULL;
- queue->bfd.cb = write_queue_bfd_cb;
- queue->paused = 0;
- INIT_LLIST_HEAD(&queue->msg_queue);
-}
-
-int write_queue_enqueue(struct write_queue *queue, struct msgb *data)
-{
- if (queue->current_length + 1 >= queue->max_length)
- LOGP(DMSC, LOGL_ERROR, "The queue is full. Dropping not yet implemented.\n");
-
- ++queue->current_length;
- msgb_enqueue(&queue->msg_queue, data);
-
- if (!queue->paused)
- queue->bfd.when |= BSC_FD_WRITE;
-
- return 0;
-}
-
-void write_queue_pause(struct write_queue *queue)
-{
- queue->paused = 1;
- queue->bfd.when &= ~BSC_FD_WRITE;
-}
-
-void write_queue_unpause(struct write_queue *queue)
-{
- queue->paused = 0;
- if (!llist_empty(&queue->msg_queue))
- queue->bfd.when |= BSC_FD_WRITE;
-}
diff --git a/tests/patching/Makefile.am b/tests/patching/Makefile.am
index d99a55a..8418806 100644
--- a/tests/patching/Makefile.am
+++ b/tests/patching/Makefile.am
@@ -1,8 +1,8 @@
-INCLUDES = $(all_includes) -I$(top_srcdir)/include $(LAFORGE_CFLAGS) -Wall
+INCLUDES = $(all_includes) -I$(top_srcdir)/include $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSCCP_CFLAGS) -Wall
noinst_PROGRAMS = patching_test
patching_test_SOURCES = patching_test.c $(top_srcdir)/src/bss_patch.c \
$(top_srcdir)/src/openbsc_nat/tlv_parser.c \
$(top_srcdir)/src/openbsc_nat/bssap.c
-patching_test_LDADD = $(LAFORGE_LIBS) $(SCCP_LIBS)
+patching_test_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS)
diff --git a/tests/patching/patching_test.c b/tests/patching/patching_test.c
index ecbad83..12e292c 100644
--- a/tests/patching/patching_test.c
+++ b/tests/patching/patching_test.c
@@ -1,6 +1,8 @@
#include <bss_patch.h>
-#include <laf0rge1/debug.h>
+#include <cellmgr_debug.h>
+
+#include <osmocore/utils.h>
#include <stdio.h>
#include <string.h>