aboutsummaryrefslogtreecommitdiffstats
path: root/proto.c
AgeCommit message (Collapse)AuthorFilesLines
2000-05-31Get rid of the only uses of proto_tree_add_item_old() andGilbert Ramirez1-128/+1
proto_tree_add_item_hidden_old(), and get rid of the functions as well. Also remove a static function in proto.c that is no longer used (it was used by proto_tree_add_item()). svn path=/trunk/; revision=2033
2000-05-31Add routines for adding items to a protocol tree that take arguments ofGuy Harris1-155/+676
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-19Add protection against 0-length FT_BYTES being added to proto_tree.Gilbert Ramirez1-9/+20
Convert ethertype() and dissect_null() to use tvbuff. svn path=/trunk/; revision=1979
2000-05-18Have "proto_tree_is_visible" false except when we're in the middle ofGuy Harris1-2/+2
doing something that requires that the text for protocol tree entries be generated, i.e. 1) initialize it to FALSE; 2) have every routine that sets it clear it when it's done; 3) when printing packets, set it to TRUE only if we're not just printing packet summary lines; and then get rid of settings to FALSE made unnecessary as a result of those changes. This makes sure it's not set when it doesn't have to be (which causes the protocol tree code to format the text when it doesn't have to, wasting CPU time). svn path=/trunk/; revision=1973
2000-05-11Add tvbuff class.Gilbert Ramirez1-41/+44
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-04-25Add proto_tree_add_int_format() function.Gilbert Ramirez1-2/+58
svn path=/trunk/; revision=1889
2000-04-13Change the sub-dissector handoff registration routines so that theGilbert Ramirez1-18/+1
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-11Have proto_tree_set_boolean() call proto_tree_set_uint() so thatGilbert Ramirez1-2/+2
bit shifting is handled correctly. svn path=/trunk/; revision=1829
2000-04-04Add assertions from Ben Fowler <wapdev@leedsnet.com>.Gilbert Ramirez1-2/+4
svn path=/trunk/; revision=1794
2000-04-04Make "make-reg-dotc" generate a "register_all_protocol_handoffs()"Guy Harris1-2/+8
routine, which calls all routines found in the dissector source files with names that match " proto_reg_handoff_[a-z_0-9A-Z]*". Call "register_all_protocol_handoffs()" after calling "register_all_protocols()" - "register_all_protocols()" needs to be called first, so that all protocols can register their fields, because registering a dissector as being called if field "proto.port" is equal to N requires that "proto.port" be a registered field. Give DNS a handoff registration routine, and register its dissector to be called if "udp.port" is UDP_PORT_DNS; remove the registration of DNS from "packet-udp.c", and make "dissect_dns()" static (as nobody else need know that it exists). svn path=/trunk/; revision=1788
2000-04-04Rename find_hfinfo_record() to proto_registrar_get_nth() sinceGilbert Ramirez1-23/+23
all the other public functions in proto.c start with "proto_". svn path=/trunk/; revision=1783
2000-04-03Jeff Foster's patch to support attaching a hash table to a protocolGuy Harris1-7/+20
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-14Fix some errors discovered by making GCC do format string/argumentGuy Harris1-8/+8
cross-checking, and by replacing "proto_tree_add_item_format()" by multiple routines to add items of various types. Make the arguments of "proto_tree_add_bytes_format()" and "proto_tree_add_string_format()" that specify the bytes or the string be "const" pointers, so that one can pass a "const" pointer without complaints from the compiler. Squelch a (bogus, but the compiler isn't in a position to know that) complaint about an uninitialized variable. svn path=/trunk/; revision=1716
2000-03-12Break proto_tree_add_item_format() into multiple functions:Gilbert Ramirez1-91/+545
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-07Declare "proto_item_set_text()" in such a fashion as to make GCC 2.x andGuy Harris1-5/+3
later check the format string against the arguments. svn path=/trunk/; revision=1698
2000-02-07Code changes, but not Makefile changes, for enabling plugins for Win32.Gilbert Ramirez1-11/+8
svn path=/trunk/; revision=1605
2000-01-22Add "proto_item_set_text()", which sets the "representation" field of anGuy Harris1-2/+33
existing protocol tree item. Add "proto_tree_add_notext()"; it's just like "proto_tree_add_text()", but without the text, and it sets the "representation" field to NULL; that field would be set later with "proto_item_set_text()". Those routines let you construct, for example, an interior node of the protocol tree whose text can't be determined until all the nodes under it have been dissected - it's similar to "proto_item_set_len()" in that fashion. Use that when dissecting address TLVs in the CDP dissector - create the item for an address in an "Addresses" TLV with no text, and then fill in the items under it one at a time; if we get cut off before we get to the actual address, set the text to "Truncated address", otherwise set it to a description of the address. Also, set the length of the item for the entire address TLV correctly. svn path=/trunk/; revision=1520
1999-12-05As per Nathan Leulinger's suggestion, have a stub SNMP dissector ifGuy Harris1-7/+1
there are no SNMP libraries to use in a real dissector; this means that other dissectors don't have to care if there are SNMP libraries, they can just call "dissect_snmp()" - and this also simplifies "Makefile.am" and "configure.in" a bit, as they just treat "packet-snmp.c" and "packet-snmp.h" the same way they treat other dissector source files. svn path=/trunk/; revision=1214
1999-11-21Enable IPX network name resolution by providing for an /etc/ipxnetsGilbert Ramirez1-2/+3
and a $HOME/.ethereal/ipxnets file. get_ipxnet_name() and other functions, similar to get_ether_name() and friends, have been added. svn path=/trunk/; revision=1085
1999-11-16Replace the ETT_ "enum" members, declared in "packet.h", withGuy Harris1-1/+48
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
1999-11-15Add "class" that understands IPv4 addresses and subnet masks.Gilbert Ramirez1-4/+11
We now store IPv4 addresses in host order, allowing non-equivalence comparisons. That is, display filters with lt, le, gt, and ge will work on big-endian and little-endian machines. CIDR notation is now supported for IPv4 addresses in display filters. You can test to see if an IPv4 address is on a certain subnet by using this notation. For example, to test for IPv4 packets on a Class-C network: ip.addr == 192.168.1.0/24 svn path=/trunk/; revision=1032
1999-11-11Expanded bootparams dissector to handle decoding getfile calls and replies.Nathan Neulinger1-1/+11
Added proto_registrar_get_name routine to proto.c to retrieve the name of particular proto_tree field. Added dissect_rpc_string_item to packet-rpc.c. This routine does the same thing as dissect_rpc_string, except it takes a hfindex of a proto_tree item instead of a name. It uses the p_r_get_name call to get the name, and adds the actual string content as a hidden field (so that the subtree highlights the entire data area - length, data, and padding). There is only one call to dissect_rpc_string, so I believe that this routine should replace it. svn path=/trunk/; revision=1011
1999-10-20Automatically generate a function to call the register routines for allGuy Harris1-134/+7
protocols (idea shamelessly stolen from GDB). We require that the register routines 1) be located in "packet.c" or in one of the "packet-XXX.c" files; 2) have a name of the form "proto_register_XXX"; 3) take no argument, and return no value; 4) have their names appear in the source file either at the beginning of the line, or preceded only by "void " at the beginning of the line; and we require that "packet-XXX.c" files be added to "DISSECTOR_SOURCES" in "Makefile.am". svn path=/trunk/; revision=891
1999-10-17- add lpd protocol registrationLaurent Deniel1-1/+3
- add display filters svn path=/trunk/; revision=872
1999-10-16Added FT_UINT24 (FT_INT24 was already there) to glossary output soGilbert Ramirez1-1/+4
description of fields in man page is correct. svn path=/trunk/; revision=859
1999-10-16Add the missing proto_register_bgp().Laurent Deniel1-1/+3
svn path=/trunk/; revision=853
1999-10-14Nathan Neulinger's NTP dissector.Guy Harris1-1/+3
svn path=/trunk/; revision=828
1999-10-14Nathan Neulinger's dissector for the Yahoo messenger and pagerGuy Harris1-1/+3
protocols. svn path=/trunk/; revision=824
1999-10-13Jun-ichiro itojun Hagino's code for PIM, and some fixes from him asGuy Harris1-1/+3
well. Add some more protocols to the list of value/string pairs for IP protocol types. svn path=/trunk/; revision=822
1999-10-13Use %d to sprintf FT_INT* into proto_tree instead of %u.Gilbert Ramirez1-12/+124
svn path=/trunk/; revision=820
1999-10-12Jun-ichiro itojun Hagino's changes for IPv6 extension header decodingGuy Harris1-1/+3
and RIPng decoding. svn path=/trunk/; revision=818
1999-10-12Add FT_UINT24 and FT_INT24 to a spot where they were missing.Gilbert Ramirez1-1/+3
svn path=/trunk/; revision=817
1999-10-12Fix byte-count of IPv6 addresses.Gilbert Ramirez1-2/+2
svn path=/trunk/; revision=816
1999-10-12New proto_tree header_field_info stuff. Header_field_infos now containGilbert Ramirez1-97/+373
the base for numbers to be displayed in, bitmasks for bitfields, and blurbs (which are one or two sentences describing the field). proto_tree_add*() routines now automatically handle bitfields. You tell it which header field you are adding, and just pass it the value of the entire field, and the proto_tree routines will do the masking and shifting for you. This means that bitfields are more naturally filtered via dfilter now. Added Phil Techau's support for signed integers in dfilters/proto_tree. Added the beginning of the SNA dissector. It's not complete, but I'm committing it now because it has example after example of how to use bitfields with the new header_field_info struct and proto_tree routines. It was the impetus to change how header_field_info works. svn path=/trunk/; revision=815
1999-10-12Re-implemented fix to keep display filter from reading data from outsideGilbert Ramirez1-1/+54
the packet boundary. Now the field boundary is honored. The frame boundary is ignored, but of course we put proper field lengths in the proto_tree, right? :) Implemented negative offsets in byte-strings: frame[-4:4] will read the last 4 bytes of a frame. Implemented "offset-only" byte-string comparisons, since the dfilter compiler knows the length of the byte-string you supplied. These are now legal: frame[-4] == 0.0.0.1 tr.dst[0] == 00:06:29 Implemented the use of integers if you're comparing one byte. These are legal: llc[0] == 0xaa llc[0:1] == 0xaa All these forms check against the length of the field, so these will be reported as bad to the user: eth.src[5] == 00:06:29 (goes beyond field boundary) eth.dst == 1.2.3.4.5.6.7 (too long, goes beyond field boundary) Thes is also reported as bad: eth.dst[0:3] == 1.2 (incorrect number of bytes specified) eth.dst[0:1] == eth.src[0:2] (disparate lengths) I had to add a new function, proto_registrar_get_length() in proto.c, which reports the length of a field as can be determined at registration time. There are some shift/reduce errors in the grammar that I need to get rid of. svn path=/trunk/; revision=811
1999-10-11- add handling of FT_IPv6 variablesLaurent Deniel1-1/+14
there is still some work to do in resolv.c (get_host_ipaddr6) - add display filters of this kind in packet-ipv6.c just for testing (display filtering is incomplete) svn path=/trunk/; revision=808
1999-10-08Christophe Tronche's BPDU dissector.Guy Harris1-1/+3
svn path=/trunk/; revision=790
1999-10-04Removed dummy protocol and removed bug which prevented the firstGilbert Ramirez1-4/+1
registered protocol's name from being used in a display filter. svn path=/trunk/; revision=766
1999-10-03packet-aarp.c:Laurent Deniel1-1/+4
- add display filter for AARP proto.c: - register a dummy protocol before the first one (aarp) since the first entry can not be filtered (bug ?) Gilbert, could you check this ? svn path=/trunk/; revision=762
1999-09-18Handle the missing FT_BYTES field type.Laurent Deniel1-1/+16
svn path=/trunk/; revision=687
1999-09-17Add a "BYTES_ARE_IN_FRAME()" macro, to test whether there are aGuy Harris1-1/+3
specified number of bytes of captured data in the frame at the specified offset, and a "IS_DATA_IN_FRAME()" macro, to test whether there are any bytes of captured data in the frame at the specified offset, and convert some bounds checks to use them. Add a dissector for the Internet Printing Protocol. svn path=/trunk/; revision=685
1999-09-15Changed (again) the way that the FT_BOOLEAN field type works internally.Gilbert Ramirez1-3/+3
Dissector code can add FT_BOOLEAN fields to the proto_tree and pass TRUE or FALSE values (non-zero and zero values). The display filter language, however, treats the checking for the existence of a FT_BOOLEAN field as the checking for its truth. Before this change, packet-tr.c was the only dissector using FT_BOOLEAN fields, and it only added the field to the proto_tree if the TRUE; the dissector was determining the difference between the check for existence and the check for truth. I made this change because packet-ppp.c added some FT_BOOLEAN fields and added them to the tree regardless of truth value, It's more natural just to do it this way and let the display filter code worry about whether to check for existence or truth. So that's how it works now. svn path=/trunk/; revision=679
1999-09-14Peter Torvals' Internet Cache Protocol dissector.Guy Harris1-1/+3
svn path=/trunk/; revision=677
1999-09-12Some old CPP or tools that take C code in input doLaurent Deniel1-3/+3
not like #preprocessor_macros that do not start at the first column. So write: #ifdef FOO # include <dummy1.h> # define DUMMY 1 #else # include <dummy2.h> # define DUMMY 2 #endif instead of #ifdef FOO #include <dummy1.h> #define DUMMY 1 #else #include <dummy2.h> #define DUMMY 2 #endif svn path=/trunk/; revision=668
1999-09-12Add summary-vs-detail radio buttons to the print dialog box; detailGuy Harris1-4/+23
prints the protocol tree, and summary prints the fields in the summary clist, with a header line at the beginning of the printout. Print only packets selected by the current packet filter. Just have "ARP" and "RARP" in the "Protocol" field for ARP packets; whether it's a request or a reply can be seen in the "Info" field. Add to the "Frame" section of the protocol tree the time between the current packet and the previous displayed packet, and the packet number. Have FT_RELATIVE_TIME fields be a "struct timeval", and display them as seconds and fractional seconds (we didn't have any fields of that type, and that type of time fits the delta time above). Add an FT_DOUBLE field type (although we don't yet have anything using it). svn path=/trunk/; revision=666
1999-09-11Added Guy's patch to use the pseudo header facility to pass up the AscendGerald Combs1-1/+3
metadata. Also added filter items for the session and task number. svn path=/trunk/; revision=664
1999-09-11Register cotp and clnp instead of simply osi to allowLaurent Deniel1-3/+5
display filtering on those protocols and future enhancements (other OSI protocols decoding). svn path=/trunk/; revision=662
1999-09-11Added support for PPP Multilink Protocol (MP). Modified dissect_ppp_stuffGerald Combs1-1/+3
to recognize and handle protocol field compression. svn path=/trunk/; revision=651
1999-08-30Fixed problem with not being able to filt on field values.Gilbert Ramirez1-2/+6
svn path=/trunk/; revision=610
1999-08-29Removed from the display filter/proto_tree code the assumption thatGilbert Ramirez1-50/+66
a protocol occurs only once in a packet. Because of encapsulation (IP within IP), a protocol can occur more than once. I don't have a packet trace showing such a packet, but the code should handle it now. The one thing that it cannot do, though, is differentiate the levels. It might be nice to say: ip{1}.src == 192.168.1.1 && ipx{2}.dst == 10.0.0.1 In the dfilter grammar I had left IPXNET variables out of the list of variables that could be checked for existence. Now you can check for the existence of ipx.srcnet and ipx.dstnet. Hurrah. svn path=/trunk/; revision=608