[DFDL-WG] newVariableInstance direction property discussion - PCAP example

Mike Beckerle mbeckerle.dfdl at gmail.com
Mon Apr 12 13:26:03 EDT 2021


For our next conference call, I said I would walk through the Apache
Daffodil newVariableInstance feature, and how for unparsing we had to add a
direction property to variables so they can be evaluated with forward
referencing for unparsing.

The code I'd like to discuss is here:

https://github.com/DFDLSchemas/PCAP/blob/cb9ee66aa565d982f01130918bcd785def51b58d/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd

The defineVariable that is the best motivating example is defined at line
104, and is used at line 213. This is a simple common-subexpression
elimination, but it is used to avoid redundant calls to dfdl:valueLength in
the dfdl:outputValueCalc of the stored length field named InclLen.

There is a second example of using newVariableInstance at unparse time in
this schema also, with the variable definitions starting at line 115, and
usage in the group defined starting at line 320. This usage is far more
complex, and in hindsight I think a DFDL parse of PCAP data should not be
creating IP addresses in the Infoset that look like "1.2.3.4", because it
requires all this complexity to unparse from that back to the binary
representation. However, it is a good exercise in how the
newVariableInstance feature works.

-mikeb

Mike Beckerle | OGF DFDL Workgroup Co-Chair | Owl Cyber Defense |
www.owlcyberdefense.com
Please note: Contributions to the DFDL Workgroup's email discussions are
subject to the OGF Intellectual Property Policy
<http://www.ogf.org/About/abt_policies.php>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20210412/63f74071/attachment.html>


More information about the dfdl-wg mailing list