aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/Makefile.am2
-rw-r--r--openbsc/configure.in2
-rw-r--r--openbsc/include/openbsc/Makefile.am12
-rw-r--r--openbsc/include/openbsc/ipaccess.h5
-rw-r--r--openbsc/include/openbsc/msgb.h3
-rw-r--r--openbsc/include/openbsc/select.h2
-rw-r--r--openbsc/include/openbsc/telnet_interface.h3
-rw-r--r--openbsc/include/openbsc/tlv.h13
-rw-r--r--openbsc/include/sccp/Makefile.am3
-rw-r--r--openbsc/include/sccp/sccp.h4
-rw-r--r--openbsc/liblaf0rge1.pc.in11
-rw-r--r--openbsc/libsccp.pc.in10
-rw-r--r--openbsc/src/Makefile.am17
-rw-r--r--openbsc/src/bsc_init.c6
-rw-r--r--openbsc/src/input/ipaccess.c19
-rw-r--r--openbsc/src/sccp/sccp.c7
-rw-r--r--openbsc/tests/db/Makefile.am2
-rw-r--r--openbsc/tests/gsm0408/Makefile.am2
-rw-r--r--openbsc/tests/sccp/Makefile.am2
-rw-r--r--openbsc/tests/sccp/sccp_test.c4
-rw-r--r--openbsc/tests/sms/Makefile.am2
21 files changed, 98 insertions, 33 deletions
diff --git a/openbsc/Makefile.am b/openbsc/Makefile.am
index deaba0fa1..7dcd956df 100644
--- a/openbsc/Makefile.am
+++ b/openbsc/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
SUBDIRS = include src tests
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = openbsc.pc
+pkgconfig_DATA = openbsc.pc liblaf0rge1.pc libsccp.pc
#dist-hook:
# rm -rf `find $(distdir) -name .svn`
diff --git a/openbsc/configure.in b/openbsc/configure.in
index cba6c6cd9..88a3f61f4 100644
--- a/openbsc/configure.in
+++ b/openbsc/configure.in
@@ -38,6 +38,8 @@ AM_CONFIG_HEADER(bscconfig.h)
AC_OUTPUT(
openbsc.pc
+ liblaf0rge1.pc
+ libsccp.pc
include/openbsc/Makefile
include/vty/Makefile
include/sccp/Makefile
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index b4760252e..0226c2d77 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -1,8 +1,12 @@
-noinst_HEADERS = abis_nm.h abis_rsl.h debug.h db.h gsm_04_08.h gsm_data.h \
- gsm_subscriber.h linuxlist.h msgb.h select.h tlv.h gsm_04_11.h \
+noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
+ gsm_subscriber.h gsm_04_11.h \
timer.h misdn.h chan_alloc.h telnet_interface.h paging.h \
- subchan_demux.h trau_frame.h e1_input.h trau_mux.h signal.h \
+ subchan_demux.h trau_frame.h e1_input.h trau_mux.h \
gsm_utils.h ipaccess.h rs232.h openbscdefines.h rtp_proxy.h \
- bsc_rll.h mncc.h talloc.h transaction.h ussd.h gsm_04_80.h \
+ bsc_rll.h mncc.h transaction.h ussd.h gsm_04_80.h \
silent_call.h mgcp.h meas_rep.h bitvec.h rest_octets.h \
system_information.h handover.h statistics.h
+
+laforge_HEADERS = signal.h linuxlist.h timer.h talloc.h msgb.h select.h tlv.h \
+ debug.h
+laforgedir= $(includedir)/laf0rge1
diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h
index 8c12e59cc..e101428e4 100644
--- a/openbsc/include/openbsc/ipaccess.h
+++ b/openbsc/include/openbsc/ipaccess.h
@@ -48,6 +48,11 @@ int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa);
int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd);
struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error);
void ipaccess_prepend_header(struct msgb *msg, int proto);
+int ipaccess_send_id_ack(int fd);
+int ipaccess_send_id_req(int fd);
+
+int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
+
/*
* Firmware specific header
diff --git a/openbsc/include/openbsc/msgb.h b/openbsc/include/openbsc/msgb.h
index ab3c03396..d0efc90b5 100644
--- a/openbsc/include/openbsc/msgb.h
+++ b/openbsc/include/openbsc/msgb.h
@@ -20,7 +20,8 @@
*
*/
-#include <openbsc/linuxlist.h>
+#include <sys/types.h>
+#include "linuxlist.h"
struct bts_link;
diff --git a/openbsc/include/openbsc/select.h b/openbsc/include/openbsc/select.h
index c2af1d787..2d8b3ec07 100644
--- a/openbsc/include/openbsc/select.h
+++ b/openbsc/include/openbsc/select.h
@@ -1,7 +1,7 @@
#ifndef _BSC_SELECT_H
#define _BSC_SELECT_H
-#include <openbsc/linuxlist.h>
+#include "linuxlist.h"
#define BSC_FD_READ 0x0001
#define BSC_FD_WRITE 0x0002
diff --git a/openbsc/include/openbsc/telnet_interface.h b/openbsc/include/openbsc/telnet_interface.h
index f4e976f77..8e0e9108a 100644
--- a/openbsc/include/openbsc/telnet_interface.h
+++ b/openbsc/include/openbsc/telnet_interface.h
@@ -27,9 +27,6 @@
#include <vty/vty.h>
-#define TELNET_COMMAND_48 1
-#define TELNET_COMMAND_11 2
-
struct telnet_connection {
struct llist_head entry;
struct gsm_network *network;
diff --git a/openbsc/include/openbsc/tlv.h b/openbsc/include/openbsc/tlv.h
index c90643eed..6141b1f07 100644
--- a/openbsc/include/openbsc/tlv.h
+++ b/openbsc/include/openbsc/tlv.h
@@ -22,6 +22,7 @@
#define TLV_GROSS_LEN(x) (x+2)
#define TLV16_GROSS_LEN(x) ((2*x)+2)
#define TL16V_GROSS_LEN(x) (x+3)
+#define L16TV_GROSS_LEN(x) (x+3)
#define TVLV_MAX_ONEBYTE 0x7f
@@ -105,6 +106,18 @@ static inline u_int8_t *msgb_tvlv_put(struct msgb *msg, u_int8_t tag, u_int16_t
return tvlv_put(buf, tag, len, val);
}
+static inline u_int8_t *msgb_l16tv_put(struct msgb *msg, u_int16_t len, u_int8_t tag,
+ const u_int8_t *val)
+{
+ u_int8_t *buf = msgb_put(msg, L16TV_GROSS_LEN(len));
+
+ *buf++ = len >> 8;
+ *buf++ = len & 0xff;
+ *buf++ = tag;
+ memcpy(buf, val, len);
+ return buf + len;
+}
+
static inline u_int8_t *v_put(u_int8_t *buf, u_int8_t val)
{
*buf++ = val;
diff --git a/openbsc/include/sccp/Makefile.am b/openbsc/include/sccp/Makefile.am
index 42fd31047..6c8a51714 100644
--- a/openbsc/include/sccp/Makefile.am
+++ b/openbsc/include/sccp/Makefile.am
@@ -1 +1,2 @@
-noinst_HEADERS = sccp_types.h sccp.h
+sccp_HEADERS = sccp_types.h sccp.h
+sccpdir = $(includedir)/sccp
diff --git a/openbsc/include/sccp/sccp.h b/openbsc/include/sccp/sccp.h
index e5e8b819c..643479adc 100644
--- a/openbsc/include/sccp/sccp.h
+++ b/openbsc/include/sccp/sccp.h
@@ -27,11 +27,11 @@
#include <stdlib.h>
#include <sys/socket.h>
-
-#include <openbsc/msgb.h>
+#include <sys/types.h>
#include "sccp_types.h"
+struct msgb;
struct sccp_system;
enum {
diff --git a/openbsc/liblaf0rge1.pc.in b/openbsc/liblaf0rge1.pc.in
new file mode 100644
index 000000000..953910156
--- /dev/null
+++ b/openbsc/liblaf0rge1.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: LaF0rge Lib
+Description: C Utility Library
+Version: @VERSION@
+Libs: -L${libdir} -llaf0rge1
+Cflags: -I${includedir}/
+
diff --git a/openbsc/libsccp.pc.in b/openbsc/libsccp.pc.in
new file mode 100644
index 000000000..eda8d499c
--- /dev/null
+++ b/openbsc/libsccp.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: OpenBSC SCCP Lib
+Description: OpenBSC SCCP Lib
+Version: @VERSION@
+Libs: -L${libdir} -lsccp
+Cflags: -I${includedir}/
diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am
index 161c283f6..ba3d2802c 100644
--- a/openbsc/src/Makefile.am
+++ b/openbsc/src/Makefile.am
@@ -3,14 +3,19 @@ AM_CFLAGS=-Wall
sbin_PROGRAMS = bsc_hack bs11_config ipaccess-find ipaccess-config \
isdnsync bsc_mgcp ipaccess-proxy
-noinst_LIBRARIES = libbsc.a libmsc.a libvty.a libsccp.a
+noinst_LIBRARIES = libbsc.a libmsc.a libvty.a
noinst_HEADERS = vty/cardshell.h
+bscdir = $(libdir)
+bsc_LIBRARIES = liblaf0rge1.a libsccp.a
+
+liblaf0rge1_a_SOURCES = msgb.c timer.c talloc.c select.c signal.c debug.c
+
libbsc_a_SOURCES = abis_rsl.c abis_nm.c gsm_data.c gsm_04_08_utils.c \
- msgb.c select.c chan_alloc.c timer.c debug.c \
+ chan_alloc.c \
gsm_subscriber_base.c subchan_demux.c bsc_rll.c transaction.c \
trau_frame.c trau_mux.c paging.c e1_config.c e1_input.c tlv_parser.c \
- input/misdn.c input/ipaccess.c signal.c gsm_utils.c talloc.c \
+ input/misdn.c input/ipaccess.c signal.c gsm_utils.c \
talloc_ctx.c system_information.c bitvec.c rest_octets.c \
rtp_proxy.c statistics.c bts_siemens_bs11.c bts_ipaccess_nanobts.c \
bts_unknown.c
@@ -25,7 +30,7 @@ libvty_a_SOURCES = vty/buffer.c vty/command.c vty/vector.c vty/vty.c
libsccp_a_SOURCES = sccp/sccp.c
bsc_hack_SOURCES = bsc_hack.c bsc_init.c vty_interface.c vty_interface_layer3.c
-bsc_hack_LDADD = libmsc.a libbsc.a libmsc.a libvty.a -ldl -ldbi $(LIBCRYPT)
+bsc_hack_LDADD = libmsc.a libbsc.a libmsc.a libvty.a liblaf0rge1.a -ldl -ldbi $(LIBCRYPT)
bs11_config_SOURCES = bs11_config.c abis_nm.c gsm_data.c msgb.c debug.c \
select.c timer.c rs232.c tlv_parser.c signal.c talloc.c \
@@ -34,11 +39,11 @@ bs11_config_SOURCES = bs11_config.c abis_nm.c gsm_data.c msgb.c debug.c \
ipaccess_find_SOURCES = ipaccess/ipaccess-find.c select.c timer.c
ipaccess_config_SOURCES = ipaccess/ipaccess-config.c ipaccess/ipaccess-firmware.c
-ipaccess_config_LDADD = libbsc.a libmsc.a libbsc.a libvty.a -ldl -ldbi $(LIBCRYPT)
+ipaccess_config_LDADD = libbsc.a libmsc.a libbsc.a libvty.a liblaf0rge1.a -ldl -ldbi $(LIBCRYPT)
isdnsync_SOURCES = isdnsync.c
bsc_mgcp_SOURCES = mgcp/mgcp_main.c mgcp/mgcp_protocol.c msgb.c talloc.c debug.c select.c timer.c telnet_interface.c
-bsc_mgcp_LDADD = libvty.a
+bsc_mgcp_LDADD = libvty.a liblaf0rge1.a
ipaccess_proxy_SOURCES = ipaccess/ipaccess-proxy.c msgb.c select.c talloc.c debug.c timer.c
diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c
index 622fb98cd..617d4ae44 100644
--- a/openbsc/src/bsc_init.c
+++ b/openbsc/src/bsc_init.c
@@ -802,8 +802,10 @@ static int bootstrap_bts(struct gsm_bts *bts)
}
break;
case GSM_BAND_900:
- if (bts->c0->arfcn < 1 || bts->c0->arfcn > 124) {
- LOGP(DNM, LOGL_ERROR, "GSM900 channel must be between 1-124.\n");
+ if (bts->c0->arfcn < 1 ||
+ (bts->c0->arfcn > 124 && bts->c0->arfcn < 955) ||
+ bts->c0->arfcn > 1023) {
+ LOGP(DNM, LOGL_ERROR, "GSM900 channel must be between 1-124, 955-1023.\n");
return -EINVAL;
}
break;
diff --git a/openbsc/src/input/ipaccess.c b/openbsc/src/input/ipaccess.c
index 90d7cea85..10a3d2283 100644
--- a/openbsc/src/input/ipaccess.c
+++ b/openbsc/src/input/ipaccess.c
@@ -89,7 +89,7 @@ static const char *ipac_idtag_name(int tag)
return idtag_names[tag];
}
-static int ipac_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
+int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
{
u_int8_t t_len;
u_int8_t t_tag;
@@ -164,6 +164,17 @@ static int parse_unitid(const char *str, u_int16_t *site_id, u_int16_t *bts_id,
return 0;
}
+/* send the id ack */
+int ipaccess_send_id_ack(int fd)
+{
+ return write(fd, id_ack, sizeof(id_ack));
+}
+
+int ipaccess_send_id_req(int fd)
+{
+ return write(fd, id_req, sizeof(id_req));
+}
+
/* base handling of the ip.access protocol */
int ipaccess_rcvmsg_base(struct msgb *msg,
struct bsc_fd *bfd)
@@ -180,7 +191,7 @@ int ipaccess_rcvmsg_base(struct msgb *msg,
break;
case IPAC_MSGT_ID_ACK:
DEBUGP(DMI, "ID_ACK? -> ACK!\n");
- ret = write(bfd->fd, id_ack, sizeof(id_ack));
+ ret = ipaccess_send_id_ack(bfd->fd);
break;
}
return 0;
@@ -201,7 +212,7 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg,
case IPAC_MSGT_ID_RESP:
DEBUGP(DMI, "ID_RESP ");
/* parse tags, search for Unit ID */
- ipac_idtag_parse(&tlvp, (u_int8_t *)msg->l2h + 2,
+ ipaccess_idtag_parse(&tlvp, (u_int8_t *)msg->l2h + 2,
msgb_l2len(msg)-2);
DEBUGP(DMI, "\n");
@@ -530,7 +541,7 @@ static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what)
}
/* Request ID. FIXME: request LOCATION, HW/SW VErsion, Unit Name, Serno */
- ret = write(bfd->fd, id_req, sizeof(id_req));
+ ret = ipaccess_send_id_req(bfd->fd);
return ret;
//return e1inp_line_register(line);
diff --git a/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c
index 7630b1c58..689555d34 100644
--- a/openbsc/src/sccp/sccp.c
+++ b/openbsc/src/sccp/sccp.c
@@ -24,11 +24,12 @@
#include <string.h>
-#include <sccp/sccp.h>
-
+#include <openbsc/msgb.h>
#include <openbsc/debug.h>
#include <openbsc/talloc.h>
-#include <openbsc/linuxlist.h>
+
+#include <sccp/sccp.h>
+
static void *tall_sccp_ctx;
static LLIST_HEAD(sccp_connections);
diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am
index 8ce7e3c49..310763aec 100644
--- a/openbsc/tests/db/Makefile.am
+++ b/openbsc/tests/db/Makefile.am
@@ -4,5 +4,5 @@ AM_CFLAGS=-Wall -ggdb3
noinst_PROGRAMS = db_test
db_test_SOURCES = db_test.c
-db_test_LDADD = $(top_builddir)/src/libbsc.a $(top_builddir)/src/libmsc.a $(top_builddir)/src/libbsc.a -ldl -ldbi
+db_test_LDADD = $(top_builddir)/src/libbsc.a $(top_builddir)/src/libmsc.a $(top_builddir)/src/libbsc.a $(top_builddir)/src/liblaf0rge1.a -ldl -ldbi
diff --git a/openbsc/tests/gsm0408/Makefile.am b/openbsc/tests/gsm0408/Makefile.am
index ff8caf999..69f1e4e69 100644
--- a/openbsc/tests/gsm0408/Makefile.am
+++ b/openbsc/tests/gsm0408/Makefile.am
@@ -2,4 +2,4 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
noinst_PROGRAMS = gsm0408_test
gsm0408_test_SOURCES = gsm0408_test.c
-gsm0408_test_LDADD = $(top_builddir)/src/libbsc.a $(top_builddir)/src/libmsc.a $(top_builddir)/src/libbsc.a -ldbi
+gsm0408_test_LDADD = $(top_builddir)/src/libbsc.a $(top_builddir)/src/libmsc.a $(top_builddir)/src/libbsc.a $(top_builddir)/src/liblaf0rge1.a -ldbi
diff --git a/openbsc/tests/sccp/Makefile.am b/openbsc/tests/sccp/Makefile.am
index 5a275fc2b..3e350143a 100644
--- a/openbsc/tests/sccp/Makefile.am
+++ b/openbsc/tests/sccp/Makefile.am
@@ -4,5 +4,5 @@ AM_CFLAGS=-Wall -ggdb3
noinst_PROGRAMS = sccp_test
sccp_test_SOURCES = sccp_test.c
-sccp_test_LDADD = $(top_builddir)/src/libsccp.a $(top_builddir)/src/libbsc.a
+sccp_test_LDADD = $(top_builddir)/src/libsccp.a $(top_builddir)/src/libbsc.a $(top_builddir)/src/liblaf0rge1.a
diff --git a/openbsc/tests/sccp/sccp_test.c b/openbsc/tests/sccp/sccp_test.c
index 553544dab..562e1345f 100644
--- a/openbsc/tests/sccp/sccp_test.c
+++ b/openbsc/tests/sccp/sccp_test.c
@@ -26,9 +26,11 @@
#include <arpa/inet.h>
-#include <sccp/sccp.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
+#include <openbsc/msgb.h>
+
+#include <sccp/sccp.h>
#define MIN(x, y) ((x) < (y) ? (x) : (y))
diff --git a/openbsc/tests/sms/Makefile.am b/openbsc/tests/sms/Makefile.am
index 807c674e5..c1eeec74e 100644
--- a/openbsc/tests/sms/Makefile.am
+++ b/openbsc/tests/sms/Makefile.am
@@ -2,4 +2,4 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
noinst_PROGRAMS = sms_test
sms_test_SOURCES = sms_test.c
-sms_test_LDADD = $(top_builddir)/src/libmsc.a $(top_builddir)/src/libbsc.a -ldl -ldbi
+sms_test_LDADD = $(top_builddir)/src/libmsc.a $(top_builddir)/src/libbsc.a $(top_builddir)/src/liblaf0rge1.a -ldl -ldbi