LCR now compiles with current version of OpenBSC.
authorroot <root@nuedel.(none)>
Sun, 23 Aug 2009 12:58:21 +0000 (14:58 +0200)
committerroot <root@nuedel.(none)>
Sun, 23 Aug 2009 12:58:21 +0000 (14:58 +0200)
No more patch is required, just link openbsc directory to LCR source directory and run "configure":
cd lcr
ln -s path_to_openbsc/openbsc .

modified:   Makefile.am
modified:   Makefile.in
deleted:    bootstrap.c
deleted:    bootstrap.h
modified:   configure
modified:   configure.ac
modified:   default/gsm.conf
modified:   gsm.cpp
modified:   gsm.h
modified:   gsm_conf.c

Makefile.am
Makefile.in
bootstrap.c [deleted file]
bootstrap.h [deleted file]
configure
configure.ac
default/gsm.conf
gsm.cpp
gsm.h
gsm_conf.c

index c072870..84bfd89 100644 (file)
@@ -45,11 +45,11 @@ INSTALLATION_DEFINES = \
 
 if ENABLE_GSM
 
-GSM_INCLUDE = -DWITH_GSM
+GSM_INCLUDE = -DWITH_GSM -I./openbsc/include
 
-GSM_SOURCE = gsm_audio.c gsm.cpp gsm_conf.c bootstrap.c
+GSM_SOURCE = gsm_audio.c gsm.cpp gsm_conf.c openbsc/src/bsc_init.c openbsc/src/vty_interface.c openbsc/src/vty_interface_layer3.c
 
-GSM_LIB = /usr/lib/libgsm.a /usr/local/lib/libbsc.a /usr/local/lib/libvty.a -ldbi -lcrypt
+GSM_LIB = /usr/lib/libgsm.a ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -ldbi -lcrypt
 
 #gsm_audio.po: gsm_audio.c gsm_audio.h
 #      $(CC) -D_GNU_SOURCE -fPIC -c gsm_audio.c -o gsm_audio.po
@@ -128,6 +128,9 @@ if ENABLE_GSM
        @if test -a $(CONFIGdir)/gsm.conf ; then \
                echo "NOTE: gsm.conf already exists, not changed." ; else \
                cp -v default/gsm.conf $(CONFIGdir) ; fi
+       @if test -a $(CONFIGdir)/openbsc.cfg ; then \
+               echo "NOTE: openbsc.cfg already exists, not changed." ; else \
+               cp -v default/openbsc.cfg $(CONFIGdir) ; fi
 endif
        @if test -a $(CONFIGdir)/numbering_int.conf ; then \
                echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
index 47398ba..56f2e2d 100644 (file)
@@ -75,14 +75,18 @@ gentones_LDADD = $(LDADD)
 genwave_SOURCES = genwave.c
 genwave_OBJECTS = genwave.$(OBJEXT)
 genwave_LDADD = $(LDADD)
-am__lcr_SOURCES_DIST = gsm_audio.c gsm.cpp gsm_conf.c bootstrap.c \
-       action.cpp mISDN.cpp tones.c action_efi.cpp crypt.cpp mail.c \
-       trace.c action_vbox.cpp dss1.cpp main.c vbox.cpp alawulaw.c \
+am__lcr_SOURCES_DIST = gsm_audio.c gsm.cpp gsm_conf.c \
+       openbsc/src/bsc_init.c openbsc/src/vty_interface.c \
+       openbsc/src/vty_interface_layer3.c action.cpp mISDN.cpp \
+       tones.c action_efi.cpp crypt.cpp mail.c trace.c \
+       action_vbox.cpp dss1.cpp main.c vbox.cpp alawulaw.c \
        endpoint.cpp interface.c message.c apppbx.cpp endpointapp.cpp \
        join.cpp options.c extension.c joinpbx.cpp port.cpp callerid.c \
        joinremote.cpp route.c cause.c socket_server.c
 @ENABLE_GSM_TRUE@am__objects_1 = gsm_audio.$(OBJEXT) gsm.$(OBJEXT) \
-@ENABLE_GSM_TRUE@      gsm_conf.$(OBJEXT) bootstrap.$(OBJEXT)
+@ENABLE_GSM_TRUE@      gsm_conf.$(OBJEXT) bsc_init.$(OBJEXT) \
+@ENABLE_GSM_TRUE@      vty_interface.$(OBJEXT) \
+@ENABLE_GSM_TRUE@      vty_interface_layer3.$(OBJEXT)
 am_lcr_OBJECTS = $(am__objects_1) action.$(OBJEXT) mISDN.$(OBJEXT) \
        tones.$(OBJEXT) action_efi.$(OBJEXT) crypt.$(OBJEXT) \
        mail.$(OBJEXT) trace.$(OBJEXT) action_vbox.$(OBJEXT) \
@@ -96,8 +100,8 @@ am_lcr_OBJECTS = $(am__objects_1) action.$(OBJEXT) mISDN.$(OBJEXT) \
 lcr_OBJECTS = $(am_lcr_OBJECTS)
 am__DEPENDENCIES_1 =
 @ENABLE_GSM_TRUE@am__DEPENDENCIES_2 = /usr/lib/libgsm.a \
-@ENABLE_GSM_TRUE@      /usr/local/lib/libbsc.a \
-@ENABLE_GSM_TRUE@      /usr/local/lib/libvty.a
+@ENABLE_GSM_TRUE@      ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a \
+@ENABLE_GSM_TRUE@      ./openbsc/src/libvty.a
 lcr_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
 am_lcradmin_OBJECTS = lcradmin.$(OBJEXT) cause.$(OBJEXT) \
        options.$(OBJEXT)
@@ -239,9 +243,9 @@ INSTALLATION_DEFINES = \
  -DLOG_DIR="\"$(LOGdir)\"" \
  -DEXTENSION_DATA="\"$(EXTENSIONdir)\""
 
-@ENABLE_GSM_TRUE@GSM_INCLUDE = -DWITH_GSM
-@ENABLE_GSM_TRUE@GSM_SOURCE = gsm_audio.c gsm.cpp gsm_conf.c bootstrap.c
-@ENABLE_GSM_TRUE@GSM_LIB = /usr/lib/libgsm.a /usr/local/lib/libbsc.a /usr/local/lib/libvty.a -ldbi -lcrypt
+@ENABLE_GSM_TRUE@GSM_INCLUDE = -DWITH_GSM -I./openbsc/include
+@ENABLE_GSM_TRUE@GSM_SOURCE = gsm_audio.c gsm.cpp gsm_conf.c openbsc/src/bsc_init.c openbsc/src/vty_interface.c openbsc/src/vty_interface_layer3.c
+@ENABLE_GSM_TRUE@GSM_LIB = /usr/lib/libgsm.a ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -ldbi -lcrypt
 @ENABLE_ASTERISK_CHANNEL_DRIVER_TRUE@chan_lcr_so_SOURCES = 
 @ENABLE_ASTERISK_CHANNEL_DRIVER_TRUE@chan_lcr_so_LDFLAGS = -shared
 @ENABLE_ASTERISK_CHANNEL_DRIVER_TRUE@chan_lcr_so_LDADD = chan_lcr.po bchannel.po options.po callerid.po
@@ -279,15 +283,15 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
-             cd $(srcdir) && $(AUTOMAKE) --foreign  \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(srcdir) && $(AUTOMAKE) --gnu  \
                && exit 0; \
              exit 1;; \
          esac; \
        done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
        cd $(top_srcdir) && \
-         $(AUTOMAKE) --foreign  Makefile
+         $(AUTOMAKE) --gnu  Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
@@ -405,7 +409,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/action_vbox.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alawulaw.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apppbx.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootstrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsc_init.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callerid.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cause.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt.Po@am__quote@
@@ -436,6 +440,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tones.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trace.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vty_interface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vty_interface_layer3.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -451,6 +457,48 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
 
+bsc_init.o: openbsc/src/bsc_init.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bsc_init.o -MD -MP -MF "$(DEPDIR)/bsc_init.Tpo" -c -o bsc_init.o `test -f 'openbsc/src/bsc_init.c' || echo '$(srcdir)/'`openbsc/src/bsc_init.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/bsc_init.Tpo" "$(DEPDIR)/bsc_init.Po"; else rm -f "$(DEPDIR)/bsc_init.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='openbsc/src/bsc_init.c' object='bsc_init.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsc_init.o `test -f 'openbsc/src/bsc_init.c' || echo '$(srcdir)/'`openbsc/src/bsc_init.c
+
+bsc_init.obj: openbsc/src/bsc_init.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bsc_init.obj -MD -MP -MF "$(DEPDIR)/bsc_init.Tpo" -c -o bsc_init.obj `if test -f 'openbsc/src/bsc_init.c'; then $(CYGPATH_W) 'openbsc/src/bsc_init.c'; else $(CYGPATH_W) '$(srcdir)/openbsc/src/bsc_init.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/bsc_init.Tpo" "$(DEPDIR)/bsc_init.Po"; else rm -f "$(DEPDIR)/bsc_init.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='openbsc/src/bsc_init.c' object='bsc_init.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsc_init.obj `if test -f 'openbsc/src/bsc_init.c'; then $(CYGPATH_W) 'openbsc/src/bsc_init.c'; else $(CYGPATH_W) '$(srcdir)/openbsc/src/bsc_init.c'; fi`
+
+vty_interface.o: openbsc/src/vty_interface.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vty_interface.o -MD -MP -MF "$(DEPDIR)/vty_interface.Tpo" -c -o vty_interface.o `test -f 'openbsc/src/vty_interface.c' || echo '$(srcdir)/'`openbsc/src/vty_interface.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/vty_interface.Tpo" "$(DEPDIR)/vty_interface.Po"; else rm -f "$(DEPDIR)/vty_interface.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='openbsc/src/vty_interface.c' object='vty_interface.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vty_interface.o `test -f 'openbsc/src/vty_interface.c' || echo '$(srcdir)/'`openbsc/src/vty_interface.c
+
+vty_interface.obj: openbsc/src/vty_interface.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vty_interface.obj -MD -MP -MF "$(DEPDIR)/vty_interface.Tpo" -c -o vty_interface.obj `if test -f 'openbsc/src/vty_interface.c'; then $(CYGPATH_W) 'openbsc/src/vty_interface.c'; else $(CYGPATH_W) '$(srcdir)/openbsc/src/vty_interface.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/vty_interface.Tpo" "$(DEPDIR)/vty_interface.Po"; else rm -f "$(DEPDIR)/vty_interface.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='openbsc/src/vty_interface.c' object='vty_interface.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vty_interface.obj `if test -f 'openbsc/src/vty_interface.c'; then $(CYGPATH_W) 'openbsc/src/vty_interface.c'; else $(CYGPATH_W) '$(srcdir)/openbsc/src/vty_interface.c'; fi`
+
+vty_interface_layer3.o: openbsc/src/vty_interface_layer3.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vty_interface_layer3.o -MD -MP -MF "$(DEPDIR)/vty_interface_layer3.Tpo" -c -o vty_interface_layer3.o `test -f 'openbsc/src/vty_interface_layer3.c' || echo '$(srcdir)/'`openbsc/src/vty_interface_layer3.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/vty_interface_layer3.Tpo" "$(DEPDIR)/vty_interface_layer3.Po"; else rm -f "$(DEPDIR)/vty_interface_layer3.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='openbsc/src/vty_interface_layer3.c' object='vty_interface_layer3.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vty_interface_layer3.o `test -f 'openbsc/src/vty_interface_layer3.c' || echo '$(srcdir)/'`openbsc/src/vty_interface_layer3.c
+
+vty_interface_layer3.obj: openbsc/src/vty_interface_layer3.c
+@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vty_interface_layer3.obj -MD -MP -MF "$(DEPDIR)/vty_interface_layer3.Tpo" -c -o vty_interface_layer3.obj `if test -f 'openbsc/src/vty_interface_layer3.c'; then $(CYGPATH_W) 'openbsc/src/vty_interface_layer3.c'; else $(CYGPATH_W) '$(srcdir)/openbsc/src/vty_interface_layer3.c'; fi`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/vty_interface_layer3.Tpo" "$(DEPDIR)/vty_interface_layer3.Po"; else rm -f "$(DEPDIR)/vty_interface_layer3.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='openbsc/src/vty_interface_layer3.c' object='vty_interface_layer3.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vty_interface_layer3.obj `if test -f 'openbsc/src/vty_interface_layer3.c'; then $(CYGPATH_W) 'openbsc/src/vty_interface_layer3.c'; else $(CYGPATH_W) '$(srcdir)/openbsc/src/vty_interface_layer3.c'; fi`
+
 .cpp.o:
 @am__fastdepCXX_TRUE@  if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
 @am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@@ -789,6 +837,9 @@ install-data-hook:
 @ENABLE_GSM_TRUE@      @if test -a $(CONFIGdir)/gsm.conf ; then \
 @ENABLE_GSM_TRUE@              echo "NOTE: gsm.conf already exists, not changed." ; else \
 @ENABLE_GSM_TRUE@              cp -v default/gsm.conf $(CONFIGdir) ; fi
+@ENABLE_GSM_TRUE@      @if test -a $(CONFIGdir)/openbsc.cfg ; then \
+@ENABLE_GSM_TRUE@              echo "NOTE: openbsc.cfg already exists, not changed." ; else \
+@ENABLE_GSM_TRUE@              cp -v default/openbsc.cfg $(CONFIGdir) ; fi
        @if test -a $(CONFIGdir)/numbering_int.conf ; then \
                echo "NOTE: numbering_int.conf is obsolete, please use routing." ; fi
        @if test -a $(CONFIGdir)/numbering_ext.conf ; then \
diff --git a/bootstrap.c b/bootstrap.c
deleted file mode 100644 (file)
index 96f7ec2..0000000
+++ /dev/null
@@ -1,1207 +0,0 @@
-/* Bootstrapping GSM - taken from bsc_hack.c */
-
-/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
- * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
- * 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 <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <getopt.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <openbsc/gsm_data.h>
-#include <openbsc/gsm_04_08.h>
-#include <openbsc/db.h>
-#include <openbsc/timer.h>
-#include <openbsc/select.h>
-#include <openbsc/abis_rsl.h>
-#include <openbsc/abis_nm.h>
-#include <openbsc/debug.h>
-#include <openbsc/misdn.h>
-#include <openbsc/telnet_interface.h>
-#include <openbsc/paging.h>
-#include <openbsc/e1_input.h>
-#include <openbsc/signal.h>
-
-
-static enum gsm_band BAND = GSM_BAND_900;
-
-/* The following definitions are for OM and NM packets that we cannot yet
- * generate by code but we just pass on */
-
-// BTS Site Manager, SET ATTRIBUTES
-
-/*
-  Object Class: BTS Site Manager
-  Instance 1: FF
-  Instance 2: FF
-  Instance 3: FF
-SET ATTRIBUTES
-  sAbisExternalTime: 2007/09/08   14:36:11
-  omLAPDRelTimer: 30sec
-  shortLAPDIntTimer: 5sec
-  emergencyTimer1: 10 minutes
-  emergencyTimer2: 0 minutes
-*/
-
-unsigned char msg_1[] = 
-{
-       NM_MT_BS11_SET_ATTR, NM_OC_SITE_MANAGER, 0xFF, 0xFF, 0xFF, 
-               NM_ATT_BS11_ABIS_EXT_TIME, 0x07, 
-                       0xD7, 0x09, 0x08, 0x0E, 0x24, 0x0B, 0xCE, 
-               0x02, 
-                       0x00, 0x1E, 
-               NM_ATT_BS11_SH_LAPD_INT_TIMER, 
-                       0x01, 0x05,
-               0x42, 0x02, 0x00, 0x0A, 
-               0x44, 0x02, 0x00, 0x00
-};
-
-// BTS, SET BTS ATTRIBUTES
-
-/*
-  Object Class: BTS
-  BTS relat. Number: 0 
-  Instance 2: FF
-  Instance 3: FF
-SET BTS ATTRIBUTES
-  bsIdentityCode / BSIC:
-    PLMN_colour_code: 7h
-    BS_colour_code:   7h
-  BTS Air Timer T3105: 4  ,unit 10 ms
-  btsIsHopping: FALSE
-  periodCCCHLoadIndication: 1sec
-  thresholdCCCHLoadIndication: 0%
-  cellAllocationNumber: 00h = GSM 900
-  enableInterferenceClass: 00h =  Disabled
-  fACCHQual: 6 (FACCH stealing flags minus 1)
-  intaveParameter: 31 SACCH multiframes
-  interferenceLevelBoundaries:
-    Interference Boundary 1: 0Ah 
-    Interference Boundary 2: 0Fh
-    Interference Boundary 3: 14h
-    Interference Boundary 4: 19h
-    Interference Boundary 5: 1Eh
-  mSTxPwrMax: 11
-      GSM range:     2=39dBm, 15=13dBm, stepsize 2 dBm 
-      DCS1800 range: 0=30dBm, 15=0dBm, stepsize 2 dBm 
-      PCS1900 range: 0=30dBm, 15=0dBm, stepsize 2 dBm 
-                    30=33dBm, 31=32dBm 
-  ny1:
-    Maximum number of repetitions for PHYSICAL INFORMATION message (GSM 04.08): 20
-  powerOutputThresholds:
-    Out Power Fault Threshold:     -10 dB
-    Red Out Power Threshold:       - 6 dB
-    Excessive Out Power Threshold:   5 dB
-  rACHBusyThreshold: -127 dBm 
-  rACHLoadAveragingSlots: 250 ,number of RACH burst periods
-  rfResourceIndicationPeriod: 125  SACCH multiframes 
-  T200:
-    SDCCH:                044 in  5 ms
-    FACCH/Full rate:      031 in  5 ms
-    FACCH/Half rate:      041 in  5 ms
-    SACCH with TCH SAPI0: 090 in 10 ms
-    SACCH with SDCCH:     090 in 10 ms
-    SDCCH with SAPI3:     090 in  5 ms
-    SACCH with TCH SAPI3: 135 in 10 ms
-  tSync: 9000 units of 10 msec
-  tTrau: 9000 units of 10 msec
-  enableUmLoopTest: 00h =  disabled
-  enableExcessiveDistance: 00h =  Disabled
-  excessiveDistance: 64km
-  hoppingMode: 00h = baseband hopping
-  cellType: 00h =  Standard Cell
-  BCCH ARFCN / bCCHFrequency: 1
-*/
-
-static unsigned char bs11_attr_bts[] = 
-{
-               NM_ATT_BSIC, HARDCODED_BSIC,
-               NM_ATT_BTS_AIR_TIMER, 0x04,
-               NM_ATT_BS11_BTSLS_HOPPING, 0x00,
-               NM_ATT_CCCH_L_I_P, 0x01,
-               NM_ATT_CCCH_L_T, 0x00,
-               NM_ATT_BS11_CELL_ALLOC_NR, NM_BS11_CANR_GSM,
-               NM_ATT_BS11_ENA_INTERF_CLASS, 0x01,
-               NM_ATT_BS11_FACCH_QUAL, 0x06,
-               /* interference avg. period in numbers of SACCH multifr */
-               NM_ATT_INTAVE_PARAM, 0x1F, 
-               NM_ATT_INTERF_BOUND, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x7B,
-               NM_ATT_CCCH_L_T, 0x23,
-               NM_ATT_GSM_TIME, 0x28, 0x00,
-               NM_ATT_ADM_STATE, 0x03,
-               NM_ATT_RACH_B_THRESH, 0x7F,
-               NM_ATT_LDAVG_SLOTS, 0x00, 0xFA,
-               NM_ATT_BS11_RF_RES_IND_PER, 0x7D,
-               NM_ATT_T200, 0x2C, 0x1F, 0x29, 0x5A, 0x5A, 0x5A, 0x87,
-               NM_ATT_BS11_TSYNC, 0x23, 0x28,
-               NM_ATT_BS11_TTRAU, 0x23, 0x28, 
-               NM_ATT_TEST_DUR, 0x01, 0x00,
-               NM_ATT_OUTST_ALARM, 0x01, 0x00,
-               NM_ATT_BS11_EXCESSIVE_DISTANCE, 0x01, 0x40,
-               NM_ATT_BS11_HOPPING_MODE, 0x01, 0x00,
-               NM_ATT_BS11_PLL, 0x01, 0x00, 
-               NM_ATT_BCCH_ARFCN, 0x00, HARDCODED_ARFCN/*0x01*/, 
-};
-
-// Handover Recognition, SET ATTRIBUTES
-
-/*
-Illegal Contents GSM Formatted O&M Msg 
-  Object Class: Handover Recognition
-  BTS relat. Number: 0 
-  Instance 2: FF
-  Instance 3: FF
-SET ATTRIBUTES
-  enableDelayPowerBudgetHO: 00h = Disabled
-  enableDistanceHO: 00h =  Disabled
-  enableInternalInterCellHandover: 00h = Disabled
-  enableInternalIntraCellHandover: 00h =  Disabled
-  enablePowerBudgetHO: 00h = Disabled
-  enableRXLEVHO: 00h =  Disabled
-  enableRXQUALHO: 00h =  Disabled
-  hoAveragingDistance: 8  SACCH multiframes 
-  hoAveragingLev:
-    A_LEV_HO: 8  SACCH multiframes 
-    W_LEV_HO: 1  SACCH multiframes 
-  hoAveragingPowerBudget:  16  SACCH multiframes 
-  hoAveragingQual:
-    A_QUAL_HO: 8  SACCH multiframes 
-    W_QUAL_HO: 2  SACCH multiframes 
-  hoLowerThresholdLevDL: (10 - 110) dBm
-  hoLowerThresholdLevUL: (5 - 110) dBm
-  hoLowerThresholdQualDL: 06h =   6.4% < BER < 12.8%
-  hoLowerThresholdQualUL: 06h =   6.4% < BER < 12.8%
-  hoThresholdLevDLintra : (20 - 110) dBm
-  hoThresholdLevULintra: (20 - 110) dBm
-  hoThresholdMsRangeMax: 20 km 
-  nCell: 06h
-  timerHORequest: 3  ,unit 2 SACCH multiframes 
-*/
-
-unsigned char msg_3[] = 
-{
-       NM_MT_BS11_SET_ATTR, NM_OC_BS11_HANDOVER, 0x00, 0xFF, 0xFF, 
-               0xD0, 0x00,
-               0x64, 0x00,
-               0x67, 0x00,
-               0x68, 0x00,
-               0x6A, 0x00,
-               0x6C, 0x00,
-               0x6D, 0x00,
-               0x6F, 0x08,
-               0x70, 0x08, 0x01,
-               0x71, 0x10, 0x10, 0x10,
-               0x72, 0x08, 0x02,
-               0x73, 0x0A,
-               0x74, 0x05,
-               0x75, 0x06,
-               0x76, 0x06,
-               0x78, 0x14,
-               0x79, 0x14,
-               0x7A, 0x14,
-               0x7D, 0x06,
-               0x92, 0x03, 0x20, 0x01, 0x00,
-               0x45, 0x01, 0x00,
-               0x48, 0x01, 0x00,
-               0x5A, 0x01, 0x00,
-               0x5B, 0x01, 0x05,
-               0x5E, 0x01, 0x1A,
-               0x5F, 0x01, 0x20,
-               0x9D, 0x01, 0x00,
-               0x47, 0x01, 0x00,
-               0x5C, 0x01, 0x64,
-               0x5D, 0x01, 0x1E,
-               0x97, 0x01, 0x20,
-               0xF7, 0x01, 0x3C,
-};
-
-// Power Control, SET ATTRIBUTES
-
-/*
-  Object Class: Power Control
-  BTS relat. Number: 0 
-  Instance 2: FF
-  Instance 3: FF
-SET ATTRIBUTES
-  enableMsPowerControl: 00h =  Disabled
-  enablePowerControlRLFW: 00h =  Disabled
-  pcAveragingLev:
-    A_LEV_PC: 4  SACCH multiframes 
-    W_LEV_PC: 1  SACCH multiframes 
-  pcAveragingQual:
-    A_QUAL_PC: 4  SACCH multiframes 
-    W_QUAL_PC: 2  SACCH multiframes 
-  pcLowerThresholdLevDL: 0Fh
-  pcLowerThresholdLevUL: 0Ah
-  pcLowerThresholdQualDL: 05h =   3.2% < BER <  6.4%
-  pcLowerThresholdQualUL: 05h =   3.2% < BER <  6.4%
-  pcRLFThreshold: 0Ch
-  pcUpperThresholdLevDL: 14h
-  pcUpperThresholdLevUL: 0Fh
-  pcUpperThresholdQualDL: 04h =   1.6% < BER <  3.2%
-  pcUpperThresholdQualUL: 04h =   1.6% < BER <  3.2%
-  powerConfirm: 2  ,unit 2 SACCH multiframes 
-  powerControlInterval: 2  ,unit 2 SACCH multiframes 
-  powerIncrStepSize: 02h = 4 dB
-  powerRedStepSize: 01h = 2 dB
-  radioLinkTimeoutBs: 64  SACCH multiframes 
-  enableBSPowerControl: 00h =  disabled
-*/
-
-unsigned char msg_4[] = 
-{
-       NM_MT_BS11_SET_ATTR, NM_OC_BS11_PWR_CTRL, 0x00, 0xFF, 0xFF, 
-               NM_ATT_BS11_ENA_MS_PWR_CTRL, 0x00,
-               NM_ATT_BS11_ENA_PWR_CTRL_RLFW, 0x00,
-               0x7E, 0x04, 0x01,
-               0x7F, 0x04, 0x02,
-               0x80, 0x0F,
-               0x81, 0x0A,
-               0x82, 0x05,
-               0x83, 0x05,
-               0x84, 0x0C, 
-               0x85, 0x14, 
-               0x86, 0x0F, 
-               0x87, 0x04,
-               0x88, 0x04,
-               0x89, 0x02,
-               0x8A, 0x02,
-               0x8B, 0x02,
-               0x8C, 0x01,
-               0x8D, 0x40,
-               0x65, 0x01, 0x00 // set to 0x01 to enable BSPowerControl
-};
-
-
-// Transceiver, SET TRX ATTRIBUTES (TRX 0)
-
-/*
-  Object Class: Transceiver
-  BTS relat. Number: 0 
-  Tranceiver number: 0 
-  Instance 3: FF
-SET TRX ATTRIBUTES
-  aRFCNList (HEX):  0001
-  txPwrMaxReduction: 00h =   30dB
-  radioMeasGran: 254  SACCH multiframes 
-  radioMeasRep: 01h =  enabled
-  memberOfEmergencyConfig: 01h =  TRUE
-  trxArea: 00h = TRX doesn't belong to a concentric cell
-*/
-
-static unsigned char bs11_attr_radio[] = 
-{
-               NM_ATT_ARFCN_LIST, 0x01, 0x00, HARDCODED_ARFCN /*0x01*/,
-               NM_ATT_RF_MAXPOWR_R, 0x00,
-               NM_ATT_BS11_RADIO_MEAS_GRAN, 0x01, 0x05, 
-               NM_ATT_BS11_RADIO_MEAS_REP, 0x01, 0x01,
-               NM_ATT_BS11_EMRG_CFG_MEMBER, 0x01, 0x01,
-               NM_ATT_BS11_TRX_AREA, 0x01, 0x00, 
-};
-
-static unsigned char nanobts_attr_bts[] = {
-       NM_ATT_INTERF_BOUND, 0x55, 0x5b, 0x61, 0x67, 0x6d, 0x73,
-       /* interference avg. period in numbers of SACCH multifr */
-       NM_ATT_INTAVE_PARAM, 0x06,
-       /* conn fail based on SACCH error rate */
-       NM_ATT_CONN_FAIL_CRIT, 0x00, 0x02, 0x01, 0x10, 
-       NM_ATT_T200, 0x1e, 0x24, 0x24, 0xa8, 0x34, 0x21, 0xa8,
-       NM_ATT_MAX_TA, 0x3f,
-       NM_ATT_OVERL_PERIOD, 0x00, 0x01, 10, /* seconds */
-       NM_ATT_CCCH_L_T, 10, /* percent */
-       NM_ATT_CCCH_L_I_P, 1, /* seconds */
-       NM_ATT_RACH_B_THRESH, 10, /* busy threshold in - dBm */
-       NM_ATT_LDAVG_SLOTS, 0x03, 0xe8, /* rach load averaging 1000 slots */
-       NM_ATT_BTS_AIR_TIMER, 128, /* miliseconds */
-       NM_ATT_NY1, 10, /* 10 retransmissions of physical config */
-       NM_ATT_BCCH_ARFCN, HARDCODED_ARFCN >> 8, HARDCODED_ARFCN & 0xff,
-       NM_ATT_BSIC, HARDCODED_BSIC,
-};
-
-static unsigned char nanobts_attr_radio[] = {
-       NM_ATT_RF_MAXPOWR_R, 0x0c, /* number of -2dB reduction steps / Pn */
-       NM_ATT_ARFCN_LIST, 0x00, 0x02, HARDCODED_ARFCN >> 8, HARDCODED_ARFCN & 0xff,
-};
-
-static unsigned char nanobts_attr_e0[] = {
-       0x85, 0x00,
-       0x81, 0x0b, 0xbb,       /* TCP PORT for RSL */
-};
-
-/* Callback function to be called whenever we get a GSM 12.21 state change event */
-int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
-                  struct gsm_nm_state *old_state, struct gsm_nm_state *new_state)
-{
-       struct gsm_bts *bts;
-       struct gsm_bts_trx *trx;
-       struct gsm_bts_trx_ts *ts;
-
-       /* This is currently only required on nanoBTS */
-
-       switch (evt) {
-       case EVT_STATECHG_OPER:
-               switch (obj_class) {
-               case NM_OC_SITE_MANAGER:
-                       bts = container_of(obj, struct gsm_bts, site_mgr);
-                       if (old_state->operational != 2 && new_state->operational == 2) {
-                               abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
-                       }
-                       break;
-               case NM_OC_BTS:
-                       bts = (struct gsm_bts *)obj;
-                       if (new_state->availability == 5) {
-                               abis_nm_set_bts_attr(bts, nanobts_attr_bts,
-                                                       sizeof(nanobts_attr_bts));
-                               abis_nm_opstart(bts, NM_OC_BTS,
-                                               bts->bts_nr, 0xff, 0xff);
-                               abis_nm_chg_adm_state(bts, NM_OC_BTS,
-                                                     bts->bts_nr, 0xff, 0xff,
-                                                     NM_STATE_UNLOCKED);
-                       }
-                       break;
-               case NM_OC_CHANNEL:
-                       ts = (struct gsm_bts_trx_ts *)obj;
-                       trx = ts->trx;
-                       if (new_state->availability == 5) {
-                               if (ts->nr == 0 && trx == trx->bts->c0)
-                                       abis_nm_set_channel_attr(ts, NM_CHANC_BCCH_CBCH);
-                               else
-                                       abis_nm_set_channel_attr(ts, NM_CHANC_TCHFull);
-                               abis_nm_opstart(trx->bts, NM_OC_CHANNEL,
-                                               trx->bts->bts_nr, trx->nr, ts->nr);
-                               abis_nm_chg_adm_state(trx->bts, NM_OC_CHANNEL,
-                                                     trx->bts->bts_nr, trx->nr, ts->nr,
-                                                     NM_STATE_UNLOCKED);
-                       }
-                       break;
-               default:
-                       break;
-               }
-               break;
-       default:
-               //DEBUGP(DMM, "Unhandled state change in %s:%d\n", __func__, __LINE__);
-               break;
-       }
-       return 0;
-}
-
-/* Callback function to be called every time we receive a 12.21 SW activated report */
-static int sw_activ_rep(struct msgb *mb)
-{
-       struct abis_om_fom_hdr *foh = (struct abis_om_fom_hdr *)msgb_l3(mb);
-       struct gsm_bts_trx *trx = mb->trx;
-
-       switch (foh->obj_class) {
-       case NM_OC_BASEB_TRANSC:
-               /* TRX software is active, tell it to initiate RSL Link */
-               abis_nm_ipaccess_msg(trx->bts, 0xe0, NM_OC_BASEB_TRANSC,
-                                    trx->bts->bts_nr, trx->nr, 0xff,
-                                    nanobts_attr_e0, sizeof(nanobts_attr_e0));
-               abis_nm_opstart(trx->bts, NM_OC_BASEB_TRANSC, 
-                               trx->bts->bts_nr, trx->nr, 0xff);
-               abis_nm_chg_adm_state(trx->bts, NM_OC_BASEB_TRANSC, 
-                                       trx->bts->bts_nr, trx->nr, 0xff,
-                                       NM_STATE_UNLOCKED);
-               break;
-       case NM_OC_RADIO_CARRIER:
-               abis_nm_set_radio_attr(trx, nanobts_attr_radio,
-                                       sizeof(nanobts_attr_radio));
-               abis_nm_opstart(trx->bts, NM_OC_RADIO_CARRIER,
-                               trx->bts->bts_nr, trx->nr, 0xff);
-               abis_nm_chg_adm_state(trx->bts, NM_OC_RADIO_CARRIER,
-                                     trx->bts->bts_nr, trx->nr, 0xff,
-                                     NM_STATE_UNLOCKED);
-               break;
-       }
-       return 0;
-}
-
-/* Callback function for NACK on the OML NM */
-static int oml_msg_nack(int mt)
-{
-       if (mt == NM_MT_SET_BTS_ATTR_NACK) {
-               fprintf(stderr, "Failed to set BTS attributes. That is fatal. "
-                               "Was the bts type and frequency properly specified?\n");
-               exit(-1);
-       }
-
-       return 0;
-}
-
-/* Callback function to be called every time we receive a signal from NM */
-static int nm_sig_cb(unsigned int subsys, unsigned int signal,
-                    void *handler_data, void *signal_data)
-{
-       switch (signal) {
-       case S_NM_SW_ACTIV_REP:
-               return sw_activ_rep((struct msgb *)signal_data);
-       case S_NM_NACK:
-               return oml_msg_nack((int)signal_data);
-       default:
-               break;
-       }
-       return 0;
-}
-
-static void bootstrap_om_nanobts(struct gsm_bts *bts)
-{
-       /* We don't do callback based bootstrapping, but event driven (see above) */
-}
-
-static void bootstrap_om_bs11(struct gsm_bts *bts)
-{
-       struct gsm_bts_trx *trx = bts->c0;
-
-       /* stop sending event reports */
-       abis_nm_event_reports(bts, 0);
-
-       /* begin DB transmission */
-       abis_nm_bs11_db_transmission(bts, 1);
-
-       /* end DB transmission */
-       abis_nm_bs11_db_transmission(bts, 0);
-
-       /* Reset BTS Site manager resource */
-       abis_nm_bs11_reset_resource(bts);
-
-       /* begin DB transmission */
-       abis_nm_bs11_db_transmission(bts, 1);
-
-       abis_nm_raw_msg(bts, sizeof(msg_1), msg_1); /* set BTS SiteMgr attr*/
-       abis_nm_set_bts_attr(bts, bs11_attr_bts, sizeof(bs11_attr_bts));
-       abis_nm_raw_msg(bts, sizeof(msg_3), msg_3); /* set BTS handover attr */
-       abis_nm_raw_msg(bts, sizeof(msg_4), msg_4); /* set BTS power control attr */
-
-       /* Connect signalling of bts0/trx0 to e1_0/ts1/64kbps */
-       abis_nm_conn_terr_sign(trx, 0, 1, 0xff);
-       abis_nm_set_radio_attr(trx, bs11_attr_radio, sizeof(bs11_attr_radio));
-
-       /* Use TEI 1 for signalling */
-       abis_nm_establish_tei(bts, 0, 0, 1, 0xff, 0x01);
-       abis_nm_set_channel_attr(&trx->ts[0], NM_CHANC_SDCCH_CBCH);
-
-#ifdef HAVE_TRX1
-       /* TRX 1 */
-       abis_nm_conn_terr_sign(&bts->trx[1], 0, 1, 0xff);
-       /* FIXME: TRX ATTRIBUTE */
-       abis_nm_establish_tei(bts, 0, 0, 1, 0xff, 0x02);
-#endif
-
-       /* SET CHANNEL ATTRIBUTE TS1 */
-       abis_nm_set_channel_attr(&trx->ts[1], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts1 to e1_0/ts2/b */
-       abis_nm_conn_terr_traf(&trx->ts[1], 0, 2, 1);
-       
-       /* SET CHANNEL ATTRIBUTE TS2 */
-       abis_nm_set_channel_attr(&trx->ts[2], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts2 to e1_0/ts2/c */
-       abis_nm_conn_terr_traf(&trx->ts[2], 0, 2, 2);
-
-       /* SET CHANNEL ATTRIBUTE TS3 */
-       abis_nm_set_channel_attr(&trx->ts[3], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts3 to e1_0/ts2/d */
-       abis_nm_conn_terr_traf(&trx->ts[3], 0, 2, 3);
-
-       /* SET CHANNEL ATTRIBUTE TS4 */
-       abis_nm_set_channel_attr(&trx->ts[4], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts4 to e1_0/ts3/a */
-       abis_nm_conn_terr_traf(&trx->ts[4], 0, 3, 0);
-
-       /* SET CHANNEL ATTRIBUTE TS5 */
-       abis_nm_set_channel_attr(&trx->ts[5], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts5 to e1_0/ts3/b */
-       abis_nm_conn_terr_traf(&trx->ts[5], 0, 3, 1);
-
-       /* SET CHANNEL ATTRIBUTE TS6 */
-       abis_nm_set_channel_attr(&trx->ts[6], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts6 to e1_0/ts3/c */
-       abis_nm_conn_terr_traf(&trx->ts[6], 0, 3, 2);
-
-       /* SET CHANNEL ATTRIBUTE TS7 */
-       abis_nm_set_channel_attr(&trx->ts[7], NM_CHANC_TCHFull);
-       /* Connect traffic of bts0/trx0/ts7 to e1_0/ts3/d */
-       abis_nm_conn_terr_traf(&trx->ts[7], 0, 3, 3);
-
-       /* end DB transmission */
-       abis_nm_bs11_db_transmission(bts, 0);
-
-       /* Reset BTS Site manager resource */
-       abis_nm_bs11_reset_resource(bts);
-
-       /* restart sending event reports */
-       abis_nm_event_reports(bts, 1);
-}
-
-static void bootstrap_om(struct gsm_bts *bts)
-{
-       fprintf(stdout, "bootstrapping OML for BTS %u\n", bts->nr);
-
-       switch (bts->type) {
-       case GSM_BTS_TYPE_BS11:
-               bootstrap_om_bs11(bts);
-               break;
-       case GSM_BTS_TYPE_NANOBTS_900:
-       case GSM_BTS_TYPE_NANOBTS_1800:
-               bootstrap_om_nanobts(bts);
-               break;
-       default:
-               fprintf(stderr, "Unable to bootstrap OML: Unknown BTS type %d\n", bts->type);
-       }
-}
-
-static int shutdown_om(struct gsm_bts *bts)
-{
-       /* stop sending event reports */
-       abis_nm_event_reports(bts, 0);
-
-       /* begin DB transmission */
-       abis_nm_bs11_db_transmission(bts, 1);
-
-       /* end DB transmission */
-       abis_nm_bs11_db_transmission(bts, 0);
-
-       /* Reset BTS Site manager resource */
-       abis_nm_bs11_reset_resource(bts);
-
-       return 0;
-}
-
-int shutdown_net(struct gsm_network *net)
-{
-       struct gsm_bts *bts;
-
-       llist_for_each_entry(bts, &net->bts_list, list) {
-               int rc;
-               rc = shutdown_om(bts);
-               if (rc < 0)
-                       return rc;
-       }
-
-       return 0;
-}
-
-struct bcch_info {
-       u_int8_t type;
-       u_int8_t len;
-       const u_int8_t *data;
-};
-
-/*
-SYSTEM INFORMATION TYPE 1
-  Cell channel description
-    Format-ID bit map 0
-    CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
-  RACH Control Parameters
-    maximum 7 retransmissions
-    8 slots used to spread transmission
-    cell not barred for access
-    call reestablishment not allowed
-    Access Control Class = 0000
-*/
-static u_int8_t si1[] = {
-       /* header */0x55, 0x06, 0x19,
-       /* ccdesc */0x04 /*0x00*/, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*0x01*/,
-       /* rach */0xD5, 0x00, 0x00,
-       /* s1 reset*/0x2B
-};
-
-static u_int8_t *gsm48_si1(u_int8_t *arfcn_list, int arfcn_len, int max_trans, int tx_integer, int cell_barr, int re, int ec, u_int8_t *ac_list, int ac_len)
-{
-       static u_int8_t si[23];
-       int i, bit, octet;
-
-       memset(&si, 0, sizeof(si));
-
-       /* header */
-       si[0] = 0x55;
-       si[1] = 0x06;
-       si[2] = 0x19;
-       /* ccdesc */
-       for (i = 0; i < arfcn_len; i++) {
-               if (arfcn_list[i] <= 124 && arfcn_list[i] > 0) {
-                       bit = (arfcn_list[i] - 1) & 7;
-                       octet = (arfcn_list[i] -1) / 8;
-                       si[18 - octet] |= (1 << bit);
-               }
-       }
-       /* rach */
-       si[19] = (max_trans << 6);
-       si[19] |= (tx_integer << 2);
-       si[19] |= (cell_barr << 1);
-       si[19] |= re;
-       si[20] = (ec << 2);
-       for (i = 0; i < ac_len; i++) {
-               if (ac_list[i] <= 15 && ac_list[i] != 10) {
-                       bit = ac_list[i] & 7;
-                       octet = ac_list[i] / 8;
-                       si[21 - octet] |= (1 << bit);
-               }
-       }
-       /* s1 rest */
-       si[22] = 0x2B;
-
-       /* testig */
-       if (memcmp(&si1, &si, sizeof(si)))
-               printf("SI1 does not match default template.\n");
-
-       return si;
-}
-
-/*
- SYSTEM INFORMATION TYPE 2
-  Neighbour Cells Description
-    EXT-IND: Carries the complete BA
-    BA-IND = 0
-    Format-ID bit map 0
-    CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-  NCC permitted (NCC) = FF
-  RACH Control Parameters
-    maximum 7 retransmissions
-    8 slots used to spread transmission
-    cell not barred for access
-    call reestablishment not allowed
-    Access Control Class = 0000
-*/
-static u_int8_t si2[] = {
-       /* header */0x59, 0x06, 0x1A,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       /* ncc */0xFF,
-       /* rach*/0xD5, 0x00, 0x00
-};
-
-static u_int8_t *gsm48_si2(int ba, u_int8_t *arfcn_list, int arfcn_len, u_int8_t ncc, int max_trans, int tx_integer, int cell_barr, int re, int ec, u_int8_t *ac_list, int ac_len)
-{
-       static u_int8_t si[23];
-       int i, bit, octet;
-
-       memset(&si, 0, sizeof(si));
-
-       /* header */
-       si[0] = 0x59;
-       si[1] = 0x06;
-       si[2] = 0x1A;
-       /* ncdesc */
-       si[3] = (ba << 4);
-       for (i = 0; i < arfcn_len; i++) {
-               if (arfcn_list[i] <= 124 && arfcn_list[i] > 0) {
-                       bit = (arfcn_list[i] - 1) & 7;
-                       octet = (arfcn_list[i] -1) / 8;
-                       si[18 - octet] |= (1 << bit);
-               }
-       }
-       /* ncc */
-       si[19] = ncc;
-       /* rach */
-       si[20] = (max_trans << 6);
-       si[20] |= (tx_integer << 2);
-       si[20] |= (cell_barr << 1);
-       si[20] |= re;
-       si[21] = (ec << 2);
-       for (i = 0; i < ac_len; i++) {
-               if (ac_list[i] <= 15 && ac_list[i] != 10) {
-                       bit = ac_list[i] & 7;
-                       octet = ac_list[i] / 8;
-                       si[22 - octet] |= (1 << bit);
-               }
-       }
-
-       /* testig */
-       if (memcmp(&si2, &si, sizeof(si)))
-               printf("SI2 does not match default template.\n");
-
-       return si;
-}
-
-
-/*
-SYSTEM INFORMATION TYPE 3
-  Cell identity = 00001 (1h)
-  Location area identification
-    Mobile Country Code (MCC): 001
-    Mobile Network Code (MNC): 01
-    Location Area Code  (LAC): 00001 (1h)
-  Control Channel Description
-    Attach-detach: MSs in the cell are not allowed to apply IMSI attach /detach
-    0 blocks reserved for access grant
-    1 channel used for CCCH, with SDCCH
-    5 multiframes period for PAGING REQUEST
-    Time-out T3212 = 0
-  Cell Options BCCH
-    Power control indicator: not set
-    MSs shall not use uplink DTX
-    Radio link timeout = 36
-  Cell Selection Parameters
-    Cell reselect hysteresis = 6 dB RXLEV hysteresis for LA re-selection
-    max.TX power level MS may use for CCH = 2 <- according to GSM05.05 39dBm (max)
-    Additional Reselect Parameter Indication (ACS) = only SYSTEM INFO 4: The SI rest octets, if present, shall be used to derive the value of PI and possibly C2 parameters
-    Half rate support (NECI): New establishment causes are not supported
-    min.RX signal level for MS = 0
-  RACH Control Parameters
-    maximum 7 retransmissions
-    8 slots used to spread transmission
-    cell not barred for access
-    call reestablishment not allowed
-    Access Control Class = 0000
-  SI 3 Rest Octets
-    Cell Bar Qualify (CBQ): 0
-    Cell Reselect Offset = 0 dB
-    Temporary Offset = 0 dB
-    Penalty Time = 20 s
-    System Information 2ter Indicator (2TI): 0 = not available
-    Early Classmark Sending Control (ECSC):  0 = forbidden
-    Scheduling Information is not sent in SYSTEM INFORMATION TYPE 9 on the BCCH
-*/
-static u_int8_t si3[] = {
-       /* header */0x49, 0x06, 0x1B,
-       /* cell */0x00, 0x01,
-       /* lai  */0x00, 0xF1, 0x10, 0x00, 0x01,
-       /* desc */0x01, 0x03, 0x00,
-       /* option*/0x28,
-       /* selection*/0x62, 0x00,
-       /* rach */0xD5, 0x00, 0x00,
-       /* reset*/0x80, 0x00, 0x00, 0x2B
-};
-
-/*
-SYSTEM INFORMATION TYPE 4
-  Location area identification
-    Mobile Country Code (MCC): 001
-    Mobile Network Code (MNC): 01
-    Location Area Code  (LAC): 00001 (1h)
-  Cell Selection Parameters
-    Cell reselect hysteresis = 6 dB RXLEV hysteresis for LA re-selection
-    max.TX power level MS may use for CCH = 2
-    Additional Reselect Parameter Indication (ACS) = only SYSTEM INFO 4: The SI rest octets, if present, shall be used to derive the value of PI and possibly C2 parameters
-    Half rate support (NECI): New establishment causes are not supported
-    min.RX signal level for MS = 0
-  RACH Control Parameters
-    maximum 7 retransmissions
-    8 slots used to spread transmission
-    cell not barred for access
-    call reestablishment not allowed
-    Access Control Class = 0000
-  Channel Description
-    Type = SDCCH/4[2]
-    Timeslot Number: 0
-    Training Sequence Code: 7h
-    ARFCN: 1
-  SI Rest Octets
-    Cell Bar Qualify (CBQ): 0
-    Cell Reselect Offset = 0 dB
-    Temporary Offset = 0 dB
-    Penalty Time = 20 s
-*/
-static u_int8_t si4[] = {
-       /* header */0x41, 0x06, 0x1C,
-       /* lai */0x00, 0xF1, 0x10, 0x00, 0x01,
-       /* sel */0x62, 0x00,
-       /* rach*/0xD5, 0x00, 0x00,
-       /* var */0x64, 0x30, 0xE0, HARDCODED_ARFCN/*0x01*/, 0x80, 0x00, 0x00,
-       0x2B, 0x2B, 0x2B
-};
-
-/*
- SYSTEM INFORMATION TYPE 5
-  Neighbour Cells Description
-    EXT-IND: Carries the complete BA
-    BA-IND = 0
-    Format-ID bit map 0
-    CA-ARFCN Bit 124...001 (Hex): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-*/
-
-static u_int8_t si5[] = {
-       /* header without l2 len*/0x06, 0x1D,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static u_int8_t *gsm48_si5(int ba, u_int8_t *arfcn_list, int arfcn_len)
-{
-       static u_int8_t si[18];
-       int i, bit, octet;
-
-       memset(&si, 0, sizeof(si));
-
-       /* header */
-       si[0] = 0x06;
-       si[1] = 0x1D;
-       /* ncdesc */
-       si[2] = (ba << 4);
-       for (i = 0; i < arfcn_len; i++) {
-               if (arfcn_list[i] <= 124 && arfcn_list[i] > 0) {
-                       bit = (arfcn_list[i] - 1) & 7;
-                       octet = (arfcn_list[i] -1) / 8;
-                       si[17 - octet] |= (1 << bit);
-               }
-       }
-
-       /* testig */
-       if (memcmp(&si3, &si, sizeof(si)))
-               printf("SI3 does not match default template.\n");
-
-       return si;
-}
-
-
-// SYSTEM INFORMATION TYPE 6
-
-/*
-SACCH FILLING
-  System Info Type: SYSTEM INFORMATION 6
-  L3 Information (Hex): 06 1E 00 01 xx xx 10 00 01 28 FF
-
-SYSTEM INFORMATION TYPE 6
-  Cell identity = 00001 (1h)
-  Location area identification
-    Mobile Country Code (MCC): 001
-    Mobile Network Code (MNC): 01
-    Location Area Code  (LAC): 00001 (1h)
-  Cell Options SACCH
-    Power control indicator: not set
-    MSs shall not use uplink DTX on a TCH-F. MS shall not use uplink DTX on TCH-H.
-    Radio link timeout = 36
-  NCC permitted (NCC) = FF
-*/
-
-static u_int8_t si6[] = {
-       /* header */0x06, 0x1E,
-       /* cell id*/ 0x00, 0x01,
-       /* lai */ 0x00, 0xF1, 0x10, 0x00, 0x01,
-       /* options */ 0x28,
-       /* ncc */ 0xFF,
-};
-
-
-
-static const struct bcch_info bcch_infos[] = {
-       {
-               RSL_SYSTEM_INFO_1,
-               sizeof(si1),
-               si1,
-       }, {
-               RSL_SYSTEM_INFO_2,
-               sizeof(si2),
-               si2,
-       }, {
-               RSL_SYSTEM_INFO_3,
-               sizeof(si3),
-               si3,
-       }, {
-               RSL_SYSTEM_INFO_4,
-               sizeof(si4),
-               si4,
-       },
-};
-
-static_assert(sizeof(si1) == sizeof(struct gsm48_system_information_type_1), type1)
-static_assert(sizeof(si2) == sizeof(struct gsm48_system_information_type_2), type2)
-static_assert(sizeof(si3) == sizeof(struct gsm48_system_information_type_3), type3)
-static_assert(sizeof(si4) >= sizeof(struct gsm48_system_information_type_4), type4)
-static_assert(sizeof(si5) == sizeof(struct gsm48_system_information_type_5), type5)
-static_assert(sizeof(si6) >= sizeof(struct gsm48_system_information_type_6), type6)
-
-/* set all system information types */
-static int set_system_infos(struct gsm_bts_trx *trx)
-{
-       unsigned int i;
-
-#if 0
-       u_int8_t *_si1;
-       u_int8_t *_si2;
-       u_int8_t *_si5;
-       u_int8_t arfcn_list[8];
-
-       arfcn_list[0] = trx->arfcn;
-       _si1 = gsm48_si1(arfcn_list, 1, 3, 5, 0, 1, 0, NULL, 0);
-
-       memset(arfcn_list, 0, sizeof(arfcn_list));
-       arfcn_list[0] = trx->arfcn;
-       arfcn_list[1] = 112;
-       arfcn_list[2] = 62;
-       arfcn_list[3] = 99;
-       arfcn_list[4] = 77;
-       arfcn_list[5] = 64;
-       arfcn_list[6] = 54;
-       arfcn_list[7] = 51;
-       _si2 = gsm48_si2(0, arfcn_list, 8, 0xff, 3, 5, 0, 1, 0, NULL, 0);
-       _si5 = gsm48_si5(0, arfcn_list, 8);
-
-       rsl_bcch_info(trx, RSL_SYSTEM_INFO_1, _si1, 23);
-       rsl_bcch_info(trx, RSL_SYSTEM_INFO_2, _si2, 23);
-//     rsl_bcch_info(trx, RSL_SYSTEM_INFO_3, _si3, );
-//     rsl_bcch_info(trx, RSL_SYSTEM_INFO_4, _si4, );
-
-       for (i = 2; i < ARRAY_SIZE(bcch_infos); i++) {
-               rsl_bcch_info(trx, bcch_infos[i].type,
-                             bcch_infos[i].data,
-                             bcch_infos[i].len);
-       }
-       rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, _si5, 18);
-       rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si6, sizeof(si6));
-#endif
-
-       for (i = 0; i < ARRAY_SIZE(bcch_infos); i++) {
-               rsl_bcch_info(trx, bcch_infos[i].type,
-                             bcch_infos[i].data,
-                             bcch_infos[i].len);
-       }
-       rsl_sacch_filling(trx, RSL_SYSTEM_INFO_5, si5, sizeof(si5));
-       rsl_sacch_filling(trx, RSL_SYSTEM_INFO_6, si6, sizeof(si6));
-
-       return 0;
-}
-
-/*
- * Patch the various SYSTEM INFORMATION tables to update
- * the LAI
- */
-static void patch_tables(struct gsm_bts *bts)
-{
-       u_int8_t arfcn_low = bts->c0->arfcn & 0xff;
-       u_int8_t arfcn_high = (bts->c0->arfcn >> 8) & 0x0f;
-       /* covert the raw packet to the struct */
-       struct gsm48_system_information_type_3 *type_3 =
-               (struct gsm48_system_information_type_3*)&si3;
-       struct gsm48_system_information_type_4 *type_4 =
-               (struct gsm48_system_information_type_4*)&si4;
-       struct gsm48_system_information_type_6 *type_6 =
-               (struct gsm48_system_information_type_6*)&si6;
-       struct gsm48_loc_area_id lai;
-
-       gsm0408_generate_lai(&lai, bts->network->country_code,
-                            bts->network->network_code,
-                            bts->location_area_code);
-
-       /* assign the MCC and MNC */
-       type_3->lai = lai;
-       type_4->lai = lai;
-       type_6->lai = lai;
-
-       /* patch ARFCN into BTS Attributes */
-       bs11_attr_bts[69] &= 0xf0;
-       bs11_attr_bts[69] |= arfcn_high;
-       bs11_attr_bts[70] = arfcn_low;
-       nanobts_attr_bts[42] &= 0xf0;
-       nanobts_attr_bts[42] |= arfcn_high;
-       nanobts_attr_bts[43] = arfcn_low;
-
-       /* patch ARFCN into TRX Attributes */
-       bs11_attr_radio[2] &= 0xf0;
-       bs11_attr_radio[2] |= arfcn_high;
-       bs11_attr_radio[3] = arfcn_low;
-       nanobts_attr_radio[5] &= 0xf0;
-       nanobts_attr_radio[5] |= arfcn_high;
-       nanobts_attr_radio[6] = arfcn_low;
-
-       type_4->data[2] &= 0xf0;
-       type_4->data[2] |= arfcn_high;
-       type_4->data[3] = arfcn_low;
-
-       /* patch Control Channel Description 10.5.2.11 */
-       type_3->control_channel_desc = bts->chan_desc;
-
-       /* patch BSIC */
-       bs11_attr_bts[1] = bts->bsic;
-       nanobts_attr_bts[sizeof(nanobts_attr_bts)-1] = bts->bsic;
-}
-
-
-static void bootstrap_rsl(struct gsm_bts_trx *trx)
-{
-       fprintf(stdout, "bootstrapping RSL for BTS/TRX (%u/%u) "
-               "using MCC=%u MNC=%u\n", trx->nr, trx->bts->nr, trx->bts->network->country_code, trx->bts->network->network_code);
-       set_system_infos(trx);
-}
-
-void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx)
-{
-       switch (event) {
-       case EVT_E1_TEI_UP:
-               switch (type) {
-               case E1INP_SIGN_OML:
-                       bootstrap_om(trx->bts);
-                       break;
-               case E1INP_SIGN_RSL:
-                       bootstrap_rsl(trx);
-                       break;
-               default:
-                       break;
-               }
-               break;
-       case EVT_E1_TEI_DN:
-               fprintf(stderr, "Lost some E1 TEI link\n");
-               /* FIXME: deal with TEI or L1 link loss */
-               break;
-       default:
-               break;
-       }
-}
-
-static int bootstrap_bts(struct gsm_bts *bts, int lac, int arfcn)
-{
-       bts->band = BAND;
-       bts->location_area_code = lac;
-       bts->c0->arfcn = arfcn;
-
-       /* Control Channel Description */
-       memset(&bts->chan_desc, 0, sizeof(struct gsm48_control_channel_descr));
-       bts->chan_desc.att = 1;
-       bts->chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C;
-       bts->chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5;
-       bts->chan_desc.t3212 = 0;
-
-       patch_tables(bts);
-
-       paging_init(bts);
-
-       if (bts->type == GSM_BTS_TYPE_BS11) {
-               struct gsm_bts_trx *trx = bts->c0;
-               set_ts_e1link(&trx->ts[0], 0, 1, 0xff);
-               set_ts_e1link(&trx->ts[1], 0, 2, 1);
-               set_ts_e1link(&trx->ts[2], 0, 2, 2);
-               set_ts_e1link(&trx->ts[3], 0, 2, 3);
-               set_ts_e1link(&trx->ts[4], 0, 3, 0);
-               set_ts_e1link(&trx->ts[5], 0, 3, 1);
-               set_ts_e1link(&trx->ts[6], 0, 3, 2);
-               set_ts_e1link(&trx->ts[7], 0, 3, 3);
-#ifdef HAVE_TRX1
-               /* TRX 1 */
-               trx = &bts->trx[1];
-               set_ts_e1link(&trx->ts[0], 0, 1, 0xff);
-               set_ts_e1link(&trx->ts[1], 0, 2, 1);
-               set_ts_e1link(&trx->ts[2], 0, 2, 2);
-               set_ts_e1link(&trx->ts[3], 0, 2, 3);
-               set_ts_e1link(&trx->ts[4], 0, 3, 0);
-               set_ts_e1link(&trx->ts[5], 0, 3, 1);
-               set_ts_e1link(&trx->ts[6], 0, 3, 2);
-               set_ts_e1link(&trx->ts[7], 0, 3, 3);
-#endif
-       }
-
-       return 0;
-}
-
-struct gsm_network *bootstrap_network(int (*mncc_recv)(struct gsm_network *, int, void *), gsm_bts_type bts_type, int mcc, int mnc, int lac, int arfcn, int cardnr, int release_l2, char *name_short, char *name_long, char *database_name, int allow_all)
-{
-       struct gsm_network *gsmnet;
-       struct gsm_bts *bts;
-
-       switch(bts_type) {
-       case GSM_BTS_TYPE_NANOBTS_1800:
-               if (arfcn < 512 || arfcn > 885) {
-                       fprintf(stderr, "GSM1800 channel must be between 512-885.\n");
-                       return NULL;
-               }
-               break;
-       case GSM_BTS_TYPE_BS11:
-       case GSM_BTS_TYPE_NANOBTS_900:
-               /* Assume we have a P-GSM900 here */
-               if (arfcn < 1 || arfcn > 124) {
-                       fprintf(stderr, "GSM900 channel must be between 1-124.\n");
-                       return NULL;
-               }
-               break;
-       case GSM_BTS_TYPE_UNKNOWN:
-               fprintf(stderr, "Unknown BTS. Please use the --bts-type switch\n");
-               return NULL;
-       }
-
-       /* initialize our data structures */
-       gsmnet = gsm_network_init(mcc, mnc, mncc_recv);
-       if (!gsmnet)
-               return NULL;
-
-       gsmnet->name_long = name_long;
-       gsmnet->name_short = name_short;
-
-       bts = gsm_bts_alloc(gsmnet, bts_type, HARDCODED_TSC, HARDCODED_BSIC);
-       bootstrap_bts(bts, lac, arfcn);
-
-       if (db_init(database_name)) {
-               printf("DB: Failed to init database. Please check the option settings.\n");
-               return NULL;
-       }        
-       printf("DB: Database initialized.\n");
-
-       if (db_prepare()) {
-               printf("DB: Failed to prepare database.\n");
-               return NULL;
-       }
-       printf("DB: Database prepared.\n");
-
-       telnet_init(gsmnet, 4242);
-
-       register_signal_handler(SS_NM, nm_sig_cb, NULL);
-
-       /* E1 mISDN input setup */
-       if (bts_type == GSM_BTS_TYPE_BS11) {
-               gsmnet->num_bts = 1;
-               if (e1_config(bts, cardnr, release_l2))
-                       return NULL;
-       } else {
-               /* FIXME: do this dynamic */
-               bts->ip_access.site_id = 1801;
-               bts->ip_access.bts_id = 0;
-
-               bts = gsm_bts_alloc(gsmnet, bts_type, HARDCODED_TSC, HARDCODED_BSIC);
-               bootstrap_bts(bts, lac, arfcn);
-               bts->ip_access.site_id = 1800;
-               bts->ip_access.bts_id = 0;
-               if (ipaccess_setup(gsmnet))
-                       return NULL;
-       }
-
-       if (allow_all)
-               gsm0408_allow_everyone(1);
-
-       return gsmnet;
-}
-
-static void create_pcap_file(char *file)
-{
-       mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
-       int fd = open(file, O_WRONLY|O_TRUNC|O_CREAT, mode);
-
-       if (fd < 0) {
-               perror("Failed to open file for pcap");
-               return;
-       }
-
-       e1_set_pcap_fd(fd);
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/bootstrap.h b/bootstrap.h
deleted file mode 100644 (file)
index e67408d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-struct gsm_network *bootstrap_network(int (*mncc_recv)(struct gsm_network *, int, void *), gsm_bts_type bts_type, int mcc, int mnc, int lac, int arfcn, int cardnr, int release_l2, char *name_short, char *name_long, char *database_name, int allow_all);
-int shutdown_net(struct gsm_network *network);
-
index beb24a9..59b587d 100755 (executable)
--- a/configure
+++ b/configure
@@ -1385,7 +1385,7 @@ Optional Packages:
 
   --with-ssl              compile with ssl support (libcrypto) [default=check]
 
-  --with-gsm              compile with OpenBSC support (libbsc) [default=no]
+  --with-gsm              compile with OpenBSC support [default=no]
 
 
 Some influential environment variables:
@@ -6264,13 +6264,50 @@ fi
 if test "${with_gsm+set}" = set; then
   withval=$with_gsm;
 else
-  with_gsm=no
+  with_gsm="check"
+fi
+
+
+if test "x$with_gsm" != xno; then
+  { $as_echo "$as_me:$LINENO: checking for openbsc/include/openbsc/gsm_data.h" >&5
+$as_echo_n "checking for openbsc/include/openbsc/gsm_data.h... " >&6; }
+if test "${ac_cv_file_openbsc_include_openbsc_gsm_data_h+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+$as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+if test -r "openbsc/include/openbsc/gsm_data.h"; then
+  ac_cv_file_openbsc_include_openbsc_gsm_data_h=yes
+else
+  ac_cv_file_openbsc_include_openbsc_gsm_data_h=no
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_file_openbsc_include_openbsc_gsm_data_h" >&5
+$as_echo "$ac_cv_file_openbsc_include_openbsc_gsm_data_h" >&6; }
+if test "x$ac_cv_file_openbsc_include_openbsc_gsm_data_h" = x""yes; then
+  with_gsm="yes"
+else
+  if test "x$with_gsm" != xcheck ; then
+                         { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: --with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ .
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: --with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ .
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+                     fi
+
+fi
+
+
 fi
 
 
 
 
-if test "x$with_gsm" != "xno" ; then
+if test "x$with_gsm" == "xyes" ; then
   ENABLE_GSM_TRUE=
   ENABLE_GSM_FALSE='#'
 else
index bbd770f..c4850b3 100644 (file)
@@ -98,12 +98,22 @@ AS_IF([test "x$with_ssl" != xno],
 # check for gsm
 AC_ARG_WITH([gsm],
        [AS_HELP_STRING([--with-gsm],
-                       [compile with OpenBSC support (libbsc) @<:@default=no@:>@])
+                       [compile with OpenBSC support @<:@default=no@:>@])
        ],
        [],
-       [with_gsm=no])
+       [with_gsm="check"])
+
+AS_IF([test "x$with_gsm" != xno],
+      [AC_CHECK_FILE([openbsc/include/openbsc/gsm_data.h],
+                       [with_gsm="yes"],
+                       [if test "x$with_gsm" != xcheck ; then
+                         AC_MSG_FAILURE(
+                           [--with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ .])
+                     fi
+                    ])
+      ])
 
-AM_CONDITIONAL(ENABLE_GSM, test "x$with_gsm" != "xno" )
+AM_CONDITIONAL(ENABLE_GSM, test "x$with_gsm" == "xyes" )
 
 # Checks for libraries.
 AC_CHECK_LIB([m], [main])
index 2fb9fae..456dbf3 100644 (file)
 #interface-bsc mISDN_l1loop.1
 #interface-lcr mISDN_l1loop.2
 
-# GSM network names.
-# This name is presented to the mobile station.
-# By default 'LCR' is used.
-#long-name Linux-Call-Router
-#short-name LCR
-
-# Give the GSM country code.
-# The country code is different from the PSTN country code. E.g Germany uses
-# 262 instead of 49. Use this for IMSI catching.
-# This will override the default value of 1 = 'test country';
-#mcc 001
-
-# Give the GSM network code.
-# The network code is different from the PSTN network codes. Change this if
-# you run different test networks in the same locations.
-# This will override the default value of 1 = 'test network';
-#mnc 01
-
-# Give the location area code.
-# The location area code is not known to the author of LCR. Don't change it!
-#lac 1
+# Give openbsc.cnf config file
+# It will be located at /usr/local/lcr by default.
+#config openbsc.cfg
 
 # Give database of Home Location Register (HLR)
 # HLR stores all subscribers. It will be used to grant access to the network.
 # The database is located at /usr/local/lcr by default.
 #hlr hlr.sqlite3
 
-# Authorization of unknown subscribers.
-# To allow all subscribers to access the network, use this option.
-# By default, subscribers are only accepted if allowed in the HLR
-allow-all
+# How to reject unknown subscribers.
+#reject-cause 0
 
 # To keep layer 2 connection to BS11 when quitting, use this option.
 # It is only usefull for developing. TRX will stay on.
@@ -55,14 +35,6 @@ allow-all
 # Warning: Keeping layer 2 link may prevent emergency calls. (See below)
 #keep-l2
 
-# You must define a list of your BTS'.
-# Usage: 'bts bs11 <card> <frequency> [<frequency 2>]
-#  The keyword 'bts' is used to specify a BTS. Multiple BTS' may be defined.
-#  The 'bs11' keyword specifies a BS11 BTS connected to an E1 card.
-#  The frequency is given for the first TRX (tranceiver).
-#  In case of a second tranceiver, give frequency 2.
-bts bs11 0 123
-
 # Shutdown on emergency calls:
 # This option will prevent a shutdown if an emergency call is received. In
 # case of an emergency, a mobile phone may log onto you GSM network and may
diff --git a/gsm.cpp b/gsm.cpp
index f9c9914..9c19e94 100644 (file)
--- a/gsm.cpp
+++ b/gsm.cpp
 
 #include "main.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 extern "C" {
-#include "openbsc/mncc.h"
-#include "openbsc/trau_frame.h"
-#include "openbsc/select.h"
-#include "openbsc/debug.h"
-#include "openbsc/e1_input.h"
-#include "bootstrap.h"
+#include <getopt.h>
+
+#include <openbsc/db.h>
+#include <openbsc/select.h>
+#include <openbsc/debug.h>
+#include <openbsc/e1_input.h>
+#include <openbsc/talloc.h>
+#include <openbsc/mncc.h>
+#include <openbsc/trau_frame.h>
+struct gsm_network *bsc_gsmnet = 0;
+extern int ipacc_rtp_direct;
+extern int bsc_bootstrap_network(int (*mmc_rev)(struct gsm_network *, int, void *),
+                                const char *cfg_file);
+extern int bsc_shutdown_net(struct gsm_network *net);
+void talloc_ctx_init(void);
+void on_dso_load_token(void);
+void on_dso_load_rrlp(void);
+
 #include "gsm_audio.h"
 
 #undef AF_ISDN
@@ -865,7 +880,7 @@ void Pgsm::retr_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc
 /*
  * BSC sends message to port
  */
-static int message_bcs(struct gsm_network *net, int msg_type, void *arg)
+static int message_bsc(struct gsm_network *net, int msg_type, void *arg)
 {
        struct gsm_mncc *mncc = (struct gsm_mncc *)arg;
        unsigned int callref = mncc->callref;
@@ -1608,7 +1623,7 @@ int gsm_exit(int rc)
                        gsm_sock_close();
                /* shutdown network */
                if (gsm->network)
-                       shutdown_net((struct gsm_network *)gsm->network);
+                       bsc_shutdown_net((struct gsm_network *)gsm->network);
                /* free network */
 //             if (gsm->network) {
 //                     free((struct gsm_network *)gsm->network); /* TBD */
@@ -1622,9 +1637,17 @@ int gsm_exit(int rc)
 
 int gsm_init(void)
 {
-       char hlr[128], filename[128];
+       char hlr[128], cfg[128], filename[128];
         mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
-       int pcapfd;
+       int pcapfd, rc;
+
+       tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
+       talloc_ctx_init();
+       on_dso_load_token();
+       on_dso_load_rrlp();
+
+       /* seed the PRNG */
+       srand(time(NULL));
 
        /* create gsm instance */
        gsm = (struct lcr_gsm *)MALLOC(sizeof(struct lcr_gsm));
@@ -1637,46 +1660,64 @@ int gsm_init(void)
        }
 
        /* set debug */
-       debug_parse_category_mask(gsm->conf.debug);
+       if (gsm->conf.debug[0])
+               debug_parse_category_mask(gsm->conf.debug);
+
+       /* open pcap file */
+       if (gsm->conf.pcapfile[0]) {
+               if (gsm->conf.pcapfile[0] == '/')
+                       SCPY(filename, gsm->conf.pcapfile);
+               else
+                       SPRINT(filename, "%s/%s", CONFIG_DATA, gsm->conf.pcapfile);
+               pcapfd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, mode);
+               if (pcapfd < 0) {
+                       PERROR("Failed to open file for pcap\n");
+                       return gsm_exit(-1);
+               }
+               e1_set_pcap_fd(pcapfd);
+       }
+
+       /* set reject cause */
+       if (gsm->conf.reject_cause)
+               gsm0408_set_reject_cause(gsm->conf.reject_cause);
+
+       /* use RTP proxy for audio streaming */
+       if (gsm->conf.rtp_proxy)
+               ipacc_rtp_direct = 0;
 
        /* init database */
        if (gsm->conf.hlr[0] == '/')
                SCPY(hlr, gsm->conf.hlr);
        else
                SPRINT(hlr, "%s/%s", CONFIG_DATA, gsm->conf.hlr);
-
-       // TODO multiple base stations
-       if (gsm->conf.numbts < 1 || gsm->conf.numbts > 1) {
-               PERROR("Expecting exactly one BTS. You defined %d.\n", gsm->conf.numbts);
+       if (db_init(hlr)) {
+               PERROR("GSM DB: Failed to init database '%s'. Please check the option settings.\n", hlr);
                return gsm_exit(-1);
        }
+       printf("DB: Database initialized.\n");
+       if (db_prepare()) {
+               PERROR("GSM DB: Failed to prepare database.\n");
+               return gsm_exit(-1);
+       }
+       printf("DB: Database prepared.\n");
 
        /* bootstrap network */
-       gsm->network = bootstrap_network(&message_bcs, gsm->conf.bts[0].type, gsm->conf.mcc, gsm->conf.mnc, gsm->conf.lac, gsm->conf.bts[0].frequency[0], gsm->conf.bts[0].card, !gsm->conf.keep_l2, gsm->conf.short_name, gsm->conf.long_name, hlr, gsm->conf.allow_all);
-       if (!gsm->network) {
+       if (gsm->conf.openbsc_cfg[0] == '/')
+               SCPY(cfg, gsm->conf.openbsc_cfg);
+       else
+               SPRINT(cfg, "%s/%s", CONFIG_DATA, gsm->conf.openbsc_cfg);
+       rc = bsc_bootstrap_network(&message_bsc, cfg);
+       if (rc < 0) {
                PERROR("Failed to bootstrap GSM network.\n");
                return gsm_exit(-1);
        }
+       gsm->network = bsc_gsmnet;
 
        /* open gsm loop interface */
        if (gsm_sock_open(gsm->conf.interface_bsc)) {
                return gsm_exit(-1);
        }
 
-       /* open pcap file */
-       if (gsm->conf.pcapfile[0]) {
-               if (gsm->conf.pcapfile[0] == '/')
-                       SCPY(filename, gsm->conf.pcapfile);
-               else
-                       SPRINT(filename, "%s/%s", CONFIG_DATA, gsm->conf.pcapfile);
-               pcapfd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, mode);
-               if (pcapfd < 0) {
-                       PERROR("Failed to open file for pcap\n");
-                       return gsm_exit(-1);
-               }
-               e1_set_pcap_fd(pcapfd);
-       }
-
        return 0;
 }
 
diff --git a/gsm.h b/gsm.h
index a4653e1..1fbcee7 100644 (file)
--- a/gsm.h
+++ b/gsm.h
@@ -2,29 +2,20 @@ extern "C" {
 #include <openbsc/gsm_data.h>
 }
 
-struct bts_conf {
-       gsm_bts_type type;              /* type of BTS */
-       int card;                       /* E1 card number of BS11 BTS */
-       int numtrx;                     /* up to 8 TRXs */
-       int frequency[8];               /* up to 8 frequencies for TRXs */
-};
-
 struct gsm_conf {
        char debug[128];                /* debug info */
        char interface_bsc[64];         /* loopback interface BSC side */
        char interface_lcr[64];         /* loopback interface LCR side */
+       char openbsc_cfg[128];          /* openbsc config file */
        char short_name[64];            /* short network name */
        char long_name[64];             /* long network name */
-       int mcc;                        /* mobile country code */
-       int mnc;                        /* mobile network code */
-       int lac;                        /* location area code */
        char hlr[64];                   /* database name */
        int allow_all;                  /* accept unknown subscribers */
        int keep_l2;                    /* keep layer 2 after exit */
-       int numbts;                     /* number of BTS' */
-       struct bts_conf bts[8];         /* configure BTS' */
        int noemergshut;                /* don't shut down on emergency */
        char pcapfile[128];             /* open capture file for BS11 links */
+       int reject_cause;               /* reject cause for unsubcribed IMSIs */
+       int rtp_proxy;                  /* enable RTP proxy */
 };
 
 struct lcr_gsm {
index 2f46def..9957b86 100644 (file)
@@ -33,16 +33,10 @@ int gsm_conf(struct gsm_conf *gsm_conf)
        SCPY(gsm_conf->debug, "");
        SCPY(gsm_conf->interface_bsc, "mISDN_l1loop.1");
        SCPY(gsm_conf->interface_lcr, "mISDN_l1loop.2");
-       SCPY(gsm_conf->short_name, "LCR");
-       SCPY(gsm_conf->long_name, "Linux-Call-Router");
-       gsm_conf->mcc = 1;
-       gsm_conf->mnc = 1;
-       gsm_conf->lac = 1;
        SCPY(gsm_conf->hlr, "hlr.sqlite3");
-       gsm_conf->allow_all = 0;
+       SCPY(gsm_conf->openbsc_cfg, "openbsc.cfg");
+       gsm_conf->reject_cause = 0;
        gsm_conf->keep_l2 = 0;
-       gsm_conf->numbts = 0;
-       //gsm_conf->bts[xx]
        gsm_conf->noemergshut = 0;
 
        SPRINT(filename, "%s/gsm.conf", CONFIG_DATA);
@@ -132,52 +126,28 @@ int gsm_conf(struct gsm_conf *gsm_conf)
                        SCPY(gsm_conf->interface_lcr, params[0]);
 
                } else
-               if (!strcmp(option,"short-name")) {
+               if (!strcmp(option,"config")) {
                        if (params[0][0]==0) {
                                SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
                                goto error;
                        }
-                       SCPY(gsm_conf->short_name, params[0]);
+                       SCPY(gsm_conf->openbsc_cfg, params[0]);
 
                } else
-               if (!strcmp(option,"long-name")) {
-                       if (params[0][0]==0) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
-                               goto error;
-                       }
-                       SCPY(gsm_conf->long_name, params[0]);
-
-               } else
-               if (!strcmp(option,"mcc")) {
-                       if (params[0][0]==0) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
-                               goto error;
-                       }
-                       gsm_conf->mcc = atoi(params[0]);
-
-               } else
-               if (!strcmp(option,"mnc")) {
-                       if (params[0][0]==0) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
-                               goto error;
-                       }
-                       gsm_conf->mnc = atoi(params[0]);
-
-               } else
-               if (!strcmp(option,"lac")) {
+               if (!strcmp(option,"hlr")) {
                        if (params[0][0]==0) {
                                SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
                                goto error;
                        }
-                       gsm_conf->lac = atoi(params[0]);
+                       SCPY(gsm_conf->hlr, params[0]);
 
                } else
-               if (!strcmp(option,"hlr")) {
+               if (!strcmp(option,"reject-cause")) {
                        if (params[0][0]==0) {
                                SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
                                goto error;
                        }
-                       SCPY(gsm_conf->hlr, params[0]);
+                       gsm_conf->reject_cause = atoi(params[0]);
 
                } else
                if (!strcmp(option,"allow-all")) {
@@ -190,46 +160,15 @@ int gsm_conf(struct gsm_conf *gsm_conf)
                if (!strcmp(option,"no-mergency-shutdown")) {
                        gsm_conf->noemergshut = 1;
                } else
+               if (!strcmp(option,"rtp-proxy")) {
+                       gsm_conf->rtp_proxy = 1;
+               } else
                if (!strcmp(option,"pcapfile")) {
                        if (params[0][0]==0) {
                                SPRINT(gsm_conf_error, "Error in %s (line %d): parameter for option %s missing.\n",filename,line, option);
                                goto error;
                        }
                        SCPY(gsm_conf->pcapfile, params[0]);
-               } else
-               if (!strcmp(option,"bts")) {
-                       if (gsm_conf->numbts == 8) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): too many BTS defined.\n",filename,line);
-                               goto error;
-                       }
-                       if (params[0][0]==0) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): parameter <bts-type> for option %s missing.\n",filename,line,option);
-                               goto error;
-                       }
-                       if (params[1][0]==0) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): parameter <card number> for option %s missing.\n",filename,line,option);
-                               goto error;
-                       }
-                       if (params[2][0]==0) {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): parameter <frequency> for option %s missing.\n",filename,line,option);
-                               goto error;
-                       }
-                       if (!strcmp(params[0], "bs11")) {
-                               gsm_conf->bts[gsm_conf->numbts].type = GSM_BTS_TYPE_BS11;
-                       } else {
-                               SPRINT(gsm_conf_error, "Error in %s (line %d): unknown BTS type '%s'.\n",filename,line,params[0]);
-                               goto error;
-                       }
-                       gsm_conf->bts[gsm_conf->numbts].card = atoi(params[1]);
-                       gsm_conf->bts[gsm_conf->numbts].numtrx = 0;
-                       while (params[gsm_conf->bts[gsm_conf->numbts].numtrx+2][0]) {
-                               if (gsm_conf->bts[gsm_conf->numbts].numtrx == 8) {
-                                       SPRINT(gsm_conf_error, "Error in %s (line %d): too many frequencies defined.\n",filename,line);
-                                       goto error;
-                               }
-                               gsm_conf->bts[gsm_conf->numbts].frequency[gsm_conf->bts[gsm_conf->numbts].numtrx++] = atoi(params[gsm_conf->bts[gsm_conf->numbts].numtrx+2]);
-                       }
-                       gsm_conf->numbts++;
                } else {
                        SPRINT(gsm_conf_error, "Error in %s (line %d): wrong option keyword %s.\n", filename,line,option);
                        goto error;