Commit Graph

96 Commits

Author SHA1 Message Date
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
Tim Potter 60e4ca9c4f Moved the generic true_false_string saying "Set", "Not set" into
epan/packet.c

It was cut and pasted into seven other dissectors!

svn path=/trunk/; revision=6052
2002-08-21 21:25:23 +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 4401f1433f Don't pass "tvb_reported_length_remaining(tvb, offset)" as the fourth
argument to "tvb_new_subset()" - just use -1 if the subset tvbuff is to
run to the end of the parent tvbuff.

svn path=/trunk/; revision=5597
2002-05-30 01:56:55 +00:00
Guy Harris 12d83302b0 If variables are used only if "HAVE_UCD_SNMP" is undefined, declare them
only if "HAVE_UCD_SNMP" is undefined.

svn path=/trunk/; revision=5117
2002-04-08 01:55:05 +00:00
Guy Harris c0565b3fbe From Kikuchi Ayamura: include <ucd-snmp/ucd-snmp-config.h> to fix IRIX
compilation problems.

svn path=/trunk/; revision=5073
2002-04-01 22:00:00 +00:00
Guy Harris 2963d86afd (Conditionally) mark unused variables as such.
svn path=/trunk/; revision=5063
2002-03-31 22:43:47 +00:00
Guy Harris 4d842c13de Make the UCD SNMP library read its configuration files, so that, for
example, you can configure it to read in MIB files other than the
default ones.

svn path=/trunk/; revision=5022
2002-03-26 06:35:03 +00:00
Guy Harris 6327b456db Get rid of the "--enable-snmp" option; instead, use "--with-ucdsnmp".
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
2002-03-12 10:37:04 +00:00
Guy Harris bb172432d1 "format_var()" returns a "malloc()"ed string, not a "g_malloc()"ed
string; free it with "free()", not "g_free()".

svn path=/trunk/; revision=4925
2002-03-11 01:51:37 +00:00
Guy Harris 7e8c5a1741 If we're linking with the UCD SNMP library, make "format_oid()" append a
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
2002-03-11 01:48:08 +00:00
Guy Harris d9a00fc228 The "val_len" member of a "struct variable_list" should be set to the
length of the variable's value, in bytes, not the length of the BER
encoding of that variable's value.  The latter setting means it won't be
correct for object IDs.

svn path=/trunk/; revision=4922
2002-03-11 01:40:28 +00:00
Guy Harris bdbb567087 Use "ds_set_int()", not "snmp_set_suffix_only()", to set the "print
suffixes only" setting.

svn path=/trunk/; revision=4916
2002-03-10 23:17:00 +00:00
Guy Harris d50103f67f Use the "sprint_realloc_" routines in UCD SNMP 4.2.2 and later, rather
than the "sprint_" routines in UCD and CMU SNMP; the latter routines
have no bounds checking, and if you use them you cannot protect against
buffer overflows.

As we now require UCD SNMP 4.2.2 or later:

	1) we no longer need code to support CMU SNMP;

	2) we no longer need code to work around problems with UCD SNMP
	   4.1.1;

and, as we no longer use the "sprint_" routines, we no longer need code
to work around the changed API and ABI of those routines in some
nonstandard versions of the UCD SNMP library.

svn path=/trunk/; revision=4914
2002-03-10 22:18:12 +00:00
Guy Harris f4f14e0128 Check to make sure SNMP_IPADDR items are 4 bytes long and SNMP_COUNTER64
items are 8 bytes long.

svn path=/trunk/; revision=4882
2002-03-06 03:52:13 +00:00
Guy Harris d8a08e186c Add a routine to "asn1.c" to translate ASN1_ERR_ values to strings. Use
that in the SNMP dissector.

Check the return values of ASN.1 routines in the LDAP dissector, and
have all the subroutines in that disesctor that can return error
indications return ASN1_ERR_ values.

Have the routines that can supply a pointer to a newly-created
protocol-tree item use the right type for items ("proto_item *", not
"proto_tree *", even though they are, at least currently, typedefs for
the same type), and use "proto_item" for the type of the item a pointer
to which is passed to those routines.

Before calling those routines, set the item pointer to null, in case the
routine fails.

Don't check the return value of "parse_filter_strings()" against -1 -
that routine can't return -1.

svn path=/trunk/; revision=4833
2002-03-01 02:48:10 +00:00
Guy Harris ddf6a753f0 From Andrew Hood: translate enterprise OIDs in SNMP traps to strings if
possible.

svn path=/trunk/; revision=4758
2002-02-19 09:35:45 +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
Gerald Combs 3dedae14f9 Work around changes made to recent Red Hat ucd-snmp packages. See
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=57421

for details.

svn path=/trunk/; revision=4387
2001-12-12 05:26:53 +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 bced8711f6 Make "dissector_add()", "dissector_delete()", and "dissector_change()"
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-12-03 04:00:26 +00:00
Guy Harris 07b2709f8a Change "conversation_set_dissector()" to take a dissector handle, rather
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-27 07:13:32 +00:00
Ed Warnicke 4877553530 Switched from using CHECK_DISPLAY_AS_DATA to using CHECK_DISPLAY_AS_X
which also takes a handle as an argument and thus doesn't call
dissect_data directly.

svn path=/trunk/; revision=4270
2001-11-26 05:13:14 +00:00
Ed Warnicke fcd5b352af Moved from using dissect_data() to using call_dissector()
svn path=/trunk/; revision=4269
2001-11-26 04:52:51 +00:00
Guy Harris 3388bde488 Instead of having a single datum attached to a conversation, have a list
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-09-03 10:33:12 +00:00
Guy Harris ab5d4fcca0 Squelch some compiler warnings.
svn path=/trunk/; revision=3899
2001-09-03 08:19:12 +00:00
Guy Harris 8412393197 From Joerg Mayer: explicitly fill in all members of a
"header_field_info" structure, including the ones that are later set by
the routines to register fields.

svn path=/trunk/; revision=3561
2001-06-18 02:18:27 +00:00
Guy Harris 3c7b6471e3 Rename the arguments and flags for the conversation routines, so as not
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-06-10 09:50:20 +00:00
Guy Harris 32c0848007 Get rid of END_OF_FRAME references in tvbuffified dissectors.
svn path=/trunk/; revision=3364
2001-04-23 04:29:54 +00:00
Guy Harris 5f89c1d715 Conversation dissectors are called through a mechanism that doesn't
check for disabled protocols or set "pinfo->current_proto", so they have
to do that for themselves.

svn path=/trunk/; revision=3306
2001-04-15 09:05:17 +00:00
Guy Harris 15dcdcf3f8 Fix up a pile of NullTVB uses that were left in the previous checkin.
svn path=/trunk/; revision=3304
2001-04-15 07:51:11 +00:00
Guy Harris b0e06bd8d1 Tvbuffify the ASN.1 code and the Kerberos, LDAP, and SNMP dissectors.
Clean up some problems that revealed.

svn path=/trunk/; revision=3301
2001-04-15 07:30:03 +00:00
Guy Harris 1bfd09545e At least with UCD SNMP 4.1.2, you can safely pass to "sprint_value()" a
variable with a null pointer-to-value and a zero length, so we don't
need to protect the assignment to "variable.val.string" with
"SAFE_STRING()" - and doing so causes complaints from the compiler about
assigning a pointer to a "const gchar" to the non-const pointer
"variable.val.string".

svn path=/trunk/; revision=3267
2001-04-07 08:23:58 +00:00
Guy Harris 3d446c2609 Don't blow up if "asn1_string_value_decode()" supplies a null pointer as
the string because the string value is zero-length.

Don't try to treat an agent address in a V1 trap as an IP address if
it's not 4 bytes long.

svn path=/trunk/; revision=3265
2001-04-07 00:52:07 +00:00
Guy Harris ca49be4d3e In "dissect_snmp_parse_error()" and "dissect_snmp_error()", put an error
indication into the protocol tree as well as the summary line, so people
don't get confused if, say, doing "tethereal -V".

Pass those routines the subtree for the packet, rather than the
top-level tree, so that the error indication and the item for the rest
of the packet show up there rather than at the top level.

svn path=/trunk/; revision=3264
2001-04-06 23:12:33 +00:00
Gilbert Ramirez f75a4d1d87 Do a better job of #ifdef'ing out 3 variables in the case of non-UCD-SNMP
and linux.

svn path=/trunk/; revision=3081
2001-02-27 19:39:48 +00:00
Guy Harris a267b11066 Work around a CMU SNMP bug wherein "sprint_value()" dumps core if there
are no entries in any of the MIBs for any of the components of the
variable's OID.

svn path=/trunk/; revision=2961
2001-01-30 07:16:28 +00:00
Guy Harris 418d1cd9f8 SNMPv2u support.
svn path=/trunk/; revision=2957
2001-01-30 02:13:43 +00:00
Guy Harris 43ccfd8054 Add an additional "protocol index" argument to "{old_}dissector_add()",
"{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-09 06:32:10 +00:00
Gilbert Ramirez 5b7f184296 Ensure that all value_string arrays end in {0, NULL}. Dissectors got away
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
2001-01-03 16:41:08 +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 60f9476740 Rename "asn1_octet_string_value_decode()" to
"asn1_string_value_decode()", as it can be used for various character
string types as well.

Turn "asn1_octet_string_decode()" into "asn1_string_decode()", which
takes an additional argument giving the tag expected for the string in
question, and make "asn1_octet_string_decode()" a wrapper around it.

Clean up the ASN.1 dissection in the Kerberos dissector, making more use
of the code in "asn1.c", wrapping more operations up in macros, and
doing some more type checking.

Use "REP" rather than "RESP" in names and strings; "REP" is what the
Kerberos spec uses.

Make the routines in the Kerberos dissector not used outside that
dissector static.

Fix some problems with the dissection of strings in the Kerberos
dissector (it was extracting the data from the wrong place in the
packet).

In Kerberos V5, the "kvno" item in the EncryptedData type is optional;
treat it as such.

Treat integers as unsigned in the Kerberos dissector.

svn path=/trunk/; revision=2777
2000-12-24 09:10:12 +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
Guy Harris 99c98f9e74 Move "bytes_to_str()" to "strutil.c" from "packet.c" - it's just a
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-13 07:19:37 +00:00
Guy Harris 339c4a4f66 Don't require that all SNMP packets go to or from the SNMP port - the
SNMP request would, but an SNMP reply can come back from another port.
Instead, when an SNMP request is seen, create a conversation with a
wildcard port, if one doesn't already exist, and make its dissector the
SNMP dissector.

svn path=/trunk/; revision=2526
2000-10-21 18:52:17 +00:00
Gilbert Ramirez 348ee93844 Move the dlclose() of libsnmp_handle into the libsnmp_handle != NULL
block.

svn path=/trunk/; revision=2446
2000-09-19 02:25:17 +00:00
Guy Harris b3bffc4741 Close the handle for the SNMP library after we're done with it - shared
objects are reference-counted so that won't make it disappear if
Ethereal is also linked with it as a shared SNMP library.

svn path=/trunk/; revision=2443
2000-09-17 07:23:44 +00:00
Guy Harris 0653c5b18b Load "libsnmp.so.0", not "libsnmp.so":
on the systems that have the problem we're working around, the
	SNMP shared library is "libsnmp.so.0";

	on those systems, there's also no "libsnmp.so" unless the user
	has installed the UCD SNMP development package or has made a
	symlink from "libsnmp.so" to "libsnmp.so.0" by hand, and we
	don't want to force users to do that (some of them may be
	sufficiently new to UNIX that they don't know how to do that);

	the run-time linker, if told to load "libsnmp.so", won't
	necessarily realize that it's the same object as "libsnmp.so.0",
	and may load it again rather than using the already-loaded
	object, which might not be a good idea.

svn path=/trunk/; revision=2398
2000-09-08 07:14:01 +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