Ethereal-dev: Re: [Ethereal-dev] MPEG2 TS dissector

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Fri, 03 Dec 2004 01:59:17 -0800
Lutz Findeisen wrote:

I have written a dissector for analyzing MPEG2 Transport streams, it is able to display the TS and Section header information, the program specific information (PAT, PMT, NIT,SDT) with some descriptors, MPE (mutiprotocol encapsualtion) and
ULE (ultra lightweight encapsulation)

The patch includes some files in a "dvb_incs" directory, but Ethereal
doesn't have such a directory.  We currently put header files for
dissectors in the "epan/dissectors" directory.

It was only compiled with gcc version 3.3.3 and mvc++ version 6

The headers also have many C++-style comments - GCC handles them, and I
think MSVC++ handles them, but IBM's C compiler on AIX, for example,
doesn't handle them.  See the "portability" section of the
"doc/README.developer" document.

In fact, it appears that some headers explicitly *won't* work on
compilers other than GCC and Windows compilers, as "avpes_hdr.h" does:

#ifdef __GNUC__
#define attr_pack __attribute__((packed))
#elif defined(_WIN32)
#define attr_pack
#pragma pack(push,p,1)
#else
#error "Compiler not supported"
#endif

For Ethereal, the code has to work with more compilers than that, as
many different compilers are used, including various vendor compilers on
commercial UN*Xes.

You might want to look at *not* using structures,

Also, the patch included changes to a file named "1", which appears to
be compiler output; it includs some warnings:

../mpeg2_descriptors.c: In function `dvb_descr_assoc_tag_print':
../mpeg2_descriptors.c:696: warning: comparison is always true due to
limited range of data type

You should look at that one.

+../mpeg2_descriptors.c:700: warning: implicit declaration of function
`ntohs'
+../mpeg2_psi.c: In function `dvb_pat_prog_print':
+../mpeg2_psi.c:210: warning: implicit declaration of function `ntohs'

If you use "tvb_get_ntohs()" to fetch items, you won't get that warning.