Commit Graph

65 Commits

Author SHA1 Message Date
Peter Wu f5340b2a07 Split init routine into init/cleanup for more dissectors
This patch converts some dissectors using g_hash_table_foreach_remove.

 - 9p: drop no-op free func.
 - nfs: use g_hash_table_new_full such that a destructor function can
   be used. Drop NULL check since g_free can handle these just fine.
 - nlm: use g_hash_table_new_full such that a destructor function can
   be used. Simplify "matched" destruction by replacing the wrapper by
   a direct g_free call.

Change-Id: I455e7f0ad4e47e70dae05af7233fdcdebf583f9f
Reviewed-on: https://code.wireshark.org/review/9224
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:36:11 +00:00
Hadriel Kaplan ceb8d954d2 Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.

Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-27 15:14:12 +00:00
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Michael Mann 05516b0c92 Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 1 of many

Change-Id: I77a5789ac23388e6a5f8098dc398592f39638124
Reviewed-on: https://code.wireshark.org/review/5532
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-11-29 22:42:56 +00:00
Bill Meier 24d50bc290 Adjust indentation to match editor modelines; Do other minor whitespace changes.
Change-Id: Ic020b2c92db5d14a2be9dc4d35aef4514b8b0353
Reviewed-on: https://code.wireshark.org/review/4502
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-06 17:12:33 +00:00
Guy Harris ca1ac2cf69 9P2000.L also has the UID field in tattach.
See, for example:

	http://code.google.com/p/diod/wiki/protocol#attach,_auth_--_messages_to_establish_a_connection

and

	http://code.google.com/p/diod/wiki/protocol#Overview

where the latter says

	9P2000.L consists of a subset of the canonical 9P2000
	operations, the 9P2000.u attach and auth messages, plus new
	operations designed to map to the Linux VFS in a straightforward
	way.

so tattach and tauth are the same as 9P2000.u.

Don't throw a dissector assertion of there's data at the end of the
packet; in the particular case that found this bug, yes, it was a
dissector bug, but it could also be a malformed packet, and we should
not throw dissector assertions unless we know *for certain* that the
problem is a dissector bug rather than a malformed packet.

Change-Id: I5ef5d837bccb4e7c4844d31a138aa55a85ec1b60
Reviewed-on: https://code.wireshark.org/review/3758
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-20 22:15:47 +00:00
Michael Mann 3fa5625ea0 Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ib6024307e85d6c23decf40e9759f549c19ffe136
Reviewed-on: https://code.wireshark.org/review/3318
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-03 16:29:16 +00:00
Peter Wu 286c191846 9p: fix version detection, fix dissect_9P retval
Fix version detection (detect against full string instead of prefix),
properly dissect Tcreate extension field (9p2000.u only), dissect
Tunlinkat flags (9p2000.L).

Refactor pattern to dissect string[s] types for DRY.

Convert to use tcp_dissect_pdus. I have not seen a fragmented case, but
maybe that may happen in the future.

The main motivation for touching 9p was that it returns bogus values
for some types. This has been fixed by properly increasing offset, and
always return the captured length.

Change-Id: If2184204ae9c853b94aca8ade3763d7fe523fa86
Reviewed-on: https://code.wireshark.org/review/2836
Reviewed-by: Christopher Maynard <Christopher.Maynard@gtech.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-05 22:04:54 +00:00
Michael Mann f5e2b4293d convert to proto_tree_add_subtree[_format]
Change-Id: I358bfaa4e5d40cd01b766f614f8bd0dbaf611dd0
Reviewed-on: https://code.wireshark.org/review/2508
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 14:34:17 +00:00
Jakub Zawadzki 923cf412f1 Fix copy/paste errors in value_string.
Also make repetition_coding_indications[] standard terminated.

Change-Id: Ice20e1f27f5ab4d111f893608a230b83899efc9f
Reviewed-on: https://code.wireshark.org/review/2288
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-17 00:08:49 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Guy Harris ddb966fb2f The file's name has a lower-case "p" in "9p".
svn path=/trunk/; revision=54880
2014-01-21 20:13:40 +00:00
Guy Harris 4eb619b677 Always combine ENC_UTF_8 with ENC_NA.
svn path=/trunk/; revision=54878
2014-01-21 20:12:48 +00:00
Guy Harris 4b02416cc9 9p strings are, not surprisingly, encoded using UTF-8; replace
tvb_get_string() calls with tvb_get_string_enc() calls explicitly
specifying UTF-8.

svn path=/trunk/; revision=54876
2014-01-21 19:53:52 +00:00
Guy Harris d15a6d0add Don't cast away constness.
svn path=/trunk/; revision=54814
2014-01-15 03:37:06 +00:00
Bill Meier 1ed5971a72 Remove 'L' and 'LL' from constants; they are all used as 32-bit quantities.
#if 0 an unsed constant definition.

svn path=/trunk/; revision=54269
2013-12-19 20:52:56 +00:00
Jakub Zawadzki f91eba752b Fix some warnings: cast discards `__attribute__((const))' qualifier from pointer target type
svn path=/trunk/; revision=53875
2013-12-08 23:16:06 +00:00
Bill Meier 13124b7b8b Constify two vars;
Add editor modelines;
Rework some whitespace.

svn path=/trunk/; revision=53482
2013-11-21 18:03:10 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Evan Huus 6df83e8078 Add _g_ to the names of functions that allocate glib memory. This is a bit more
explicit, and frees up the "generic" names (like tvb_memdup) for new signatures
that take the appropriate wmem pool.

Majority of the conversion done with sed.

svn path=/trunk/; revision=52164
2013-09-21 17:04:41 +00:00
Alexis La Goutte c28b726878 Fix (-W)documentation error found by Clang
packet-9p.c:342:16: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint16  len; /*< Length of the string */
                      ^~~
                      /**<
packet-9p.c:343:13: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        char *str; /*< The string */
                   ^~~
                   /**<
packet-9p.c:364:15: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint8 type; /*< Type */
                     ^~~
                     /**<
packet-9p.c:365:19: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint32 version; /*< Monotonically incrementing version number */
                         ^~~
                         /**<
packet-9p.c:366:16: error: not a Doxygen trailing comment [-Werror,-Wdocumentation]
        guint64 path; /*< Per-server-unique ID for a file system element */
                      ^~~
                      /**<
5 errors generated

svn path=/trunk/; revision=51260
2013-08-10 21:28:50 +00:00
Jeff Morriss 1dc3a29474 From Dominique Martinet via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8787 :
Follow-up on 9P dissector enhancement ( https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8589 )

"fid"s, 9P file descriptors, are valid from the moment it's allocated until
when it's freed. My original patch kept a fid hashtable updated everytime a
packet was dissected in full-view (with a non-null tree)

Attached is a patch that builds a tree for each 9P fid and stores the
corresponding path when it becomes valid/marks it as invalid when it no longer
is.

svn path=/trunk/; revision=51092
2013-08-01 21:04:32 +00:00
Chris Maynard e37533ced7 Fix warnings: comma at end of enumerator list.
svn path=/trunk/; revision=50640
2013-07-15 21:37:55 +00:00
Guy Harris ba8ead5e61 Add some casts for C++ compatibility.
Make conv_get_fid() return a "const char *", as it can return a string
constant, and they are usually *not* writable.

svn path=/trunk/; revision=49400
2013-05-18 01:42:20 +00:00
Guy Harris a274d9de4a A "pointer to something" is a "void *", not a "char *". Using "void *"
avoids some alignment warnings from clang.

svn path=/trunk/; revision=49399
2013-05-18 00:45:20 +00:00
Guy Harris d4ad2e087c Fix some more warnings that show up on platforms with 32-bit time_t.
Get rid of double semicolons.

svn path=/trunk/; revision=49371
2013-05-17 08:09:39 +00:00
Anders Broman 4b85b45281 Squelch more warnings about empty structures.
svn path=/trunk/; revision=49366
2013-05-17 05:33:53 +00:00
Guy Harris f296630024 Squelch warnings about empty structures and chopping off 64-bit values
at 32 bits.

svn path=/trunk/; revision=49364
2013-05-17 05:25:11 +00:00
Jeff Morriss 504d830981 From Dominique Martinet via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8589 :
Theses patches add alot of new message types for the 9P protocol and its
extensions (most specifically 9P2000.L), while staying compatible with the
legacy protocol (hence the hashtable with conversation information, since
version is only known at handshake)

It is still missing alot of 9P2000.u specifics, but I don't have any server
to test it with. I'm also missing some dump to test legacy, but I'm pretty
confident I didn't break much there as it is mostly compatible, most
differences are handled using different messages, the only one that was
changed would be RERROR.


second diff also adds deeper interpretation of the protocol, by following
the conversation stream and keeping a bigger hashtable associating fid (file
handles) and file names, for easier debugging.


From me: roll the contents of the (new) packet-9p.h back into the C file.

svn path=/trunk/; revision=49363
2013-05-17 02:00:05 +00:00
Anders Broman 221b249acd svn path=/trunk/; revision=48272 2013-03-12 21:58:04 +00:00
Anders Broman 455f5c8243 - [-Wmissing-prototypes]
- explicit casts.

svn path=/trunk/; revision=48265
2013-03-12 20:00:50 +00:00
Bill Meier a5b230b1d8 Add missing hf[] entries found by checkhf.
ERROR: NO ARRAY: packet-9p.c, hf_9P_dm_exec_group
  ERROR: NO ARRAY: packet-9p.c, hf_9P_dm_read_group
  ERROR: NO ARRAY: packet-9p.c, hf_9P_dm_write_group


svn path=/trunk/; revision=47493
2013-02-05 14:51:59 +00:00
Evan Huus a9bb9186dd Fix some unused variable warnings from GCC.
svn path=/trunk/; revision=45064
2012-09-23 12:45:03 +00:00
Michael Mann b89a06a3e1 replaced decode_boolean_bitfield calls with itemized filters
svn path=/trunk/; revision=45059
2012-09-23 00:12:14 +00:00
Jeff Morriss 2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +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
Bill Meier 638d74d43f Use val_to_str_const() where appropriate;
Also (for a few files):
- create/use some extended value strings;
- remove unneeded #include files;
- remove unneeded variable initialization;
- re-order fcns slightly so prefs_reg_handoff...() at end, etc

svn path=/trunk/; revision=44438
2012-08-10 22:55:02 +00:00
Jakub Zawadzki b18e880040 Update FSF address - part II.
svn path=/trunk/; revision=43538
2012-06-28 23:18:38 +00:00
Alexis La Goutte 98639900ed Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=41261
2012-03-01 13:41:02 +00:00
Chris Maynard e799efeed9 Fix some duplicate display filter names.
svn path=/trunk/; revision=40568
2012-01-18 21:07:53 +00:00
Bill Meier 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +00:00
Bill Meier 67dda34221 Fix benign bugs wherein proto_tree_add_uint() was intended instead of proto_tree_add_item();
(Replaces changes made in SVN #39351).

svn path=/trunk/; revision=39361
2011-10-11 15:39:47 +00:00
Bill Meier ee395460d0 Fix benign bugs in some proto_tree_add_item() 'encoding' args;
svn path=/trunk/; revision=39351
2011-10-10 23:36:07 +00:00
Guy Harris 5f854948d4 Use ENC_NA and ENC_LITTLE_ENDIAN rather than TRUE or FALSE in
proto_tree_add_item() calls.

For strings, add ENC_UTF_8.  (Yes, the byte order is irrelevant for
those - but they should arguably be FT_UINT_STRING, as they're counted
strings, and the byte order *is* relevant for FT_UINT_STRING.)

svn path=/trunk/; revision=39041
2011-09-19 10:10:14 +00:00
Bill Meier 2cb9d994a1 From Yaniv Kaul: some 'set but not used' compilation fixes.
svn path=/trunk/; revision=36889
2011-04-27 05:02:47 +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
Bill Meier 09764dd969 Remove unneeded #include <stdio.h>
svn path=/trunk/; revision=32367
2010-04-03 21:55:23 +00:00
Anders Broman aaa917be72 remove check_col
svn path=/trunk/; revision=32089
2010-03-03 13:52:17 +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