Unite the acked/nacked handling in a common response...
This commit is contained in:
parent
24893de3cb
commit
88ea832ed7
|
@ -150,8 +150,7 @@ struct gsm_network {
|
|||
|
||||
void (*update_request_accepted)(struct gsm_bts *, u_int32_t);
|
||||
void (*channel_allocated)(struct gsm_lchan *bts, enum gsm_chreq_reason_t);
|
||||
void (*channel_acked)(struct gsm_lchan *);
|
||||
void (*channel_nacked)(struct gsm_lchan *);
|
||||
void (*channel_response)(struct gsm_lchan *, int acked);
|
||||
};
|
||||
|
||||
struct gsm_network *gsm_network_init(unsigned int num_bts, u_int16_t country_code,
|
||||
|
|
|
@ -468,8 +468,8 @@ static int rsl_rx_chan_act_ack(struct msgb *msg)
|
|||
|
||||
lchan = lchan_lookup(msg->trx, rslh->chan_nr);
|
||||
network = msg->trx->bts->network;
|
||||
if (network->channel_acked)
|
||||
(*network->channel_acked)(lchan);
|
||||
if (network->channel_response)
|
||||
(*network->channel_response)(lchan, 1);
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -491,8 +491,8 @@ static int rsl_rx_chan_act_nack(struct msgb *msg)
|
|||
|
||||
lchan = lchan_lookup(msg->trx, rslh->chan_nr);
|
||||
network = msg->trx->bts->network;
|
||||
if (network->channel_nacked)
|
||||
(*network->channel_nacked)(lchan);
|
||||
if (network->channel_response)
|
||||
(*network->channel_response)(lchan, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ static const char *database_name = "hlr.sqlite3";
|
|||
static void bsc_hack_update_request_accepted(struct gsm_bts *bts, u_int32_t assigned_tmi);
|
||||
static void bsc_hack_channel_allocated(struct gsm_lchan *chan,
|
||||
enum gsm_chreq_reason_t reason);
|
||||
static void bsc_hack_channel_acked(struct gsm_lchan *chan);
|
||||
static void bsc_hack_channel_nacked(struct gsm_lchan *chan);
|
||||
static void bsc_hack_channel_response(struct gsm_lchan *chan, int acked);
|
||||
|
||||
|
||||
/* The following definitions are for OM and NM packets that we cannot yet
|
||||
|
@ -645,8 +644,7 @@ static int bootstrap_network(void)
|
|||
bts->trx[0].arfcn = HARDCODED_ARFCN;
|
||||
gsmnet->update_request_accepted = bsc_hack_update_request_accepted;
|
||||
gsmnet->channel_allocated = bsc_hack_channel_allocated;
|
||||
gsmnet->channel_acked = bsc_hack_channel_acked;
|
||||
gsmnet->channel_nacked = bsc_hack_channel_nacked;
|
||||
gsmnet->channel_response = bsc_hack_channel_response;
|
||||
|
||||
if (mi_setup(bts, 0, mi_cb) < 0)
|
||||
return -EIO;
|
||||
|
@ -840,7 +838,7 @@ static void bsc_hack_channel_allocated(struct gsm_lchan *chan,
|
|||
del_timer(&pag_timer);
|
||||
}
|
||||
|
||||
static void bsc_hack_channel_acked(struct gsm_lchan *lchan)
|
||||
static void bsc_hack_channel_response(struct gsm_lchan *lchan, int ack)
|
||||
{
|
||||
struct pending_registered_station *station;
|
||||
if (llist_empty(&pending_stations)) {
|
||||
|
@ -856,37 +854,20 @@ static void bsc_hack_channel_acked(struct gsm_lchan *lchan)
|
|||
return;
|
||||
}
|
||||
|
||||
DEBUGP(DPAG, "We have probably paged a channel for tmsi: %u on %d\n",
|
||||
station->tmsi, lchan->nr);
|
||||
if (ack) {
|
||||
DEBUGP(DPAG, "We have probably paged a channel for tmsi: %u on %d\n",
|
||||
station->tmsi, lchan->nr);
|
||||
|
||||
llist_del(&station->entry);
|
||||
free(station);
|
||||
}
|
||||
|
||||
/* failed... remove from the list */
|
||||
static void bsc_hack_channel_nacked(struct gsm_lchan *lchan)
|
||||
{
|
||||
struct pending_registered_station *station;
|
||||
if (llist_empty(&pending_stations)) {
|
||||
DEBUGP(DPAG, "Channel nacked but nothing pending\n");
|
||||
return;
|
||||
llist_del(&station->entry);
|
||||
free(station);
|
||||
} else {
|
||||
/*
|
||||
* give up and go to the next channel
|
||||
*/
|
||||
llist_del(&station->entry);
|
||||
free(station);
|
||||
pag_timer_cb(0);
|
||||
}
|
||||
|
||||
station = (struct pending_registered_station*) pending_stations.next;
|
||||
if (station->tmsi != (u_int32_t)lchan->user_data) {
|
||||
DEBUGP(DPAG, "Hmmm the channel is not allocated by the"
|
||||
"station we wanted channel: %u us:%u\n",
|
||||
(u_int32_t)(lchan->user_data), station->tmsi);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* give up and go to the next channel
|
||||
*/
|
||||
llist_del(&station->entry);
|
||||
free(station);
|
||||
pag_timer_cb(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
Loading…
Reference in New Issue