From ffc0151b1258b604999b1b1ce9cc68268a908dbf Mon Sep 17 00:00:00 2001 From: root Date: Sun, 5 Jul 2009 21:40:54 +0200 Subject: [PATCH] Changed GSM api to current development tree of OpenBSC. Removed obsolete (never finisshed) installation wizzard. modified: bootstrap.c modified: default/gsm.conf deleted: wizzard.c --- bootstrap.c | 128 +++++++++++++++++++++++++----------- default/gsm.conf | 2 +- wizzard.c | 194 ------------------------------------------------------- 3 files changed, 91 insertions(+), 233 deletions(-) delete mode 100644 wizzard.c diff --git a/bootstrap.c b/bootstrap.c index 96f7ec2..b2d2b0c 100644 --- a/bootstrap.c +++ b/bootstrap.c @@ -636,7 +636,7 @@ static u_int8_t si1[] = { /* 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 *gsm48_si1(struct gsm_bts_conf *conf) { static u_int8_t si[23]; int i, bit, octet; @@ -647,24 +647,24 @@ static u_int8_t *gsm48_si1(u_int8_t *arfcn_list, int arfcn_len, int max_trans, i 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; + /* ccdesc 10.5.2.1b.2 (bit map 0 format) */ + for (i = 0; i < conf->arfcn_len; i++) { + if (conf->arfcn_list[i] <= 124 && conf->arfcn_list[i] > 0) { + bit = (conf->arfcn_list[i] - 1) & 7; + octet = (conf->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; + /* rach 10.5.2.29 */ + si[19] = (conf->max_trans << 6); + si[19] |= (conf->tx_integer << 2); + si[19] |= (conf->cell_barr << 1); + si[19] |= conf->re; + si[20] = (conf->ec << 2); + for (i = 0; i < conf->ac_len; i++) { + if (conf->ac_list[i] <= 15 && conf->ac_list[i] != 10) { + bit = conf->ac_list[i] & 7; + octet = conf->ac_list[i] / 8; si[21 - octet] |= (1 << bit); } } @@ -701,7 +701,7 @@ static u_int8_t si2[] = { /* 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 *gsm48_si2(struct gsm_bts_conf *conf) { static u_int8_t si[23]; int i, bit, octet; @@ -712,27 +712,27 @@ static u_int8_t *gsm48_si2(int ba, u_int8_t *arfcn_list, int arfcn_len, u_int8_t 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; + /* ncdesc 10.5.2.22 */ + si[3] = (ba_ind << 4); + for (i = 0; i < conf->ncell_arfcn_len; i++) { + if (conf->ncell_arfcn_list[i] <= 124 && conf->ncell_arfcn_list[i] > 0) { + bit = (conf->ncell_arfcn_list[i] - 1) & 7; + octet = (conf->ncell_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; + /* ncc 10.5.2.27 */ + si[19] = conf->ncc; + /* rach 10.5.2.29 */ + si[20] = (conf->max_trans << 6); + si[20] |= (conf->tx_integer << 2); + si[20] |= (conf->cell_barr << 1); + si[20] |= conf->re; + si[21] = (conf->ec << 2); + for (i = 0; i < conf->ac_len; i++) { + if (conf->ac_list[i] <= 15 && conf->ac_list[i] != 10) { + bit = conf->ac_list[i] & 7; + octet = data->ac_list[i] / 8; si[22 - octet] |= (1 << bit); } } @@ -784,6 +784,7 @@ SYSTEM INFORMATION TYPE 3 Scheduling Information is not sent in SYSTEM INFORMATION TYPE 9 on the BCCH */ static u_int8_t si3[] = { +#warning nicht 0x59 == 22 octets + length /* header */0x49, 0x06, 0x1B, /* cell */0x00, 0x01, /* lai */0x00, 0xF1, 0x10, 0x00, 0x01, @@ -791,9 +792,60 @@ static u_int8_t si3[] = { /* option*/0x28, /* selection*/0x62, 0x00, /* rach */0xD5, 0x00, 0x00, - /* reset*/0x80, 0x00, 0x00, 0x2B + /* rest */0x80, 0x00, 0x00, 0x2B }; +static u_int8_t *gsm48_si3(struct gsm_net *net, struct gsm_bts_conf *conf) +{ + static u_int8_t si[23]; + int i, bit, octet; + + memset(&si, 0, sizeof(si)); + + /* header */ +#warning testing + si[0] = 0x59; + si[1] = 0x06; + si[2] = 0x1B; + /* cell 10.5.1.1 */ + si[3] = ci >> 8; + si[4] = ci; + /* lai 10.5.1.3 */ + gsm0408_generate_lai(&si[5], network->country_code, + network->network_code, + conf->location_area_code); + /* desc 10.5.2.11 */ + si[10] = conf->att << 6; + si[10] |= conf->bs_ag_blks_res << 3; + si[10] |= conf->ccch_conf; + si[11] = conf->bs_pa_mfrms; + si[12] = conf->t3212_decihours; + /* option 10.5.2.3 */ + si[13] = conf->pwrc << 6; + si[13] |= conf->dtx << 4; + si[13] |= conf->rl_timeout; + /* selection 10.5.2.4 */ + si[14] = conf->csel_hyst << 5; + si[14] |= conf->ms_txpwr_max_cch; + si[15] = conf->acs << 7; + si[15] |= conf->neci << 6; + si[15] |= conf->rxlev_access_min; + /* rach 10.5.2.29 */ + si[16] = (conf->max_trans << 6); + si[16] |= (conf->tx_integer << 2); + si[16] |= (conf->cell_barr << 1); + si[16] |= conf->re; + si[17] = (conf->ec << 2); + for (i = 0; i < conf->ac_len; i++) { + if (conf->ac_list[i] <= 15 && conf->ac_list[i] != 10) { + bit = conf->ac_list[i] & 7; + octet = data->ac_list[i] / 8; + si[18 - octet] |= (1 << bit); + } + } + /* rest 10.5.2.34 */ +} + /* SYSTEM INFORMATION TYPE 4 Location area identification @@ -868,8 +920,8 @@ static u_int8_t *gsm48_si5(int ba, u_int8_t *arfcn_list, int arfcn_len) } /* testig */ - if (memcmp(&si3, &si, sizeof(si))) - printf("SI3 does not match default template.\n"); + if (memcmp(&si5, &si, sizeof(si))) + printf("SI5 does not match default template.\n"); return si; } diff --git a/default/gsm.conf b/default/gsm.conf index a0f4b49..2fb9fae 100644 --- a/default/gsm.conf +++ b/default/gsm.conf @@ -4,7 +4,7 @@ # Enable debugging of OpenBSC library. # Refer to OpenBSC project for debugging options. # By default, debugging is turned off. -#debug DRLL:DCC:DMM:DRR:DRSL:DNM:DSMS:DMNCC:DMNSMS:DPAG:DMUX +#debug DRLL:DCC:DMM:DRR:DRSL:DNM:DSMS:DMNCC:DMNSMS:DPAG:DMUX:DMEAS # Two Loopback interfaces for audio transfer between OpenBSC and mISDN. # The first interface must provide B-channelis for each call mobile call. diff --git a/wizzard.c b/wizzard.c deleted file mode 100644 index 80851c9..0000000 --- a/wizzard.c +++ /dev/null @@ -1,194 +0,0 @@ -/*****************************************************************************\ -** ** -** PBX4Linux ** -** ** -**---------------------------------------------------------------------------** -** Copyright: Andreas Eversberg ** -** ** -** installation wizzard ** -** ** -\*****************************************************************************/ - -#include -#include -#include - -char *check_mISDN(void) -{ -} - -char *install_mISDN(void) -{ -} - -char *check_kernel(void) -{ -} - -char *install_kernel(void) -{ -} - -char *check_includes(void) -{ -} - -char *install_includes(void) -{ -} - -char *check_device(void) -{ -} - -char *install_device(void) -{ -} - -char *check_lib(void) -{ -} - -char *install_lib(void) -{ -} - -char *check_isdnnet(void) -{ -} - -char *install_isdnnet(void) -{ -} - -char *check_pbx(void) -{ -} - -char *install_pbx(void) -{ -} - -char *check_mISDNrc(void) -{ -} - -char *install_mISDNrc(void) -{ -} - - -struct jobs { - char *name; - (char *(check))(void); - (char *(install))(void); -} jobs[] = { - { "Install mISDN to kernel Source.", check_mISDN, install_mISDN }, - { "Compile and install Kernel.", check_kernel, install_kernel }, - { "Copy user space includes.", check_includes, install_includes }, - { "Create \"/dev/mISDN\" device", check_device, install_device }, - { "Compile mISDN device library.", check_lib, install_lib }, - { "Compile mISDN NT-mode library.", check_isdnnet, install_isdnnet }, - { "Compile and install PBX4Linux.", check_pbx, install_pbx }, - { "Create mISDNrc to load mISDN.", check_mISDNrc, install_mISDNrc }, - { NULL, NULL, NULL}, -}; - - -int main(int argc, char *argv[]) -{ - int allok = 1; - int i; - char *ret; - char input[256]; - - printf("\nWelcome to PBX4Linux installation wizzard.\n\n"); - - again: - - /* check what to do */ - i = 0; - while(jobs[i].name) - { - printf("Checking: %s - ", jobs[i].name); - fflush(stdout); - ret = jobs[i].check(); - if (ret == NULL) - printf("OK\n"); - else { - printf("%s\n", ret); - allok = 0; - } - i++; - } - - /* if all ok */ - if (allok) - { - printf("\nEverything seems to be correctly installed. Do you like to continue? (y/n)"); - fflush(stdout); - do { - scanf("%s", input); - } while(input[0] != 'y' && input[0] != 'n'); - if (input[0] == 'n') - return(0); - - } - - /* select installation step(s) */ - printf("\nPlease select one of the following install options:\n"); - printf("a - Complete installation with all of the following steps\n"); - i = 0; - while(jobs[i].name) - { - printf("%d - Step %d: %s\n", i+1, i+1, jobs[i].name); - i++; - } - printf("x - Exit wizzard.\n"); - printf("\n(a/1-%d/x)", i); - fflush(stdout); - do { - scanf("%s", input); - } while(input[0]!='a' && (input[0]<'1' || input[0]>('0'+i)) && input[0]!='x'); - if (input[0] == 'x') - return(0); - i = 0; - while(jobs[i].name) - { - if (input[0]=='a' || (input[0]-'1')==i) - { - printf("\nDoing Step %d: %s\n", i+1, jobs[i].name); - ret = jobs[i].check(); - if (ret) - printf("It is required to continue with this step. Dou you want to continue? (y/n)"); - else - printf("It is not required to continue with this step. Still want to continue? (y/n)"); - fflush(stdout); - do { - scanf("%s", input); - } while(input[0] != 'y' && input[0] != 'n'); - if (input[0] == 'n') - i++; - continue; - } - ret = jobs[i].install(); - if (ret) - { - printf("Failed to install step: %s\n", jobs[i].name); - printf("%s\n", ret); - printf("Do you like to retry? (y/n)"); - fflush(stdout); - do { - scanf("%s", input); - } while(input[0] != 'y' && input[0] != 'n'); - if (input[0] == 'y') - continue; - } - break; - } - i++; - } - goto again; -} - - -- 2.13.6