Cleanup some parsing in the mncc.c code

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Thu Jul 2 04:45:48 UTC 2009


Hi Holger,
On Mon, Jun 29, 2009 at 05:27:28PM +0200, Holger Freyther wrote:
 
> did you have this in mind when mentioning that the parsing of the data derived 
> informations could be driven by a struct?

yes, I had something like this in mind.  It somehow reduces the readability
of the code to those not familiar with this decoding scheme,  but well, it reduces
the number of lines quite significantly on the other side.

Also:

> +	static struct dd_parser parser[] = {
> +		DECLARE_DECODER(CAUSE, cause),
> +		DECLARE_DECODER(FACILITY, facility),
> +		DECLARE_DECODER3(USER_USER, USERUSER, useruser),
> +		DECLARE_DECODER3(SS_VERS, SSVERSION, ssversion),
> +	};
> +
> +	parse_data_derived_information(&parser[0], ARRAY_SIZE(parser), &tp, &disc);

the parser[] arrays can and should be marked as const, I believe.  Also,
maybe another step of indirection, i.e. have the dd_parser[] structure static
const but global for all IE, and then list in every function which IE's it
expects to parse.

Regards,
-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)




More information about the OpenBSC mailing list