aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
AgeCommit message (Collapse)AuthorFilesLines
2000-12-30understand TCP MD5 signature. Greg Hankins <gregh@twoguys.org>Jun-ichiro itojun Hagino1-1/+11
svn path=/trunk/; revision=2803
2000-12-13Add code to check the checksums of TCP segments and UDP datagrams;Guy Harris1-7/+61
replace the existing checksummer with a modified version of the BSD checksumming code. Add a flag to the "packet_info" structure to indicate that a packet is the first fragment of a fragmented datagram, so that the checksummers won't try to checksum those. (It doesn't seem to add a lot of CPU overhead, so we don't introduce a flag to disable it, yet. Further checks may be necessary to see whether the overhead is just swamped by other overheads when scanning through a capture dissecting all frames, or if it truly is negligible.) Make the Boolean preference option controlling whether to make the top-level protocol tree item for TCP display a packet summary static to the TCP dissector (it doesn't need to be accessible outside the TCP dissector). svn path=/trunk/; revision=2751
2000-12-04Add a "col_clear()" routine, to clear a column; it appears (and itGuy Harris1-40/+29
doesn't just seem to be a profiling artifact) that, at least on FreeBSD 3.4, it's significantly more efficient to clear out a column by stuffing a '\0' into the first byte of the column data than to do so by copying a null string (I guess when copying one byte, the fixed overhead of the procedure call and of "strcpy()" is significant). Have the TCP dissector set the Protocol column, and clear the Info column, before doing anything that might cause an exception to be thrown, so that if we *do* get an exception thrown, the frame at least shows up as TCP. Instead of, in the TCP dissector, constructing a string and then stuffing it into the Info column, just append to the Info column, which avoids one string copy. Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP) options, so they can use it to append to the Info column. svn path=/trunk/; revision=2744
2000-11-20next_pd and next_offset are used only if HAVE_PLUGINS is #defined.Gilbert Ramirez1-1/+3
Therefore, declare these 2 variables only if HAVE_PLUGINS is #defined. svn path=/trunk/; revision=2678
2000-11-19For each column, have both a buffer into which strings for that columnGuy Harris1-2/+2
can be put, and a pointer to the string for the column, which might or might not point to that buffer. Add a routine "col_set_str()", which sets the string for the column to the string passed to it as an argument; it should only be handed a static string (a string constant would be ideal). It doesn't do any copying, so it's faster than "col_add_str()". Make the routines that append to columns check whether the pointer to the string for the column points to the buffer for the column and, if not, copy the string for the column to the buffer for the column so that you can append to it (so you can use "col_set_str()" and then use "col_append_str()" or "col_append_fstr()"). Convert a bunch of "col_add_str()" calls that take a string constant as an argument to "col_set_str()" calls. Convert some "col_add_fstr()" calls that take a string constant as the only argument - i.e., the format string doesn't have any "%" slots into which to put strings for subsequent arguments to "col_set_str()" calls (those calls are just like "col_add_str()" calls). Replace an END_OF_FRAME reference in a tvbuffified dissector with a "tvb_length(tvb)" call. svn path=/trunk/; revision=2670
2000-11-18Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSIGuy Harris1-92/+116
ESIS dissectors. Register the IP dissector and have dissectors that call it directly (rather than through a port table) call it through a handle. Add a routine "tvb_set_reported_length()" which a dissector can use if it was handed a tvbuff that contains more data than is actually in its part of the packet - for example, handing a padded Ethernet frame to IP; the routine sets the reported length of the tvbuff (and also adjusts the actual length, as appropriate). Then use it in IP. Given that, "ethertype()" can determine how much of the Ethernet frame was actually part of an IP datagram (and can do the same for other protocols under Ethernet that use "tvb_set_reported_length()"; have it return the actual length, and have "dissect_eth()" and "dissect_vlan()" use that to mark trailer data in Ethernet II frames as well as in 802.3 frames. svn path=/trunk/; revision=2658
2000-11-05Allow a plugin to specify several underlying protocols (i.e. tcp and udp).Olivier Abad1-2/+3
The protocol constant definition in the plugin must be : DLLEXPORT const gchar protocol[] = "tcp udp"; svn path=/trunk/; revision=2567
2000-10-22When checking whether we should build the list of flag names to put inGuy Harris1-2/+2
the COL_INFO column, check COL_INFO, not COL_PROTOCOL. svn path=/trunk/; revision=2529
2000-09-21In "dissect_tcp()", compute the payload length of a TCP segment and useGuy Harris1-5/+9
that value later, rather than computing it several times. svn path=/trunk/; revision=2454
2000-09-21If I ever again have to compute the sequence number of the first byteGuy Harris1-1/+12
after a TCP segment, so I can see what stuff some other segment is ACKing, I'll go crazy. Add a "Next sequence number" field to the TCP dissection, giving exactly that (well, giving exactly that unless the TCP segment is in a fragmented IP datagram, but hopefully those are rare; when we support IP fragment reassembly, we can fix that). svn path=/trunk/; revision=2453
2000-09-14Show CWR and ECN flags in TCP. Ulrich Kiermayr <kie@thp.univie.ac.at>Gilbert Ramirez1-3/+17
svn path=/trunk/; revision=2437
2000-09-11Move format_text(), get_token_len(), and fine_line_end(), into strutil.cGilbert Ramirez1-1/+2
This keeps tvbuff.c generic; it doesn't have to pull in packet.h and all of it's included files. svn path=/trunk/; revision=2409
2000-08-13Add the "Edit:Protocols..." feature which currently only implementsLaurent Deniel1-1/+3
the following: It is now possible to enable/disable a particular protocol decoding (i.e. the protocol dissector is void or not). When a protocol is disabled, it is displayed as Data and of course, all linked sub-protocols are disabled as well. Disabling a protocol could be interesting: - in case of buggy dissectors - in case of wrong heuristics - for performance reasons - to decode the data as another protocol (TODO) Currently (if I am not wrong), all dissectors but NFS can be disabled (and dissectors that do not register protocols :-) I do not like the way the RPC sub-dissectors are disabled (in the sub-dissectors) since this could be done in the RPC dissector itself, knowing the sub-protocol hfinfo entry (this is why, I've not modified the NFS one yet). Two functions are added in proto.c : gboolean proto_is_protocol_enabled(int n); void proto_set_decoding(int n, gboolean enabled); and two MACROs which can be used in dissectors: OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree) CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree) See also the XXX in proto_dlg.c and proto.c around the new functions. svn path=/trunk/; revision=2267
2000-08-11Miscellaneous code cleaningLaurent Deniel1-11/+5
- add <stdarg.h> or <varargs.h> in snprintf.h and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes - remove the check of multiple inclusions in source (.c) code (there is a bit loss of _cpp_ performance, but I prefer the gain of code reading and maintenance; and nowadays, disk caches and VM are correctly optimized ;-). - protect all (well almost) header files against multiple inclusions - add header (i.e. GPL license) in some include files - reorganize a bit the way header files are included: First: #include <system_include_files> #include <external_package_include_files (e.g. gtk, glib etc.)> Then #include "ethereal_include_files" with the correct HAVE_XXX or NEED_XXX protections. - add some HAVE_XXX checks before including some system header files - add the same HAVE_XXX in wiretap as in ethereal Please forgive me, if I break something (I've only compiled and regression tested on Linux). svn path=/trunk/; revision=2254
2000-08-07Allow either old-style (pre-tvbuff) or new-style (tvbuffified)Guy Harris1-15/+11
dissectors to be registered as dissectors for particular ports, registered as heuristic dissectors, and registered as dissectors for conversations, and have routines to be used both by old-style and new-style dissectors to call registered dissectors. Have the code that calls those dissectors translate the arguments as necessary. (For conversation dissectors, replace "find_conversation_dissector()", which just returns a pointer to the dissector, with "old_try_conversation_dissector()" and "try_conversation_dissector()", which actually call the dissector, so that there's a single place at which we can do that translation. Also make "dissector_lookup()" static and, instead of calling it and, if it returns a non-null pointer, calling that dissector, just use "old_dissector_try_port()" or "dissector_try_port()", for the same reason.) This allows some dissectors that took old-style arguments and immediately translated them to new-style arguments to just take new-style arguments; make them do so. It also allows some new-style dissectors not to have to translate arguments before calling routines to look up and call dissectors; make them not do so. Get rid of checks for too-short frames in new-style dissectors - the tvbuff code does those checks for you. Give the routines to register old-style dissectors, and to call dissectors from old-style dissectors, names beginning with "old_", with the routines for new-style dissectors not having the "old_". Update the dissectors that use those routines appropriately. Rename "dissect_data()" to "old_dissect_data()", and "dissect_data_tvb()" to "dissect_data()". svn path=/trunk/; revision=2218
2000-07-30In TCP segments with RST and data, display the data as text, labeling itGuy Harris1-3/+24
as a cause for the RST, as per RFC 1122: 4.2.2.12 RST Segment: RFC-793 Section 3.4 A TCP SHOULD allow a received RST segment to include data. DISCUSSION It has been suggested that a RST segment could contain ASCII text that encoded and explained the cause of the RST. No standard has yet been established for such data. Thanks and a tip of the Hatlo hat to Kevin Steves of HP for mentioning this on the tcpdump-workers list (he contributed a tcpdump patch to do the same). svn path=/trunk/; revision=2178
2000-07-14Direct call to dissect_rpc() removed. This can be made much clearer withUwe Girlich1-8/+2
an heuristic dissector. svn path=/trunk/; revision=2139
2000-07-13Add an option to show/hide the TCP summary information in the protocolGilbert Ramirez1-3/+20
label in the protocol tree. svn path=/trunk/; revision=2135
2000-05-31Add routines for adding items to a protocol tree that take arguments ofGuy Harris1-14/+14
a particular type, rather than taking a varargs list, along the lines of the "proto_tree_add_XXX_format()" routines. Replace most calls to "proto_tree_add_item()" and "proto_tree_add_item_hidden()" with calls to those routines. Rename "proto_tree_add_item()" and "proto_tree_add_item_hidden()" to "proto_tree_add_item_old()" and "proto_tree_add_item_hidden_old()", and add new "proto_tree_add_item()" and "proto_tree_add_item_hidden()" routines that don't take the item to be added as an argument - instead, they fetch the argument from the packet whose tvbuff was handed to them, from the offset handed to them. svn path=/trunk/; revision=2031
2000-05-11Add tvbuff class.Gilbert Ramirez1-29/+29
Add exceptions routines. Convert proto_tree_add_*() routines to require tvbuff_t* argument. Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as the tvbuff_t* argument to proto_tree_add_*() routines. dissect_packet() creates a tvbuff_t, wraps the next dissect call in a TRY block, will print "Short Frame" on the proto_tree if a BoundsError exception is caught. The FDDI dissector is converted to use tvbuff's. svn path=/trunk/; revision=1939
2000-05-05Add routines to:Guy Harris1-18/+6
register lists of "heuristic" dissectors, which are handed a frame that may or may contain a payload for the protocol they dissect, and that return FALSE if it's not or dissect the packet and return TRUE if it is; add a dissector to such a list; go through such a list, calling each dissector until either a dissector returns TRUE, in which case the routine returns TRUE, or it runs out of entries in the list, in which case the routine returns FALSE. Have lists of heuristic dissectors for TCP and for COTP when used with the Inactive Subset of CLNP, and add the GIOP and Yahoo Messenger dissectors to the first list and the Sinec H1 dissector to the second list. Make the dissector name argument to "dissector_add()" and "dissector_delete()" a "const char *" rarther than just a "char *". Add "heur_dissector_add()", the routine to add a heuristic dissector to a list of heuristic dissectors, to the set of routines we can export to plugins through a table on platforms where dynamically-loaded code can't call stuff in the main program, and initialize the element in the table in question for "dissector_add()" (which we'd forgotten to do). svn path=/trunk/; revision=1909
2000-04-20Have the IPv6 dissector use the same dissector table as the IPv4Guy Harris1-2/+2
dissector. Don't dissect the payload of any fragmented IPv6 packet unless it's the initial fragment (that's what we do for IPv4). svn path=/trunk/; revision=1882
2000-04-17Make "decode_tcp_ports()" and "decode_udp_ports()" more closely resembleGuy Harris1-39/+38
one another, put the comments that explain what they do in front of them, and clean up the indentation. svn path=/trunk/; revision=1874
2000-04-16Register an "ip.proto" dissector table for IPv4, and have dissectors forGuy Harris1-1/+8
protocols that run inside IPv4 register themselves with it using "dissector_add()". Make various dissectors static if they can be, and get rid of any header files that no longer contain any information as a result of that change. svn path=/trunk/; revision=1870
2000-04-14Change dfilter_apply() to 4-argument function. 4th argument is not yet used,Gilbert Ramirez1-2/+2
but will be in the future, and it's easier for me to keep my local branch in sync with the source with the calls to dfilter_apply() already modified tothe 4-arg format. Add a CPP macro to ipv4.h to define ipv4_addr_ne(). Use it in dfilter.c svn path=/trunk/; revision=1854
2000-04-13Change the sub-dissector handoff registration routines so that theGilbert Ramirez1-2/+2
sub-dissector table is not stored in the header_field_info struct, but in a separate namespace. Dissector tables are now registered by name and not by field ID. For example: udp_dissector_table = register_dissector_table("udp.port"); Because of this different namespace, dissector tables can have names that are not field names. This is useful for ethertype, since multiple fields are "ethertypes". packet-ethertype.c replaces ethertype.c (the name was changed so that it would be named in the same fashion as all the filenames passed to make-reg-dotc) Although it registers no protocol or field, it registers one dissector table: ethertype_dissector_table = register_dissector_table("ethertype"); All protocols that can be called because of an ethertype field now register that fact with dissector_add() calls. In this way, one dissector_table services all ethertype fields (hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype) Furthermore, the code allows for names of protocols to exist in the etype_vals, yet a dissector for that protocol doesn't exist. The name of the dissector is printed in COL_INFO. You're welcome, Richard. :-) svn path=/trunk/; revision=1848
2000-04-12Jeff Foster's SOCKS dissector, support for associating dissectorsGuy Harris1-54/+73
with conversations and having TCP and UDP check whether a packet is part of a conversation with a dissector and, if so, using that dissector on the conversation, and "ethertype()"-style support for allowing a dissector to call a sub-dissector via the same path that the TCP and UDP dissectors use, based on port numbers supplied by that dissector. svn path=/trunk/; revision=1837
2000-04-08Move calls to "dissector_add()" out of the register routines for TCP andGuy Harris1-70/+1
UDP and into the handoff registration routines for the protocols in question. Make the dissectors for those protocols static if they're not called outside the dissector's source file. Get rid of header files if all they did was declare dissectors that are now static; remove declarations of now-static dissectors from header files that do more than just declare the dissector. svn path=/trunk/; revision=1823
2000-04-08Jeff Foster's rlogin dissector, and changes to the TCP dissector toGuy Harris1-2/+8
export the urgent pointer (as the rlogin dissector needs it). svn path=/trunk/; revision=1822
2000-04-04Add a test to check if there is at least one enabled plugin before searchingOlivier Abad1-2/+2
the plugin list. svn path=/trunk/; revision=1798
2000-04-04Make a routine that takes a dissector table, a port number, andGuy Harris1-15/+5
pd/offset/fd/tree arguments, looks up the port number in the dissector table, and: if it finds it, call the corresponding dissector routine with the pd/offset/fd/tree arguments, and return TRUE; if it doesn't find it, return FALSE. Use that in the TCP and UDP dissectors. Don't add arbitrary UDP ports for which a dissector is found in the table as ports that should be dissected as TFTP; this should only be done if we find a packet going from port XXX to the official TFTP port. Don't register TFTP in UDP's dissector table, as it has to be handled specially (i.e., we have to add the source port as a TFTP port, although we really should register the source port *and* IP address); eventually, we should move that registration to the TFTP dissector itself, at which point we can register TFTP normally. svn path=/trunk/; revision=1785
2000-04-03Fix a compile error introduced by the previous checkin, which also movedGuy Harris1-11/+12
the check for plugins after the check for ONC RPC protocols, so that we do the checks in the same order for TCP and UDP (ONC RPC first, as we expect the RPC heuristics not to get false hits, and ONC RPC protocols could well use ports that are nominally assigned to other protocols). svn path=/trunk/; revision=1780
2000-04-03Jeff Foster's patch to support attaching a hash table to a protocolGuy Harris1-81/+70
field, to allow dissectors to register their dissection routine in a particular field's hash table with a particular "port" value, and to make the TCP and UDP dissectors support that for their "port" field and to look up ports in that hash table. This replaces the hash table that the UDP dissector was using. There's still more work needed to make this useful - right now, the hash tables are attached to the protocol field in the register routines for the TCP and UDP protocols, which means that the register routines for protocols that run atop TCP and UDP can't use this unless their register routines happen to be called after those for TCP and/or UDP, and several other protocols need to attach hash tables to fields, and there's no single global field for Ethernet types so we can't even attach a hash table to such a field to allow protocols to register themselves with a particular Ethertype - but it's a start. svn path=/trunk/; revision=1779
2000-03-12Break proto_tree_add_item_format() into multiple functions:Gilbert Ramirez1-6/+6
proto_tree_add_protocol_format() proto_tree_add_uint_format() proto_tree_add_ipxnet_format() proto_tree_add_ipv4_format() proto_tree_add_ipv6_format() proto_tree_add_bytes_format() proto_tree_add_string_format() proto_tree_add_ether_format() proto_tree_add_time_format() proto_tree_add_double_format() proto_tree_add_boolean_format() If using GCC 2.x, we can check the print-format against the variable args passed in. Regardless of compiler, we can now check at run-time that the field type passed into the function corresponds to what that function expects (FT_UINT, FT_BOOLEAN, etc.) Note that proto_tree_add_protocol_format() does not require a value field, since the value of a protocol is always NULL. It's more intuitive w/o the vestigial argument. Fixed a proto_tree_add_item_format-related bug in packet-isis-hello.c Fixed a variable usage bug in packet-v120.c. (ett_* was used instead of hf_*) Checked in Guy's fix for the function declearation for proto_tree_add_text() and proto_tree_add_notext(). svn path=/trunk/; revision=1713
2000-03-12In the TCP stream following code, we don't use the time stamp field inGuy Harris1-4/+2
the stuff we write to the temporary file, so don't bother writing it. Keep track of the two sides of the TCP stream by keeping track of the source address *and* port, so that we correctly handle connections between two ports on the same machine. svn path=/trunk/; revision=1712
2000-02-28Fred Reimer's patch to put the TCP segment length in the TCP packetGuy Harris1-5/+5
summary. svn path=/trunk/; revision=1669
2000-02-15Create a header file for every packet-*.c file. Prune the packet.h file.Gilbert Ramirez1-4/+24
This change allows you to add a new packet-*.c file and not cause a recompilation of everything that #include's packet.h Add the plugin_api.[ch] files ot the plugins/Makefile.am packaging list. Add #define YY_NO_UNPUT 1 to the lex source so that the yyunput symbol is not defined, squelching a compiler complaint when compiling the generated C file. svn path=/trunk/; revision=1637
2000-01-16Get rid of the include of "util.h" that some dissectors do - it's notGuy Harris1-2/+1
necessary. svn path=/trunk/; revision=1496
2000-01-15Merge in the final code to make Ethereal run on Win32, compiledGilbert Ramirez1-4/+2
with MSVC 6.0 and 'nmake', the make tool that comes with MSVC. It compiles, links, and runs. It doesn't run correctly. There's a problem when reading files. I'm getting short reads. I'm not linking in zlib or libsnmp because it first needs to be debugged. I changed the plugin code to use gmodule instead of libltdl, but the Unix build still links ethereal against libltdl. I'll fix that tonight; sorry about leaving it in such a sad state, but I wanted to check in this code before I left work on a Friday night. Ethereal still works, but the building is less than optimal. svn path=/trunk/; revision=1479
1999-12-09Dissect port 3128 as HTTP, as per Jamie Coe's patch and Squid andGuy Harris1-25/+29
NetCache's use of it as a proxy port, and dissect port 3132 as HTTP, as per NetCache's use of it for its HTTP-based administrative UI. svn path=/trunk/; revision=1266
1999-12-09plugins support (i.e. Dynamically loadable dissectors)Olivier Abad1-2/+22
depends on dlopen() being available on the target platform svn path=/trunk/; revision=1263
1999-12-09added ldap dissector placeholder, just does request/response for now, until ↵Nathan Neulinger1-1/+5
I have a chance to figure out ASN.1 svn path=/trunk/; revision=1254
1999-12-07James Coe's patch to add SRVLOC and NCP-over-IP support.Guy Harris1-1/+9
svn path=/trunk/; revision=1234
1999-12-06added simple irc dissectorNathan Neulinger1-1/+5
svn path=/trunk/; revision=1232
1999-12-03added skeletal tacplus/xtacacs dissectorNathan Neulinger1-1/+5
svn path=/trunk/; revision=1191
1999-11-29added start of tns dissectorNathan Neulinger1-1/+5
svn path=/trunk/; revision=1155
1999-11-28Add code to colorize TCP streams.Gerald Combs1-2/+4
svn path=/trunk/; revision=1131
1999-11-26Fixed the problem causing a SIGSEGV, and fixed problems withRichard Sharpe1-2/+2
UNICODE strings in transact SMBs. Added decode of NetShareEnum transact request. Will have to clean that all up and use the decode engine when I get it done. Still more fix ups to be done, but the book is calling, and I have to write some stuff after an interview with LinuxCare. svn path=/trunk/; revision=1113
1999-11-19Added Uwe's update to RPC.Gilbert Ramirez1-2/+2
svn path=/trunk/; revision=1069
1999-11-16Replace the ETT_ "enum" members, declared in "packet.h", withGuy Harris1-17/+29
dynamically-assigned "ett_" integer values, assigned by "proto_register_subtree_array()"; this: obviates the need to update "packet.h" whenever you add a new subtree type - you only have to add a call to "proto_register_subtree_array()" to a "register" routine and an array of pointers to "ett_", if they're not already there, and add a pointer to the new "ett_" variable to the array, if they are there; would allow run-time-loaded dissectors to allocate subtree types when they're loaded. svn path=/trunk/; revision=1043