Add an option to set the global reject cause

This will need to be moved into bsc_hack.c together with the
policy to accept/reject a UPDATING LOCATION REQUEST.
This commit is contained in:
Holger Freyther 2008-12-31 18:52:11 +00:00
parent 1bc7de50be
commit e97f7fba97
3 changed files with 16 additions and 3 deletions

View File

@ -380,7 +380,10 @@ enum gsm48_reject_value {
struct msgb;
struct gsm_bts;
/* config options controlling the behaviour of the lower leves */
void gsm0408_allow_everyone(int allow);
void gsm0408_set_reject_cause(int cause);
int gsm0408_rcvmsg(struct msgb *msg);
void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc,
u_int16_t mnc, u_int16_t lac);

View File

@ -674,6 +674,7 @@ static void print_help()
printf(" -c --country-code number (MCC) \n");
printf(" -l --database db-name The database to use\n");
printf(" -a --authorize-everyone Allow everyone into the network.\n");
printf(" -r --reject-cause number The reject cause for LOCATION UPDATING REJECT.\n");
printf(" -h --help this text\n");
}
@ -689,10 +690,11 @@ static void handle_options(int argc, char** argv)
{"country-code", 1, 0, 'c'},
{"database", 1, 0, 'l'},
{"authorize-everyone", 0, 0, 'a'},
{"reject-cause", 1, 0, 'r'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "hc:n:d:sa",
c = getopt_long(argc, argv, "hc:n:d:sar:",
long_options, &option_index);
if (c == -1)
break;
@ -720,6 +722,9 @@ static void handle_options(int argc, char** argv)
case 'a':
gsm0408_allow_everyone(1);
break;
case 'r':
gsm0408_set_reject_cause(atoi(optarg));
break;
default:
/* ignore */
break;

View File

@ -59,6 +59,12 @@ void gsm0408_allow_everyone(int everyone)
authorize_everonye = everyone;
}
static int reject_cause = 0;
void gsm0408_set_reject_cause(int cause)
{
reject_cause = cause;
}
static int authorize_subscriber(struct gsm_subscriber *subscriber)
{
if (!subscriber)
@ -360,8 +366,7 @@ static void loc_upd_rej_cb(void *data)
{
struct gsm_lchan *lchan = data;
/* 0x16 is congestion */
gsm0408_loc_upd_rej(lchan, 0x04);
gsm0408_loc_upd_rej(lchan, reject_cause);
rsl_chan_release(lchan);
}