Commit Graph

36 Commits

Author SHA1 Message Date
Jörg Mayer 3e2633a0f4 char *drep -> guint8 *drep
svn path=/trunk/; revision=9735
2004-01-19 20:10:37 +00:00
Guy Harris 550a238a0f Eliminate "alignment.h" header - the stuff in it is no longer used.
svn path=/trunk/; revision=9625
2004-01-10 02:43:29 +00:00
Guy Harris 69f30a1f12 "dissect_mailslot_browse()", "dissect_mailslot_lanman()", and
"dissect_smb_logon()" always return TRUE, so just get rid of their
return value.

"call_dissector()" automatically calls the data dissector if the
protocol for the dissector being called is disabled, so we don't have to
check its result and call the data dissector if it returns 0.

svn path=/trunk/; revision=9027
2003-11-19 03:53:33 +00:00
Guy Harris 7bd2e232a9 Export "protocol_t" as an opaque type.
Make "proto_is_protocol_enabled()" and "proto_get_protocol_short_name()"
take a "protocol_t *" as an argument, so they don't have to look up the
"protocol_t" - this will probably speed them up considerably, and
they're called on almost every dissector handoff.

Get rid of a number of "proto_is_protocol_enabled()" calls that aren't
necessary (dissectors called through handles, including those called
through dissector tables, or called as heuristic dissectors, aren't even
called if their protocol isn't enabled).

Change some direct dissector calls to go through handles.

svn path=/trunk/; revision=8979
2003-11-16 23:17:27 +00:00
Guy Harris afd3103ba2 Don't include <epan/conversation.h> if you don't need it.
svn path=/trunk/; revision=8361
2003-09-03 20:58:09 +00:00
Guy Harris ee97ce3196 Add new routines:
tvb_get_string() - takes a tvbuff, an offset, and a length as
	arguments, allocates a buffer big enough to hold a string with
	the specified number of bytes plus an added null terminator
	(i.e., length+1), copies the specified number of bytes from the
	tvbuff, at the specified offset, to that buffer and puts in a
	null terminator, and returns a pointer to that buffer (or throws
	an exception before allocating the buffer if that many bytes
	aren't available in the tvbuff);

	tvb_get_stringz() - takes a tvbuff, an offset, and a pointer to
	a "gint" as arguments, gets the size of the null-terminated
	string starting at the specified offset in the tvbuff (throwing
	an exception if the null terminator isn't found), allocates a
	buffer big enough to hold that string, copies the string to that
	buffer, and returns a pointer to that buffer and stores the
	length of the string (including the terminating null) in the
	variable pointed to by the "gint" pointer.

Replace many pieces of code allocating a buffer and copying a string
with calls to "tvb_get_string()" (for one thing, "tvb_get_string()"
doesn't require you to remember that the argument to
"tvb_get_nstringz0()" is the size of the buffer into which you're
copying the string, which might be the length of the string to be copied
*plus 1*).

Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string).  Use "tvb_get_stringz()", instead.

In some cases where a value is fetched but is only used to pass an
argument to a "proto_tree_add_XXX" routine, use "proto_tree_add_item()"
instead.

svn path=/trunk/; revision=7859
2003-06-12 08:33:32 +00:00
Gerald Combs 0b9bbbbdb6 Modify tvb_get_nstringz*() to behave more like snprintf(). Make changes
where necessary to reflect the new behavior.

svn path=/trunk/; revision=7607
2003-04-30 02:35:28 +00:00
Richard Sharpe cb0461411d Fix up the parsing of browser rest messages.
svn path=/trunk/; revision=7360
2003-03-24 16:49:10 +00:00
Richard Sharpe dbbfc76654 Add support for the missing ResetBrowserState announcement in
packet-smb-browse.c

svn path=/trunk/; revision=7357
2003-03-21 05:28:04 +00:00
Guy Harris dd22e794c3 At least in regular SMB Browse and RAP messages, the server type mask is
not guaranteed to be aligned on a 4-byte boundary, so, if we're not
dissecting a DCE RPC request or reply, don't use "dissect_ndr_uint32()"
to extract the access mask.

svn path=/trunk/; revision=7175
2003-02-20 07:55:00 +00:00
Tim Potter 3031823bed Dissect the server type bitfield in NetServerGetInfo for SERVER_INFO_101
and SERVER_INFO_102.

Modify all callers to use the new interface.

svn path=/trunk/; revision=7158
2003-02-17 01:59:39 +00:00
Tim Potter d486235430 Put the computer_name in COL_INFO when dissecting a
BROWSE_REQUEST_ANNOUNCE packet.

svn path=/trunk/; revision=7036
2003-01-30 04:51:30 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris da74615c79 Get rid of some unused arguments, and mark some others as unused.
Remove the declaration of "dissect_nt_sid()" from
"packet-dcerpc-samr.c"; get it by including "packet-smb-common.h",
instead.

svn path=/trunk/; revision=5313
2002-04-30 11:03:08 +00:00
Guy Harris eb2d6593dc Replace a bunch of "tvb_length()" and "tvb_length_remaining()" calls in
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
2002-01-24 09:20:54 +00:00
Guy Harris ee5ca25d31 Include files from the "epan" directory and subdirectories thereof with
"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-21 07:37:49 +00:00
Guy Harris 23319ff023 Move the pointer to the "column_info" structure in the "frame_data"
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-10 00:26:21 +00:00
Guy Harris 5b36683d39 Make the register routines for the mailslot, pipe, browser, and
mailslot-based logon protocols just be regular register routines,
detected by the script that generates the "register.c" file, rather than
special stuff known to the SMB dissector.

svn path=/trunk/; revision=4222
2001-11-19 10:23:39 +00:00
Guy Harris d2b01e812b Remote API protocol (that seems to be what it's called in a number of
places) dissector tvbuffified, from Ronnie Sahlberg and me.

Additional "are we past the end of the buffer" checks added, so that we
don't hand random junk to the transaction and transact2 dissectors.

svn path=/trunk/; revision=3824
2001-08-05 01:15:27 +00:00
Guy Harris 0363dc030d Put in the right URL for the browser spec on the Samba site.
The periodicity in \MAILSLOT\LANMAN browser packets appears to be in
seconds, not milliseconds.

svn path=/trunk/; revision=3805
2001-08-01 08:12:15 +00:00
Guy Harris 9ab5b580ce Packets sent to \MAILSLOT\LANMAN appear to be browser announcements (for
an older version of the protocol than the one for packets sent to
\MAILSLOT\BROWSE), rather than being LANMAN pipe packets.

svn path=/trunk/; revision=3803
2001-08-01 03:47:00 +00:00
Guy Harris f8b71590ef Use "tvb_strsize()" rather than "tvb_strnlen()" to get the size
(including the terminating null byte) of a null-terminated string; it
includes the terminating null in the count, and throws an exception if
the string goes past the end of the tvbuff, so we don't have to do
either of those ourselves.

svn path=/trunk/; revision=3797
2001-07-30 05:20:44 +00:00
Guy Harris c10166c5d0 Get rid of some unused variables.
svn path=/trunk/; revision=3744
2001-07-20 07:11:57 +00:00
Guy Harris 9d191e7f03 Set "pinfo->current_proto" in the browsser dissector.
Set the protocol and info columns before fetching anything that might
cause an exception.

Add some more different fields for the different types of host names in
browser packets.

Force an exception to be thrown if there's no NUL terminator for a name
in the tvbuff.

svn path=/trunk/; revision=3711
2001-07-13 07:04:23 +00:00
Guy Harris 82a553e9c9 Add a "time_msecs_to_str()" routine, to turn a time interval, expressed
as a 32-bit number of milliseconds, to a descriptive string.

Use that in the MS Browser dissector.

svn path=/trunk/; revision=3708
2001-07-13 00:27:51 +00:00
Guy Harris 01710d371c The 2 bytes in the middle of the election criteria field of an election
request are the major and minor versions of the browser protocol.

The 4 bytes that, in announcements other than domain/workgroup
announcements, are the major and minor versions of the browser protocol
and the signature constant, are something else mysterious in
domain/workgroup announcements; stuff them in as a "Mysterious Field"
for now.

svn path=/trunk/; revision=3707
2001-07-13 00:01:35 +00:00
Guy Harris 6a1bd87566 Tvbuffified SMB BROWSER dissector, from Ronnie Sahlberg.
svn path=/trunk/; revision=3706
2001-07-12 23:37:48 +00:00
Guy Harris 7c8faf262f Move the declaration of routines exported from "packet-smb-browse.c"
into a "packet-smb-browse.h" header file, and have modules that import
those routines include "packet-smb-browse.h" rather than declaring the
routines themselves; do the same for routines exported from
"packet-smb-logon.c".

Make routines and arrays not exported static, and make routines that
return a true/false return value "gboolean" rather than "guint32".

svn path=/trunk/; revision=3147
2001-03-18 03:34:22 +00:00
Guy Harris 0e7c1de08a Have "proto_register_protocol()" build a list of data structures for
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
2001-01-03 06:56:03 +00:00
Guy Harris 252d55d80f For each column, have both a buffer into which strings for that column
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-19 08:54:37 +00:00
Laurent Deniel cc36f0b931 Add the "Edit:Protocols..." feature which currently only implements
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-08-13 14:09:15 +00:00
Guy Harris 283ce59938 Add routines for adding items to a protocol tree that take arguments of
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-31 05:09:07 +00:00
Gilbert Ramirez 292e38e2c6 Add tvbuff class.
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-05-11 08:18:09 +00:00
Richard Sharpe 43c9217ba4 Minor update to SMB browse display code ...
svn path=/trunk/; revision=1821
2000-04-08 01:28:13 +00:00
Guy Harris 12df8af4e3 Jeff Foster's SMB Mailslot and Netlogin dissectors; he split
"packet-smb.c" up into several files.

svn path=/trunk/; revision=1629
2000-02-14 04:02:21 +00:00