Commit Graph

519 Commits

Author SHA1 Message Date
Jakub Zawadzki 85aad38347 Add proto_tree_add_unicode_string() to add UTF-8 string to tree.
Convert some proto_tree_add_string_format_value(..., val, "%s", val); to use new function.

svn path=/trunk/; revision=43363
2012-06-19 14:32:24 +00:00
Guy Harris 14b616c35d Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls.

Add new "add_packet_field" method to the TreeItem class, taking a
protocol field (*not* a protocol), TvbRange, and encoding value as
arguments.

Add the ENC_ values to init.lua.  Make them all hex #defines so
make-init-lua.pl can easily extract them.

Export tvb_unicode_strsize() for use by Lua (and elsewhere as desired). 
Note that it handles UTF-16 and UTF-8, and fix the comment to note that
its count of hexadectets *does* include the null terminator (that's what
the code does).

svn path=/trunk/; revision=42621
2012-05-14 00:49:05 +00:00
Guy Harris 7a87d7b6a3 Add ENC_UTF_16 and ENC_UCS_2. Note that UTF-16 and UCS-2 are not the
same, and that the routines to get "Unicode" strings are really doing
UCS-2 (and not doing anything about code values that aren't valid in
UCS-2 strings).

Have tvb_get_ephemeral_string_enc() separate cases for ASCII and UTF-8,
even though they're *currently* treated the same.

For FT_UINT_STRING, treat an encoding value of TRUE as meaning
"little-endian ASCII"; pass all other encodings through to
tvb_get_ephemeral_string_enc().

svn path=/trunk/; revision=42592
2012-05-11 23:55:54 +00:00
Guy Harris f1b11f62f8 proto_registrar_get_ftype() returns an FT_ value; make its return type
"enum ftenum" to reflect that, and fix the "switch doesn't handle XXX"
warnings that provokes.

svn path=/trunk/; revision=42579
2012-05-11 17:29:56 +00:00
Anders Broman 0cea399fda From Jakub Zawadzki: Use custom model in Filter Expression dialog.
svn path=/trunk/; revision=42411
2012-05-04 04:44:23 +00:00
Anders Broman 82a60c13d0 From Evan Huus: Add DISSECTOR_ASSERT_HINT() macro https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7142
svn path=/trunk/; revision=42137
2012-04-19 05:44:50 +00:00
Gerald Combs 8b3024e57c Make bit_offset in _tvb_get_bits64 and related functions unsigned. This
removes a potential buffer overflow and should fix a bunch of Coverity
errors mentioned in bug 6878.

We might want to do the same for no_of_bits.

svn path=/trunk/; revision=41945
2012-04-04 21:54:22 +00:00
Anders Broman ff47bdf96c Use the expert system to show packet comments.
The packet comment widget should be replaced by a ListView with two columns,  packet no and Comment.

svn path=/trunk/; revision=41322
2012-03-02 13:31:16 +00:00
Anders Broman b28516dc00 From Mike Morrin: A small patch to correct the name of the function proto_tree_add_split_bits_item_ret_val()
svn path=/trunk/; revision=41255
2012-03-01 07:01:15 +00:00
Anders Broman 597047d253 From Mike Morrin:
The attached patches add the ability to dissect split bit-strings as discussed under bug 6797.
proto_tree_add_split_bits_ret_val()
proto_tree_add_split_bits_crumb()

svn path=/trunk/; revision=41246
2012-02-29 17:13:43 +00:00
Gerald Combs 3c1b8a6ca1 Add a "-G ftypes" option, which dumps our supprted FT_… names and
descriptions. Captitalize and fix up the descriptions. Use its output to
create the field type list in the wireshark-filter man page.

svn path=/trunk/; revision=40306
2011-12-27 20:35:41 +00:00
Bill Meier eeaf3993ad (Trivial) remove an extra blank line.
svn path=/trunk/; revision=39909
2011-11-17 17:36:29 +00:00
Chris Maynard 934c2ce1a2 Move FI_RESET_FLAG and PROTO_ITEM_SET_VISIBLE macros to proto.h and fix the FI_RESET_FLAG macro, being sure to use the 1's complement operator, '~', instead of the logical negation operator, '!'. (Fixes Coverity CID 1326).
svn path=/trunk/; revision=39888
2011-11-16 20:09:49 +00:00
Bill Meier 6a5895b2de Convert proto_tree_add_bitmask(), proto_tree_add_bitmask_text(), proto_tree_add_bitmask_tree() to have 'encoding' arg rather than 'little_endian' arg
svn path=/trunk/; revision=39538
2011-10-24 19:52:43 +00:00
Guy Harris 6358754048 Note some character encodings that can probably be used Real Soon Now,
and the dissectors that deal with them.

svn path=/trunk/; revision=39456
2011-10-18 06:50:20 +00:00
Chris Maynard cf4d497af4 Some minor documentation changes: little_endian -> encoding. Also, fully parenthesize FI_BITS_OFFSET, FI_BITS_SIZE, and FI_GET_FLAG macro arguments.
svn path=/trunk/; revision=39273
2011-10-05 18:22:30 +00:00
Stig Bjørlykke 21dbaea387 Add proto_unregister_field().
This can be used to unregister fields registered in dissector UAT's.

svn path=/trunk/; revision=39248
2011-10-04 10:12:55 +00:00
Anders Broman 00e46951ad In proto_tree_add_bits... use const guint encoding to be consistent with proto_tree_add_item().
svn path=/trunk/; revision=39163
2011-09-27 12:04:29 +00:00
Guy Harris 0989347195 Add an ENC_ASCII; right now, it's the same as ENC_UTF_8, but it should
eventually cause all bytes with the 8th bit set to be displayed as error
indications.

svn path=/trunk/; revision=39064
2011-09-20 17:42:27 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Guy Harris 338af96b2e Add a tvb_get_ephemeral_string_enc() routine that's like
tvb_get_ephemeral_string() but takes an ENC_ value for the character
encoding.  Use it in the MQ dissector to fetch strings to put, for
example, into the Info column, so we properly handle EBCDIC strings
there.

svn path=/trunk/; revision=37876
2011-07-03 17:08:25 +00:00
Guy Harris ae7f40cbfc Add ENC_ values for UTF-8 and EBCDIC, support them for FT_STRINGZ
values, and use them in the MQ dissector, so EBCDIC strings are
displayed as such.

Fix up some other final arguments to proto_tree_add_item().

svn path=/trunk/; revision=37872
2011-07-03 01:40:12 +00:00
Alexis La Goutte 7d317e553b Add FT_EUI64 Field Type
* Remove proto_tree_add_eui64 function from 802.15.4 Dissector 
* Replace print_eui64/print_eui64 by eui64_to_str/get_eui64_name
* Update Documentation (README.dev)
* Add new function in libwireshark.def
* Support of encoding for tvb_eui64_to_str
* Use FT_EUI64 for ICMPv6, CAPWAP, Zbee ... dissector

svn path=/trunk/; revision=37015
2011-05-08 10:23:53 +00:00
Jeff Morriss ecf8cbed34 As suggested by Jakub Zawadzki:
Rename g_gnuc_malloc.h to g_gnuc.h (since it contains non-malloc related
GNUC stuff).

Use G_GNUC_WARN_UNUSED_RESULT from glib instead of using warn_unused_result
directly.

svn path=/trunk/; revision=36825
2011-04-22 17:57:10 +00:00
Stephen Fisher 6da2292163 Fix whitespace a bit and add field names from doc/README.developer to
comments such as FIELDNAME, FIELDABBREV, etc.


svn path=/trunk/; revision=36817
2011-04-22 17:08:59 +00:00
Jeff Morriss 64e31d0b0d If we're using GNUC, use attribute warn_unused_result to verify that the
return value of proto_item_add_subtree() is used.

(The WARN_IF_UNUSED macro doesn't belong here...  But where should it go?)

svn path=/trunk/; revision=36812
2011-04-22 15:15:10 +00:00
Gerald Combs 33819c43c8 Add a hint for Visual C++ to DISSECTOR_ASSERT. Hopefully this will
reduce some of the /analyze false positives.

svn path=/trunk/; revision=35990
2011-02-17 23:21:07 +00:00
Guy Harris 4f7ae8bf3a For FT_{ABSOLUTE,RELATIVE}_TIME, make the rest of the encoding
orthogonal to the byte order.

This means that we can't just test for a non-zero encoding to determine
whether the format is big-endian or little-endian when we set the
field's endianness flag; instead, for the types where we accept any
non-zero value as meaning "litle-endian", map it to ENC_LITTLE_ENDIAN.

When we use ENC_TIME_NTP, OR in the byte order flag.  While we're at it,
in the dissectors that used ENC_TIME_NTP, update all the other encoding
items in proto_tree_add_item() calls to use the appropriate ENC_ value.

svn path=/trunk/; revision=35841
2011-02-07 08:18:12 +00:00
Jeff Morriss 8fc6e28b6a Add support for passing NTP times to proto_tree_add_item() by specifying
an encoding of ENC_TIME_NTP.

This increases the number of decimal places shown for NTP times (from 6 to 9),
so round the value to the nearest microsecond.  (I can't tell if NTP times are
ever more precise than a microsecond--this rounding is mainly to be closer to
the old behavior.)

Use proto_tree_add_item() for some NTP times.

svn path=/trunk/; revision=35840
2011-02-07 03:31:40 +00:00
Jeff Morriss 6deff94555 Add comments indicating that the DISSECTOR_ASSERT() routines should not be used to report malformed packets.
svn path=/trunk/; revision=34466
2010-10-11 01:28:22 +00:00
Jeff Morriss f12ef203b3 Revert 34191 and add some casts instead
svn path=/trunk/; revision=34193
2010-09-23 06:00:22 +00:00
Jeff Morriss 7cdf98c245 Use gsize (size_t) in a couple of places to make the Win64 build happy.
svn path=/trunk/; revision=34191
2010-09-23 01:14:44 +00:00
Sake Blok 7364bef1b3 When using a custom column, make it possible to select which occurrence to show if the field has multiple occurrences.
svn path=/trunk/; revision=34186
2010-09-22 20:56:14 +00:00
Anders Broman a009cc0605 Doxygen changes.
svn path=/trunk/; revision=33990
2010-08-29 10:47:38 +00:00
Anders Broman a96e6b2047 Doxygen changes.
svn path=/trunk/; revision=33981
2010-08-28 19:27:19 +00:00
Anders Broman a20bf7af0d Fix doxygen errors.
svn path=/trunk/; revision=33938
2010-08-26 19:40:08 +00:00
Stig Bjørlykke 90cb202dbd Added proto_item_prepend_text().
svn path=/trunk/; revision=33800
2010-08-14 17:24:21 +00:00
Martin Mathieson 7c4ec2e051 Expert severity was still overlapping with bits length, so separate them.
svn path=/trunk/; revision=32974
2010-05-26 13:53:17 +00:00
Martin Mathieson ee5c636603 Re-organise which FI bits are used to store expert severity and event info, in order to avoid clash with bit offset and length as added in 4413 (Improve bitview display).
The event info values were (mostly) done as though they were flags rather than values, but as it doesn't really make sense to combine events I changed them to use contiguous values.  They now use the 8 m.s. bits, so there are now 9 unused bits available for new uses.

svn path=/trunk/; revision=32945
2010-05-25 11:21:51 +00:00
Guy Harris 1b444c55fd Refer to the endianness arguments as "encoding" rather than
"representation" - we already use "representation" to refer to the text
representation of fields.

Change some routines with an endianness argument to make it a
representation argument instead; 

svn path=/trunk/; revision=32929
2010-05-24 06:06:17 +00:00
Guy Harris 998677339e Create a new REP_NA value for fields where there are no representations
from which to choose; use that for protocol fields in some protocols
(modify the CORBA generator to use it, and manually update the generated
CORBA dissectors accordingly).

svn path=/trunk/; revision=32777
2010-05-13 00:20:40 +00:00
Guy Harris 4ff4ebe3c5 Add REP_{BIG,LITTLE}_ENDIAN #defines, for possible future use in
proto_tree_add_item() and field definitions, and for current use if
somebody finds it more self-documenting (some dissectors already have
their own #defines for that purpose).

svn path=/trunk/; revision=32775
2010-05-12 22:35:56 +00:00
Anders Broman e87ddd657c From Jakub Zawadzki:
Fix copy&paste error + add support for proto_tree_add_bits API
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4413

svn path=/trunk/; revision=32634
2010-05-02 15:37:23 +00:00
Anders Broman ab825ec9d9 From Jakub Zawadzki:
- use function pointers instead of switch.
 - initalize ->match_type during first use of match_str() func.

svn path=/trunk/; revision=32576
2010-04-27 12:38:49 +00:00
Anders Broman fab55e4772 From Jakub Zawadzki:
Itroduce value_string_ext for faster value matching in value_strings.

svn path=/trunk/; revision=32574
2010-04-27 10:32:34 +00:00
Anders Broman c705b3bc88 From Jakub Zawadzki:
Add support for multi byte entries.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4413

svn path=/trunk/; revision=32525
2010-04-20 17:32:12 +00:00
Bill Meier 9aea38f51c Revise comment on use of 'display' field in hf[] entry to show
that for FT_BOOLEAN the display field contains the bit-field width
only when hf[] entry bitmask is non-zero.


svn path=/trunk/; revision=32476
2010-04-15 19:40:11 +00:00
Bill Meier 6812b68eb1 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

 From me: Fix a number of instances where the function prototype or
  the function definition wasn't changed so there was a mismatch 
  thus causing Windows (but not gcc) compilation errors.

svn path=/trunk/; revision=32365
2010-04-03 18:18:50 +00:00
Bill Meier d32b4c0758 Revert SVN #32360 until Windows compilation errors corrected.
svn path=/trunk/; revision=32361
2010-04-02 15:18:03 +00:00
Bill Meier 049f9eac85 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

svn path=/trunk/; revision=32360
2010-04-02 14:37:49 +00:00
Jaap Keuter bedb8715e9 Fix for bug 4565:
As a true 'pseudo' GLib function, act benign when presented a NULL pointer.

svn path=/trunk/; revision=32193
2010-03-15 08:14:58 +00:00
Guy Harris 500eb99cd9 Add a third date format, ABSOLUTE_TIME_DOY_UTC, to show UTC with the
date as YYYY/DDD, where DDD is a 1-origin day of year.  Move the formats
to a "time_fmt.h" file, included by the headers that use it.  Have
abs_time_to_str() and abs_time_secs_to_str() take the date format value,
rather than a Boolean "show this as UTC" flag, as an argument.  Document
the ABSOLUTE_TIME_ formats a bit better.  Use that format in the CCSDS
and VCDU dissectors, rather than having those dissectors do the
formatting themselves.

svn path=/trunk/; revision=32034
2010-02-27 19:01:27 +00:00
Stig Bjørlykke 9092486f58 Changed from using own defined GNUC_FORMAT_CHECK to G_GNUC_PRINTF
defined in GLib.  Removed epan/gnuc_format_check.h.

svn path=/trunk/; revision=31657
2010-01-25 13:20:53 +00:00
Gerasimos Dimitriadis 383f6a65dc Add _format_value variants of the proto_tree_add_bits function
for different header field types; now possible to add bits item
for FT_FLOAT and FT_INT types.

svn path=/trunk/; revision=31633
2010-01-23 16:17:17 +00:00
Gerald Combs 2efa26e0e1 Fix a double-free bug which was causing a crash. Our decryption buffer
length doesn't change, so allocate it just once. Add an expert item for
a successful decryption.

svn path=/trunk/; revision=31571
2010-01-19 19:28:30 +00:00
Guy Harris 8e236e55de For fields of type FT_ABSOLUTE_TIME, have the "display" value be one of
ABSOLUTE_TIME_LOCAL or ABSOLUTE_TIME_UTC, indicating whether to display
the date/time in local time or UTC. (int)ABSOLUTE_TIME_LOCAL ==
(int)BASE_NONE, so there's no source or binary compatiblity issue,
although we might want to eliminate BASE_NONE at some point and have the
BASE_ values used with integral types start at 0, so that you can't
specify BASE_NONE for an integral field.

svn path=/trunk/; revision=31319
2009-12-19 03:17:44 +00:00
Stig Bjørlykke 29a4a0789a Added expert info group PI_PROTOCOL.
svn path=/trunk/; revision=31308
2009-12-18 15:13:44 +00:00
Guy Harris a4b7135ce3 Rename BASE_STRUCTURE_RESET to BASE_DISPLAY_E_MASK, to clarify that it's
a mask to select the base_display_e value from a display field in a
header_field_info structure.

Never select that value by masking out the BASE_RANGE_STRING flag bit,
as that won't continue to work if more flag bits, or other bitfields,
are added.  Instead, mask with BASE_DISPLAY_E_MASK.

Note that the base_display_e value and BASE_RANGE_STRING flag are only
for integral field types, and clarify what BASE_DISPLAY_E_MASK is.

Give at least one of the reasons why hiding protocol fields is not
considered a good idea.

svn path=/trunk/; revision=31249
2009-12-12 03:15:28 +00:00
Kovarththanan Rajaratnam a2f211d07b Don't rely on G_STMT
svn path=/trunk/; revision=31042
2009-11-21 11:03:14 +00:00
Kovarththanan Rajaratnam 9bbbd6ef0e Rewrite macros to not use ternary operator
svn path=/trunk/; revision=31041
2009-11-21 10:45:35 +00:00
Jeff Morriss 8ec5a160ec Make sure no one calls PROTO_ITEM_SET_*(proto_tree_add_*) by forcing a compile error if they do.
svn path=/trunk/; revision=30645
2009-10-20 17:39:22 +00:00
Bill Meier bf85ecb308 Rename hfinfo.ref_count to hfinfo.ref_type since that's now how it's used.
svn path=/trunk/; revision=30216
2009-09-30 14:02:49 +00:00
Anders Broman c6d4c80371 From : Didier Gautheron
speed up a little proto_custom_set.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3972

svn path=/trunk/; revision=29789
2009-09-08 10:33:15 +00:00
Kovarththanan Rajaratnam 9c512f7cb4 Introduce TRY_TO_FAKE_THIS_REPR which is an optimization similar to the existing TRY_TO_FAKE_THIS_ITEM. The purpose of TRY_TO_FAKE_THIS_REPR is to avoid generating the string representation for the protocol item. There is no point in doing this if the protocol tree isn't visible. In this case the result will be discarded any way.
svn path=/trunk/; revision=29731
2009-09-06 07:24:54 +00:00
Kovarththanan Rajaratnam 4df25480b7 The frame dissector disables the TRY_TO_FAKE_THIS_ITEM() optimization by marking the protocol tree as permamently visible. It only needs to disable the optimization temporarily while it creates the protocol item it intends to use proto_item_append_string() on
svn path=/trunk/; revision=29730
2009-09-06 06:33:13 +00:00
Martin Mathieson 232747f501 Add missing semicolon.
svn path=/trunk/; revision=29553
2009-08-25 23:01:03 +00:00
Anders Broman 32e7cddf70 From Didier Gautheron:
move custom col set from  proto_tree_set_xxx() to
epan_dissect_fill_in_columns().
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3930

I'v added the new functions to the .h files.

svn path=/trunk/; revision=29551
2009-08-25 21:10:35 +00:00
Kovarththanan Rajaratnam 27f7d88c84 Also fake empty field_info's by gracefully handling NULL field_info pointer elsewhere.
svn path=/trunk/; revision=29490
2009-08-21 11:03:30 +00:00
Kovarththanan Rajaratnam 261a8406bc TRY_TO_FAKE_THIS_ITEM now fakes FT_PROTOCOL per default. If there are any users (e.g. proto_hier_stats.c, others?) that relies on FT_PROTOCOL nodes being created they'll now need to call the newly introduced epan_dissect_fake_protocols() to disable this optimization.
Also make use of TRY_TO_FAKE_THIS_ITEM in proto_tree_add_text_node(), proto_tree_add_none_format() and proto_tree_add_protocol_format().

svn path=/trunk/; revision=29380
2009-08-11 18:08:03 +00:00
Kovarththanan Rajaratnam 4e177a23c7 Use PITEM_FINFO.
svn path=/trunk/; revision=29357
2009-08-09 18:15:36 +00:00
Kovarththanan Rajaratnam 083729e02c Add PTREE_FINFO and use PITEM_FINFO when possible.
svn path=/trunk/; revision=29355
2009-08-09 17:57:31 +00:00
Kovarththanan Rajaratnam 3512e485ca Add PNODE_FINFO. We've been using PITEM_FINFO on proto_node's. This works because proto_item is typedefed to proto_node. We shouldn't rely on this since this is an implementation detail.
svn path=/trunk/; revision=29354
2009-08-09 17:33:23 +00:00
Jörg Mayer 45ab8d50d2 Warning fix: comma at end of enum
svn path=/trunk/; revision=29289
2009-08-04 07:50:49 +00:00
Anders Broman 2a80b47ce4 Whitespace change.
svn path=/trunk/; revision=29211
2009-07-28 09:26:18 +00:00
Stig Bjørlykke 221225e0f3 From Kovarththanan Rajaratnam via bug 3719:
This patch optimizes proto_tree_prime_hfid() + friends and
plugs a memleak in the process.

From me:
Removed unused hfindex in proto_tree_new_item()
Fixed ref_count entry in struct header_field_info.

svn path=/trunk/; revision=29137
2009-07-18 20:10:14 +00:00
Jaap Keuter d27c92e496 Add posibility to mark protocol as private. This prevents inadvertent Wiki access.
svn path=/trunk/; revision=27533
2009-02-24 17:24:03 +00:00
Gerald Combs 6d04f793f0 Back out r27047 and r27053.
svn path=/trunk/; revision=27062
2008-12-19 17:39:52 +00:00
Martin Mathieson 3633774826 Make proto_tree_add_bytes_format() (unused) behave as expected.
Was identical to proto_tree_add_bytes_format_value().

svn path=/trunk/; revision=27047
2008-12-18 17:08:26 +00:00
Stig Bjørlykke 5e5a674e76 Show both short and long protocol name in the Filter Expression dialog.
svn path=/trunk/; revision=26537
2008-10-24 07:48:09 +00:00
Jaap Keuter 0fde67dd54 From Andrew Narver:
Currently, if you call proto_tree_free on anything other than the root node of a tree 
the tree will get left in an inconsistent state.  This is because the parent is left pointing 
to the newly freed child.

The traversal code is updated, the parent node update is currently disabled since 
freeing is done for the complete tree only at this time, so there is no need to keep 
the parent node consistent.

svn path=/trunk/; revision=26466
2008-10-15 20:02:15 +00:00
Stig Bjørlykke 6012a91ebb Added an option to syntax check only a single field name.
svn path=/trunk/; revision=26405
2008-10-10 17:00:38 +00:00
Anders Broman da85c3dfab From Alexey Neyman :
This patch implements a function for dissecting bitfields with better control
over the resulting representation than the existing proto_tree_add_bitmask()
routine. This function will be used by reworked IPMI/ATCA dissector (bug 2048).

The function is described in README.developer. In short, the differences are as
follows:

- The new function does not require a hf_XXX field for the whole bitmask. When
the bitmask includes several unrelated fields, such hf_XXX field does not make
sense.

- The new function allows better control over the way the sub-item descriptions
are added to the top-level item. For example, proto_tree_add_bitmask() function
does not add non-enumerated integers, does not use true_false_string to display
boolean.

- The new function allows to specify "fallback" text for the top-level item
which is used if no items were added to the top-level item.

svn path=/trunk/; revision=25920
2008-08-04 20:41:43 +00:00
Anders Broman 876e751069 From Alexey Neyman :
Implement BASE_CUSTOM display type

svn path=/trunk/; revision=25870
2008-07-30 12:30:02 +00:00
Jeff Morriss acd338f422 Remove the (long deprecated) proto_tree_add_*_hidden() functions
svn path=/trunk/; revision=25820
2008-07-24 15:35:29 +00:00
Guy Harris 094911ef4f Rename arguments not to collide with function names, to avoid warnings
from -Wshadow, as noted by John Smith.

svn path=/trunk/; revision=25540
2008-06-23 20:15:30 +00:00
Richard van der Hoff bcfb45de67 fields passed into proto_tree_add_bits_* should have bits==0
svn path=/trunk/; revision=25074
2008-04-16 09:49:39 +00:00
Luis Ontanon 906d2f3cbb http://www.wireshark.org/lists/wireshark-dev/200803/msg00308.html
proto.[hc]
    define new APIs to allow delayed registration of protocol fields,
	so that dissectors with "flexible" fields  like xml, radius, diameter,
	snmp do not have to load their files at startup but can do so as late as possible.

gtk/dfilter_expr_dlg.c :
	have the expression dialog registering all prefixes so that all fileds appear in the dialog

tshark.c
	register all prefixes when called with -G

epan/radius_dict.l
epan/dissectors/packet-radius.c
epan/dissectors/packet-radius.h
	refactor registration to delay dictionary loading as long as possible



svn path=/trunk/; revision=24762
2008-04-03 22:13:52 +00:00
Stig Bjørlykke a2d1e9005d This patch adds support for configuration profiles, which can be used to
configure and use more than one set of preferences and configuration files.

This can be found in the "Configuration Profiles..." menu item from the Edit
menu, or by pressing Shift-Ctrl-A.  It's also possible to start wireshark
and tshark with a named profile by using the "-C ProfileName" option.
A new status pane in the main window will show the current profile.

The configuration files currently stored in the Profiles are:
- Preferences
- Capture Filters
- Display Filters
- Coloring Rules
- Disabled Protocols
- User Accessible Tables

The recent data are by design not added to the profile.

Planned future enhancements:
- make a more convenient function to switch between profiles
- add a "clone profile" button to copy an existing profile
- make the profiles list active and accept return as OK
- save users "Decode as" in the profile
- make new, clone and deletion of profiles more secure
- make some of the recent values available in the profile

This patch also fixes:
- setting default status pane sizes
- a bug setting status pane for packets when not having main lower pane.

svn path=/trunk/; revision=24089
2008-01-14 16:40:23 +00:00
Jaap Keuter abe4e72137 Describe text only field as "Text Item", shown in status bar.
Improve documentation headers.

svn path=/trunk/; revision=23938
2007-12-22 10:47:26 +00:00
Jaap Keuter 4c8455b1fd Clean up header field info comments.
svn path=/trunk/; revision=23872
2007-12-15 13:21:05 +00:00
Guy Harris 04938c7926 Reserve 20 bits for expert "event groups", to leave room for more.
Shuffle the expert severities down, and note that we have only 8 bits
available for FI_ flags unless you shrink the set of event groups and
shuffle them and the expert severities up.

svn path=/trunk/; revision=23731
2007-12-04 01:26:02 +00:00
Guy Harris ce635c2310 Severities are unsigned.
svn path=/trunk/; revision=23727
2007-12-03 23:02:09 +00:00
Guy Harris ebd47f95d1 Make the flags field a guint32, to make it clear that it's 32 bits.
Move the expert information bits to the top of that field, to avoid
collisions (we had a collision with the 0x00000004 bit).

svn path=/trunk/; revision=23726
2007-12-03 22:48:49 +00:00
Stig Bjørlykke 72af3183ab Added functionality to highlight the FCS bytes in Ethernet and IEEE 802.11
packets in the Packet Details View.

This "appendix" bytes are not copied with the Copy functions or in the
Export Selected Packet Bytes.

svn path=/trunk/; revision=22887
2007-09-17 12:12:02 +00:00
Luis Ontanon 9865b6346f As per Ulf's request add ${proto.field} macros that will use the value of the given field has in the last selected packet.
svn path=/trunk/; revision=22427
2007-07-30 23:32:47 +00:00
Anders Broman b688f9154a Split tvb_get_bits64 into tvb_get_bits8 tvb_get_bits16 tvb_get_bits32 and tvb_get_bits64
and use them in proto_tree_add_bits_ret_val().

svn path=/trunk/; revision=21828
2007-05-18 16:46:35 +00:00
Graeme Lunt cf56e76be9 Updated splash screen for Wireshark that shows the initialisation progress.
The splash screen shows a progress bar and a percentage complete - like the progress dialog.
As dissectors are initialised and handed off the name is shown. However, the names of plugin dissectors are not shown.
The update to the make-dissector-reg shell script has been tested, though I think generally the python version is used.


svn path=/trunk/; revision=21716
2007-05-07 17:55:42 +00:00
Anders Broman 43bb2aea51 Add:
proto_tree_add_bits_ret_val()
tvb_get_bits()
And modify
proto_tree_add_bits() not to return a value.
little endian is not yet implemented.

svn path=/trunk/; revision=21607
2007-04-28 12:13:25 +00:00
Anders Broman ccac0e7983 Change the signature of proto_tree_add_bits() and add proto_tree_add_bits_ret_val()
which will hopefully be more acceptable.
Change name of tvb_get_bits() in ansi_801

svn path=/trunk/; revision=21594
2007-04-26 06:39:29 +00:00
Anders Broman fea883ebec Add a new proto function proto_tree_add_bits() which adds bits to the tree
starting at the bit offset given for the number of bits indicated which wll also return
the value of the bits.
Experimental and for review, documentation to be updated.

svn path=/trunk/; revision=21556
2007-04-24 19:24:14 +00:00
Stephen Fisher 3288a39db2 From Sebastien Tandel:
copy paste hit again, here is a patch with the accurate declaration of
RVALS in proto.h
Thx gcc-4.1.2 for finding new ways of generating strict aliasing warnings :)

patch with accurate comment and declaration.


svn path=/trunk/; revision=21157
2007-03-23 18:48:57 +00:00
Stephen Fisher aa897723ff From Sebastien Tandel:
Here is an updated patch for proto_tree_add_item and the
range_string structure. The new macro RVALS() can be used as the macro
VALS() in the declaration of your hf_register_info with another
structure (range_string).  Be aware that you *have to* ORed the value of
the field display with BASE_RANGE_STRING constant and it can 'only' be
used with FT_(U)INT* types in a header_field_info.


svn path=/trunk/; revision=20805
2007-02-14 00:39:48 +00:00
Stephen Fisher b68220cc22 Fix indentation of field_info struct definition
svn path=/trunk/; revision=20556
2007-01-25 20:47:37 +00:00
Guy Harris 0fb0fa8794 Put
#ifdef __cplusplus
	extern "C" {
	#endif /* __cplusplus */

		...

	#ifdef __cplusplus
	}
	#endif /* __cplusplus */

wrappers into some header files, for the benefit of C++ plugins.  Also,
add multiple-include protections.

svn path=/trunk/; revision=20485
2007-01-18 18:43:30 +00:00
Guy Harris 44c0624bd9 Add a WIRESHARK_RUN_FROM_BUILD_DIRECTORY environment variable on UN*X;
if set, and if the program isn't running with additional privileges,
it'll treat the directory in which the program is found as the data
directory.

If, on Windows, the version-number subdirectory of {data
directory}\plugins doesn't exist (which is assumed to mean that the
program is being run from the build directory), or if, on UN*X,
WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set, the plugin directory is the
"plugins" subdirectory of the data directory, and all subdirectories of
that directory are scanned for plugins, as the "plugins" subdirectory of
the build directory contains subdirectories for the plugins; this means
that if we're running from the build directory, we'll find the plugins
we built in the build tree.

When generating the wireshark-filter man page, run tshark with
WIRESHARK_RUN_FROM_BUILD_DIRECTORY set, so it uses the plugins from the
build to generate the list of filters.

svn path=/trunk/; revision=20261
2007-01-02 06:49:40 +00:00
Ronnie Sahlberg 41c258daf3 create a nice helper to dissect bitmasks and implement some test useage of it in the scsi dissector
svn path=/trunk/; revision=20002
2006-11-27 14:50:23 +00:00
Guy Harris d3fed959bc Have separate proto_construct_match_selected_string() and
proto_can_match_selected() routines, to more clearly separate the two
functions - but have them both call the same underlying routine, so
they both make the same decisions as to whether a match-selected string
can be constructed or not.

svn path=/trunk/; revision=19976
2006-11-24 18:25:23 +00:00
Guy Harris 37a6c02697 Rename proto_construct_dfilter_string() to
proto_construct_match_selected_string() to indicate what it does - and
have it return a Boolean indication of whether the string could be
built, returning the string through a pointer, and, if that pointer is
null, have it just return the Boolean and not construct the string.

Get rid of proto_can_match_selected() -
proto_construct_match_selected_string() can be used for that, which
means we have only one piece of code that knows whether a "match
selected" string can be constructed or not.

Have proto_construct_match_selected_string() support matching
zero-length FT_NONE (and FT_PCRE, but that shouldn't happen) fields even
if there's no epan_dissect_t, as such a match just checks whether the
field is present.

svn path=/trunk/; revision=19967
2006-11-23 21:16:46 +00:00
Graeme Lunt 23937f82c7 A new field information flag, FI_URL, to indicate a field contains a URL.
This is used to display the field underlined and to allow the user to double-click on it (like FT_FRAMENUM) to open the URL in the configured browser. 
Example usage in the x509ce and logotype certificate extensions. 


svn path=/trunk/; revision=19383
2006-09-30 14:37:09 +00:00
Gerald Combs 9e23f31e5f Add support for reading from stdin under Windows. Based on a patch sent
in last year by Gianluca Varenni.

Add partial support for reading from named pipes (currently disabled).

Move utf_8to16() and utf_16to8() to a separate module (unicode-utils.[ch])
so that we don't have to cut and paste code in dumpcap.c.

Fix up whitespace.

svn path=/trunk/; revision=19291
2006-09-22 21:14:54 +00:00
Tomas Kukosa 539102ca60 - new function ssl_dissector_delete()
- register H.225.0 over TLS (configurable port 1300)
- register SIP over TLS (fixed port 5061)
- new function proto_tree_get_root()

svn path=/trunk/; revision=19059
2006-08-28 07:05:02 +00:00
Ulf Lamping df377ffcc5 fix a comment
svn path=/trunk/; revision=18527
2006-06-21 07:26:39 +00:00
Gerald Combs f7e38bd5e6 Change ETH_VAR_IMPORT to WS_VAR_IMPORT. Try to fix a duplicate variable
definition in the Catapult DCT2000 code.

svn path=/trunk/; revision=18524
2006-06-20 18:30:54 +00:00
Anders Broman 996d4db495 Ethereal->Wireshark
svn path=/trunk/; revision=18234
2006-05-28 19:49:07 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +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
Anders Broman 61b223303a From Greg Morris:
Modification to (proto.h) is made to add an additional expert group type of PI_REQUEST_CODE to allow Request tag information to be passed to the expert tap. This is for such reasons where a dissector would like to echo specific information about certain types of requests. For example: NCP connection request is really a request not a REPLY_CODE. Same is true for the TCP SYN request.

Changes to packet-ncp.c
1. Server broadcast message flag. Now indicates if the message is a pending message or an oplock clear notification.
2. Cleanup of packet signature detection process. Previous method had some flaws so I redesigned it. Appears to be solid now.
3. Echo NCP Server Session information to expert tap.
 
Note on item #3: NCP Connection+Task = NCP Session, a Single connection can have many tasks. The server sees each connection/task as a unique session. For this reason the NCP session information is now echoed to the expert composite statistics so that you can easily identify the different NCP processes and sessions. It is important to NCP analysis to understand that each session is most likely a different program on the requesting host sharing the same NCP connection.
 
Changes to packet-ncp2222.inc
1. Comment out the echo of NCP connection info to expert tap. Replaced by NCP sessions.
2. Add displayEID in request decode (resolves Coverity defect for dead code in NCP dissector)
 
Changes to ncp2222.py
1. Fix for endian display of bindery object type in NCP 0x1720.
2. Fix for size of bindery object type to 2 bytes instead of 4 to match other bindery NCP's.

svn path=/trunk/; revision=17636
2006-03-15 18:56:35 +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
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
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 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
Guy Harris 92cc6da06c Make "REPORT_DISSECTOR_BUG()" (and the macros that use it) call
"abort()" if the ETHEREAL_ABORT_ON_DISSECTOR_BUG environment variable is
set; this is for debugging purposes, to make it easier to get a stack
trace of the offending call.

svn path=/trunk/; revision=16013
2005-09-26 20:34:13 +00:00
Guy Harris aba53424dd Move the definition of GNUC_FORMAT_CHECK() to its own header, use it in
column-utils.h, and add it to expert.h, so we check the arguments to
"expert_add_info_format()", at least if the format argument is a
constant string.

Fix some more calls to "expert_add_info_format()" to pass it a format
string.

Don't record BoundsError exceptions as expert events - they merely
reflect a capture done with a snapshot length too short to capture all
of the packet (any case where it's caused by something else is a bug).

svn path=/trunk/; revision=15776
2005-09-13 04:00:47 +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
Tomas Kukosa b9b159713a get rid of few warnings
svn path=/trunk/; revision=15700
2005-09-06 14:18:49 +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
Ulf Lamping 06c86303e7 The protocol item in the protocol tree will have a gray background now, which makes it much better visible.
Add some more optional flags to the protocol items, so more "special cases" can be marked in the protocol tree.

New flags:
/** The protocol field has a bad checksum */
FI_CHECKSUM_ERROR
/** The protocol field has an unusual sequence (e.g. TCP window is zero) */
FI_SEQUENCE_WARNING
/** The protocol field has a bad sequence (e.g. TCP segment is lost) */
FI_SEQUENCE_ERROR

svn path=/trunk/; revision=15499
2005-08-21 15:23:48 +00:00
Jörg Mayer 44cbbf1039 Stefan Rompf:
Fix warnings of type:
proto.c:2219: warning: ISO C forbids conditional expr with only one void side


svn path=/trunk/; revision=15156
2005-07-30 16:15:23 +00:00
Jörg Mayer 1fbacc90d3 Revert my previous patch - something else was seriously screwed up
svn path=/trunk/; revision=15118
2005-07-27 16:05:41 +00:00
Jörg Mayer 1a3afc844f gcc-4.0 (GCC) 4.0.2 20050720 (prerelease) (SUSE Linux)
fails when trying to use varargs. Due to a missing include
config.h we were using varargs with proto.h


svn path=/trunk/; revision=15117
2005-07-27 15:08:22 +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
Ulf Lamping e8939e1f60 fix three doxygen warnings
svn path=/trunk/; revision=14959
2005-07-19 20:49:28 +00:00
Tomas Kukosa bab34b522b new field type FT_GUID
svn path=/trunk/; revision=14845
2005-07-04 13:04:53 +00:00
Guy Harris b67f63560e More constification.
svn path=/trunk/; revision=14740
2005-06-24 02:51:01 +00:00
Gerald Combs 3a6c9ab134 Fix a format string vulneratility in the AFP dissector identified
by iDEFENSE.  Add constant format strings to proto_item_append_text()
in a bunch of other dissectors.  Copy a comment from proto.c to proto.h.

svn path=/trunk/; revision=14713
2005-06-20 19:35:58 +00:00
Jörg Mayer 488483855f Get rid of several megabytes worth of warnings about
"discards qualifier from assignment".

svn path=/trunk/; revision=14663
2005-06-16 17:23:34 +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
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
Ulf Lamping 58e7915cc0 add a DISSECTOR_ASSERT_NOT_REACHED() macro
svn path=/trunk/; revision=13870
2005-03-22 23:59:54 +00:00
Ulf Lamping e378098855 from Micheal Duigou: add some doxygen tags and some changes to README.developer
svn path=/trunk/; revision=13725
2005-03-11 21:14:38 +00:00
Guy Harris 2617e40356 Add a REPORT_DISSECTOR_BUG() macro to let caller-specified messages be
used in DissectorError exceptions.

svn path=/trunk/; revision=13079
2005-01-17 00:18:39 +00:00
Guy Harris 2bdef3c122 Rename the FieldError exception to DissectorError.
Add a DISSECTOR_ASSERT() macro, which is the usual type of assertion
macro, but throws a DissectorError exception with a message giving the
flien and line number and the failed test as a string.  Use that macro
in "alloc_field_info()".

Report that exception in the Info column and the protocol tree, as well
as logging the exception failure with g_warning().

svn path=/trunk/; revision=13078
2005-01-16 23:30:55 +00:00
Guy Harris 4c45795dab Constify a pointer, so that the array of pointers to ett_ values can be
const, although the pointers can't point to consts (as the values get
filled in as they're registered).

svn path=/trunk/; revision=12981
2005-01-07 12:56:21 +00:00
Guy Harris 55465228b2 "proto_registrar_get_byname()" doesn't modify its argument, so make it
"const char *".

svn path=/trunk/; revision=12888
2004-12-31 02:02:19 +00:00
Gilbert Ramirez f676f7107b Add a "-G fields2" option which is like "-G fields", but extends the field
records by tw fields: base (for integers), and blurb

Add a "-G values" option which shows value strings and true_false strings for
the fields that have them.

svn path=/trunk/; revision=11954
2004-09-10 15:21:20 +00:00
Guy Harris c68f62210f Add "tvb_get_ntoh64()" and "tvb_get_letoh64()" routines to fetch 64-bit
integers.

Make FT_INT64 and FT_UINT64 add numerical values, rather than byte-array
values, to the protocol tree, and add routines to add specified 64-bit
integer values to the protocol tree.

Use those routines in the RSVP dissector.

svn path=/trunk/; revision=11796
2004-08-22 00:31:58 +00:00
Olivier Biot a11651260b From Lars Roland: With this patch print.(c/h) and ps.(c/h) don't belong to
the DISSECTOR_SUPPORT_xy files any longer and as a consequence they 
won't be linked into libethereal.

svn path=/trunk/; revision=11559
2004-07-29 00:11:14 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Ulf Lamping 8da8e54fa6 remove FI_LINK again,
as this info can be derived from the presence of the FT_FRAMENUM field

svn path=/trunk/; revision=10901
2004-05-15 00:52:02 +00:00
Ulf Lamping 1314808bd5 add support to link from specially marked fields to related packets,
a doubleclick will follow the link

svn path=/trunk/; revision=10892
2004-05-14 15:55:37 +00:00
Ulf Lamping 8228cd1b79 prepared for generate documentation using doxygen,
added lot's of new (hopefully correct) comments

svn path=/trunk/; revision=10841
2004-05-10 23:13:55 +00:00
Ulf Lamping b3dc21eb5f use GNUC_FORMAT_CHECK in every appropriate function
svn path=/trunk/; revision=10838
2004-05-10 14:02:17 +00:00
Ulf Lamping 685195c073 first try to get rid of annoying double definition of the proto_tree_add_xy_fromat functions,
because of GNUC printf format checks

svn path=/trunk/; revision=10837
2004-05-10 08:29:18 +00:00
Guy Harris 15af0f656f From Lars Roland: add support for building a libethereal.dll with MSVC:
add a config.nmake option to control whether to build
	libethereal.dll or not;

	remove "./wiretap" from PATH to prevent problems due to
	wrongly-loaded files;

	build dissector.lib with MSVC;

	move "print.c" and "ps.c" to the dissector helpers, as "print.c"
	imports variables from packet-frame.c and packet-data.c, which
	are in libethereal;

	move "g711.c" out of the dissector helpers, as they're used only
	by Ethereal in a tap, not in Tethereal or in any dissector;

	add a .def file for libethereal;

	arrange to declare global variables exported from libethereal
	with "__declspec(dllimport)" when building programs that import
	those variables;

	update the NSIS installer.

Make the "configure" script define ETH_VAR_IMPORT as "extern".

svn path=/trunk/; revision=10834
2004-05-09 10:03:41 +00:00
Ulf Lamping b964421aec added changed some comments to better reflect current "behaviour"
svn path=/trunk/; revision=10833
2004-05-09 09:26:31 +00:00
Olivier Biot 8d29376f42 Squelch a compiler warning (extraneous extern on struct).
Fix the PROTO_ITEM_IS_XXX and PROTO_ITEM_SET_XXX macros by replacing
the if(x) with trigraphs so the macros can still be used in subsequent
conditional tests.

svn path=/trunk/; revision=10758
2004-05-01 20:15:56 +00:00
Ulf Lamping 6faeb75881 prevent null pointer exception
svn path=/trunk/; revision=10755
2004-05-01 18:39:07 +00:00
Ulf Lamping d9118dc089 add PROTO_ITEM_SET_HIDDEN() and PROTO_ITEM_SET_GENERATED(),
this sets flags for later rendering of the field data

svn path=/trunk/; revision=10752
2004-05-01 15:15:08 +00:00
Ulf Lamping 37fc156dc6 removed unused things
svn path=/trunk/; revision=10740
2004-04-30 06:56:15 +00:00
Guy Harris 044f075c66 From Tomas Kukosa: add APIs to get the parent of a protocol tree item
and the item N levels up from a protocol tree item.

svn path=/trunk/; revision=10486
2004-03-25 23:55:21 +00:00
Guy Harris a6ed2d499a From Tomas Kukosa: BER dissector enhancements and proto.c updates to
support them.

From Ronnie Sahlberg: Kerberos updates with new constants from the
current draft, decryption and dissection of Kerberos blobs, and changes
to work with the changed BER dissector.

svn path=/trunk/; revision=10479
2004-03-25 09:18:03 +00:00
Richard Sharpe fa9874ef73 Apply the patches from Tadaaki Nagao for a global version of disabled
protocols ...

svn path=/trunk/; revision=9538
2004-01-03 18:40:08 +00:00
Gilbert Ramirez 058ef64db8 Add the ability to print packet dissections in PDML (an XML-based format)
to tethereal. It could be added to Ethereal, but the GUI changes to
allow the user to select PDML as a print format have not been added.

Provide a python module (EtherealXML.py) to help parse PDML.

Provide a sample app (msnchat) which uses tethereal and EtherealXML.py
to reconstruct MSN Chat sessions from packet capture files. It produces
a nice HTML report of the chat sessions.

Document tethereal's PDML and EtherealXML.py usage in doc/README.xml-output

Update tethereal's manpage to reflect the new [-T pdml|ps|text] option

svn path=/trunk/; revision=9180
2003-12-06 06:09:13 +00:00
Guy Harris fa1de9d824 It turns out the protocol tree parent link was used, so we need it in
our new scheme.

svn path=/trunk/; revision=9172
2003-12-04 19:53:54 +00:00
Guy Harris f0b9d12b6a Don't use GNodes for the protocol tree, put the sibling pointer, and
pointers to the first *and* last child, in the "proto_node" structure
itself.  That saves us one level of indirection and memory allocation,
and lets us append to a tree by appending to the last child directly,
rather than having to scan through the list of siblings of the first
child to find the end of that list.

svn path=/trunk/; revision=9171
2003-12-04 10:59:34 +00:00
Guy Harris dcd98ae8d3 The "ptr_u" unions no longer have a "next" pointer - they now just have
one member - or have one that's not used, so get rid of those unions.

svn path=/trunk/; revision=9151
2003-12-03 09:28:26 +00:00
Guy Harris ed2ae2d8d3 Instead of requiring slab-allocated structures to have a "next" pointer,
when adding them to the free list, cast the pointer to the structure to
a pointer to a "freed_item_t" which contains the "next" pointer.

This reduces the memory requirement for some of those structures, and
leaves us free to slab-allocate structures that have a "next" pointer
for other reasons.

svn path=/trunk/; revision=9150
2003-12-03 08:53:37 +00:00
Guy Harris bd9f96738c From Didier Gautheron: put an "fvalue_t" structure into a "field_info"
structure, rather than separately allocating "fvalue_t"s and having the
"field_info" structure point to them - this appears to speed up protocol
tree construction a bit.

svn path=/trunk/; revision=9146
2003-12-02 21:15:49 +00:00
Ronnie Sahlberg eb39a99b2c Speed updates
create generic macros for allocating/freeing structures.

remove one more slow GMemChunk and replace it with a simple linked list

~4% speed improvement in my tests.

the allocated data is never freed.   this may be a problem if ethereal is
ever supported on a platform lacking resource tracking but makes the
implementation faster and simpler.

svn path=/trunk/; revision=9095
2003-11-26 12:22:22 +00:00
Ronnie Sahlberg 9d88e58e51 remove another slow GMemChunk from ethereal making ethereal a little bit faster
svn path=/trunk/; revision=9085
2003-11-25 14:07:45 +00:00
Guy Harris 122dd3959c Make the recent epan/proto.{c,h} change compile.
svn path=/trunk/; revision=9075
2003-11-24 22:11:55 +00:00
Ronnie Sahlberg fa1ee7667b performance enhancement to proto.c
Removed the GMemChunk used to allocate/free field_info structures
and used a free list to store the freed structs until they are allocated again.

Ethereal will allocate more field_info structs as it needs to but never free them. Instead the are just placed in a cheap and fast free list so that if we
want to use the struct again, this will be fast.

This affects the speed of the two functions
alloc_field_info() that should be slightly faster now
free_field_info() that was replaced with a 2 line macro.

All in all  my testing suggests that ethereal is 2-3% faster with this patch.

svn path=/trunk/; revision=9073
2003-11-24 21:12:10 +00:00
Ronnie Sahlberg 7eef1914e0 Performance fix
In the GPROF logs proto_registrar_get_nth() used to take anything between 2.5 and 5.5% of the time.

Replace the GLIB array with a handroleld one for one of the private structures.

the function should now be virtually zero cost
and thus ethereal should be 2.5-5.5% faster on those traces.

anyone that wants to, please rerun GPROF with this fix and see what has changed.

svn path=/trunk/; revision=9058
2003-11-21 14:58:49 +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 0c0ef44095 Make the "fvalue_set" methods for types whose value is allocated free
any previously-allocated version first, so that they don't leak memory.

From Olivier Biot: add a "proto_item_append_string()" routine, to append
to the string value a protocol tree item has.

svn path=/trunk/; revision=8821
2003-10-29 23:48:14 +00:00
Guy Harris e4e0150ffa From Matthijs Melchior:
support for registering fields after all the protocol
	    registration routines are called (i.e., adding fields to the
	    named field tree as they're registered);

	fix the GTK 2.x version of the field list dialog to show the
	    correct name.

svn path=/trunk/; revision=8248
2003-08-25 00:15:02 +00:00
Guy Harris ca318813a4 Rename "proto_alloc_dfilter_string()" to
"proto_construct_dfilter_string()", to more accurately reflect what it
does.

Give it, and "proto_can_match_selected()", an "epan_dissect_t *"
argument, which replaces the raw data pointer argument to
"proto_construct_dfilter_string()".

For fields that don't have a type we can directly filter on, we don't
support filtering on the field as raw data if:

	the "epan_dissect_t *" argument is null;

	the data source tvbuff for the field isn't the tvbuff for the
	"epan_dissect_t" in question (i.e., it's in the result of a
	reassembly, and "frame[N:M]" can't get at it).

Trim the length the raw data in the case of such a field to the length
of the tvbuff for the "epan_dissect_t" in question, so we don't go past
it.  Fetch the raw data bytes to match from that tvbuff.

Have "proto_construct_dfilter_string()" return a null pointer if it
can't construct the filter string, and have "protocolinfo_packet()" in
the tap-protocolinfo tap ignore a field if
"proto_construct_dfilter_string()" can't construct a filter string for
it - and have it pass NULL as the "epan_dissect_t *", for now.  If
somebody decides it makes sense to dump out a "frame[N:M] =" value for
non-registered fields, it can be changed to pass "edt".

svn path=/trunk/; revision=7635
2003-05-03 00:48:37 +00:00
Guy Harris 1025817e84 Add a "proto_item_set_end()" routine that sets the length of an item
given a tvbuff/offset pair referring to the byte past the end of the
item.  Use it in one place in the SMB dissector (there are plenty of
other places where it could be used as well).

svn path=/trunk/; revision=7603
2003-04-29 21:27:19 +00:00
Guy Harris ab552d3746 Get rid of BASE_BIN - it's just the same as BASE_DEC, but people seemed
to be using it for stuff that should be hex, and for stuff that should
be Boolean.  Use BASE_DEC if it should be decimal, BASE_HEX if it should
be hex, and make it Boolean if it should be Boolean.

svn path=/trunk/; revision=7053
2003-01-31 03:17:56 +00:00
Guy Harris 7b743f7d7d Make the "strings" pointer in a "header_field_info" structure a const
pointer, and put "const" into the casts in "VALS()" and "TFS()" macros,
so we don't un-constify pointers to "value_string" arrays and
"true_false_string" structures.

Make some things "const" to keep the compiler happy with the previous
change.

svn path=/trunk/; revision=6684
2002-11-28 01:46:14 +00:00
Jörg Mayer 48be4e530d 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=6116
2002-08-28 20:41:00 +00:00
Guy Harris 6e56c25c9d From Ulf Lamping: add a new FT_FLOAT type, for single-precision
floating-point numbers, and display all the significant digits for both
single-precision and double-precision floating-point numbers in the
protocol tree, not just what "%g" does (6 digits).

Put in comments explaining how the length of filter strings is computed,
and fix some of the computations.

svn path=/trunk/; revision=6081
2002-08-24 19:45:28 +00:00
Jörg Mayer 3105ee542f Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c
and inet_ntop.c for now (can't estimate the consequences).

svn path=/trunk/; revision=5928
2002-08-02 21:29:45 +00:00
Guy Harris 73ef5a2753 WinPcap 2.3's <pcap.h> includes <packet32.h>, and WinPcap 2.3's
<packet32.h> includes <winsock2.h>; we include that rather than
<winsock.h>, to avoid errors due to conflicting declarations in
<winsock.h> and <winsock2.h>.

svn path=/trunk/; revision=5742
2002-06-23 10:32:36 +00:00
Guy Harris e390d7e0cc Make the "-G" flag take an argument. If no arugment is specified, or if
the argument is "fields", dump out a table of the fields, as we
currently do; if the argument is "protocols", dump out a table of the
protocols.

svn path=/trunk/; revision=5462
2002-05-14 10:15:12 +00:00
Guy Harris 30f02bc99c Move the code to build the balanced tree of fields into "proto_init()",
move the code from "dfilter_lookup_token()" into
"proto_registrar_get_byname()", and get rid of "dfilter_lookup_token()"
and have its callers call "proto_registrar_get_byname()" instead.

svn path=/trunk/; revision=5287
2002-04-29 07:55:32 +00:00
Guy Harris 50155a975d From Phil Williams: support for looking up fields by name.
Clean up some white space, and one non-extern declaration in
"epan/proto.h".

svn path=/trunk/; revision=5201
2002-04-18 20:19:10 +00:00
Guy Harris 5de2533f2d Start assigning ett_ values at 0, rather than 1; get rid of the reserved
ETT_NONE entry.

Initialize the "tree_type" field of a "field_info" structure to -1,
meaning "this has not been given a subtree".  Add checks before using
that field that it's in range.  That way, you have to create a subtree
before putting protocol tree items under another item.

We allocate the "tree_is_expanded" array when we've registered all
dissectors; there's no need to allocate it while we're registering
dissectors and, in fact, doing so means we leak memory (the memory for
the version we allocated while registering dissectors).

svn path=/trunk/; revision=5068
2002-04-01 02:00:53 +00:00
Guy Harris 6a21dc7e44 Don't give tvbuffs names; instead, give data sources names, where a
"data source" has a name and a top-level tvbuff, and frames can have a
list of data sources associated with them.

Use the tvbuff pointer to determine which data source is the data source
for a given field; this means we don't have to worry about multiple data
sources with the same name - the only thing the name does is label the
notebook tab for the display of the data source, and label the hex dump
of the data source in print/Tethereal output.

Clean up a bunch of things discovered in the process of doing the above.

svn path=/trunk/; revision=4749
2002-02-18 01:08:44 +00:00
Guy Harris e0828c513d The typedef in "epan/value_string.h" declares "value_string" to be a
typedef for "struct _value_string"; as such, the incomplete structure
declaration in "epan/proto.h" should declare "struct _value_string", not
"struct value_string", and casts and declarations in that header should
also use "struct _value_string", not "struct value_string".

svn path=/trunk/; revision=4699
2002-02-05 22:10:20 +00:00
Guy Harris 7494218b47 "proto_tree_is_visible" no longer exists as a global variable, so remove
its declaration.

svn path=/trunk/; revision=4477
2002-01-04 08:56:11 +00:00
Gilbert Ramirez 791f5774d0 Provide for per-protocol-tree data in the proto_tree code.
Put a hash-table of "interesting" fields in the per-proto-tree data.
The dfilter code records which fields/protocols are "interesting" (by which
I mean, their value or existence is checked). Thus, the proto_tree routines
can create special arrays of field_info*'s that are ready for the dfilter
engine to use during a filter operation.

Also store the "proto_tree_is_visible" boolean, renamed "visible", in
the per-proto-tree data.

Move epan_dissect_t to its own header file to make #include dependencies
easier to handle.

Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t*
as an argument.

epan_dissect_new() needs to be followed by epan_dissect_run() for the
dissection to actually take place. Between those two calls,
epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to
prime the empty proto_tree with the "intersesting" fields from the dfilter_t.

svn path=/trunk/; revision=4422
2001-12-18 19:09:08 +00:00
Gilbert Ramirez f1b64de80e Dfilter code finds field under *any* parent's subtree, not just
the parent under which the field was registered.

This is the *unoptimized* version, to give developers something
to use while the optimized version is being created.

svn path=/trunk/; revision=4351
2001-12-07 03:39:26 +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
Ed Warnicke 89babba223 This should be the final bit of removing the dissect_data symbol
from being required by anyone other than packet-data.c.
It can now be accessed with call_dissector() with the name "data".
dissect_data is now also of dissect_t.

svn path=/trunk/; revision=4271
2001-11-26 05:41:15 +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
Guy Harris 4a5538085f Get rid of NullTVB, the "compat_top_tvb" member of the "packet_info"
structure, the check for a null tvbuff pointer in "alloc_field_info()",
and the "tvb_create_from_top()" macro; they're no longer needed, as
there's no non-tvbuffified dissector code remaining.

svn path=/trunk/; revision=4205
2001-11-15 10:58:51 +00:00
Guy Harris 4b0bce7f97 Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.

svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
Guy Harris dffa2a989a Get rid of a bunch of stuff that was there to support non-tvbuffified
dissectors and that's no longer needed.

svn path=/trunk/; revision=4112
2001-10-31 05:59:20 +00:00
Guy Harris 1d42c94b05 Make the resolution for time values be nanoseconds rather than
microseconds.

Fix some "signed vs. unsigned" comparison warnings.

svn path=/trunk/; revision=3934
2001-09-14 07:10:13 +00:00
Guy Harris fbe8da33f5 Add a "proto_item_append_text()" routine, which is like
"proto_item_set_text()" except that it appends the result of the
formatting to the item's current text, rather than replacing the item's
current text.  Use it in the DNS dissector.

svn path=/trunk/; revision=3880
2001-08-29 00:51:10 +00:00
Guy Harris aa4cd01b9b Get rid of "proto_tree_add_notext()" - if you create a subtree using it,
but, before you set the text, you throw an exception while putting stuff
under the subtree, you end up with an absolutely blank protocol tree
item, which is really gross.  Instead of calling
"proto_tree_add_notext()", call "proto_tree_add_text()" with at least a
minimal label - yes, it does mean you do some work that will probably be
unnecessary, but, absent a scheme to arrange to do that work if it *is*
necessary (e.g., catching exceptions), the alternative is an ugly
protocol tree display.

svn path=/trunk/; revision=3879
2001-08-28 08:28:19 +00:00
Guy Harris cc21ec8124 Do __attribute__ stuff if the GCC version number is greater than or
equal to 2, not just if it's equal to 2 - GCC 3.0 makes it 3, not 2....

svn path=/trunk/; revision=3765
2001-07-22 10:25:50 +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 2851b7ef76 Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.

If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.

Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.

"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.

"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".

Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".

Before pushing a new field-description message onto the statusbar, pop
the old one off.

Get rid of an unused variable (set, but not used).

svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
Ed Warnicke f5cf9c8dca Added two new arguments to epan_init() and proto_init() to
allow the passing of register_all_protocols() and
register_all_protocol_handoffs() through epan_init() to proto_init().
This allows the removal of the compile time dependence of proto.c
on register.h.  Modified dftest.c, tethereal.c, and gtk/main.c to
use the new style epan_init() and depend on register.h.

svn path=/trunk/; revision=3237
2001-04-02 00:38:36 +00:00
Ed Warnicke cb21a9735a Added a function proto_get_id_by_filter_name() function to proto.{c,h}
to allow the lookup of proto_ids by filter_name.

svn path=/trunk/; revision=3235
2001-04-01 22:50:08 +00:00
Jeff Foster 395b68ea19 Changes required to support multiple named data sources.
Tvbuffers changed to added the data source name,
GUI and printing code changed to support these changes
and display the multiple hex views.

svn path=/trunk/; revision=3165
2001-03-23 14:44:04 +00:00
Gilbert Ramirez 540f564993 Calculate the height and width of m_r_font globally, since various
routines need it.

When a user clicks on a hex digit or on the corresponding character
(the "text dump" portion) in the hex dump, find the field in the
proto_tree that the byte corresponds to, expand the GtkCTree so that
the field is viewable, select the field, and center it vertically.
LanAlyzer has this feature, and I've missed it in Ethereal.

svn path=/trunk/; revision=3096
2001-03-02 23:10:12 +00:00
Guy Harris bea00e22cf In a display filter expression, make a field name refer to any of the
fields with that name.

svn path=/trunk/; revision=3030
2001-02-13 18:34:51 +00:00
Gilbert Ramirez 8f1fff2e6a Create a more modular type system for the FT_* types. Put them
into epan/ftypes.

Re-write display filter routines using Lemon parser instead of yacc.
Besides using a different tool, the new grammar is much simpler, while
the display filter engine itself is more powerful and more easily extended.

Add dftest executable, to test display filter "bytecode" generation.
Add option to "configure" to build dftest or randpkt, both of which are not
built by default.

Implement Ed Warnicke's ideas about dranges in the new display filter and
ftype code.

Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered
as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree,
while FT_PROTOCOL is used for protocols. This was necessary for being
able to make byte slices (ranges) out of protocols, like "frame[0:3]"

Win32 Makefile.nmake's will be added tonight.

svn path=/trunk/; revision=2967
2001-02-01 20:21:25 +00:00
Guy Harris 8b51643203 "Decode As" dialog, from David Hampton.
svn path=/trunk/; revision=2965
2001-02-01 07:34:33 +00:00
Guy Harris e7ea7a34e9 Clean up the dissector registration up a bit - arrange that all plugins
be loaded and their initialization routines called in right after we
call the initialization routines for built-in dissectors, but don't call
their handoff registration routines yet, and then call the handoff
registration routines right after calling the handoff registration
routines for built-in dissectors.

Do all that in "proto_init()", rather than "epan_init()".

That way, we call all dissector registration routines together, and then
call all dissector handoff registration routines together; all the
registration routines are called before any handoff registration
routines, as is required, and, as "proto_init()" is called by
"epan_init()" before "dfilter_init()" is called, all filterable fields
have been registered before "dfilter_init()" is called, and no plugins
have to call "dfilter_init()" themselves to get their fields registered.

Remove pointers to "dfilter_init()" and "dfilter_cleanup()" from the
plugin address table, as plugins shouldn't be calling them any more, and
remove calls to them from plugins.

svn path=/trunk/; revision=2940
2001-01-26 06:14:53 +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 ee1b884ee9 Tvbuffify the STP dissector, have it register itself and have the LLC
dissector call it through a handle, and make it static.

Give "dissect_data()" an "offset" argument, so dissectors can use it to
dissect part of the packet without having to cook up a new tvbuff.

Go back to using "dissect_data()" to dissect the data in an IPP request.

svn path=/trunk/; revision=2651
2000-11-16 07:35:43 +00:00
Gilbert Ramirez 83ec54675c First step in moving core Ethereal routines to libepan.
svn path=/trunk/; revision=2458
2000-09-27 04:55:05 +00:00