Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Adding libxml2 as optional Wireshark dependency

From: Ahmad Fatoum <ahmad.fatoum@xxxxxxxxx>
Date: Wed, 5 Apr 2017 16:42:05 +0200
No, I am using libxml2 for parsing the XML (xdd.c in the linked Github repository).
Giving the user the option to toggle XSD validation would be a nice thing to have in a future version though.

On Wed, Apr 5, 2017 at 4:36 PM, Graham Bloice <graham.bloice@xxxxxxxxxxxxx> wrote:


On 5 April 2017 at 15:30, Ahmad Fatoum <ahmad@xxxxxx> wrote:
I can't comment on the Windows binary distribution issue but Pascal's suggestion of using SUSE's sounds promising. I will attempt building on Windows and comment on the Gerrit issue later today.

Ethernet POWERLINK specifies XML Device Description (XDD) as its sole format [1].

I see the format specifies an xsd, are you using LibXml2 in "validation" mode to ensure the device XML files are well-formed?


EDS (Windows .ini-like format) files are used occasionally, owing to its CANopen roots, but are much less common in usage. Commercial tools as well as openPOWERLINK generate XML files.

The revised dissector [2] also supports EDS via Glib's GKeyFile unconditionally.
On Wed, Apr 5, 2017 at 3:38 PM, Graham Bloice <graham.bloice@xxxxxxxxxxxxx> wrote:


On 5 April 2017 at 14:11, Ahmad Fatoum <ahmad@xxxxxx> wrote:

Hello everyone,

I was advised on Gerrit to post this issue here as to garner wider input.

This concerns proposed Change-Id I13c0a2f408fb5c21bad7ab3d7971e0fa8ed7d783 [1] intending to add libxml2 as optional dependency to Wireshark.

I am currently preparing to submit upstream, changes I did to the EPL v2 dissector (packet-epl.c).

A significant change is the ability to optionally read in user-supplied XML device descriptions and to extract type/description/mapping information for aiding the dissection. See this previous submission of mine to the mailing list: https://www.wireshark.org/lists/wireshark-dev/201701/msg00154.html


Seeing as there also has been interest for libxml2 support in dissectors in the past:

https://www.wireshark.org/lists/wireshark-dev/201005/msg00108.html

https://ask.wireshark.org/questions/36063/using-libxml2-in-my-own-dissector


I think, it would be a good idea to have this as optional dependency as Glib's GMarkup may be inadequate or inconvenient for parsing actual XML.


Looking forward to your feedback.

Best regards,
Ahmad Fatoum

[1] https://code.wireshark.org/review/#/c/20912/

Thanks for the post,

1.  Where will the Windows binaries come from and are these supported long term?  The  libXml2 downloads page indicates another site provides Windows binaries [1].  The binaries at that site in the 64 bit directory seem to be the most recent and are labelled as libXml2-2.9.3 [2].  The current release of libXml2 is 2.9.4 which has a number of security fixes among other bug fixes and enhancements [3] so it would appear that the Windows binaries are not being maintained.

2.  According to the diagram at [1], libXml2 depends on iconv and zlib.  We currently build our own zlib, will that be suitable for the libXml2 dependency?  What will be the source of the iconv binary (iconv-1.14 is available in the same download area as libXml2 [2])?

3. The readme.txt in the download area ([2]) has some "interesting" text:
These are experimental 64bit binaries. For completeness, 32bit binaries 
built using the same method are also included.

The libraries in these packages are made using GCC (MinGW) toolchain. It is 
presently not possible to use these libraries with any recent version of the 
Microsoft Visual C compiler because of conflicting C-runtimes. To help you 
resist the temptation, the import libraries (.LIB) are not provided at all. 
If you need these libraries in an environment which mandates the use of the 
Microsoft toolchain, you will have to build them from source yourself.
and inspection of the download shows this is true, so it appears that we'll need to rebuild to obtain the import .lib file.

4. Microsoft have a Visual Studio porting effort underway called vcpkg [4], that does include libXml2, but unfortunately is only for VS2015 or later.  If we move to VS2015 for main releases (post 2.4 release) then this may be a viable source for libXml2 and other packages we use.  It might be possible to use this to build VS2013 libXml2.

5.  Are there any manufacturers or tools that produce XML device description files for the EPL dissector such that choosing XML as the input format is the most sensible choice, or would another format be just as applicable?

[4]: https://github.com/Microsoft/vcpkg

--
Graham Bloice




--
Graham Bloice