summaryrefslogtreecommitdiffstats
path: root/bootstrap.c
diff options
context:
space:
mode:
authorAndreas Eversberg2009-05-21 13:24:38 +0200
committerAndreas Eversberg2009-05-21 13:24:38 +0200
commit610b98487df43799a30b76c1da267458f318efa1 (patch)
treee11e7c1ef0dbcb3e7616dc28d44cb5906d809b91 /bootstrap.c
parent- Debug option now works for GSM. (diff)
downloadlcr-610b98487df43799a30b76c1da267458f318efa1.tar.gz
lcr-610b98487df43799a30b76c1da267458f318efa1.tar.xz
lcr-610b98487df43799a30b76c1da267458f318efa1.zip
OpenBSC API change.
modified: README modified: bootstrap.c modified: bootstrap.h modified: default/gsm.conf modified: gsm.cpp modified: gsm_conf.c
Diffstat (limited to 'bootstrap.c')
-rw-r--r--bootstrap.c63
1 files changed, 41 insertions, 22 deletions
diff --git a/bootstrap.c b/bootstrap.c
index 0c309a3..12a63fc 100644
--- a/bootstrap.c
+++ b/bootstrap.c
@@ -38,7 +38,6 @@
#ifdef __cplusplus
extern "C" {
#endif
-#include <openbsc/openbsc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/db.h>
@@ -786,12 +785,6 @@ static int set_system_infos(struct gsm_bts_trx *trx)
}
/*
- * Inform anyone...
- */
-static void bsc_hack_channel_allocated(struct gsm_lchan *lchan) {
-}
-
-/*
* Patch the various SYSTEM INFORMATION tables to update
* the LAI
*/
@@ -871,13 +864,41 @@ void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx)
}
}
-void *bootstrap_network(int (*mncc_recv)(void *, int, void *),int bts_type, int mcc, int mnc, int lac, int arfcn, int cardnr, int release_l2, char *name_short, char *name_long, char *hlr, int allow_all)
+static int bootstrap_bts(struct gsm_bts *bts, int lac, int arfcn)
+{
+ bts->location_area_code = lac;
+ bts->trx[0].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);
+
+ return 0;
+}
+
+
+struct gsm_network *bootstrap_network(int (*mncc_recv)(struct gsm_network *, int, void *), int bts_type, int mcc, int mnc, int lac, int arfcn, int cardnr, int release_l2, char *name_short, char *name_long, char *hlr, int allow_all)
{
struct gsm_bts *bts;
struct gsm_network *gsmnet;
+ /* seed the PRNG for TMSI */
+ srand(time(NULL));
+
+ /* initialize our data structures */
+ gsmnet = gsm_network_init(2, (gsm_bts_type)bts_type, mcc, mnc, mncc_recv);
+ if (!gsmnet)
+ return 0;
+
/* open database */
- if (db_init(hlr)) {
+ if (db_init(hlr, gsmnet)) {
fprintf(stderr, "DB: Failed to init HLR database '%s'. Please check the option settings.\n", hlr);
return NULL;
}
@@ -886,19 +907,10 @@ void *bootstrap_network(int (*mncc_recv)(void *, int, void *),int bts_type, int
return NULL;
}
- /* seed the PRNG for TMSI */
- srand(time(NULL));
-
- /* initialize our data structures */
- gsmnet = gsm_network_init(1, (gsm_bts_type)bts_type, mcc, mnc, mncc_recv);
- if (!gsmnet)
- return 0;
-
gsmnet->name_long = name_long;
gsmnet->name_short = name_short;
bts = &gsmnet->bts[0];
- bts->location_area_code = lac;
- bts->trx[0].arfcn = arfcn;
+ bootstrap_bts(bts, lac, arfcn);
/* Control Channel Description */
memset(&bts->chan_desc, 0, sizeof(struct gsm48_control_channel_descr));
@@ -910,17 +922,24 @@ void *bootstrap_network(int (*mncc_recv)(void *, int, void *),int bts_type, int
patch_tables(bts);
paging_init(bts);
- bts->paging.channel_allocated = bsc_hack_channel_allocated;
telnet_init(gsmnet, 4242);
/* 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 {
- if (ia_config(bts))
+ bts->ip_access.site_id = 1801;
+ bts->ip_access.bts_id = 0;
+ bts = &gsmnet->bts[1];
+ 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)
@@ -929,7 +948,7 @@ void *bootstrap_network(int (*mncc_recv)(void *, int, void *),int bts_type, int
return gsmnet;
}
-int shutdown_net(void *network)
+int shutdown_net(struct gsm_network *network)
{
struct gsm_network *net = (struct gsm_network *)network;
unsigned int i;