Now you triggered my industrial automation curiosity ... now I must have a look at this ;-)
Chris Von: Mike Beckerle <mbecke...@apache.org> Datum: Freitag, 23. Mai 2025 um 15:02 An: users@daffodil.apache.org <users@daffodil.apache.org> Betreff: How to get PCAP working? A user recently asked how to get PCAP working, which is complex due to it being dependent on the ethernetIP schema. For example: PCAP uses the basicByteBinary file that is in the ethernetIP schema. Users often download daffodil, and then want some easy examples to try out, so they go to DFDLSchemas and find PCAP, which is familiar. They then set out to get it to run using the daffodil CLI. And the problem is... it's not possible to make PCAP work only via the daffodil CLI. Details and how to overcome this are below. This issue was first raised as an issue ticket on the PCAP schema project. Here's the answer to that issue on the PCAP schema project: https://github.com/DFDLSchemas/PCAP/issues/25#issuecomment-2904267949 This is a common enough situation now, both with PCAP+ethernetIP and other schemas that have inter-dependencies, that I am repeating that material here for posterity. This is about command line usage. I'd like to also have examples showing how to get PCAP working within the VSCode extension for Daffodil, but that is not provided here. To make PCAP work, one must have the ‘sbt’ build tool, as ethernetIP has a small bit of scala code in it that must be compiled. This scala code exists because IP packets have a checksum in them. The scala code is the checksum algorithm. We call PCAP an “assembly” schema, and ethernetIP a "component" schema. (These are not exclusive as some schemas are both an assembly of some components, and themselves a component in yet another schema.) What sbt does for you is take a one line specification of the dependency on ethernetIP (in PCAP's build.sbt file), and automate extracting all the needed files from it. It also compiles the scala code that is part of ethernetIP’s IPv4Checksum calculation (a Daffodil plug-in) and creates a java jar file from it that Daffodil will find on the classpath. Here’s the steps I take to get PCAP to run its unit tests. Of note, these steps do not use the daffodil CLI. They will work without you even having downloaded daffodil at all. * git clone or unzip the release of PCAP * git clone or unzip the release of ethernetIP – you need the version that is in PCAP’s build.sbt line which is 1.4.0 currently. * cd ethernetIP * sbt test – shows that ethernetIP works. This pulls down everything needed (like Daffodil itself) from the internet. * sbt package – compiles and creates jar file – this will pull in Daffodil and all its dependencies automatically * sbt publishLocal – makes jar it available as a “managed dependency” (It stores jar in a subdir of your homedir named “~/.ivy2/local” on linux which sbt knows and uses later) * cd PCAP * sbt test – shows that PCAP works (and uses ethernetIP) Now you are in a situation where you can download Daffodil and use it from the command line with PCAP. However, the DAFFODIL_CLASSPATH must be set properly to allow Daffodil to find the ethernetIP components in their jar files. Once again `sbt` helps you do this, but the specific command is complex. Hence, you really need the setDaffodilClasspath alias. For linux bash shell that’s this: alias setDaffodilClasspath='export DAFFODIL_CLASSPATH=$(sbt -batch -error "export fullClasspath")' Chat GPT tells me the windows equivalent (I did not test this) is a batch file named 'setDaffodilClasspath.bat' that does this: for /f "delims=" %i in ('sbt -batch -error "export fullClasspath"') do set DAFFODIL_CLASSPATH=%i That sets DAFFODIL_CLASSPATH so that ethernetIP’s jar file can be found by PCAP when you issue daffodil command lines. Now the daffodil CLI can be used to parse PCAP files. Mike Beckerle Apache Daffodil PMC | daffodil.apache.org<http://daffodil.apache.org/> OGF DFDL Workgroup Co-Chair | www.ogf.org/ogf/doku.php/standards/dfdl/dfdl<http://www.ogf.org/ogf/doku.php/standards/dfdl/dfdl> Owl Cyber Defense | www.owlcyberdefense.com<http://www.owlcyberdefense.com/>