Wireshark-dev: Re: [Wireshark-dev] porting wireshark

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 19 Mar 2013 10:57:17 -0700
(replying to the wireshark-dev version of this question, not the wireshark-users version; this is a wireshark-dev question, as it involves software development work with Wireshark, not a wireshark-users question)

On Mar 18, 2013, at 8:48 PM, "Ankit Kejriwal" <kejriwal.ankit@xxxxxxxxx> wrote:

> I am supposed to port tshark to a custom OS (IOS-XR) that is based on qnx..can someone please guide me as to how to go about building it?

I doubt you're going to be running your build tools on IOS XR:

	https://en.wikipedia.org/wiki/IOS_XR

as machines like a BFR:

	https://en.wikipedia.org/wiki/Cisco_CRS-1

(not to be confused with a BFG:

	http://en.wikipedia.org/wiki/BFG_(weapon)

) aren't, as far as I know, really set up as development machines.

So there are two platforms involved here - the platform on which you'll be building TShark and the platform on which you'll be running it.

I'll start by discussing the platform on which you'll be running it, as, if that platform won't actually support it, there's not much point in building it....

Fortunately, you said "TShark", so, when it comes to the platform on which you'll be running it, you don't have to worry about GUI support.

So that means that you will need to make the following work on IOS XR:

	GLib - TShark uses GLib for a lot of functions.  You will need to be able to cross-build GLib for a QNX target (and, in particular, an IOS XR target, which might impose its own requirements).  You'll probably have to run the configure script for GLib with the right options to build for IOS XR, whatever they might be - I don't know what they'd be, so you'll probably have to do a Web search for help or ask the GLib developer.

	file reading and writing:

		TShark either reads existing capture files or runs dumpcap to capture network traffic and incrementally reads the file or files that dumpcap writes, so it needs to be able to read those files.  It also needs to be able to read various configuration files.

		*IF* you plan to have TShark run dumpcap to capture traffic, or if you plan to have it read existing capture files and either write out filtered files or write out dissected output, it will need to be able to write those files.

		*IF* IOS XR has a local file system, and it's large enough to write out capture files, then I suspect it offers a POSIX-like I/O interface, as I think that's what QNX offers.  If not, you'll have to wrap *something* to make that work.

	packet capture:

		*IF* you want to use TShark to capture traffic, rather than to read captures produced by other parts of IOS XR, you'll need to get a version of libpcap that works on QNX.  I've occasionally seen references to a very old port of libpcap, but have never been able to find it.

		However, given that this is for a BFR, there might already be infrastructure for capturing (as it's not as if it's a machine with only one interface running at a rate that simple capturing can handle), so that might not be an issue.

As for the platform on which you'll be building it:

Presumably you have some form of cross-development software; you will need to determine how to make that work with autoconf or, with newer versions of Wireshark, CMake.

For autoconf, there's probably a --host= option to make that work (autoconf uses the GNU terminology, in which the platform on which you'll be building something is the "build" platform and the platform on which you'll be running something is the "host" platform; this was done because if you're doing a "Canadian Cross":

	http://en.wikipedia.org/wiki/Cross_compiler#Canadian_Cross

so that what you're building is a development tool, there's a third platform, the platform for which what you're building will produce code, and *that's* what is called the "target" platform, *not* the platform on which you'll be running whatever it is you're building).

For CMake, there's probably something similar.