aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet.h
AgeCommit message (Collapse)AuthorFilesLines
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
2001-11-27Change "conversation_set_dissector()" to take a dissector handle, ratherGuy Harris1-1/+5
than a pointer to a dissector function, as an argument. This means that the conversation dissector is called through "call_dissector()", so the dissector itself doesn't have to worry about checking whether the protocol is enabled or setting "pinfo->current_proto", so get rid of the code that does that in conversation dissectors. Also, make the conversation dissectors static. Get rid of some direct calls to dissectors; replace them with calls through handles, and, again, get rid of code to check whether a protocol is enabled and set "pinfo->current_proto" where that code isn't needed. Make those dissectors static if they aren't already static. Add a routine "create_dissector_handle()" to create a dissector handle without registering it by name, if the dissector isn't used outside the module in which it's defined. svn path=/trunk/; revision=4281
2001-11-26This should be the final bit of removing the dissect_data symbolEd Warnicke1-4/+1
from being required by anyone other than packet-data.c. It can now be accessed with call_dissector() with the name "data". dissect_data is now also of dissect_t. svn path=/trunk/; revision=4271
2001-11-21Remove the global packet_info called "pi". Dissectors now onlyGilbert Ramirez1-3/+4
access their own "pinfo". A packet_info is stored in epan_dissect_t, which is created for the dissection of a single packet. GUI functions which need to access the packet_info of the currently selected packet used to use "pi"; now they use cfile.edt->pi. cfile's "edt" member is the epan_dissect_t of the currently-selected packet. The functionality of blank_packetinfo() was moved into dissect_packet(), as that's the only place that called blank_packetinfo(), after a spurious call to blank_packetinfo() was removed from packet_list_select_cb(). svn path=/trunk/; revision=4246
2001-11-20Make the capture routines take an additional argument giving the amountGuy Harris1-8/+6
of packet data captured. Make the "BYTES_ARE_IN_FRAME()" macro take a "captured length of the packet" argument. Add some length checks to capture routines. svn path=/trunk/; revision=4235
2001-11-20"END_OF_FRAME" and "IS_DATA_IN_FRAME()" are no longer used; get rid ofGuy Harris1-13/+5
them. svn path=/trunk/; revision=4234
2001-10-31Put "extern" in front of a pile of function declarations.Guy Harris1-36/+47
It makes no difference if they really are function declarations; however, in plugins, when building on OSes that don't let dynamically-loaded modules access functions in the main program (e.g., Windows), when compiling a plugin, <plugin_api.h> defines the names of those functions as (*pointer_name), so they turn into declarations of pointer variables pointing to the functions in question, and, on platforms with a def/ref model in the linker, if a plugin has more than one source file that gets linked into the plugin, the linker may get upset at two definitions of the same variable. svn path=/trunk/; revision=4114
2001-10-31Get rid of a bunch of stuff that was there to support non-tvbuffifiedGuy Harris1-9/+6
dissectors and that's no longer needed. svn path=/trunk/; revision=4112
2001-06-29Create a routine to do the tvbuff-length-adjusting andGuy Harris1-1/+9
"pinfo->{len,captured_len}"-adjusting currently done by the IP dissector, make the IP dissector call that rather than doing the work itself, make the IPv6 dissector call that rather than just adjusting the tvbuff length itself, and make the IPX dissector call that rather than just adjusting "pi.{len,captured_len}" itself. This cleans things up a bit, and causes trailers to be properly reported in IPX-over-Ethernet frames. svn path=/trunk/; revision=3621
2001-06-02"old_dissector_delete()" is no longer used; remove it.Guy Harris1-4/+2
Update Gerald's e-mail address. svn path=/trunk/; revision=3506
2001-05-30No old-style dissectors call "old_dissector_try_port()", so get rid ofGuy Harris1-10/+1
"old_dissector_try_port()". There are no longer any old-style heuristic or conversation dissectors, so get rid of "old_heur_dissector_add()" and "old_conv_dissector_add()" and the data-structure members that support old-style heuristic and conversation dissectors. svn path=/trunk/; revision=3478
2001-04-17Move the declaration of "etype_vals[]" from "epan/packet.h" toGuy Harris1-2/+1
"etypes.h". svn path=/trunk/; revision=3314
2001-04-17Move the declaration of "ipprotostr()" out of "epan/packet.h" into a newGuy Harris1-4/+1
"ipproto.h" header file. svn path=/trunk/; revision=3313
2001-04-01Moved the the remaining column related routines out of packet.{c,h}Ed Warnicke1-25/+2
and into column-utils{c,h}. svn path=/trunk/; revision=3231
2001-04-01Moved the packet_info structure and supporting functions out ofEd Warnicke1-70/+2
packet.{h,c} and into a separate packet_info{h,c}. svn path=/trunk/; revision=3225
2001-04-01Moved the frame_data structures and functions from packet.{h,c} toEd Warnicke1-32/+2
frame_data{h,c}. Added a frame_data_init to be called by epan_init. svn path=/trunk/; revision=3223
2001-04-01Moved the column_info structure and related enum from packet.{c,h} toEd Warnicke1-58/+2
column_info.h. svn path=/trunk/; revision=3222
2001-04-01Moved the value_string structures and function from packet.{c,h} intoEd Warnicke1-12/+2
a separate value_string.{c,h}. svn path=/trunk/; revision=3221
2001-04-01Moved various to_str files from packet.{c,h} to a separateEd Warnicke1-16/+2
to_str.{c,h}. Resolved strange situation where ipx_addr_to_str was declared in packet.h but defined in packet-ipx.c by moving ipx_addr_to_str, ipxnet_to_str_punct, and ipxnet_to_str from packet-ipx.{c,h} to to_str.{c,h} svn path=/trunk/; revision=3219
2001-03-23Changes required to support multiple named data sources.Jeff Foster1-1/+3
Tvbuffers changed to added the data source name, GUI and printing code changed to support these changes and display the multiple hex views. svn path=/trunk/; revision=3165
2001-03-15Add a new AT_OSI address type.Guy Harris1-2/+3
In the CLNP dissector, set the source and destination network-layer and "top-level" addresses; this will cause them to show up in the source and destination columns of the summary display if you're showing the network-layer or top-level address (although you'll probably have to widen those columns significantly to see the entire address), and also makes them available to subdissectors. svn path=/trunk/; revision=3131
2001-02-27Fix up the handling of NBIPX packets, and of Microsoft "direct hosting"Guy Harris1-1/+2
name-server-over-IPX and mailslot-datagram-over-IPX packets, based on stuff dredged out of a pile of documents on the Web. svn path=/trunk/; revision=3079
2001-02-01"Decode As" dialog, from David Hampton.Guy Harris1-1/+27
svn path=/trunk/; revision=2965
2001-01-18Pull the handling of trailers in Ethernet (as opposed to 802.3) framesGuy Harris1-5/+5
into "ethertype()". svn path=/trunk/; revision=2915
2001-01-13Tvbuffify the PIM dissector.Guy Harris1-3/+1
It was the last dissector that used "old_call_dissector()", and tvbuffifying it got rid of that, so get rid of "old_call_dissector()". svn path=/trunk/; revision=2892
2001-01-09Add a new "ip_to_str_buf()" routine that takes a pointer to an IPGuy Harris1-1/+2
address and a pointer to a character buffer as arguments, and puts a printable form of the IP address into the buffer. Make "ip_to_str()" use it. Make "host_name_lookup()" use "ip_to_str_buf()", not "ip_to_str()", so that it doesn't trash any strings that a dissector has gotten with "ip_to_str()" (for example, the ARP dissector gets strings for the source and target protocol addresses, and then may attempt to register names for the source and target hardware addresses with "add_ether_byip()"; if "host_name_lookup()" fails to find a host name for the IP address, it shouldn't use "ip_to_str()" to generate an IP address string to associate with the IP address, as if that's done twice it'll run out of "ip_to_str()" buffers - there're only 3 of them - and trash one of the IP address strings the ARP dissector got). svn path=/trunk/; revision=2850
2001-01-09Add an additional "protocol index" argument to "{old_}dissector_add()",Guy Harris1-8/+14
"{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/+23
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
2000-12-13Add code to check the checksums of TCP segments and UDP datagrams;Guy Harris1-2/+3
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-1/+2
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-12-03Update a comment.Guy Harris1-3/+3
svn path=/trunk/; revision=2742
2000-12-03Pull the code to set the fields in the "cfile.cinfo" structure into aGuy Harris1-1/+5
common routine to initialize a "column_info()" structure, shared by Ethereal and Tethereal. svn path=/trunk/; revision=2739
2000-11-21Senseless old prototype for rpc init removed.Uwe Girlich1-3/+1
svn path=/trunk/; revision=2686
2000-11-19For each column, have both a buffer into which strings for that columnGuy Harris1-1/+3
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-18Nobody calls "old_try_conversation_dissector()" orGuy Harris1-3/+1
"old_dissector_try_heuristic()" any more, as their users have all been tvbuffified - get rid of them. svn path=/trunk/; revision=2660
2000-11-18Put in an empty declaration of "struct dissector_handle" beforeGuy Harris1-2/+4
typedeffing "dissector_handle_t" to be a pointer to it. svn path=/trunk/; revision=2659
2000-11-18Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSIGuy Harris1-2/+2
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-16Tvbuffify the STP dissector, have it register itself and have the LLCGuy Harris1-2/+2
dissector call it through a handle, and make it static. Give "dissect_data()" an "offset" argument, so dissectors can use it to dissect part of the packet without having to cook up a new tvbuff. Go back to using "dissect_data()" to dissect the data in an IPP request. svn path=/trunk/; revision=2651
2000-11-15Add a mechanism by which a dissector can be registered by name, anotherGuy Harris1-1/+16
dissector can get a "handle" for that dissector by name and then call that dissector through the handle. This allows dissectors that can't be called through a port table or a heuristic table to be called from other dissectors without directly referring to the dissector function - dynamically-loaded modules, under Windows, cannot directly call functions in the main program, and non-plugin dissectors are in the main program and thus cannot be called from plugin dissectors unless either 1) a pointer to the dissector is put in the Big Transfer Vector or 2) some other mechanism for getting a pointer to the dissector is provided. This mechanism could also support registering old-style dissectors and calling them from new-style dissectors without the new-style dissector having to do the argument translation itself (I didn't add support for registering old-style dissectors because I'd prefer to have people tvbuffify their code if they have to register a dissector...). It could also, in the future, perhaps support disabling of protocols; setting "pinfo->current_proto"; inside "call_dissector()" - and inside "{old_}dissector_try_port()" and "{old_"dissector_try_heuristic()" - allowing a pile of stuff that currently has to be done in every dissector be done by common code. (I have some ideas about how to do this, by having "proto_register_protocol()" take an abbreviation - of the sort that would be put in, for example, "pinfo->current_proto" - as an argument; having the calls to register dissectors take an index returned by "proto_register_protocol()" as an argument. The abbreviation could be used elsewhere as well, e.g. in the "Decoding" tab of the "Edit->Protocols" dialog box, and in a GUI for constructing protocol filters. Watch this space.) Make "dissect_sdp()" the first client of this mechanism; it's now static to "packet-sdp.c", and all dissectors that call it - including the MGCP plugin - now call it through a dissector handle fetched by "find_dissector()". (Next step - see if Ethereal can now compile on Windows as a result of this.) svn path=/trunk/; revision=2647
2000-11-13Move "bytes_to_str()" to "strutil.c" from "packet.c" - it's just aGuy Harris1-2/+1
string formatter, like "format_text()", and, as "tvbuff.c" now calls it (*vide infra*), we don't want to have to make "tvbuff.c" drag "packet.h" in just to declare "bytes_to_str()". It's now declared in "strutil.h", so include it in modules that use "bytes_to_str()" and weren't already including it. Add a "tvb_bytes_to_str()" wrapper that calls "tvb_get_ptr()" to get a pointer to a chunk of N bytes at a given offset in a tvbuff and then hands that chunk to "bytes_to_str()". Convert the code that was doing that to use "tvb_bytes_to_str()" instead (which caught what I suspect is a bug in the Q.2931 dissector, where it was handing an offset of 0 to "tvb_get_ptr()" - a cut-and-pasteo, I think). Tvbuffify the ARP dissector. svn path=/trunk/; revision=2634
2000-11-01Add a fourth choice of time format in the packet list display, whichGuy Harris1-1/+2
shows the date (in YYYY-MM-DD format) as well as the time of day when the packet arrived. svn path=/trunk/; revision=2547
2000-10-06Implement epan_dissect_new() and epan_dissect_free(). These are theGilbert Ramirez1-6/+7
"top-level" dissectors that libepan-users call, instead of dissect_packet(). The epan_dissect_t holds the tvbuff after dissection so that the tvbuff's memory is not cleared until after the proto_tree is freed. (I might stuff the proto_tree into the epan_dissect_t, too). What remains of dissect_packet() in packet.c handles the tvbuff initialiation. The real meat of dissect_packet() is now in dissect_frame(), in packet-frame.c This means that "packet.c" is no longer a dissector, os it is no longer passed to make-reg-dotc. Once dissect_fddi() gets two wrapper functions (dissect_fddi_swapped() and dissect_fddi_nonswapped()), the a dissector handoff routine could be used instead of the switch statement in dissect_frame(). I'd register a field like "wtap.encap" svn path=/trunk/; revision=2478
2000-09-27Move packet.[ch] to epanGilbert Ramirez1-0/+371
svn path=/trunk/; revision=2460