aboutsummaryrefslogtreecommitdiffstats
path: root/packet-cops.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't assume the length field in a PacketCable object is sane.Guy Harris2004-05-041-1/+7
| | | | svn path=/trunk/; revision=10783
* Make some floating-point fields FT_FLOAT, rather than FT_UINT32.Guy Harris2004-04-301-11/+10
| | | | svn path=/trunk/; revision=10744
* MSVC warnings removedUlf Lamping2004-04-301-2/+3
| | | | svn path=/trunk/; revision=10738
* From Dick Gooris: add two extra PacketCable tables (and clean up someGuy Harris2004-04-251-248/+441
| | | | | | white space). svn path=/trunk/; revision=10683
* From Dick Gooris: PacketCable support in the COPS dissector.Guy Harris2004-04-151-1/+861
| | | | svn path=/trunk/; revision=10605
* Newlines don't belong in format strings for the "proto_tree_add"Guy Harris2004-02-181-3/+3
| | | | | | routines. svn path=/trunk/; revision=10094
* splitted some of the preferences texts into more than one line,Ulf Lamping2004-01-171-3/+3
| | | | | | | to reduce the size of the preferences dialog. This becoming necessary, as some of the texts were huge svn path=/trunk/; revision=9693
* The type values from Net-SNMP are u_chars; make the formal argument forGuy Harris2004-01-071-3/+3
| | | | | | them u_char. svn path=/trunk/; revision=9586
* removed some MSVC warnings (level 3)Ulf Lamping2004-01-051-2/+2
| | | | svn path=/trunk/; revision=9561
* warning: ISO C does not allow extra ; outside of a functionJörg Mayer2003-12-211-2/+2
| | | | svn path=/trunk/; revision=9387
* Make some variables that hold unsigned 16-bit quantities "guint16",Guy Harris2003-12-131-5/+5
| | | | | | which lets us get rid of some casts. svn path=/trunk/; revision=9260
* prevent MSVC warning:Ulf Lamping2003-12-111-3/+3
| | | | | | | "warning C4761: Gr��enkonflikt im Argument. Konvertierung vorgenommen" -> size conflict in argument, conversion done svn path=/trunk/; revision=9244
* variable.type is of type u_char, so use 0 instead of NULLJörg Mayer2003-10-051-4/+4
| | | | svn path=/trunk/; revision=8616
* From Kari Tiirikainen:Guy Harris2003-09-121-27/+44
| | | | | | | | | | Updated the COPS dissector to print the names of the Prefix PRIDs correctly. The last fix to PRID OID printout caused this minor problem for PPRIDs. Rename a few variables to make the code more logical to read. svn path=/trunk/; revision=8464
* From Kari Tiirikainen:Guy Harris2003-09-081-1159/+1223
| | | | | | | | | | | | | | COPS Dissector as been updated to - Optionally read ASN.1 type and enumeration information from PIBs (first converted to MIBs using guidelines in RFC 3159, Appendix A) and use that information when decoding the BER encoded COPS-PR data. By default this option is disabled. This option requires that Ethereal is compiled with NET-SNMP library. Only PRID OIDs are printed in textual format if UCD-SNMP is used. - Decode the instaceids of PRIDs correctly (the textual decoding no longer hides the InstanceId) svn path=/trunk/; revision=8414
* Don't return a success/failure value from a function if we're not goingGuy Harris2003-02-211-25/+36
| | | | | | | | | | | | | | | | | | | | | | | | to check the value, or if we always return "success". Have "dissect_cops_object()" check for a bogus object length and give up, returning an error indication, if it gets one. Also don't store the object length in a guint16, as we might round it up to a multiple of 4, and if it's 65535, it gets rounded up to 0, not 65536, if it's 16 bits long. Have "dissect_cops_pr_objects()" check for a bogus object length and give up if it gets one. Also don't store the object length in a guint16, as we might round it up to a multiple of 4, and if it's 65535, it gets rounded up to 0, not 65536, if it's 16 bits long. If "dissect_cops_object()" returns a "bogus length" indication, stop dissecting. If we've fetched a value, don't fetch it again to pass it to "proto_tree_add_uint()". If we haven't fetched the value, don't fetch it to pass it to "proto_tree_add_uint()", use "proto_tree_add_item()". svn path=/trunk/; revision=7177
* Removed trailing whitespaces from .h and .c files using theJörg Mayer2002-08-281-49/+49
| | | | | | | winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6117
* From Joerg Mayer: make a pile of stuff not used outside one source fileGuy Harris2002-05-101-2/+2
| | | | | | | | | static, and add a new "packet-data.h" to declare "proto_data". Display escape sequences in octal in the IAPP dissector, as is now done in the RADIUS dissector. svn path=/trunk/; revision=5441
* Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,Guy Harris2002-05-051-110/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Changes to display some OCTET STRING values appropriately, and to removeGuy Harris2002-04-281-169/+214
| | | | | | | | some old unused code, from Kari Tiirikainen. Clean up white space. svn path=/trunk/; revision=5262
* Give all subtrees an ett_ value.Guy Harris2002-04-051-37/+27
| | | | | | | | | | | | Clean up some case statements - instead of having most branches do "return 0", and the default branch just break, with code after the case statement handing that case and then returning 0, pull the code after the case statement into the default case, and have the other cases just break, with the "return 0" after the case statement. Initialize some ett_ values that weren't getting initialized. svn path=/trunk/; revision=5104
* The variables in question are only used if old unused code is present.Guy Harris2002-03-311-2/+2
| | | | | | Fix the #ifdef. svn path=/trunk/; revision=5064
* Get rid of an unused variable.Guy Harris2002-03-311-3/+3
| | | | | | #ifdef out definitions of variables used only if the #ifdef is true. svn path=/trunk/; revision=5057
* Get rid of unnecessary includes.Guy Harris2002-03-121-10/+1
| | | | svn path=/trunk/; revision=4931
* Get rid of the "--enable-snmp" option; instead, use "--with-ucdsnmp".Guy Harris2002-03-121-17/+2
| | | | | | | | | | | Make the directory option to "--with-ucdsnmp" optional. Handle "--with-ucdsnmp" similar to the way "--with-pcap" is handled. Get rid of unnecessary #defines in "packet-cops.c". Get rid of no-longer-necessary include of "dlfcn.h" in "packet-snmp.c". svn path=/trunk/; revision=4930
* If we're linking with the UCD SNMP library, make "format_oid()" append aGuy Harris2002-03-111-187/+22
| | | | | | | | | | | | | display of the symbolic form of the OID. Remove code that used to do that outside of "format_oid()". Export "format_oid()" from "packet-snmp.c" and use it in "packet-cops.c". Remove support for CMU SNMP and older versions of UCD SNMP from "packet-cops.c", as it has been removed from the rest of Ethereal. svn path=/trunk/; revision=4924
* From Kari Tiirikainen: use the SNMP library, if present, to print theGuy Harris2002-02-261-50/+189
| | | | | | textual names of the PIB OIDs. svn path=/trunk/; revision=4814
* Add some necessary "volatile" declarations.Guy Harris2002-02-221-2/+2
| | | | svn path=/trunk/; revision=4788
* Catch the ReportedBoundsError exception in the DNS and TPKT dissectorsGuy Harris2002-02-221-1/+13
| | | | | | | | | | | | when dissecting messages over TCP, so that an error in one message doesn't stop us from dissecting the next message in the segment, if any. Put an XXX comment before the code that constructs the tvbuff for each message inside a TCP segment, noting that we really want tvbuffs to have three lengths and to have a new type of exception thrown if you go past the second length but not past the reported length. svn path=/trunk/; revision=4782
* COPS-PR extension support, from Kari Tiirikainen.Guy Harris2002-02-221-33/+748
| | | | | | | Add support for desegmentation of COPS messages and for multiple COPS messages per TCP segment. svn path=/trunk/; revision=4781
* Added a preference to allow for setting the COPS tcp port.Ed Warnicke2002-02-221-5/+40
| | | | svn path=/trunk/; revision=4772
* Replace a bunch of "tvb_length()" and "tvb_length_remaining()" calls inGuy Harris2002-01-241-3/+3
| | | | | | | | | | | | arguments to "proto_tree_add_text()", and to "proto_tree_add_XXX()" calls that add FT_NONE or FT_PROTO items to the protocol tree, with -1. Replace some calls to "tvb_length()" or "tvb_length_remaining()" with calls to "tvb_reported_length()" and "tvb_reported_length_remaining()", as those give the actual length of the data in the packet, not just the data that happened to be captured. svn path=/trunk/; revision=4605
* Include files from the "epan" directory and subdirectories thereof withGuy Harris2002-01-211-2/+2
| | | | | | | | | | | | | "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
* Move the pointer to the "column_info" structure in the "frame_data"Guy Harris2001-12-101-7/+7
| | | | | | | | | | | | | | | 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
* Make "dissector_add()", "dissector_delete()", and "dissector_change()"Guy Harris2001-12-031-3/+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
* From Joerg Mayer: explicitly fill in all members of aGuy Harris2001-06-181-34/+34
| | | | | | | "header_field_info" structure, including the ones that are later set by the routines to register fields. svn path=/trunk/; revision=3561
* Get rid of some unnecessary includes.Guy Harris2001-04-231-2/+2
| | | | | | Fix up Gerald's e-mail address. svn path=/trunk/; revision=3371
* Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="Guy Harris2001-01-221-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Don't use col_add_fstr(..., "%s", string); Use col_add_str(..., string); as it does the same thing, but doesn't drag all the heavy *printf machinery in. Fix the DDTP dissector to set the Info column regardless of whether we're building a protocol tree or not, and to set it to "Encrypted payload" if the payload is encrypted. Also fix a typo in a field name. Register the FTP data dissector as being associated with the FTP data protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()" call checked "proto_ftp_data", and the removed "pinfo->current_proto =" line set it to "FTP-DATA", so it should be associated with "proto_ftp_data"). Make the H1 dissector check whether the frame has at least 2 bytes in it before checking the first two bytes; heuristic dissectors must not throw exceptions until they've accepted the packet as one of theirs. Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()" in some dissectors where the result of "tvb_get_ptr()" is used only in the "format_text()" call. In the Quake dissector, don't check whether there are at least 4 bytes in the packet - if we return, the packet won't be dissected at all (it's not as if some other dissector will get to handle it), and, if we don't return, we'll throw an exception if there aren't at least 4 bytes in the packet, so the packet will be marked as short or malformed, as appropriate. In the RIPng dissector, associate the table of strings for the command field with the command field, so that the dissector doesn't have to format the string for the protocol tree entry itself, and so that the filter construction dialog box can let you select "Request" or "Response" from a list rather than requiring you to know the values for "Request" and "Response". Make "dissect_rpc()" static, as it's called only through a heuristic dissector list. Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols; the string used is from a table provided by the dissector, and is a string constant. Don't format the Info column for WSP into a buffer and then format that buffer into the column with "%s" - "col_add_fstr()" can do the formatting for you, without having to allocate your own buffer (or run through the *printf machinery twice). Don't fetch fields from the WTP packet until you're ready to use them, so that you don't throw an exception before you even set the Protocol column or clear the Info column. Use "pinfo->destport", not "pi.destport", in the Zebra dissector when checking whether the packet is a request or reply, and do the check by comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that if the dissector is ever registered on another port, it still correctly determines whether the packet is a request or reply - the Network Monitor HTTP dissector has port 80 wired into its brain, which is a bit irritating if you're trying to get it to dissect HTTP proxy traffic on port 3128 or proxy administration UI traffic on port 3132). svn path=/trunk/; revision=2931
* Add an additional "protocol index" argument to "{old_}dissector_add()",Guy Harris2001-01-091-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
* Ensure that all value_string arrays end in {0, NULL}. Dissectors got awayGilbert Ramirez2001-01-031-1/+3
| | | | | | | | | | | | | | with not terminating their arrays because they knew the limits of the value used to look up strings in the value_string array, but the dfilter_expr_dlg does not know these limits and must rely on the terminating {0, NULL} record. Also, in SNA fixed a bug in which a field should have been defined as FT_UINT8 but was defined as FT_BOOLEAN. In WTP, fixed a value string which had duplicate keys. svn path=/trunk/; revision=2817
* Have "proto_register_protocol()" build a list of data structures forGuy Harris2001-01-031-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
* Get rid of extra blanks in strings.Guy Harris2000-12-271-24/+24
| | | | | | | | "tvb_length_remaining()" will return -1 if the offset argument is past the end of the tvbuff; check for values > 0, not values != 0, when checking to see if there's extra garbage at the end of the packet. svn path=/trunk/; revision=2786
* For each column, have both a buffer into which strings for that columnGuy Harris2000-11-191-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
* Complete the COPS dissector. Heikki Vatiainen <hessu@cs.tut.fi>Gilbert Ramirez2000-10-161-8/+510
| | | | svn path=/trunk/; revision=2497
* Add the "Edit:Protocols..." feature which currently only implementsLaurent Deniel2000-08-131-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
* Allow either old-style (pre-tvbuff) or new-style (tvbuffified)Guy Harris2000-08-071-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Convert IPX-and-friend dissectors in packet-ipx.c to useGilbert Ramirez2000-06-151-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | tvbuffs. In doing so, I realied that my recommendation for using tvb_new_subset(pi.compat_top_tvb, -1, -1) was incorrect, because some dissectors (ethernet!) change pi.len and pi.cap_len. So, I have to take those two variables into account instead of using -1 and -1. So, I provide a macro called tvb_create_from_top(offset), where offset is the name of your offset variable. It is a wrapper around tvb_new_subset(). I converted the lines that followed my suggestion to use tvb_create_from_top(). In proto.c I added proto_tree_add_debug_text(proto_tree*, const char*, ...) It's much like proto_tree_add_text(), except that it takes no offset or length; it's soley for temporarily putting debug text into the proto_tree while debugging a dissector. In making sure that its use is temporary, the funciton also prints the debug string to stdout to remind the programmer that the debug code needs to be removed before shipping the code. svn path=/trunk/; revision=2068
* Add COPS dissector (with a few fixes for compiling on Win32).Gilbert Ramirez2000-06-071-0/+335
I put the header file info in packet-cops.c since no one else uses it. Fix the version number and plugin directory in config.h.win32. svn path=/trunk/; revision=2044