aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tftp.c
AgeCommit message (Collapse)AuthorFilesLines
2001-09-03Instead of having a single datum attached to a conversation, have a listGuy Harris1-3/+2
of protocol-id-plus-datum pairs, so that multiple protocols can attach information to the same conversation. Dissectors that attach information to a conversation should not assume that if they find a conversation it has one of its data attached to it; the conversation might've been created by another dissector. svn path=/trunk/; revision=3901
2001-06-18From Joerg Mayer: explicitly fill in all members of aGuy Harris1-8/+8
"header_field_info" structure, including the ones that are later set by the routines to register fields. svn path=/trunk/; revision=3561
2001-06-10Rename the arguments and flags for the conversation routines, so as notGuy Harris1-9/+13
to imply that 1) conversations have source and destination addresses and ports - they don't (if they did, they'd be monologues, not conversations), they just have two address/port pairs for the two endpoints, with one or more of the address or port in the second pair possibly being wildcarded; 2) the first and second address or port argument to "find_conversation()" or "try_conversation_dissector()" have anything to do with the first or second address/port pair in a conversation - they don't, the two arguments to those routines are matched against *both* address/port pairs for a conversation; as otherwise people might think that they need to add flags to wildcard the first arguments "conversation_new()" or "find_conversation()" (they don't, they just have to pass the non-wildcarded address/port first and then pass the wildcarded one, even if that means passing the destination first and source second). svn path=/trunk/; revision=3537
2001-02-09Add "TFTP_" before the packet type names, to avoid compiler warnings onGuy Harris1-20/+20
Windows where ERROR is #defined by some header file that gets included by "packet-tftp.c". svn path=/trunk/; revision=3006
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-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
2000-12-25Add a new "tvb_strsize()" routine, which finds the size of aGuy Harris1-39/+11
NUL-terminated string, starting at a given offset. The size includes the terminating NUL. If it doesn't find the terminating NUL, it throws the appropriate exception, as either there's no terminating NUL in the packet or there is but it's past the end of the captured data in the packet. Use that routine in the TFTP dissector. As it throws an exception if the string isn't NUL-terminated, we can just use "%s" to print option strings; we don't need to use "%.*s" with a string length. svn path=/trunk/; revision=2783
2000-12-24Add a "tftp_strnlen()" routine thatGuy Harris1-22/+52
1) checks to make sure that the terminating '\0' is found in the string, and throws a BoundsError exception if it isn't (TFTP packets should fit in a single frame, so if the '\0' isn't found, that's an error); 2) adds 1 to the length to include the trailing '\0'; and use it to find all string lengths, so that we properly handle short or malformed frames. svn path=/trunk/; revision=2778
2000-12-02Some tvbuffified dissectors weren't setting "pinfo->current_proto", soGuy Harris1-1/+3
that if they threw an exception, the wrong protocol would be blamed. Add the missing assignments. Clean up the extraction of the null-encapsulation header. svn path=/trunk/; revision=2730
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-13Use "tvb_offset_exists()" rather than "tvb_length_remaining()" to checkGuy Harris1-2/+2
whether there's any data left in the tvbuff starting at a specified offset. svn path=/trunk/; revision=2636
2000-11-10Don't use "pi" in the TFTP dissector, now that it's a new-styleGuy Harris1-5/+5
dissector; use "pinfo" instead. svn path=/trunk/; revision=2600
2000-11-10Tvbuffify the TFTP dissector, and make heavier use of registered fieldsGuy Harris1-98/+128
and "value_string" tables. svn path=/trunk/; revision=2599
2000-10-21Wildcard matching is tricky - you have to try wildcarding both theGuy Harris1-3/+37
source *and* destination port and/or both the source *and* destination address passed to "find_conversation()", because the packet for which you're trying to find the conversation may be going in the opposite direction to the packet for which the conversation was originally created. Create different hash tables for wildcarded conversations, to reduce the number of "is this a wildcard?" tests done when doing hash lookups. This is sufficient to allow the TFTP dissector to use conversations rather than being special-cased in the UDP dissector, and may also be sufficient to handle a similar problem with SMTP (request goes from client IP X port Y to server IP Z's well-known port, reply comes back from some other port on server Z to client IP X port Y), but further use may reveal other changes that should be made. svn path=/trunk/; revision=2525
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-05-31Add routines for adding items to a protocol tree that take arguments ofGuy Harris1-4/+4
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-24/+24
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-02-09Dietmar Petras provided:Gilbert Ramirez1-4/+1
* fix a bug in packet-tftp.c dissecting TFTP Option Acknowledgement packets. The is no Block-Id in TFTP Option Acknowledgements, as it is in TFTP Acknowledgements. * Extension of manuf by ethernet addresses from ELSA (my company), a german vendor of ISDN routers, cable modems, etc. * New dissector for Time Protocol [RFC 0868]. That protocol works on port 37 of UDP and TCP. The implementation in this patch only dissects the more usual UDP version. It could print the time in a more fashion way, but thats for a later version. svn path=/trunk/; revision=1609
2000-01-27TFTP Option Extension (RFC 2347) support, from Craig Newell.Guy Harris1-5/+43
svn path=/trunk/; revision=1573
2000-01-07Fix Gerald's e-mail address.Guy Harris1-2/+2
svn path=/trunk/; revision=1437
1999-11-16Replace the ETT_ "enum" members, declared in "packet.h", withGuy Harris1-2/+8
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-14Add display filters.Laurent Deniel1-8/+22
svn path=/trunk/; revision=1027
1999-07-29Made the protocol (but not the fields) use the new proto_tree routine,Gilbert Ramirez1-3/+16
allowing users to filter on the existence of these protocols. I also added packet-clip.c to the Nmake makefile. svn path=/trunk/; revision=402
1999-07-07Created a new protocol tree implementation and a new display filterGilbert Ramirez1-20/+19
mechanism that is built into ethereal. Wiretap is now used to read all file formats. Libpcap is used only for capturing. svn path=/trunk/; revision=342
1999-05-13Get rid of the include of <arpa/tftp.h>; put the #defines for packetGuy Harris1-9/+12
types in "packet-tftp.c", and grab the opcode directly from the first 2 bytes of the packet, using "pntohs()" (which will also keep us from crashing, on processors that require strict alignment, if the UDP payload isn't aligned on a 2-byte boundary). Also use "pntohs()" to grab the block number in data and acknowledgment packets, for the same reason we use it to grab the opcode. svn path=/trunk/; revision=286
1999-03-23Removed all references to gtk objects from packet*.[ch] files. They nowGilbert Ramirez1-28/+24
reference the protocol tree with struct proto_tree and struct proto_item objects. That way, the packet decoding source code file can be used with non-gtk packet decoders, like a curses-based ethereal, e.g. I also re-arranged some of the information in packet.h to more appropriate places (like other packet-*.[ch] files). svn path=/trunk/; revision=223
1999-02-15Added Richard Sharpe's TFTP support.Guy Harris1-0/+146
svn path=/trunk/; revision=190