aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/gsm_04_08_utils.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c
index 0e242b778..e95de79fa 100644
--- a/openbsc/src/gsm_04_08_utils.c
+++ b/openbsc/src/gsm_04_08_utils.c
@@ -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;
+
+ 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 < ARRAY_SIZE(chreq_type_neci0); i++) {
- const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i];
+ for (i = 0; i < length; i++) {
+ const struct chreq *chr = &chreq[i];
if ((ra & chr->mask) == chr->val)
return reason_by_chreq[chr->type];
}