range arfcn encoding

Holger Freyther holger at freyther.de
Fri Apr 15 17:36:25 UTC 2016

> On 15 Apr 2016, at 12:16, Max <msuraev at sysmocom.de> wrote:
> Hi.
> How to properly use range_enc_arfcns() and range_enc_range*() from
> arfcn_range_decode.h? There're not many comments around the code. From
> function signature it seems like range_enc_arfcns() will put results
> into w parameter but in system_information.c after that there's also
> call to one of range_enc_range*().
> I've tried to feed output to wireshark but it decode some unexpected
> stuff. So, if I have a sequence of ints which I'd like to run through
> range512 for example - ho do I get the output?

1st Determine which range to use
2nd filter out ARFCNs, e.g. if ARFCN 0 is included in the set or not
3rd encode according to the range 

does this already help?

        range = range_enc_determine_range(arfcns, arfcns_used, &f0);
        if (range == ARFCN_RANGE_INVALID)
                return -2;

         * Manipulate the ARFCN list according to the rules in J4 depending
         * on the selected range.
        arfcns_used = range_enc_filter_arfcns(arfcns, arfcns_used,
                                f0, &f0_included);

        memset(w, 0, sizeof(w));
        rc = range_enc_arfcns(range, arfcns, arfcns_used, w, 0);
        if (rc != 0)


	switch (range) {
	case ARFCN_RANGE_128:
		return range_enc_range128(chan_list, f0, w);
	case ARFCN_RANGE_256:

More information about the OpenBSC mailing list