tcpdump mailing list archives

start of modularization of tcpdump


From: Michael Richardson <mcr () sandelman ottawa on ca>
Date: Wed, 24 Mar 2004 22:26:38 -0500

-----BEGIN PGP SIGNED MESSAGE-----


Two and a half years ago, I rototiled a copy of tcpdump such that all of
the globals were in a structure that got passed around. tcpdump's
printers could be put into a library, which I called "netdissect".

I'm doing this again.

This is what I've done:
     1) moved all variables from tcpdump.c to a structure.

     2) declare a global structure

     3) declared a global pointer to this structure

     4) created a "tcpdump_printf()" function as the printer,
        which the reworked code should use.

     5) created netdissect.h, (actually used my old one)

     6) created #define's at the end of interface.h, which
        map all the globals to "gndo->ndo_X"

Old code will have an #include "interface.h", while revised code
will have just a #include "netdissect.h".

All printing functions should be modified to take:
    netdisssect_options *ndo

as their first parameter. If you have to call a new style-function
from an old-style function, then you may pass (for now) the value
"gndo".

There are revised versions of TCHECK called ND_TCHECK() which assume
the local parameter "ndo" is set up.

The code compiles, but it does not pass all tests initially.
It appears that this is because the "proto" parameter was introduced,
and the tests were not updated.

print-eap.c is the first (very simple, very stiupid) dissector with this
code.

I also fixed all the warnings that I saw.

Unless there are objections, I'm going to check this code in.
I've already committed print-eap.c and netdissect.h so you can see them.

- --
]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson,    Xelerance Corporation, Ottawa, ON    |net architect[
] mcr () xelerance com      http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys

iQCVAwUBQGJRbIqHRg3pndX9AQE8KgQAvBw27bvL5TSEGcrRb+BOyshoKs7gmhRj
hS0DZ4hvHEl+nOVWocKESZ32syGfsg8yHfCRNVRIboFGhU9nLu8xJeahxdcGFYMO
z99HYFm9Q7/wtq+d40P/5SggBuxwdJ6hqXP/SSdD7QBCZs2qZwtYtlyguzu2YS6h
mf2GiSGoyHE=
=6vsP
-----END PGP SIGNATURE-----
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: