Selecting the required encoding rules at command line
Go to github.com/vlm/asn1c for the latest version.
Brought to you by:
vlm
Currently asn1c generates stuff for all supported
rules. But often only one encoding rule support is
required. It'd be helpfull to select kind of rules at
command line: BER only or XER only or PER/UPER or some
of them, in order to not produce uncovered code.
Logged In: YES
user_id=104148
The asn1c only generates tables, which are used for pretty
much all the codecs. If you don't need some codec, just
remove it from the skeletons directory.
Could you give an example of what is superfluous in the
tables which asn1c generates?
Logged In: YES
user_id=1323720
Let's create a simple application that just performs BER
encode/decode for following notation:
Sample DEFINITIONS ::= BEGIN
MonitorMode ::= ENUMERATED {interrupted(0),
notifyAndContinue(1), transparent(2)}
END
ASN compile it as : ../asn1c/asn1c -fnative-types sample.asn
Link application without reference to xer_encoder.c,
xer_decoder.c modules and inspect it with nm. What nm shows:
$> nm -a a.out | grep _DEF
08063d20 D asn_DEF_INTEGER
08063d00 d asn_DEF_INTEGER_tags
08062700 D asn_DEF_MonitorMode
080626e4 d asn_DEF_MonitorMode_1_tags
080630a0 D asn_DEF_NativeEnumerated
08063080 d asn_DEF_NativeEnumerated_tags
08063120 D asn_DEF_NativeInteger
08063100 d asn_DEF_NativeInteger_tags
$> nm -a a.out | grep _xer
0805b9cc t INTEGER__xer_body_decode
0805bbf4 T INTEGER_decode_xer
0805bc2c T INTEGER_encode_xer
08052433 T MonitorMode_decode_xer
08052472 T MonitorMode_encode_xer
080533f8 T NativeEnumerated_encode_xer
080537c9 T NativeInteger_decode_xer
080538b9 T NativeInteger_encode_xer
The feature i'm requiesting is that in case the asn1c
encounters, for example, -ber option it doens't generate
<ASNTypeName>_encode_xer(), <ASNTypeName>_decode_xer()
functions and doesn't set the xer_encoder, xer_decoder
fields in type descriptors in generated files and turns off
(for ex. by using preprocessor define) such initialization
in 'skeleton' files. The xer related functions in
'skeletons' may be left as is, because of them will not be
linked into target application.
Logged In: YES
user_id=104148
Did you see what exactly the asn1c generates? If you could
just create stubs in INTEGER.c and other skeleton files (the
stubs which do nothing but return) the overall binary size
will be close to nothing, because the asn1c does not
generate much code for these _xer functions().
Check it out.
If this is "too much code" anyways, I'd certainly add the
appropriate option :)