Refer to the section on configuration files for general information about configuration files.
Here is an example of configuring a target for an individual
element. This is taken from the c/sample_per/employee_partialdec
sample:
<asn1config> <module name="Employee"> <production name="PersonnelRecord"> <element name="children"> <element name="name"> <element name="givenName"> <partial-decode name="Given"/> </element> </element> </element> </production> </module> </asn1config>
Note that in the above, children
refers to an
element defined like so: children SEQUENCE OF ChildInformation
.
Observe the following rules:
The configuration of a partial decode target is
nested under a <production>
tag for the outermost type.
Use nested <element>
tags to specify the path
from the outermost type down to the targeted element(s).
If the path from the outermost type down to the
target passes through a SEQUENCE OF
or
SET OF
(such as the example does in
passing through the children
element), then:
if the SEQUENCE OF
or
SET OF
uses an identifier (e.g.
SEQUENCE OF abc Abc
), then include an
<element>
tag for the component of the
SEQUENCE OF
or SET OF
,
using the given identifier as the name (i.e.
<element name="abc">
)
otherwise, do not include an <element>
tag for the component of the SEQUENCE OF
or SET OF
When targeting an individual element, use a
<partial-decode>
tag inside the <element>
tag of that
element.
Specifying a name on a <partial-decode>
or
<partial-decode-group>
tag is optional. The name will be used
in the generated partial decode function name.
The above configuration results in generating the following partial decode function:
int asn1PPD_PersonnelRecord_Given ( OSCTXT* pctxt, OSRTDList* pvalue /* list of const char* */);
This function will decode a PersonnelRecord
and
return a list of givenName
values.
Now here is an example of configuring a target for a group of
elements. This is taken from the c/sample_per/employee_partialdec_grp
sample:
<asn1config> <module name="Employee"> <production name="PersonnelRecord"> <element name="children"> <element name="name"> <partial-decode-group name="ChildName"> <element name="givenName"/> <element name="familyName"/> </partial-decode-group> </element> </element> </production> </module> </asn1config>
In addition to the rules described above for the individual case, observe this additional rule:
When targeting a group of elements, wrap the
elements inside a <partial-decode-group>
tag. To do this, the
elements must be siblings (i.e. components of the same
SEQUENCE
or SET
).
The above configuration results in generating the following partial decode function:
int asn1PPD_PersonnelRecord_ChildName ( OSCTXT* pctxt, OSRTDList* pvalue /* list of Name* */);
This function will decode a PersonnelRecord
and
return a list of Name
values, with just the
givenName
and familyName
values populated.