Commit Graph

208 Commits

Author SHA1 Message Date
Jakub Zawadzki a016cd7740 Revert r44978: dissector_add_uint: Legalize formerly improper use of the API when calling it with pattern value of 0
dissector_add_uint() is *not only* used by tcp.port/udp.port dissector tables where 0 is not valid port number,
in some dissector tables 0 is valid protocol number, packet type, etc..

Sample dissectors using dissector_add_uint(.pattern = 0):
  packet-ansi_637.c:2348: dissector_add_uint("ansi_a.sms", 0, ansi_637_trans_handle);
  packet-cip.c:6017:      dissector_add_uint("cip.class.iface", 0, cip_class_generic_handle );
  packet-lon.c:723:       dissector_add_uint("cnip.protocol", 0, lon_handle);
  packet-q931.c:3599:     dissector_add_uint("lapd.sapi", LAPD_SAPI_Q931 /* 0 */, q931_handle);


svn path=/trunk/; revision=44980
2012-09-18 19:29:00 +00:00
Jörg Mayer ce7c79c0a3 dissector_add_uint:
Legalize formerly improper use of the API when calling it with
   pattern value of 0

svn path=/trunk/; revision=44978
2012-09-18 19:04:04 +00:00
Jakub Zawadzki a406bb1a50 Add data parameter to dissector_try_uint_new
svn path=/trunk/; revision=44874
2012-09-11 09:06:48 +00:00
Jakub Zawadzki 27fb6880c4 Add new function: call_dissector_with_data
svn path=/trunk/; revision=44873
2012-09-11 09:06:13 +00:00
Jakub Zawadzki 9f92dc93c5 Add data parameter to call_dissector_only.
svn path=/trunk/; revision=44872
2012-09-11 08:28:07 +00:00
Jakub Zawadzki dee4443809 Add data parameter to dissector_try_heuristic
svn path=/trunk/; revision=44871
2012-09-11 08:26:48 +00:00
Jakub Zawadzki 5a8783f5b1 Initial commit to support yet another method of passing data between dissectors.
Add new parameter 'data' to heur_dissector_t and new_dissector_t, for now it's always NULL

svn path=/trunk/; revision=44860
2012-09-10 21:40:21 +00:00
Evan Huus d574361f5c Use g_hash_table_new_full() instead of g_hash_table_new() for subdissector
registration tables, and use g_free as the value_destroy_func. This saves us
from manually freeing the value when we remove an item, and prevents us from
leaking memory when we accidentally overwrite an existing item.

svn path=/trunk/; revision=44814
2012-09-08 15:03:07 +00:00
Evan Huus baf111a23c Add casts to fix compilation with GCC.
Remove * from gconstpointers, they are already pointer types.
Add modelines to packet.c and clean up indentation a bit.

svn path=/trunk/; revision=44698
2012-08-29 22:19:29 +00:00
Jakub Zawadzki 2ec7c89c33 Fix memleak.
svn path=/trunk/; revision=44697
2012-08-29 22:14:55 +00:00
Michael Mann e5e09f7016 Fix Bug 7348 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7348)
svn path=/trunk/; revision=44696
2012-08-29 21:23:07 +00:00
Jeff Morriss 89cfdc3559 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3315 -
make Save-As/Displayed/All-Packets save not only the displayed packets but
also any other packets needed (e.g., for reassembly) to fully dissect the
displayed packets.

This works only for the "All packets" case; choosing only the Selected packet,
the Marked packets, or a range of packets would require actually storing which
packets depend on which (too much memory) or going through the packet list many
times (too slow).  Also, this behavior is always the case: you can't save the
displayed packets without their dependencies (I don't see why this would be
desirable).

So far this is done for SCTP and things using the reassembly routines (TCP has
been tested).

The Win32 dialog was modified but hasn't been tested yet.

One confusing aspect of the UI is that the Displayed count in the Save-As
dialog does not match the number of displayed packets.  (I tried renaming the
button "Displayed + Dependencies" but it looked too big.)  The tooltip tries
to explain this and the fact that this works only in the All-Packets case;
suggestions for improvement are welcome.


Implementation details:

Dissectors (or the reassembly code) can list frames which were needed to
build the current frame's tree.  If the current frame passes the display
filter then each listed frame is marked as "depended upon" (this takes up the
last free frame_data flag).

When performing a Save-As/Displayed/All-Packets then choose packets which
passed the dfilter _or_ are depended upon.

svn path=/trunk/; revision=41216
2012-02-28 03:19:49 +00:00
Bill Meier b83e1b218f Add 'heur_dissector_set_enabled()' to allow a dissector to enable/disable heuristic dissection;
Rename some vars;
Do some minor re-indentation and whitespace changes.

svn path=/trunk/; revision=40601
2012-01-20 02:43:37 +00:00
Bill Meier ebe33ba92a Add tshark option '-G heuristic-decodes' to dump heuristic dissector tables.
svn path=/trunk/; revision=40309
2011-12-28 15:05:59 +00:00
Anders Broman 8259fbb105 Preparation to make it possible to dissable heuristic protocols
trough the proto dialouge.

svn path=/trunk/; revision=40215
2011-12-15 20:39:01 +00:00
Guy Harris c1f993eef5 Clamp the reported length of a packet at G_MAXINT for now, to avoid
crashes due to having no tvbuffs for an epan_dissect_t.

Fixes bug 6663 and its soon-to-be-duplicates.

svn path=/trunk/; revision=40164
2011-12-13 00:44:22 +00:00
Chris Maynard 647c5c0b27 packet_info's in_error_pkt is now a bitfield like in_gre_pkt.
svn path=/trunk/; revision=39764
2011-11-08 18:39:11 +00:00
Jeff Morriss ab7ec88be5 Delay freeing of seasonal memory until after the conversation cleanup routine
has been called.

In the conversation cleanup routine, free the GSlist for any proto_data which
may have been hanging off the (se_allocated) conversation.

svn path=/trunk/; revision=39484
2011-10-20 02:29:13 +00:00
Stig Bjørlykke ad6be9beb8 Whitespace cleanup.
svn path=/trunk/; revision=38893
2011-09-06 09:09:36 +00:00
Anders Broman 377bfd19a0 List heuristic tables in Internals->Disscetor tables menu.
svn path=/trunk/; revision=38881
2011-09-05 13:04:23 +00:00
Gerald Combs 713a85de8a Make sure our root tvb is initialized in case its creation fails.
Untested fix for bug 6135.

svn path=/trunk/; revision=38410
2011-08-08 17:25:35 +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 32726b84d2 If a dissector table doesn't exist, print a more useful message, and
only abort if WIRESHARK_ABORT_ON_DISSECTOR_BUG is set.

svn path=/trunk/; revision=37510
2011-06-01 18:02:16 +00:00
Guy Harris 1372515b02 More eradication of old-style function definitions.
svn path=/trunk/; revision=37216
2011-05-17 22:18:32 +00:00
Bill Meier ffeff72f02 Fix a typo in a text string; use consistent indentation.
svn path=/trunk/; revision=36735
2011-04-20 16:35:42 +00:00
Stig Bjørlykke a6476ba91b Added dissector_handle_get_long_name().
svn path=/trunk/; revision=36412
2011-03-31 12:14:59 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Jeff Morriss e17b9ccec1 Rev 29427 added packet_add_new_data_source() with a comment indicating that
the data source does not need to be allocated if (!tree).

Rev 30158 took the if (!tree) check out indicating that the check was invalid.

So: (since packet_add_new_data_source() now only calls add_new_data_source()),
remove packet_add_new_data_source().

svn path=/trunk/; revision=34717
2010-10-30 16:00:30 +00:00
Sake Blok 0618e53168 Enable "Decode As..." for ethertype 0x0000 (fix for bug 4721)
svn path=/trunk/; revision=32723
2010-05-08 07:55:12 +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
Guy Harris b395a98305 Squelch a bunch of compiler warnings.
svn path=/trunk/; revision=31961
2010-02-23 04:35:23 +00:00
Anders Broman cd0147c004 Make sure we have a handle for the dissector.
svn path=/trunk/; revision=30824
2009-11-04 17:13:01 +00:00
Bill Meier adc374c903 Fix some indentation.
svn path=/trunk/; revision=30527
2009-10-12 01:31:01 +00:00
Kovarththanan Rajaratnam 1b668036d1 Move dissector add sanity check to separate function
svn path=/trunk/; revision=30346
2009-10-05 18:52:46 +00:00
Guy Harris 3a92e1e456 The data sources can be used even if the protocol tree isn't being built
or isn't visible.

Clean up some indentation.

svn path=/trunk/; revision=30158
2009-09-25 21:29:36 +00:00
Kovarththanan Rajaratnam 0e5cef61be Split a bunch of init routines into init() and cleanup(). This allows us to free memory properly on shutdown.
This is an initial step. There's still some work to do.

svn path=/trunk/; revision=29754
2009-09-06 18:25:23 +00:00
Kovarththanan Rajaratnam b3b9be09c7 We track all protocols that appear in each packet in the frame dissector. This is an expensive operation because we:
* Disable the TRY_TO_FAKE_THIS_ITEM optimization
* Use GString to store the protocols

We should only do this if the 'hf_frame_protocols' is referenced (unlikely)

svn path=/trunk/; revision=29733
2009-09-06 07:55:17 +00:00
Kovarththanan Rajaratnam 7d44262406 This patch introduces packet_add_new_data_source() which effectively deprecates add_new_data_source(). This is based on the following observation:
1) The tvb + name (aka. data_source) is only used when the protocol tree is visible

The current implementation of add_new_data_source() doesn't take this into account and simply allocates a data_source regardless. This is what packet_add_new_data_source() tries to rectify.

A couple of dissectors have already been switched over to the new packet_add_new_data_source(). Many are still missing. Help appreciated!

svn path=/trunk/; revision=29427
2009-08-15 06:38:10 +00:00
Bill Meier aed6451fff Remove 1 commented-out #include inadvertantly committed.
svn path=/trunk/; revision=29276
2009-08-03 18:06:36 +00:00
Bill Meier d8297e8312 Add some debug code (commented out) to check for duplicate dissector port registrations,
svn path=/trunk/; revision=29275
2009-08-03 17:25:17 +00:00
Gerald Combs 753e9f65e5 Zero out the packet_info struct for each packet instead of trying to
initialize everything by hand. Fixes a Valgrind warning.

svn path=/trunk/; revision=29122
2009-07-16 20:52:36 +00:00
Stig Bjørlykke 27572c22f4 From Kovarththanan Rajaratnam via bug 3702:
This patch optimizes the data source name processing in add_new_data_source()
by delaying it. We now simply store the constant string and lazily compute the
name when needed. This gives a performance boost because we only need the name
if we have multiple data sources.

svn path=/trunk/; revision=29066
2009-07-12 10:19:13 +00:00
Anders Broman c2509b0b3f Handle Detach and Service request, make it possible to set direction on link(UL/DL).
svn path=/trunk/; revision=28648
2009-06-06 17:03:34 +00:00
Anders Broman 3ab0c21cbc Introduce call dissector_try_port_new() to be used when no protocol entry is to be made in the protocols list. Used by asn2wrs dissectors to avoid multiple entrys as calls are made
multiple times for the same PDU.

svn path=/trunk/; revision=28106
2009-04-21 16:53:00 +00:00
Gerald Combs 844af38e54 size_t fixes.
svn path=/trunk/; revision=27990
2009-04-08 05:25:14 +00:00
Luis Ontanon 230d917776 Add a debug helper for EP memory corruption
if compiled in and the env var WIRESHARK_DEBUG_EP_CANARY is set:
will check for canary integrity at every call to EP_CHECK_CANARY()
if corruption is found it exits pronting the prior location and the location in which corruption was found.
Hopefully it stops running while the corruptor is still in the stack.

see EP_CHECK_CANARY() calls in packet.c as an example.




svn path=/trunk/; revision=25927
2008-08-05 02:23:35 +00:00
Jaap Keuter e86825b8f8 From Francesco Fondelli:
Attached is a patch for:
- PW Associated Channel Header dissection as per RFC 4385
- PW MPLS Control Word dissection as per RFC 4385
- mpls subdissector table indexed by label value
- enhanced "what's past last mpls label?" heuristic
- Ethernet PW (w/o CW) support as per RFC 4448

svn path=/trunk/; revision=25730
2008-07-13 17:19:33 +00:00
Jeff Morriss 35ff3c851b A slightly more complicated have_postdissector() (missed in my previous checkin--thanks Bill) which also checks if the postdissectors are enabled.
svn path=/trunk/; revision=25347
2008-05-21 20:20:37 +00:00