Commit Graph

508 Commits

Author SHA1 Message Date
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 558d6a761e Make buildbot happy again...
svn path=/trunk/; revision=34189
2010-09-22 22:46:36 +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
Stig Bjørlykke 9562d30a13 Allow for proto_tree_add_item() with FT_ABSOLUTE_TIME and FT_RELATIVE_TIME
to have length == 4 (only seconds).

svn path=/trunk/; revision=34078
2010-09-08 09:33:53 +00:00
Anders Broman 1b9da2fcf0 Fix indentation.
svn path=/trunk/; revision=33838
2010-08-18 08:09:37 +00:00
Stig Bjørlykke 90cb202dbd Added proto_item_prepend_text().
svn path=/trunk/; revision=33800
2010-08-14 17:24:21 +00:00
Stig Bjørlykke ab345f6bda Fixed adding a boolean value as a custom column.
This is reported in bug 5039.

svn path=/trunk/; revision=33602
2010-07-21 09:47:24 +00:00
Stig Bjørlykke 5a69e41f6e Enable "Show Resolved" for custom OID columns.
svn path=/trunk/; revision=33320
2010-06-25 10:44:12 +00:00
Stig Bjørlykke 4a34cf5892 Ensure we use the numeric value when creating a filter from a custom column
entry displaying a integer value.  The resolved string can contain a space,
and our routines does not quote integer values, and A DEC_HEX/HEX_DEC
combination will never match.

svn path=/trunk/; revision=33315
2010-06-24 18:07:40 +00:00
Stig Bjørlykke c7ed9aa2b8 Update to reflect changes in defines: REP_* > ENC_*
svn path=/trunk/; revision=33286
2010-06-22 11:54:45 +00:00
Anders Broman d0888eb389 Increase the base size to 100 000 we are using more than that.
svn path=/trunk/; revision=33020
2010-05-29 22:29:09 +00:00
Bill Meier 3d909801bc proto_registrar_dump_fields: output "" for blurb if blurb is a zero-length string.
svn path=/trunk/; revision=32975
2010-05-26 14:35:06 +00:00
Guy Harris 347e7a0052 More <stdarg.h> cleanup; some are real bugs, some are just "don't do
va_start and va_end unless you're actually going to use the va_list"
(those bring the va_start and va_end closer to the use point, which
makes it a little more obvious that we're using <stdarg.h> correctly and
makes it a little harder to use it incorrectly).

svn path=/trunk/; revision=32963
2010-05-26 02:25:13 +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 927b7da346 Have abs_time_to_str() and abs_time_to_str_secs() take an additional
argument indicating whether to include the time zone in the string.  If
we're constructing a display filter, don't include the time zone,
otherwise do.  Fixes bug 4756.

svn path=/trunk/; revision=32913
2010-05-21 06:33:25 +00:00
Jaap Keuter c1b3cace53 Allow for proto_tree_add_item() with FT_ABSOLUTE_TIME and FT_RELATIVE_TIME.
svn path=/trunk/; revision=32731
2010-05-10 06:32:31 +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
Jeff Morriss 0980522b8f Reindent a bunch
svn path=/trunk/; revision=32566
2010-04-26 20:48:13 +00:00
Jeff Morriss c7e88aa69f The comment here suggests fields should have abbreviations but previously we only checked if a string (even an empty string) was given. Try putting out a warning if a field has an empty string for an abbreviation.
svn path=/trunk/; revision=32562
2010-04-26 00:31:06 +00:00
Jeff Morriss 112fd18410 Make the absolute_time_display_e enum start at 1000 to avoid overlapping with
the base_display_e enum.

Fix a couple of dissectors that were still using FT_ABSOLUTE_TIME with
BASE_NONE.  (The time format chosen is based only on an attempt to not change
the behavior.  I don't know that it's right.)  One of these is built by Pidl.
I'll send a patch upstream too.

When checking hfinfos, display the absolute_time_display_e values too.
Display "bit count: X" instead of "unknown" when the display value doesn't
match one of the enumerated values.

svn path=/trunk/; revision=32552
2010-04-24 19:07:21 +00:00
Jeff Morriss d8ea017527 When checking the header_field_infos, use g_error() to give the developer a
(hopefully useful) explanation of what's wrong with his/her hfinfo field
rather than just asserting out.

So now instead of just getting a message saying aborted(core dumped), you can
get, for example:

22:31:54          Err  Field 'Message in frame' (sccp.assoc.msg) is an FT_FRAMENUM and is BASE_DEC instead of BASE_NONE

*and* an abort(core dumped) (for those who want it).

svn path=/trunk/; revision=32549
2010-04-24 03:08:08 +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
Sake Blok 00c05ed3fd Partly revert the changes made to epan/proto.c in SVN-29490
because they break 'tshark -r <file> -q -z io,phs' (no statistics 
are shown, unless you omit the -q and use -V).

svn path=/trunk/; revision=32443
2010-04-10 19:19:13 +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
Ronnie Sahlberg 4f3db1a1a8 Change printing of all BASE_OCT values to use the alternate form
%#o instead of %o

This means that the value will be printed with a leading 0, which is the 
standard way to denominate that a value is in base octal.



svn path=/trunk/; revision=32241
2010-03-19 02:05:18 +00:00
Jaap Keuter 7be36221d8 Fix for bug 4563:
Always have a tvb when adding a tree item.

svn path=/trunk/; revision=32146
2010-03-08 21:04:47 +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
Gerasimos Dimitriadis 6fd1cec787 From Jakub Zawadzki:
Remove prepare_bits_string from proto.c; Use
equivalent function decode_bits_in_field in to_str.c

svn path=/trunk/; revision=31665
2010-01-25 18:26:47 +00:00
Gerasimos Dimitriadis acd35de1f4 Minor simplification in length calculation of proto_tree_add_bits
and _format_value

svn path=/trunk/; revision=31640
2010-01-24 12:08:14 +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
Gerasimos Dimitriadis 88835212b1 Use true/false strings instead of actual numeric values when adding a boolean
field as a bits item and no custom strings are defined.

svn path=/trunk/; revision=31375
2009-12-28 21:20:27 +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
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
Guy Harris 4fde145bd2 Add an argument to abs_time_to_str() and abs_time_secs_to_str()
indicating whether the time should be shown as local time or UTC.  For
now, always pass FALSE, meaning "show as local time".

Clean up some stuff in the SNMP dissector, use abs_time_secs_to_str()
for times with one-second resolution, and update a comment in various
macros in the WSP dissector, while we're at it.

svn path=/trunk/; revision=31227
2009-12-10 22:19:29 +00:00
Stig Bjørlykke 185488655e No need to do string compare for FT_PROTOCOL.
svn path=/trunk/; revision=31018
2009-11-19 16:12:08 +00:00
Stig Bjørlykke a1c8cdcc7c Added support for some missing custom column types:
FT_NONE: Print nothing
 FT_PROTOCOL: Print "Yes" if protocol exists in packet
 FT_IPv6: Print address

The changes in r29551 made wireshark crash for this columns.

svn path=/trunk/; revision=31016
2009-11-19 13:29:57 +00:00
Stig Bjørlykke b510b97ff1 Return FALSE from proto_tracking_interesting_fields() when no tree.
svn path=/trunk/; revision=30533
2009-10-12 08:19:30 +00:00
Stig Bjørlykke ec95db36a7 Check for valid tree in proto_get_finfo_ptr_array() and
proto_tracking_interesting_fields().

This fixes a crash when using Lua script without packet list coloring.

svn path=/trunk/; revision=30532
2009-10-12 08:16:50 +00:00
Kovarththanan Rajaratnam 996e27dbc7 Set INITIAL_NUM_PROTOCOL_HFINFO to a more sensible value, e.g. 1500. Currently it is set to 200 even though we have way more protocols in Wireshark:
$ ./tshark -G protocols | wc -l
1066

svn path=/trunk/; revision=30501
2009-10-11 09:35:34 +00:00
Kovarththanan Rajaratnam ee9ea561d2 As pointed out by Bill [1] we leak some header_field_info structs on shutdown. This change plugs that mem leak.
[1] http://www.wireshark.org/lists/wireshark-dev/200910/msg00074.html

svn path=/trunk/; revision=30500
2009-10-11 09:18:51 +00:00
Kovarththanan Rajaratnam 34e05c76f7 Replace g_malloc + memset with g_new0
svn path=/trunk/; revision=30499
2009-10-11 09:02:04 +00:00
Kovarththanan Rajaratnam ca53b00b7e Set tree_is_expanded to NULL after freeing it
svn path=/trunk/; revision=30498
2009-10-11 08:57:08 +00:00
Kovarththanan Rajaratnam b998cb04de Use the slice allocator if GLIB_CHECK_VERSION > (2,10,0)
svn path=/trunk/; revision=30497
2009-10-11 08:52:34 +00:00
Jaap Keuter ee2043792f Tighten header field checks.
svn path=/trunk/; revision=30410
2009-10-08 21:26:26 +00:00
Kovarththanan Rajaratnam e981de7a99 Don't attempt to fill custom columns if we don't have a valid column expression.
svn path=/trunk/; revision=30407
2009-10-08 16:35:58 +00:00
Stig Bjørlykke 5bc9611d56 Removed a redundant prototype.
Made wrs_count_bitshift static.

svn path=/trunk/; revision=30387
2009-10-07 08:37:18 +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
Stig Bjørlykke ad14865ce0 Removed unused variable 'hfinfo' in proto_tree_set_time().
svn path=/trunk/; revision=30197
2009-09-29 19:16:52 +00:00
Kovarththanan Rajaratnam 778fe81f72 (Trivial) White space changes
svn path=/trunk/; revision=30095
2009-09-23 16:27:37 +00:00
Bill Meier 5bbec764db (Trivial) Rework a comment slightly.
svn path=/trunk/; revision=30080
2009-09-22 20:17:31 +00:00
Kovarththanan Rajaratnam 56b8d36e03 Introduce a few FT_XXX lengths defines and use those instead of hard coding constants
svn path=/trunk/; revision=29846
2009-09-10 18:22:33 +00:00
Gerald Combs c238175acf Move the infinite loop check from proto_tree_add_node to
TRY_TO_FAKE_THIS_ITEM. Partial fix for bug 3986.

svn path=/trunk/; revision=29811
2009-09-08 22:56:55 +00:00
Kovarththanan Rajaratnam d2db67480c Use g_strlcpy when possible
svn path=/trunk/; revision=29808
2009-09-08 20:06:52 +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 571e69fdfa We don't currently fake fields if they are referenced indirectly through some other fields (currently only FT_PROTOCOL's can be indirectly referenced) . However, there doesn't seem to be any reason for this restriction. We already have proto_tree_set_fake_protocols() to disable 'faking' if any clients requires this. So, this changelist removes this restriction on indirectly referenced fields.
svn path=/trunk/; revision=29742
2009-09-06 11:30:41 +00:00
Kovarththanan Rajaratnam 820ce62af5 This fix was supposed to be in r29731 which some how only contained whitespace changes.
svn path=/trunk/; revision=29732
2009-09-06 07:33:07 +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
Kovarththanan Rajaratnam 17f010119a From Jakub Zawadzki via. Bug 3330:
* Fix memleak (df->deprecated in dfilter_free())
* Free protocol hash tables on cleanup.
* Free protocols list on cleanup.
* Free memory allocated by fgetline() in parse_services_file()

From me:

* proto.c: set gmc_hfinfo to NULL after free
* proto.c: switch order of g_free() and g_list_remove() in proto_cleanup()

svn path=/trunk/; revision=29656
2009-09-01 18:16:55 +00:00
Kovarththanan Rajaratnam 8cba530c81 From Richard Brodie via. Bug 3913:
Free ptr array allocated through proto_find_finfo()

svn path=/trunk/; revision=29654
2009-09-01 17:09:36 +00:00
Kovarththanan Rajaratnam cd49063473 Revert r29614 until I figure out why buildbot doesn't like it
svn path=/trunk/; revision=29615
2009-08-29 07:53:48 +00:00
Kovarththanan Rajaratnam cc948586bf Use G_STRINGIFY/G_PASTE
svn path=/trunk/; revision=29614
2009-08-29 06:42:23 +00:00
Jörg Mayer 4d8506486f After asking on the list and receiving no feedback, I'll
just commit this:

Change the checks for type FT_IPv6 to no longer require
a lenght of exaclty 16 bytes, but something between
0 and 16 bytes. That way, we can filter on prefixes
that do not provide the whole length of 16 bytes.

svn path=/trunk/; revision=29594
2009-08-28 09:38:34 +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 da1e555499 Don't dereference pointer before checking for NULL
svn path=/trunk/; revision=29503
2009-08-21 23:02:59 +00:00
Kovarththanan Rajaratnam 8a3f4f53eb Delay TRY_TO_FAKE_THIS_ITEM() in proto_tree_add_bits_ret_val() until we know it is safe.
Thanks to Martin for pointing this out in r29493.

svn path=/trunk/; revision=29494
2009-08-21 17:11:02 +00:00
Martin Mathieson 044aabb9ea Don't try TRY_TO_FAKE_THIS_ITEM in proto_tree_add_bits_ret_val(), as otherwise
the side effect 'return_value' getting set doesn't happen.

svn path=/trunk/; revision=29493
2009-08-21 15:16:27 +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 0f6b75b7ea Move TRY_TO_FAKE_THIS_ITEM to all public proto_xxx methods. Currently we rely on our internal (static) helper functions to do the faking. However, when they fake a protocol tree, they usually return a valid tree (although a dummy tree it is still a valid one). This means that we end up calling proto_tree_set_representation + friends on it for no reason. By moving TRY_TO_FAKE_THIS_ITEM to the public proto_xxx methods we're able to bail immediately (when we're allowed to do so).
svn path=/trunk/; revision=29480
2009-08-19 19:08:34 +00:00
Kovarththanan Rajaratnam 460eacaae1 Move the NULL pointer 'tree' check under TRY_TO_FAKE_THIS_ITEMs umbrella
svn path=/trunk/; revision=29453
2009-08-17 11:21:33 +00:00
Kovarththanan Rajaratnam 69babcb4a6 Don't do PROTO_REGISTRAR_GET_NTH twice.
svn path=/trunk/; revision=29452
2009-08-17 11:13:36 +00:00
Kovarththanan Rajaratnam da97c3e2b6 This should have been part of r29428. This patch forces proto_field_is_referenced() to respect the fake_protocols flag set by Protocol Hierarchy stats tap.
svn path=/trunk/; revision=29429
2009-08-15 08:38:50 +00:00
Kovarththanan Rajaratnam 9eec025c49 DISSECTOR_ASSERT on FT_PCRE in construct_match_selected_string().
svn path=/trunk/; revision=29396
2009-08-12 18:24:49 +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 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
Bill Meier dd2a488581 g_error() if registering a subtree item type already registered (or not initialized to -1).
svn path=/trunk/; revision=29352
2009-08-09 15:49:02 +00:00
Anders Broman ded297677f From Kovarththanan Rajaratnam:
Precompile custom columns filters.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3767

svn path=/trunk/; revision=29174
2009-07-23 05:48:39 +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
Stig Bjørlykke 3ebdfb7c9c From Kovarththanan Rajaratnam:
Add "text" abbrev + tighten FT_FRAMENUM checks.

svn path=/trunk/; revision=29100
2009-07-15 08:56:12 +00:00
Stig Bjørlykke 3f53109d7e Added some casts for true_false_string's.
svn path=/trunk/; revision=28992
2009-07-07 16:04:26 +00:00
Jeff Morriss ac43decf1c ptvcursor_add_text_with_subtree(): Don't crash if called with a NULL tree.
Also fix up some indenting.

svn path=/trunk/; revision=28712
2009-06-12 14:32:32 +00:00
Stig Bjørlykke f6826c9c02 Fix a small indent issue in a comment.
svn path=/trunk/; revision=28693
2009-06-11 10:10:42 +00:00
Sebastien Tandel 52cc5fb1e8 python binding for wireshark (first commit)
* ability to write dissectors with python for wireshark.
        documentation (http://wiki.wireshark.org/Python)


svn path=/trunk/; revision=28529
2009-05-29 21:10:40 +00:00
Bill Meier d349ab0061 proto.c: proto_registrar_dump...() fixes/changes:
- dump_values: Handle range_strings (prevents crash);
- dump_fields:
   a. Formats 2,3: If type==FT_BOOLEAN: output integer "parent bitfield width"
      in Field 7 instead of "BASE_NONE", etc. to allow addt'l
      field validation when using ftsanity.py.
   b. Format 3: Output bitmask (Field 8) in hex (0x...) instead of decimal.

svn path=/trunk/; revision=28134
2009-04-22 19:50:34 +00:00
Gerald Combs f0eeb0bdf1 More size_t fixes. Use a string buffer in range.c.
svn path=/trunk/; revision=27999
2009-04-08 16:50:20 +00:00
Bill Meier 1e66f1a63f From Jakub Zawadzki: g_snprintf() & etc since glib 1.3.12
don't return -1, and also always NUL terminate the string.
We can clean sources by removing dead/unnecessary code.
From me: A few additional changes re use of g_snprintf.

svn path=/trunk/; revision=27818
2009-03-22 15:31:44 +00:00
Stig Bjørlykke 62f60df6b4 From Jakub Zawadzki (bug 3331):
g_free() is NULL safe, so we don't need check against it.

svn path=/trunk/; revision=27718
2009-03-13 22:06:48 +00:00
Stig Bjørlykke c16347358f From Jakub Zawadzki (bug3330):
Initialize hfinfo->display for FT_PROTOCOL.

svn path=/trunk/; revision=27711
2009-03-12 20:35:43 +00:00
Stig Bjørlykke 628f229936 Removed support for FT_UINT64/BASE_NONE/VALS combination.
svn path=/trunk/; revision=27671
2009-03-09 08:45:01 +00:00
Stig Bjørlykke de14669997 Added FT_INT*/FT_UINT* with BASE_NONE and a value string as a valid combination.
With this combination we get tree items with only the string match and not
the value, and the filter is created with the string.  This is usefull
when having generated items with wireshark internals as values.

Also rewrote some string constructions.

svn path=/trunk/; revision=27667
2009-03-09 00:24:21 +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
Bill Meier a668ca6bc5 Fix trivial spelling error
svn path=/trunk/; revision=27004
2008-12-15 17:05:41 +00:00
Tomas Kukosa 99295ee0d2 put the SCTP PPI for current DATA chunk into packet_info (and ppid array renamed to ppids)
svn path=/trunk/; revision=26958
2008-12-10 11:04:36 +00:00
Jaap Keuter e12599f5c9 Tighten field array check to avoid printing problems.
svn path=/trunk/; revision=26849
2008-11-26 07:25:18 +00:00
Jaap Keuter 54899df0c8 From Michael McCartney:
Simplify/generalize proto_tree_add_bits_ret_val(): ability to use other display types, ie., use 
hfinfo_uint_format() or hfinfo_uint64_format() to get the proper format string.

svn path=/trunk/; revision=26674
2008-11-03 07:32:55 +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
Stig Bjørlykke d84791245b As reported by Chidambaram Arunachalam in bug 2893:
Handle RVALS correctly in proto_tree_set_(u)int and label_fill_(u)int

svn path=/trunk/; revision=26257
2008-09-23 23:58:23 +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 baf9959afa From Alexey Neyman:
Fix proto_tree_add_*_format_value() operation on bitfields.

svn path=/trunk/; revision=25888
2008-08-01 10:16:52 +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
Jaap Keuter bfcdda1353 ptvcursor_subtree_set_item() does not need to be exported.
svn path=/trunk/; revision=25441
2008-06-11 18:16:04 +00:00
Stephen Fisher eedcd98bd2 Fix for bug #2480: Custom column, wrong display of 802.11 Sleep mode status
Changed the tfstring to use integer variable instead of value variable.  The
integer value has had its "irrelevant portions" masked out and has been bit-
shifted whereas value hasn't.  This led to unpredictable results when using
a true false string for a single bit of a byte. 


svn path=/trunk/; revision=25169
2008-04-25 05:16:23 +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
Anders Broman 63c5c71cf8 Remove:
#ifdef NEED_G_ASCII_STRCASECMP_H
#include "g_ascii_strcasecmp.h"
#endif

svn path=/trunk/; revision=24859
2008-04-09 05:36:08 +00:00
Stephen Fisher 726a1caaf1 - Remove GLIB1 code
- Change ugly GLIB version checking statements to GLIB_CHECK_VERSION
- Remove ws_strsplit files because we no longer need to borrow GLIB2's
  g_strsplit code for the no longer supported GLIB1 builds


svn path=/trunk/; revision=24829
2008-04-07 05:22:54 +00:00
Luis Ontanon a476c85e21 typo initializators -> initializers
svn path=/trunk/; revision=24763
2008-04-03 22:18:08 +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
Jeff Morriss 689e8bd855 From http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1539 :
Hexadecimal and octal are unsigned.  Don't let dissectors register signed
fields (FT_INT*) to be displayed in hexadecimal (including HEX_DEC and DEC_HEX)
or octal.  Fix dissectors that do that mostly by changing the fields to
unsigned though in PANA it appears the fields are meant to be signed so
change those fields to be displayed in decimal.

This fixes an assertion crash in hfinfo_numeric_format() if/when someone tries
to create a filter using one of these mixed signed/unsigned fields (because
that routine does not know how to present the user with a signed value in
hex).

Also add FT_*INT64 to the "make sure it's not BASE_NONE" check.

svn path=/trunk/; revision=24643
2008-03-15 22:41:57 +00:00
Martin Mathieson 8605cec511 Fix for bug 2328.
I can see this function is used in limited places.
I'm not sure if BASE_RANGE_STRING needs to masked out
of hfinfo->display in various other functions in proto.c.

svn path=/trunk/; revision=24598
2008-03-10 15:36:44 +00:00
Jeff Morriss 5ca9e9cbe8 Fix http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2009 : if the dissector told us how to format the representation of an item then indicate if we truncated it (we were already doing this if we formatted the representation). Do the same for FT_BYTES.
svn path=/trunk/; revision=24593
2008-03-09 14:50:14 +00:00
Stephen Fisher 56226b49b8 Custom column updates:
- Change apply / prepare / ... as filter to use the field's value, which
   is now stored in fdata as well as cinfo.  Now we don't have to reprocess
   the entire packet list when using these features.  This also prevents
   the use of these features from overwriting custom column information.
   (custom columns can now be used in apply / prepare ... as filter)
 - Break col_expr and col_expr_val out into a struct that is included not only
   in cinfo, but now also fdata.
 - Have col_custom_set_fstr() quote FT_STRING & FT_STRINGZ when storing the
   col_expr_val value (for filter creation).


svn path=/trunk/; revision=24511
2008-03-01 05:16:45 +00:00
Stig Bjørlykke 545fdf0586 Added support for FT_IPv4, FT_GUID and FT_OID in custom columns.
svn path=/trunk/; revision=24455
2008-02-24 20:57:34 +00:00
Stig Bjørlykke a50f232cac Print integer values according to hfinfo->display.
svn path=/trunk/; revision=24420
2008-02-22 13:27:46 +00:00
Stig Bjørlykke 20ed60cf1f Added FT_ABSOLUTE_TIME and FT_RELATIVE_TIME to custom columns.
svn path=/trunk/; revision=24419
2008-02-22 12:28:41 +00:00
Stig Bjørlykke 33524cdd48 Some custom column enhancements:
Use the value_string if defined for integer and boolean values.

svn path=/trunk/; revision=24418
2008-02-22 12:06:29 +00:00
Stig Bjørlykke 67aa6856de Some custom column fixes:
- In proto_tree_set_uint and proto_tree_set_int use value adjusted for bitmask.
- Removed col_custom_set_fstr in proto_tree_set_boolean to get a correct
  adjusted value in proto_tree_set_uint.
- Set a default column width shorter than COL_INFO. 

svn path=/trunk/; revision=24417
2008-02-22 11:32:36 +00:00
Stephen Fisher 2a8e74cedc Add ability to make more field types into custom columns: FT_ETHER & FT_BYTES.
Also change display of FT_STRING(Z) to turn non-printable characters into
backslash + number values. 


svn path=/trunk/; revision=24415
2008-02-22 03:44:08 +00:00
Stephen Fisher b0a09b3c8b Add/fix a few calls to col_custom_set_fstr() for custom columns.
svn path=/trunk/; revision=24328
2008-02-14 06:10:54 +00:00
Stephen Fisher 8f3a1b0d16 Check in changes originally checked in as SVN revision 24308 (new column
type: Custom) that were backed out in SVN revision 24309.

Changes since that revision include a reworking of the handling of the
cfile/cinfo variables in epan/column-utils.c, addition of three new
functions to libwireshark.def and a bug fix to prevent a crash when no
custom columns were not in use.

Compilation verified locally on MacOS X, Linux and Windows.


svn path=/trunk/; revision=24317
2008-02-13 05:05:33 +00:00
Stephen Fisher 5e893a8b1c Revert commit 24308 until I can get it to compile on Windows/Linux/Solaris
(strangely, it compiled fine on my MacOS X machine).


svn path=/trunk/; revision=24309
2008-02-12 08:09:22 +00:00
Stephen Fisher 0a85a9e4c6 Introduce a new column type called custom, which lets you put any display
filter name in the description field and it will display that field in the
packet list if it occurs in that packet.  Note that the more common fields
are implemented, but a number of them remain to be implemented in
epan/proto.c.  I will work on these other fields as I have time.


svn path=/trunk/; revision=24308
2008-02-12 03:16:09 +00:00
Jaap Keuter 90674d7c9e Print the string to STDOUT regardless of the value of tree.
svn path=/trunk/; revision=24114
2008-01-16 18:39:32 +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
Gerald Combs be6e31fa44 Register the "samr.nt_password" preference as obsolete.
svn path=/trunk/; revision=23794
2007-12-07 18:50:41 +00:00
Ronnie Sahlberg 0c09ac97f6 #if out a function that is only used when building with glib 2 or later
svn path=/trunk/; revision=23730
2007-12-04 00:56:11 +00:00
Guy Harris ce635c2310 Severities are unsigned.
svn path=/trunk/; revision=23727
2007-12-03 23:02:09 +00:00
Tomas Kukosa 6caaafbb6d Next few improvements to speed up startup about 10%.
- use GTree instead of GList for preference module lists

svn path=/trunk/; revision=23679
2007-11-30 09:22:01 +00:00
Tomas Kukosa 7f4df19970 fix GLIB 1.x compatibility
svn path=/trunk/; revision=23668
2007-11-29 07:48:12 +00:00
Tomas Kukosa ff7c20938e Various changes with focus to startup speedup
The startup timeout on Win32 is reduced to 80% without assembler and to 50% with assembler usage (which is optional)
proto.c
 - do not look up in filed tree and inserts in two steps but do it at once
 - next few small speedups
 - some often called elementary functions can be optionally implemented in assembler
 - dispart some functions to see more exact result from profiling
packet-tpnc.c
 - do not reallocate memory for each filed

svn path=/trunk/; revision=23643
2007-11-28 10:18:16 +00:00
Guy Harris 9c89cdaaa3 strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est.  Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).

In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.

We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot.  This causes strings that should
match not to match.

This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.

svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
Stephen Fisher 849e628334 Introduce a new field type called FT_EBCDIC. This field works the same as
FT_STRING, except that it converts the data from the packet from EBCDIC
to ASCII for display in Wireshark.


svn path=/trunk/; revision=23503
2007-11-19 21:27:01 +00:00
Anders Broman dbcabb1938 Get rid of most of the legacy oid stuff.
svn path=/trunk/; revision=23333
2007-11-01 22:07:43 +00:00
Anders Broman 9492700608 Change:
get_oid_str_name() -> oid_resolved_from_string()
get_oid_name() -> oid_resolved_from_encoded()

svn path=/trunk/; revision=23331
2007-11-01 19:36:39 +00:00
Martin Mathieson b40d397b16 Make groups of PDUs filterable as large FT_BYTES items
(where the initial length isn't readily available when item is first added)

Note that this still won't work where an initial length of 0 is given for
the item that will later be extended using proto_item_set_len(), as the
pointer value part of the zero-length array will reamin NULL...

svn path=/trunk/; revision=23253
2007-10-23 11:02:08 +00:00
Stig Bjørlykke 5a58a1435c From Andrew Feren:
Fix an assortment of typos and other minor errors in various README files

svn path=/trunk/; revision=23166
2007-10-12 19:13:31 +00:00
Stig Bjørlykke 675b312626 Added a missing break - fixing bug 1890.
svn path=/trunk/; revision=23050
2007-10-02 16:27:52 +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 00c5e48a17 get users of oid_resolv to use the new oids, rollout packet-snmp.c
svn path=/trunk/; revision=22651
2007-08-25 01:14:24 +00:00