mirror of
https://gerrit.osmocom.org/osmo-gbproxy
synced 2024-08-18 17:06:31 +00:00
[neci] Use the correct length when going over the array
Use the correct length when going over the array instead of using the neci0 values. Remove the fixme from the method as well as the issue has been addressed by adding a parameter to the method.
This commit is contained in:
parent
353e9b6429
commit
29fabfba1a
1 changed files with 25 additions and 6 deletions
|
@ -305,10 +305,20 @@ static const enum gsm_chreq_reason_t reason_by_chreq[] = {
|
|||
enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci)
|
||||
{
|
||||
int i;
|
||||
/* FIXME: determine if we set NECI = 0 in the BTS SI4 */
|
||||
int length;
|
||||
const struct chreq *chreq;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(chreq_type_neci0); i++) {
|
||||
const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i];
|
||||
if (neci) {
|
||||
chreq = chreq_type_neci1;
|
||||
length = ARRAY_SIZE(chreq_type_neci1);
|
||||
} else {
|
||||
chreq = chreq_type_neci0;
|
||||
length = ARRAY_SIZE(chreq_type_neci0);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
const struct chreq *chr = &chreq[i];
|
||||
if ((ra & chr->mask) == chr->val)
|
||||
return ctype_by_chreq[chr->type];
|
||||
}
|
||||
|
@ -319,10 +329,19 @@ enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci)
|
|||
enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci)
|
||||
{
|
||||
int i;
|
||||
/* FIXME: determine if we set NECI = 0 in the BTS SI4 */
|
||||
int length;
|
||||
const struct chreq *chreq;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(chreq_type_neci0); i++) {
|
||||
const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i];
|
||||
if (neci) {
|
||||
chreq = chreq_type_neci1;
|
||||
length = ARRAY_SIZE(chreq_type_neci1);
|
||||
} else {
|
||||
chreq = chreq_type_neci0;
|
||||
length = ARRAY_SIZE(chreq_type_neci0);
|
||||
}
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
const struct chreq *chr = &chreq[i];
|
||||
if ((ra & chr->mask) == chr->val)
|
||||
return reason_by_chreq[chr->type];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue