* use 16bit for network and country code

* use aligned attribute for more data structures
* add command line arguments for operator/country code
This commit is contained in:
Harald Welte 2008-12-28 23:42:04 +00:00
parent bde361064a
commit b84e2f4f1b
4 changed files with 17 additions and 16 deletions

View File

@ -22,7 +22,7 @@ struct gsm48_chan_desc {
u_int8_t arfcn_low; u_int8_t arfcn_low;
} h0; } h0;
}; };
}; } __attribute__ ((packed));
/* Chapter 10.5.2.30 */ /* Chapter 10.5.2.30 */
struct gsm48_req_ref { struct gsm48_req_ref {
@ -31,7 +31,7 @@ struct gsm48_req_ref {
t1_:5; t1_:5;
u_int8_t t2:5, u_int8_t t2:5,
t3_low:3; t3_low:3;
}; } __attribute__ ((packed));
/* Chapter 9.1.18 */ /* Chapter 9.1.18 */
struct gsm48_imm_ass { struct gsm48_imm_ass {
@ -44,7 +44,7 @@ struct gsm48_imm_ass {
u_int8_t timing_advance; u_int8_t timing_advance;
u_int8_t mob_alloc_len; u_int8_t mob_alloc_len;
u_int8_t mob_alloc[0]; u_int8_t mob_alloc[0];
}; } __attribute__ ((packed));
/* Chapter 10.5.1.3 */ /* Chapter 10.5.1.3 */
struct gsm48_loc_area_id { struct gsm48_loc_area_id {

View File

@ -126,8 +126,8 @@ struct gsm_ms {
struct gsm_network { struct gsm_network {
/* global parameters */ /* global parameters */
u_int8_t country_code; u_int16_t country_code;
u_int8_t network_code; u_int16_t network_code;
unsigned int num_bts; unsigned int num_bts;
/* private lists */ /* private lists */
@ -136,8 +136,8 @@ struct gsm_network {
struct gsm_subscriber *subscriber; struct gsm_subscriber *subscriber;
}; };
struct gsm_network *gsm_network_init(unsigned int num_bts, u_int8_t country_code, struct gsm_network *gsm_network_init(unsigned int num_bts, u_int16_t country_code,
u_int8_t network_code); u_int16_t network_code);
enum gsm_e1_event { enum gsm_e1_event {
EVT_E1_NONE, EVT_E1_NONE,

View File

@ -587,20 +587,21 @@ static void patch_tables(struct gsm_bts *bts)
(struct gsm48_system_information_type_4*)&si4; (struct gsm48_system_information_type_4*)&si4;
struct gsm48_system_information_type_6 *type_6 = struct gsm48_system_information_type_6 *type_6 =
(struct gsm48_system_information_type_6*)&si6; (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 */ /* assign the MCC and MNC */
gsm0408_generate_lai(&type_3->lai, bts->network->country_code, type_3->lai = lai;
bts->network->network_code, bts->location_area_code); type_4->lai = lai;
gsm0408_generate_lai(&type_4->lai, bts->network->country_code, type_6->lai = lai;
bts->network->network_code, bts->location_area_code);
gsm0408_generate_lai(&type_6->lai, bts->network->country_code,
bts->network->network_code, bts->location_area_code);
} }
static void bootstrap_rsl(struct gsm_bts *bts) static void bootstrap_rsl(struct gsm_bts *bts)
{ {
fprintf(stdout, "bootstrapping RSL\n"); fprintf(stdout, "bootstrapping RSL MCC=%u MNC=%u\n", MCC, MNC);
patch_tables(bts); patch_tables(bts);
set_system_infos(bts); set_system_infos(bts);

View File

@ -24,8 +24,8 @@
#include <openbsc/gsm_data.h> #include <openbsc/gsm_data.h>
struct gsm_network *gsm_network_init(unsigned int num_bts, u_int8_t country_code, struct gsm_network *gsm_network_init(unsigned int num_bts, u_int16_t country_code,
u_int8_t network_code) u_int16_t network_code)
{ {
int i; int i;
struct gsm_network *net; struct gsm_network *net;