aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
AgeCommit message (Collapse)AuthorFilesLines
2002-06-04Get rid of the "data_src" member of the "frame_data" structure; put itGuy Harris1-3/+2
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-05Improve a comment.Guy Harris1-6/+8
svn path=/trunk/; revision=5399
2002-05-05Make "tvb_ensure_length_remaining()" return a "guint" - it can't returnGuy Harris1-10/+18
a negative value. Use "tvb_ensure_length_remaining()" in "tcp_dissect_pdus()", rather than checking the return value of "tvb_length_remaining()" ourselves, and make various variables and parameters in it "guint" as appropriate. svn path=/trunk/; revision=5396
2002-05-05Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,Guy Harris1-1/+136
extracting PDUs from it and possibly doing reassembly. Make the COPS, DNS, DSI, Gryphon, and SCCP dissectors use it. Add "set_actual_length()", "tcp_dissect_pdus()", "decode_boolean_bitfield()", "decode_numeric_bitfield()", and "decode_enumerated_bitfield()" to the list of routines available to dissectors on platforms where routines in the main program aren't available to dynamically-loaded code. Declare routines in "to_str.h" as "extern"; as I remember, that's necessary to allow the "decode_XXX_bitfield()" routines declared therein to be made available to plugins as per the above. Note that new exported routines should be added to the end of the table if that's the only change being made to the table. Create a new "plugin_api_decls.h" header file, used to declare both the "p_" variables and the "p_" structure members in the routine-exporting mechanism; this reduces the number of places you have to change to change the list of exported routines. svn path=/trunk/; revision=5394
2002-05-04Add the packet len to the protocol tree as well, since it is often not ↵Richard Sharpe1-2/+2
visible in the summary display. svn path=/trunk/; revision=5379
2002-04-21Add a hidden length fild for TCP, tcp.len. Also fixed a small type.Richard Sharpe1-2/+13
svn path=/trunk/; revision=5210
2002-04-11Do the "follow TCP stream" stuff before calling the subdissector, soGuy Harris1-13/+14
that it gets done even if the subdissector throws an exception (and so that, if the subdissector modifies the addresses or ports, we still hand the right values to "reassemble_tcp()"). svn path=/trunk/; revision=5140
2002-03-31Mark unused arguments as such.Guy Harris1-2/+2
svn path=/trunk/; revision=5062
2002-03-27In the protocol tree entries for lists of fragments/segments, make theGuy Harris1-4/+5
top-level item correspond to the reassembled data, and make the item for each fragment/segment correspond to the part of that reassembled data that came from that fragment/segment. svn path=/trunk/; revision=5025
2002-02-24Free all the stuff pointed to by elements in the "tcp_segment_table"Guy Harris1-10/+16
hash table before freeing the memory chunks for those elements. Destroy that hash table when we're done, and set the pointer to it to null so that we'll reallocate it. svn path=/trunk/; revision=4794
2002-02-19For TCP segments that are reassembled into larger packets, show the dataGuy Harris1-4/+19
as raw TCP segment data under the TCP protocol tree item, rather than as a top-level data item - and do so even for the last of the segments reassembled into that packet. svn path=/trunk/; revision=4754
2002-02-18Add support for reassembling RPC-over-TCP fragments, and do that in bothGuy Harris1-7/+18
RPC and NDMP. Show the RPC-over-TCP fragment header as a tree with bitfields below it. Add a routine to show a reported bounds error as an "Unreassembled Packet" or a "Malformed Packet" depending on whether "pinfo->fragmented" is set, and have NBNS and RPC use that. Add "ett_ndmp_file_stats" to the list of ett_ values to be initialized (it wasn't in that list, and wasn't getting initialized). When freeing up various hash tables and memory chunks in the RPC dissector, zero out the pointers to them, just to make sure we don't try to free them again. Always destroy the TCP segment key and address memory chunks in "tcp_desegment_init()", regardless of whether TCP desegmentation is enabled - we don't *allocate* them if TCP desegmentation isn't enabled, but we should free them even if it's not enabled. Also, when we free them, set the pointers to them to null, so we don't double-free them. Supply to subdissectors called from the TCP dissector the sequence number of the first byte handed to the sub dissector. svn path=/trunk/; revision=4753
2002-02-18Don't give tvbuffs names; instead, give data sources names, where aGuy Harris1-4/+4
"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-03From Ricardo Barroetave�a: support dissectors that are handedGuy Harris1-60/+115
reassembled TCP data being able to indicate that they need still more reassembly, so that, for example, a dissector can indicate that it needs reassembly in order to dissect a header that says how long the PDU is and, when that reassembly is done and it dissects the header, it can then indicate that it needs more reassembly to get the entire PDU. svn path=/trunk/; revision=4694
2002-02-03Get rid of an extra space.Guy Harris1-2/+2
svn path=/trunk/; revision=4693
2002-01-21Include files from the "epan" directory and subdirectories thereof withGuy Harris1-4/+4
"epan/..." pathnames, so as to avoid collisions with header files in any of the directories in which we look (e.g., "proto.h", as some other package has its own "proto.h" file which it installs in the top-level include directory). Don't add "-I" flags to search "epan", as that's no longer necessary (and we want includes of "epan" headers to fail if the "epan/" is left out, so that we don't re-introduce includes lacking "epan/"). svn path=/trunk/; revision=4586
2002-01-20Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOLGuy Harris1-5/+3
items to the protocol tree; it's interpreted as "the rest of the data in the tvbuff". This can be used if 1) the item covers the entire packet or the remaining payload in the packet or 2) the item's length won't be known until it's dissected, and will be then set with "proto_item_set_len()" - if an exception is thrown in the dissection, it means the item ran *past* the end of the tvbuff, so saying it runs to the end of the tvbuff is reasonable. Convert a number of "proto_tree_add_XXX()" calls using "tvb_length_remaining()", values derived from the result of "tvb_length()", or 0 (in the case of items whose length is unknown) to use -1 instead (using 0 means that if an exception is thrown, selecting the item highlights nothing; using -1 means it highlights all the data for that item that's available). In some places where "tvb_length()" or "tvb_length_remaining()" was used to determine how large a packet is, use "tvb_reported_length()" or "tvb_reported_length_remaining()", instead - the first two calls indicate how much captured data was in the packet, the latter two calls indicate how large the packet actually was (and the fact that using the latter could cause BoundsError exceptions to be thrown is a feature - if such an exception is thrown, the frame really *was* short, and it should be tagged as such). Replace some "proto_tree_add_XXX()" calls with equivalent "proto_tree_add_item()" calls. Fix some indentation. svn path=/trunk/; revision=4578
2002-01-18Add an option to turn off TCP checksum checking (and to *allow*Guy Harris1-45/+82
desegmentation even though we don't know whether the checksum is valid). I've seen packets with bad TCP checksums in Solaris network traces, but the traffic appears to indicate that the packet *was* received; I suspect the packets were sent by the host on which the capture was being done, on a network interface to which checksumming was offloaded, so that DLPI supplied an un-checksummed packet to the capture program but a checksummed packet got put onto the wire. svn path=/trunk/; revision=4571
2002-01-17Mark un-reassembled TCP segments as (possibly) being un-reassembled, byGuy Harris1-2/+10
setting the "pinfo->fragmented" flag. If a ReportedBoundsError occurs, flag the frame as being an unreassembled packet, not an unreassembled fragmented packet, as it may have been segmented across TCP segment boundaries rather than being part of an IPv4/IPv6/CLNP/etc. fragmented/segmented packet. svn path=/trunk/; revision=4558
2002-01-10As per a comment from Ronnie Sahlberg, display TCP sequence numbers inGuy Harris1-4/+4
the list of segments in a desegmented PDU as unsigned, rather than signed. Fix some other displays of unsigned quantities with "%d" while we're at it. svn path=/trunk/; revision=4516
2001-12-10Move the pointer to the "column_info" structure in the "frame_data"Guy Harris1-38/+38
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/+3
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-05Support for reassembly of DCERPC over SMB, from Ronnie Sahlberg.Guy Harris1-1/+4
svn path=/trunk/; revision=4335
2001-12-03Get rid of the lists of conversation dissectors; instead, have aGuy Harris1-3/+1
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-03Make "dissector_add()", "dissector_delete()", and "dissector_change()"Guy Harris1-2/+5
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
2001-11-29Update from Ronnie Sahlberg:Guy Harris1-3/+3
1. Changes how can_desegment works so that can_desegment is only != 0 for whichever dissector is running immediately on top of whoever offers the can_desegment service. Thus DCERPC needs no special handling to see if it can trust can_desegment (which is currently only available ontop of TCP and not ontop of tcp->nbss->smb). 2. Changes fragment reassembly of transaction smb to only show the defragmented packet for the transaction smb holding the first fragment. To see why, test it with a transaction SMB containing a ~60kb PDU or larger. The old behaviour had approximately quadratic behaviour regarding runtime for dissecting such PDUs. (example: NetShareEnum is a command which can grow really really large if the number of shares and comments are large) svn path=/trunk/; revision=4296
2001-11-26Moved from using dissect_data() to using call_dissector()Ed Warnicke1-3/+5
svn path=/trunk/; revision=4269
2001-11-21If we have to worry about subdissectors changing the "packet_info"Guy Harris1-16/+1
structure, we may have to worry about it in more places than the places that *used* to set "pi.len" and "pi.captured_len", so there's no point in just saving and restoring it there. We'll remove those saves/restores, and worry about saves and restores when we find a problem. svn path=/trunk/; revision=4245
2001-11-20Get rid of the "len" and "captured_len" members of the "packet_info"Guy Harris1-5/+5
structure; they're no longer used. svn path=/trunk/; revision=4236
2001-11-15Get rid of NullTVB, the "compat_top_tvb" member of the "packet_info"Guy Harris1-2/+1
structure, the check for a null tvbuff pointer in "alloc_field_info()", and the "tvb_create_from_top()" macro; they're no longer needed, as there's no non-tvbuffified dissector code remaining. svn path=/trunk/; revision=4205
2001-11-03Rename the "private" member of the "packet_info" structure toGuy Harris1-3/+3
"private_data", to keep C++ compilers from getting heartburn. svn path=/trunk/; revision=4130
2001-10-30Fix to desegmentation crash, from Ronnie Sahlberg.Guy Harris1-7/+14
svn path=/trunk/; revision=4111
2001-10-01Have a flag in the "packet_info" structure, which indicates whether theGuy Harris1-109/+133
stuff currently being dissected is part of a packet included in an error packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not bother doing reassembly if the TCP segment is part of an error packet, rather than an actual TCP transmission; other dissectors might want to treat those packets specially as well. Add to the "tcpinfo" structure a flag indicating whether the URG flag was set, rather than having the zero or non-zero value of the urgent pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent pointer value isn't useful, as it means "the stuff before this segment is urgent", but it's certainly possible to put onto the wire a TCP segment with URG set and a zero urgent pointer.) Don't dissect the TCP header by grabbing the entire header with "tvb_memcpy()" and then pulling stuff out of it - extract stuff with individual tvbuff calls, and put stuff into the protocol tree and the Info column as we extract it, so that we can dissect a partial header. This lets us, for example, get the source and destination ports from the TCP header of the part of a TCP segment included in a minimum-length ICMPv4 error packet. svn path=/trunk/; revision=3986
2001-09-30The length of an NBSS message can be bigger than 64K, so make theGuy Harris1-13/+28
variable that holds it an "int" rather than a "guint16". Further strengthen the heuristics the NBSS dissector uses to distinguish NBSS messages from continuations of NBSS messages. If an frame contains an NBSS continuation, put the protocol tree item for the continuation data under an NBSS protocol tree item. Have the TCP dissector supply information to subdissectors via a "struct tcpinfo" pointed to by "pinfo->private"; move the urgent pointer value from a global variable into that structure, and add a Boolean flag that indicates whether the data it's handing to a subdissector is reassembled data or not. Make the NBSS dissector check for continuations only in non-reassembled data. Fix the computation, in the TCP dissector, of the offset into the tvbuff handed to the subdissector of the first byte of stuff that needs further reassembly, and fix the computation of the sequence number corresponding to that byte. svn path=/trunk/; revision=3984
2001-09-28Fix indentation.Guy Harris1-11/+11
svn path=/trunk/; revision=3970
2001-09-27Use the right #define for the length of the CC.NEW TCP option.Guy Harris1-2/+2
svn path=/trunk/; revision=3958
2001-09-13TCP desegmentation support, and changes to the ONC RPC and NBSSGuy Harris1-35/+472
dissectors to use it, from Ronnie Sahlberg, with additional changes to handle the case where a frame contains messages that don't run past the end followed by one that does and where a reassembled chunk has, at the end, a message that runs past the end of that chunk (because the reassembly was for an earlier message). svn path=/trunk/; revision=3923
2001-09-03Get rid of a no-longer-used #define.Guy Harris1-5/+1
svn path=/trunk/; revision=3902
2001-06-18From Joerg Mayer: explicitly fill in all members of aGuy Harris1-21/+21
"header_field_info" structure, including the ones that are later set by the routines to register fields. svn path=/trunk/; revision=3561
2001-06-14Check for a bogus TCP header length, and don't try to do dissection ifGuy Harris1-3/+24
it's bogus. svn path=/trunk/; revision=3542
2001-06-08There's no need to include "globals.h" - don't include it.Guy Harris1-3/+1
svn path=/trunk/; revision=3529
2001-04-23Move the declarations of IP protocol numbers to "ipproto.h" fromGuy Harris1-2/+3
"packet-ip.h". Fix Gerald's address in some files while we're at it. svn path=/trunk/; revision=3366
2001-03-28Use "proto_tree_add_boolean_hidden()", notGuy Harris1-2/+2
"proto_tree_add_item_hidden()", to add the "checksum bad" flags to packets; the value should be "TRUE", not the numerical value of the checksum field. svn path=/trunk/; revision=3202
2001-02-28Add hidden fields for bad checksums to various IP-family protocols.Guy Harris1-1/+8
Initialize the "hf_" value for "icmp.checksum_bad" to -1, the way all other "hf_" values are initialized, and declare it and "ip.checksum_bad" to have base BASE_NONE, not 4. svn path=/trunk/; revision=3087
2001-01-28Get rid of support for old-style plugins (support for old-style pluginsGuy Harris1-26/+2
requires that the dfilter code be initialized before the plugins are added; this required us to *re*-initialize the dfilter code after reading in all the plugins, as the plugins may themselves have added new filterable fields - that was a bit of a mess), and make the "Tools->Plugins" dialog box show the new-style plugins. svn path=/trunk/; revision=2950
2001-01-22Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="Guy Harris1-5/+1
statements. Move the setting of the Protocol column in various dissectors before anything is fetched from the packet, and also clear the Info column at that point in those and some other dissectors, so that if an exception is thrown, the columns don't reflect the previous protocol. Make the IP dissector static, as it's called only via dissector tables or dissector handles. Also make the "dissect the TOS field as the DiffServ DS field" flag static, as it's not referred to outside of "packet-ip.c". In the NCP dissector, refer to the port type through "pinfo" rather than through the global "pi", as it's a tvbuffified dissector. svn path=/trunk/; revision=2929
2001-01-09Add an additional "protocol index" argument to "{old_}dissector_add()",Guy Harris1-2/+2
"{old_}heur_dissector_add()", "{old_}conv_dissector_add()", and "register_dissector()", so that an entry in those tables has associated with it the protocol index of the protocol the dissector handles (or -1, if there is no protocol index for it). This is for future use in a number of places. (Arguably, "proto_register_protocol()" should take a dissector pointer as an argument, but 1) it'd have to handle both regular and heuristic dissectors; 2) making it take either a "dissector_t" or a union of that and a "heur_dissector_t" introduces some painful header-file interdependencies so I'm punting on that for now. As with other Ethereal internal APIs, these APIs are subject to change in the future, at least until Ethereal 1.0 comes out....) svn path=/trunk/; revision=2849
2001-01-09Add tables of "conversation" dissectors, which are associated withGuy Harris1-1/+3
particular protocols, and which keep track of all dissectors that could be associated with conversations using those particular protocols - for example, the RTP and RTCP dissectors could be assigned to UDP conversations. This is for future use with UI features allowing the dissector for a given conversation to be set from the UI, to allow 1) conversations between two ports, both of which have dissectors associated with them, that have been given to the wrong dissector to be given to the right dissector; 2) conversations between two ports, neither of which have dissectors associated with them, to be given to a dissector (RTP and RTCP, for example, typically run on random ports, and if you don't have, in a capture, traffic that would say "OK, traffic between these two hosts and ports will be RTP traffic", you may have to tell Ethereal explicitly what protocol the conversation is). svn path=/trunk/; revision=2848
2001-01-03Add a new "prefs_register_protocol()" routine, which is likeGuy Harris1-2/+2
"prefs_register_module()" except that it takes a protocol index as returned by "proto_register_protocol()" as its first argument, rather than taking two character strings as arguments as its first two arguments, and uses the protocol's abbreviation as the name to use for preferences in the preferences file and the "-o" flag and uses the protocol's short name as the name to use in the tabs in the "Edit->Preferences" window. svn path=/trunk/; revision=2812
2001-01-03Have "proto_register_protocol()" build a list of data structures forGuy Harris1-2/+3
protocols, in addition to adding structures to the list of filterable fields. Give it an extra argument that specifies a "short name" for the protocol, for use in such places as pinfo->current_proto; the dialog box for constructing filters; the preferences tab for the protocol; and so on (although we're not yet using it in all those places). Make the preference name that appears in the preferences file and the command line for the DIAMETER protocol "diameter", not "Diameter"; the convention is that the name in question be all-lower-case. Make some routines and variables that aren't exported static. Update a comment in the ICP dissector to make it clear that the dissector won't see fragments other than the first fragment of a fragmented datagram. svn path=/trunk/; revision=2810