aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.h
AgeCommit message (Collapse)AuthorFilesLines
2007-04-23Add some GCC warnings to the standard set, and add some others to theGuy Harris1-4/+4
--enable-extra-gcc-checks set. If we turn on -pedantic, try turning on -Wno-long-long as well, so that it's not *so* pedantic that it rejects the 64-bit integral data types that we explicitly require. Constify a bunch of stuff, and make some other changes, to get rid of warnings. Clean up some indentation. svn path=/trunk/; revision=21526
2007-01-18PutGuy Harris1-0/+8
#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ ... #ifdef __cplusplus } #endif /* __cplusplus */ wrappers into some header files, for the benefit of C++ plugins. Also, add multiple-include protections. svn path=/trunk/; revision=20485
2007-01-10Extending true_false_string supportJaap Keuter1-13/+2
- Separate tfs.[ch] - Add larger sample collection - Properly export DATA svn path=/trunk/; revision=20373
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-01-24Add register_postdissector() to the API.Luis Ontanon1-0/+7
Dissectors registered with register_postdissector() will be called after all other dissectors have been called. Use it to register mate. svn path=/trunk/; revision=17089
2005-08-06Squelch more const pointer warnings.Guy Harris1-1/+1
svn path=/trunk/; revision=15242
2005-08-05More char -> const char warning fixes.Jörg Mayer1-1/+1
Removed (very few) casts that only change the warning message but don't remove it (with gcc-4). svn path=/trunk/; revision=15227
2005-07-24Constify to remove a bunch of warnings. Add some casts to squelchGuy Harris1-3/+3
(presumably-)harmless-but-otherwise-unremovable const-to-nonconst warnings. In the TACACS dissector, clean up the variables used in option parsing to avoid some const-to-nonconst warnings. Clean up some white space. svn path=/trunk/; revision=15043
2005-07-23More 'char*' -> 'const char*' changes to fix warnings.Jörg Mayer1-3/+3
svn path=/trunk/; revision=15015
2005-06-19Warning fix: Declare some more strings constJörg Mayer1-2/+2
svn path=/trunk/; revision=14700
2005-06-03From Mike Duigou:Anders Broman1-12/+31
A few doxygen updates and an improved section on writing dissectors that don't use tcp_dissect_pdus(). svn path=/trunk/; revision=14537
2005-05-11Some applications do very naughty things like reusing a port for a different ↵Ronnie Sahlberg1-1/+8
protocol during different stages of an application cycle. This is very naughty and will cause problems when we have assigned a dissector to a dynamic port using conversation_set_dissector(). To make ethereal handle this case I have changed the try_conversation_dissector() to allow it to fail and return 0, meaning yes there is indeed a protocol registered for this conversation but that protocol rejected this packet. (which only happens for "new" style dissectors, "old" style dissectors will never reject a packet that way) When this happens the decode_udp_port() helper will still allow other dissectors to be tried, in the hope that the conversation is now used for some other protocol and thus someone else might be able to decode the packet. Update SNMP and TFTP dissectors to check that even if there already is a conversation but that conversation does NOT have snmp/tftp registered as the dissector for it, then create a new conversation anyway and attach the proper dissector. Since ethereal keeps track of which frame number a conversation started in, this actually works really well. svn path=/trunk/; revision=14345
2005-03-23Add a "cleanup_dissection()" routine, intended to free up dataGuy Harris1-0/+3
structures allocated by a dissection. Currently, it's the same as "init_dissection()", but they should be split with "init_dissection()" allocating the initial data structures and "cleanup_dissection()" freeing them and *not* reallocating the initial data structures. Use "cleanup_dissection()" in "cf_close()" to make it easier to find leaks. svn path=/trunk/; revision=13881
2005-03-12warning: function declaration isn't a prototypeJörg Mayer1-1/+1
svn path=/trunk/; revision=13728
2005-03-11from Micheal Duigou: add some doxygen tags and some changes to README.developerUlf Lamping1-0/+4
svn path=/trunk/; revision=13725
2005-03-11Add a "-G decodes" option to ethereal and tethereal which shows theGerald Combs1-0/+6
filter/selector/protocol associations for each dissector. This will be used to improve our automated tests, but someone with time on their hands could probably use it to generate a protocol poster using Graphviz. svn path=/trunk/; revision=13721
2004-10-30split capture_loop from capture.c, some more code cleanupUlf Lamping1-0/+3
svn path=/trunk/; revision=12451
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. svn path=/trunk/; revision=11400
2004-06-19Pick up the stuff I did for tcpdump to figure out the right strings toGuy Harris1-1/+9
use to format 64-bit integers. Fix the RSVP dissector to use that rather than hardcoding "%ll" in. Remove the "only if G_HAVE_GINT64 is defined" bit from the discussion of 64-bit integers - we're too dependent on having them to support compilers that don't have a 64-bit integral data type. Do, however, note that neither "long" nor "long long" are acceptable, and also note that you shouldn't assume "%ll" does the trick for printing them. svn path=/trunk/; revision=11182
2004-06-08add details for doxygenUlf Lamping1-14/+37
svn path=/trunk/; revision=11127
2003-10-01Have a pseudo-header for Ethernet packets, giving the size of the FCS -Guy Harris1-2/+2
0 means "there is no FCS in the packet data", 4 means "there is an FCS in the packet data", -1 means "I don't know whether there's an FCS in the packet data, guess based on the packet size". Assume that Ethernet encapsulated inside other protocols has no FCS, by having the "eth" dissector assume that (and not check for an Ethernet pseudo-header). Have "ethertype()" take an argument giving the FCS size; pass 0 when appropriate. Fix up Wiretap routines to set the pseudo-header. This means we no longer use the "generic" seek-and-read routine, so get rid of it. svn path=/trunk/; revision=8574
2003-09-09Add "dissector_get_string_handle()" for string dissector tables, similarGuy Harris1-1/+6
to "dissector_get_port_handle()" for uint dissector tables. svn path=/trunk/; revision=8434
2003-09-07Support string dissector tables in the Tethereal "decode as" stuff.Guy Harris1-6/+6
Make the Ethereal "decode as" stuff not blow up with string dissector tables. Selectors for uint dissector tables are unsigned, not signed. svn path=/trunk/; revision=8408
2003-09-06When registering a dissector table, choose what type of hash andGuy Harris1-11/+35
comparison function to use based on the type value passed in. For the traditional unsigned integer table, require FT_UINT{8,16,24,32}; if the type is FT_STRING or FT_STRINGZ, use the string hashing functions instead. Add routines for manipulating entries and looking up dissectors in string dissector tables. svn path=/trunk/; revision=8407
2003-07-31From Tomas Kukosa: add "find_dissector_table()",Guy Harris1-5/+5
"dissector_get_port_handle()", "dissector_handle_get_short_name()", "dissector_handle_get_protocol_index()", "new_register_dissector()", and "new_create_dissector_handle()" to the list of APIs available to plugins on platforms where plugins have to call core Ethereal routines through pointers. "extern"alize the remaining routines in "epan/packet.h". svn path=/trunk/; revision=8116
2003-06-05From Lionel Ains: "-d" flag for decode-as support in Tethereal.Guy Harris1-6/+9
Add a new routine to iterate through all dissector tables, calling a routine for each table, to support having the "-d" code list all dissector tables. Get rid of "dissector_handle_get_dissector_name()"; it was put in there for "-d", but turns out not to be necessary for that. Clean up the usage message a bit (using the convention, adhered to by at least some UNIX utilities, of listing all the flags with no arguments in a single lump, and then listing the ones with arguments individually, and also putting "-v" and "-h" in a separate lump, as Ethereal does). svn path=/trunk/; revision=7788
2003-05-23Add an API to get the dissector name from a dissector handle.Guy Harris1-1/+4
svn path=/trunk/; revision=7726
2002-11-15From Chris Waters: export "find_dissector_table()" and addGuy Harris1-1/+7
"dissector_handle_get_protocol_index()". svn path=/trunk/; revision=6633
2002-11-06From Solomon Peachy: support for new "wlancap" 802.11 extra-informationGuy Harris1-2/+3
header. Add overflow checks to "BYTES_ARE_IN_FRAME()", and cast all arguments to unsigned values (negative values should never be passed) to squelch compiler warnings. svn path=/trunk/; revision=6567
2002-10-25Count ICMPv6 packets as ICMP when capturing.Guy Harris1-2/+1
Check the next header type - properly handling extension headers - in "capture_ipv6()". Get rid of the count of IPv6 packets - we break that down in "capture_ipv6()" now. Fix a typo. svn path=/trunk/; revision=6510
2002-10-22Minimalistic support for counting IPv6 packets during captureJörg Mayer1-1/+2
svn path=/trunk/; revision=6476
2002-10-14From Ulf Lamping: count ARP packets in capture progress dialog box.Guy Harris1-1/+2
svn path=/trunk/; revision=6416
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-4/+4
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6116
2002-08-21Moved the generic true_false_string saying "Set", "Not set" intoTim Potter1-1/+3
epan/packet.c It was cut and pasted into seven other dissectors! svn path=/trunk/; revision=6052
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer1-3/+3
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c and inet_ntop.c for now (can't estimate the consequences). svn path=/trunk/; revision=5928
2002-06-04Get rid of the "data_src" member of the "frame_data" structure; put itGuy Harris1-3/+4
in the "packet_info" structure instead, as we don't need a pointer for every single frame in the capture file, just for each frame for which we currently have an open "epan_dissect_t". svn path=/trunk/; revision=5614
2002-05-09Merge the work in Novell_NCP_branch into the mainline code.Gilbert Ramirez1-1/+15
A little work still needs to be done on the new NCP dissector -- make some of the COL_INFO texts more useful, handle a Unicode issue, and modify some of the cases that use "request conditions". But the NCP dissector as it stands is very usable now. Note: I didn't merge in the PROTO_LENGTH_UNTIL_END macro... I wanted to think about the various possible macros and review an email conversation I had with Guy on the subject. svn path=/trunk/; revision=5432
2002-04-28Add routines to create anonymous handles for new-style dissectors (onesGuy Harris1-1/+3
that return an "int", giving either an indication of how much data was dissected, an indication of how much more data is needed from TCP to dissect, or 0, meaning "this isn't one of my packets"). svn path=/trunk/; revision=5260
2002-02-26Allow dissectors to be registered as "old-style" or "new-style"Guy Harris1-3/+21
dissectors. "Old-style" dissectors return nothing. "New-style" dissectors return one of: a positive integer, giving the number of bytes worth of data in the tvbuff that it considered to be part of the PDU in the tvbuff; zero, if it didn't consider the data in the tvbuff to be a PDU for its protocol; a negative integer, giving the number of additional bytes worth of data in needs to get the complete PDU (for use with fragmentation/segmentation when the length of the PDU isn't known to the protocol atop the one the dissector is dissecting). Have "call_dissector()" return the return value of new-style dissectors, and the length of the tvbuff handed to it for old-style dissectors. Have "dissector_try_port()" return FALSE if the subdissector is a new-style dissector and returned 0. Make the EAP dissector a new-style dissector, and have a "EAP fragment" dissector that is also a new-style dissector and handles fragmentation of EAP messages (as happens above, for example, RADIUS). Also, clean up some signed vs. unsigned comparison problems. Reassemble EAP-Message AVPs in RADIUS. svn path=/trunk/; revision=4811
2002-02-24Get rid of "init_all_protocols()"; instead, have a routineGuy Harris1-3/+3
"init_dissection()" which calls "epan_conversation_init()", does the work that "init_all_protocols()" did, and then calls "reassemble_init()", so that the standard sequence of dissection initialization is done in one place, rather than having multiple places call the same sequence of routines. svn path=/trunk/; revision=4797
2002-02-18Don't give tvbuffs names; instead, give data sources names, where aGuy Harris1-1/+12
"data source" has a name and a top-level tvbuff, and frames can have a list of data sources associated with them. Use the tvbuff pointer to determine which data source is the data source for a given field; this means we don't have to worry about multiple data sources with the same name - the only thing the name does is label the notebook tab for the display of the data source, and label the hex dump of the data source in print/Tethereal output. Clean up a bunch of things discovered in the process of doing the above. svn path=/trunk/; revision=4749
2002-02-17With the tvbuffication of all dissectors, the "packet_info" structure noGuy Harris1-7/+4
longer contains length fields, so there's no need to pass a "packet_info *" argument to "set_actual_length()". svn path=/trunk/; revision=4748
2002-02-06Old-style (non-tvbuffified) dissectors haven't been supported sinceGuy Harris1-2/+1
0.9.0 was released; get rid of the typedef for "old_dissector_t". svn path=/trunk/; revision=4703
2002-01-05Long NCP traces can easily have many packets whose "uniqueness"Gilbert Ramirez1-1/+10
variables wrap-around. Since the request/reply packets are related via a hash based on these uniqueness variables, long NCP traces can have mis-matches reqeust/reply records. Thus, only do the hash-lookup for the reply packet during the first sequential scan of the trace file. Once the pertinent info is found, store it in the packet's private data area. Since the memory allocated for the hash and for the structures that make up the keys are no longer needed after the first sequential run through the trace file, arrange to free that memory after the first sequential run. Similar to the register_init_routine() that allows dissectors to register callbacks for calling *before* a capture file is loaded, set up a register_postseq_cleanup_routine() function that allows dissectors to register callbacks for calling *after* the first sequential run-through of the trace file is made. This is not a *final* cleanup callback, since Ethereal will still have that trace file open for random-access reading. I didn't have tethereal call postseq_cleanup_all_protocols() since tethereal doesn't keep the trace file open for random-access reading. I could easily be swayed to make tethereal call that function, however. svn path=/trunk/; revision=4484
2001-12-18Provide for per-protocol-tree data in the proto_tree code.Gilbert Ramirez1-2/+2
Put a hash-table of "interesting" fields in the per-proto-tree data. The dfilter code records which fields/protocols are "interesting" (by which I mean, their value or existence is checked). Thus, the proto_tree routines can create special arrays of field_info*'s that are ready for the dfilter engine to use during a filter operation. Also store the "proto_tree_is_visible" boolean, renamed "visible", in the per-proto-tree data. Move epan_dissect_t to its own header file to make #include dependencies easier to handle. Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t* as an argument. epan_dissect_new() needs to be followed by epan_dissect_run() for the dissection to actually take place. Between those two calls, epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to prime the empty proto_tree with the "intersesting" fields from the dfilter_t. svn path=/trunk/; revision=4422
2001-12-10Move the pointer to the "column_info" structure in the "frame_data"Guy Harris1-2/+2
structure to the "packet_info" structure; only stuff that's permanently stored with each frame should be in the "frame_data" structure, and the "column_info" structure is not guaranteed to hold the column values for that frame at all times - it was only in the "frame_data" structure so that it could be passed to dissectors, and, as all dissectors are now passed a pointer to a "packet_info" structure, it could just as well be put in the "packet_info" structure. That saves memory, by shrinking the "frame_data" structure (there's one of those per frame), and also lets us clean up the code a bit. svn path=/trunk/; revision=4370
2001-12-08Attach a descriptive name field type and base to dissector tables; thatGuy Harris1-2/+14
specifies how the selector values used as keys in those tables are to be displayed, and the title to use when displaying the table. Use that information in the code to display the initial and current entries of various dissector tables. Have the dissector for BACnet APDUs register itself by name, and have the BACnet NPDU dissector call it iff the BAC_CONTROL_NET bit isn't set, rather than doing it with a dissector table. svn path=/trunk/; revision=4358
2001-12-03Get rid of the lists of conversation dissectors; instead, have aGuy Harris1-32/+12
dissector table contain both a hash table, to use to look up port numbers to find a dissector, and a list of all dissectors that *could* be assigned to ports in that hash table, to be used by user interface code. Make the "Decode As" dialog box code use that. Also make it *not* let you choose whether to set the dissector for both the UDP and TCP versions of a port; some protocols run only atop TCP, some run only atop UDP, and even those that can run atop both may have different dissector handles to use over TCP and UDP, so handling a single merged list would be a mess. (If the user is setting the dissector for a TCP port, only those protocols that Ethereal can handle over TCP should be listed; if the user is setting the dissector for a UDP port, only those protocols that Ethereal can handle over TCP should be listed; if the user is setting a dissector for both, only those protocols that Ethereal can handle over *both* TCP *and* UDP should be listed, *and* there needs to be a way to let the "Decode As" code get both the TCP handle *and* the UDP handle and use the right ones. If somebody really wants that, they need to implement all of the above if they want the code to be correct.) Fix the code that handles setting the dissection for the IP protocol number to correctly update the lists of protocols being dissected as TCP and as UDP; the code before this change wasn't updating the single such list to add new protocols. svn path=/trunk/; revision=4311
2001-12-03Add a routine tro look for a given port in a given dissector table and,Guy Harris1-1/+6
if found, return the dissector handle for that port. Use that routine in the X.25 dissector; revert to attaching a dissector handle to an X.25 virtual circuit. svn path=/trunk/; revision=4310
2001-12-03Make "dissector_add()", "dissector_delete()", and "dissector_change()"Guy Harris1-14/+15
take a dissector handle as an argument, rather than a pointer to a dissector function and a protocol ID. Associate dissector handles with dissector table entries. svn path=/trunk/; revision=4308