Ethereal-dev: Re: [Ethereal-dev] New dissector: IAX2 (Inter-Asterisk eXchange 2) VoIP protocol

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 26 Jan 2004 13:15:04 -0800

On Jan 26, 2004, at 2:22 AM, Alastair Maw wrote:

IAX2 is a Voice-over IP protocol, supported by the open-source PBX asterisk (www.asterisk.org). It is rapidly gaining in popularity in the low-cost VoIP sector. It would be most useful for Ethereal to include support for it.

I attach an IAX2 packet dissector, plus a patch for the makefiles to compile it, in the hope that it might be included in the next release.

It didn't compile:

	packet-iax2.c: In function `dissect_iax2':
	packet-iax2.c:438: error: dereferencing pointer to incomplete type
	packet-iax2.c:438: error: type of formal parameter 1 is incomplete
	packet-iax2.c:438: error: dereferencing pointer to incomplete type
	packet-iax2.c:155: warning: `iax_ies_type' defined but not used

I suspect "struct sockaddr_in" isn't defined; perhaps, on some OSes, one of the header files that packet-iax2.c transitive-closure-of-includes defines it, but on Mac OS X 10.3.2, I suspect none of those header files does.

That is actually a Good Thing, as there isn't necessarily a guarantee that a "struct sockaddr_in" has the exact same layout on all OSes!

How is the IAX_IE_APPARENT_ADDR item defined? I.e., what does the IAX2 protocol send over the wire? Note that "a 'struct sockaddr_in'" isn't the right answer; the protocol needs to specify, for example, that it sends over the wire:

	a 1-byte address length;
	a 1-byte address family code, with one of the following values:

		AF_INET: 	2
AF_INET6: {whatever value it uses - note that not all OSes have the same value for AF_INET6!}
		any other AF_ values it supports;

	for AF_INET and AF_INET6, a 2-byte port number, in network byte order;

for AF_INET, a 4-byte IPv4 address, in network byte order, and, for AF_INET6, a 16-byte IPv6 address;

if the item it sends over the wire looks like a 4.4BSD "struct sockaddr", or perhaps the same but with "a 2-byte address family code, in network byte order" instead of the 1-byte address length and 1-byte address family code if it looks like an old-style BSD "struct sockaddr", so that hosts with different "struct sockaddr_in" structures can interoperate. (Maybe it doesn't do IPv6, but perhaps it should....)