Commit Graph

212 Commits

Author SHA1 Message Date
Guy Harris 3b34a4f260 Squelch a compiler warning (for a problem that doesn't actually occur).
svn path=/trunk/; revision=17758
2006-03-29 21:53:26 +00:00
Luis Ontanon 850dfe8fa2 add proto_all_finfos() that will return a GPtrArray containing every finfo found in a tree.
svn path=/trunk/; revision=17741
2006-03-27 19:28:02 +00:00
Tomas Kukosa 923855bb20 new FT_GUID handling - big/little endian supported
svn path=/trunk/; revision=17566
2006-03-10 11:58:22 +00:00
Lars Roland e271ba9a3c Display g_error messages in the console window unconditionally, if preferences aren't loaded yet.
This way we ensure that errors are displayed during protocol registration.

Use g_error instead of g_warning, if not allowed characters are used in display filter names for protocols. Extend the error message in this case.

svn path=/trunk/; revision=17248
2006-02-11 03:50:25 +00:00
Guy Harris 55c64cec5e Add "proto_tree_add_XXX_format_value()" routines, which are like the
"proto_tree_add_XXX_format()" routines except that the format doesn't
have to include the field name - the field name, followed by ": ", are
put into the representation string, followed by the result of the
formatting, so you just format the value with the format string, not the
entire representation.

svn path=/trunk/; revision=17221
2006-02-09 04:18:23 +00:00
Jörg Mayer b446d51eb1 Didier Gautheron:
proto.c uses the wrong pointer in error msg.

Me:
        Be more verbose in case of illegal characters when
        registering filter names.

svn path=/trunk/; revision=16986
2006-01-10 16:19:56 +00:00
Jörg Mayer 9a490f4b73 Jaap Keuter:
While looking into bug 239 I found a type mismatch in proto.c. Even
though tree_is_expanded is defined as a (gboolean *) the memory
allocation is carried out using sizeof (gint *). The attached patch
fixes this.


svn path=/trunk/; revision=16877
2005-12-22 01:36:42 +00:00
Tomas Kukosa a5bfb48c2f OBJECT IDENTIFIER name resolution moved to oid_resolv.c
svn path=/trunk/; revision=16699
2005-12-06 11:45:55 +00:00
Guy Harris 46325167d9 Check for a null blurb pointer for a field, as is done in some other
locations, and initialize the blurb field to NULL for protocols, now
that we support the blurb being a null pointer.

svn path=/trunk/; revision=16672
2005-12-04 04:22:43 +00:00
Tomas Kukosa dcae7d303f new field type FT_OID for OBJECT IDENTIFIERs
svn path=/trunk/; revision=16652
2005-12-02 13:16:58 +00:00
Guy Harris cdd6ccea1d Don't pass signed characters to the <ctype.h> macros.
svn path=/trunk/; revision=16457
2005-11-10 07:42:23 +00:00
Ulf Lamping 820aaac6b0 MSVC warning fixed:
proto.c(4694) : warning C4101: 'stringified' : unreferenced local variable

svn path=/trunk/; revision=16381
2005-11-02 20:50:54 +00:00
Guy Harris cbce856e9e When printing the code for a display filter:
print register numbers as unsigned (they're guint32);

	when printing a PUT_FVALUE instruction, show the value as well
	as the type of the value.

That requires that a bunch of types get to_repr methods; add them for
PCRE (FTREPR_DFILTER-only - show the regular expression as text),
tvbuffs (FTREPR_DFILTER_only - show the data as a hex string), integral
types, string types other than FT_STRING, and FT_IPv6.

That means we can use fvalue_to_string_repr() for FT_IPXNET and FT_IPv6
in proto_construct_dfilter_string(), and that we don't need to handle
integer and floating types specially in MATE.

Fix some problems with the PCRE execution code for tvbuff types.

svn path=/trunk/; revision=16369
2005-10-31 02:42:22 +00:00
Guy Harris c72ffd259d Move the ptvcursor.c code to epan/proto, and make ptvcursor_add() handle
FT_UINT_BYTES and FT_UINT_STRING correctly when the tree argument is
null (which involves carving proto_tree_add_item() into bits and having
both ptvcursor_add() and proto_tree_add_item() call those bits).

svn path=/trunk/; revision=16287
2005-10-22 05:43:09 +00:00
Guy Harris ef966c3377 If we don't want to dump core when a field is registered twice, at least
make the message give enough information to give us some hope of finding
the offending field.

svn path=/trunk/; revision=16179
2005-10-10 18:06:50 +00:00
Guy Harris f6ef22c553 Have show_exception() take a "const char *" as its exception message,
and not free the string to which it points.  Pass to
REPORT_DISSECTOR_BUG() strings allocated with ep_strdup_printf(), so
that they're freed automatically.

svn path=/trunk/; revision=16039
2005-09-28 16:16:37 +00:00
Olivier Biot 3452023b80 The TRY_TO_FAKE_THIS_ITEM() speed optimization has a side effect in that it
will only process FT_PROTOCOL fields. As a result, proto_item_append_string()
calls may throw a dissector exception, as only a FT_STRING or FT_STRINGZ can be
appended to with this call.

In order to prevent these dissector assertions, silently return from the append
call if the field is a FT_PROTOCOL.

Note that when the tree is visible, the updates of the fields occur normally,
as expected.

svn path=/trunk/; revision=16035
2005-09-28 07:08:57 +00:00
Anders Broman cb932a2514 From Peter Johansson
I added a description for the call to DISSECTOR_ASSERT in proto.c to be 
printed to stderr.

svn path=/trunk/; revision=15802
2005-09-14 19:14:23 +00:00
Guy Harris 25c4bc9379 Replace tvb_memcpy() calls that extract IPv4 addresses into a guint32,
and that extract IPv6 addresses into a "struct e_in6_addr", with
tvb_get_ipv4() and tvb_get_ipv6() calls - except for some that we
remove, by using proto_tree_add_item(), rather than replacing.

Have epan/tvbuff.h include epan/ipv6-utils.h, to define "struct
e_in6_addr" (not necessary to declare the tvbuff routines, but including
it there means "struct e_in6_addr" is guaranteed to be defined before
those declarations, so we don't get compiler complaints if we define it
*after* those declarations).

svn path=/trunk/; revision=15758
2005-09-11 21:25:37 +00:00
Ulf Lamping 642467ad5c I'm adding the "Expert Info" prototype now, as it seems to be in a state where others might have a look and probably already find it useful :-). Anyway, we can easily disable it at one or two places in the code if it get's in our way of a new release.
Please see: http://wiki.ethereal.com/Development/ExpertInfo for a complete overview of the intended feature and it's current state of implementation.

While I'm working on this, I've also added some more status result codes to the DCE/RPC and DCOM dissectors.

svn path=/trunk/; revision=15754
2005-09-11 16:55:34 +00:00
Guy Harris 266e1a3491 Add "tvb_get_ipv4()" and "tvb_get_ipv6()" addresses, to fetch IPv4 and
IPv6 addresses.  Use "tvb_get_ipv4()" in the WINS Replication dissector,
so that it gets the right answer on little-endian *AND* big-endian
machines.

svn path=/trunk/; revision=15753
2005-09-10 19:43:41 +00:00
Tomas Kukosa c53bf17cda new BASE_DEC_HEX and BASE_HEX_DEC displaying numbers in "dual" format
svn path=/trunk/; revision=15682
2005-09-05 10:56:41 +00:00
Ronnie Sahlberg 5521c10492 hmmm i though i removed some sprintf in the previous commit apparently not.
remove all sprintf and replace with g_snprintf()


svn path=/trunk/; revision=15652
2005-09-01 09:29:21 +00:00
Ronnie Sahlberg 55add7077f convert one sprintf into g_snprintf()
at the same time, make proto_construct_dfilter_string() return an emem allocated string.
This fixes a tiny memleak in print.c that never freed the string returned by this function.


svn path=/trunk/; revision=15651
2005-09-01 09:03:29 +00:00
Ulf Lamping 994496a184 several times replacing:
sprintf -> g_snprintf
snprintf -> g_snprintf
vsnprintf -> g_vsnprintf
strdup -> g_strdup

svn path=/trunk/; revision=15412
2005-08-18 19:31:15 +00:00
Ulf Lamping 495eb1b788 snprintf -> g_snprintf
svn path=/trunk/; revision=15398
2005-08-17 23:10:28 +00:00
Gerald Combs 2f2a3fedd3 In packet-sflow.c, don't pass a NULL value pointer to
proto_tree_add_ipv6().  Add tree items for the extended router source
and dest mask, and fix offsets.  These changes appear to be correct,
but I don't have a valid capture with extended router data.

In proto.c, throw a dissector error if we try to pass a NULL value to
various proto_tree_set_*() routines.

Fixes bug 356.


svn path=/trunk/; revision=15375
2005-08-16 16:04:30 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Jörg Mayer 74a75d72fe char -> const char warning fixes
svn path=/trunk/; revision=15223
2005-08-05 13:23:47 +00:00
Guy Harris 554f620001 Constify to remove a bunch of warnings. Add some casts to squelch
(presumably-)harmless-but-otherwise-unremovable const-to-nonconst
warnings.

In the TACACS dissector, clean up the variables used in option parsing
to avoid some const-to-nonconst warnings.

Clean up some white space.

svn path=/trunk/; revision=15043
2005-07-24 19:01:28 +00:00
Jörg Mayer 30a8557868 More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
2005-07-23 11:41:25 +00:00
Jörg Mayer ca322883d6 Change proto_register_protocol to use 'const char*' instead of 'char*'
svn path=/trunk/; revision=14966
2005-07-20 11:01:35 +00:00
Tomas Kukosa bab34b522b new field type FT_GUID
svn path=/trunk/; revision=14845
2005-07-04 13:04:53 +00:00
Ulf Lamping d5ae7ee8af proto.c(2941) : warning C4090: 'function' : different 'const' qualifiers
proto.c(2941) : warning C4022: 'g_tree_insert' : pointer mismatch for actual parameter 2

svn path=/trunk/; revision=14782
2005-06-26 11:29:04 +00:00
Guy Harris b67f63560e More constification.
svn path=/trunk/; revision=14740
2005-06-24 02:51:01 +00:00
Gerald Combs dce31be366 When we add an FT_STRINGZ item, throw an exception if the length is
less than -1.  If the length is 0, set the item string to "[Empty]".
This fixes bug 219.


svn path=/trunk/; revision=14634
2005-06-15 15:10:02 +00:00
Ulf Lamping 9784fa242a add new function proto_tree_move_item(), which will move an already existing proto_item inside the tree (but it can't be moved to a different "tree level")
svn path=/trunk/; revision=14524
2005-06-02 18:35:20 +00:00
Ulf Lamping 4984c5e949 show Ethernet and IPX addresses the same way as we do with other fields as well (e.g. IP addresses), first the converted value (e.g. IP address or manufaturer name) and then in brackets the "raw data"
svn path=/trunk/; revision=14523
2005-06-02 18:29:29 +00:00
Ulf Lamping 7c07e00f1d fix #11: add a [truncated] to the label, if the message to display is too long
svn path=/trunk/; revision=14477
2005-05-29 11:23:42 +00:00
Gilbert Ramirez c2454f0260 Add a "-G fields3" report which prints the bitmask of the field, and avoids
printing the blurb twice, like fields2 does.
Add a script, fsanity.py, to check sanity of FT definitions. Right now the
only check is for bitmasks for integer-like fields.

svn path=/trunk/; revision=14454
2005-05-27 15:13:09 +00:00
Ronnie Sahlberg 864245ef6e cket wsp is creating string items and later appending to them and their value at runtime which breaks when the TRY_TO_FAKE_THIS_ITEM() is used.
Add a comment to proto_item_append_string() explaining the "danger" and what needs to be done if one decides to use proto_item_append_string()

Add a small change to WSP so that it will disable this speed optimization so not to trigger a DISSECTOR_BUG in proto_item_append_string()




svn path=/trunk/; revision=14452
2005-05-27 06:00:08 +00:00
Gerald Combs 4a5deae575 In some places we call proto_tree_add_item() with hfindex and length
values that may not be valid (e.g. dissect_ber_octet_string()
in packet-ber.c).  If the length is invalid, get_uint_value() or
get_int_value() will abort.  Change them to throw an exception instead.
This keeps us from having to do a lot of extra work in the dissector.

Fixes bug 182.


svn path=/trunk/; revision=14437
2005-05-26 14:53:39 +00:00
Gerald Combs 985f94ec24 In proto_tree_set_string(), don't set a null fvalue or Ethereal will throw
a hissy fit.  Fixes bug 157.

svn path=/trunk/; revision=14299
2005-05-03 19:33:02 +00:00
Gerald Combs a80ebce3f2 Some dissectors apparently call proto_tree_add_*() with a null tvb.
This makes tvb_ensure_bytes_exist() throw a fit, so just throw an
exception instead.

svn path=/trunk/; revision=14212
2005-04-28 04:03:30 +00:00
Gerald Combs 7323cb267c Back out the previous change, and use tvb_ensure_bytes_exist() instead of
throwing an exception ourselves.

svn path=/trunk/; revision=14209
2005-04-28 03:30:07 +00:00
Gerald Combs 5ec0554c24 In alloc_field_info, throw a ReportedBoundsError if we're passed an
invalid length.

svn path=/trunk/; revision=14203
2005-04-27 16:22:24 +00:00
Ronnie Sahlberg c27c30ba02 Bugfix for proto_item_get_subtree()
Not all proto_item* fields have a subtree associated to it.
If it doesnt have a subtree  fi  will be NULL,
test fi for NULL before trying to dereference it to avoid a coredump.



svn path=/trunk/; revision=14134
2005-04-19 11:59:40 +00:00
Ronnie Sahlberg 2bc81b2a48 Major speed improvement for filtering and dissection.
It should not dump core as far as all my tests are concerned and Menu_Statistics/ProtocolHierStats work

It needs more testing and there might still be cases where it will crash that will need to be fixed  but I feel it will be worth it since it will decrease the time to filter very large capture files dramatically.

Real significant performance boost for very large captures.


(If we cant fix all the problems we can just revert this patch)



svn path=/trunk/; revision=14051
2005-04-11 08:43:51 +00:00
Ronnie Sahlberg df98534657 From Didier:
optimization for COLUMNS to make ethereal faster when filtering

optimization to make the slow find_protocol_by_id() fast.
(idea from Didier, implementation modified by me to be less intrusive)



svn path=/trunk/; revision=14026
2005-04-07 12:00:03 +00:00
Gerald Combs 8b95cd38d5 Don't generate a "dissector bug" warning in cases where a dissector calls
proto_tree_add_*(tree, tvb, offset, 0, ...);

and "offset" is greater than the length remaining in the tvbuff.

svn path=/trunk/; revision=14014
2005-04-04 18:10:42 +00:00