Commit Graph

40 Commits

Author SHA1 Message Date
Gilbert Ramirez 4cc694839d Fix all -fstrict-alias warnings found by gcc 4.1.2
The majority of the fixes are for calls to uat_new(). Instead of
having each caller cast its private data to (void**), we use void*
in the uat_new() API itself. Inside uat_new(), we cast the void*
to void**.

Some dissectors use val64_string arrays, so a VALS64() macro was
added for those, to avoid using VALS(), which is useful only for
value_string arrays.

packet-mq.c was changed because dissect_nt_sid() requires
a char**, not a guint**. All other callers of dissect_nt_sid() use
char*'s (and take the address of it) for their local storage. So,
this was changed to follow the other practices.

A confusion between gint and absolute_time_display_e in packet-time.c
was cleared up.

The ugliest fix is the addition of ip6_guint8_to_str(), for exactly
one caller. The caller uses one type of ip6 address byte array,
while ip6_to_str() expects another. This new function is in place
until the various address implementations can be consolidated.

Add VALS64() to the developer documentation.

Change-Id: If93ff5c6c8c7cc3c9510d7fb78fa9108e4552805
Reviewed-on: https://code.wireshark.org/review/48
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-03 09:26:10 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Anders Broman acf2fed688 - Forward declaration of register functions.
svn path=/trunk/; revision=53901
2013-12-10 06:01:16 +00:00
Michael Mann 8081cf1d90 Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that?

Should tcp_dissect_pdus return length (bytes consumed)?  There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb).  Seems like that could all be rolled into one.

svn path=/trunk/; revision=53198
2013-11-09 17:46:28 +00:00
Evan Huus 95f484a91e Add a very small hack to make the UAT update callback error string freeable, and
convert all existing UAT update callbacks to use glib memory instead of
ephemeral memory for that string.

UAT code paths are entirely distinct from packet dissection, so using ephemeral
memory was the wrong choice, because there was no guarantees about when it would
be freed.

The move away from emem still needs to be propogated deeper into the UAT code
itself at some point.

Net effect: remove another bunch of emem calls from dissectors, where replacing
with wmem would have caused assertions.

svn path=/trunk/; revision=52854
2013-10-25 22:14:25 +00:00
Bill Meier f6e09faa2d From Ed Beroset: add modelines and fix irregular indenting;
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9273

This patch adds modelines and cleans up the irregular indentation of
this dissector's code.  The only other change was in
asn1/c1222/packet-c1222-template.c to consolidate an #ifdef that had a
redundant #endif (line 812) and subsequent reopening #ifdef (line
824).  The only thing between them was comments, so the span of the
original #ifdef (line 644) was simply extended by eliminating those
two lines.

The purpose for this patch is to make the file easier to edit and
understand in advance of more substantive patches later.  This patch
is intended to be easy to review by having only non-substantive
changes.


svn path=/trunk/; revision=52636
2013-10-16 00:57:28 +00:00
Jeff Morriss 545455db1c Fix compilation when we don't HAVE_LIBGCRYPT
svn path=/trunk/; revision=52527
2013-10-11 00:42:02 +00:00
Evan Huus f29544f9df Add a call to tvb_ensure_bytes_exist before we allocate memory based on our
offset+size, prevents attempts to allocate outrageous memory, fixing
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9260

svn path=/trunk/; revision=52503
2013-10-10 17:44:55 +00:00
Evan Huus a50dee3286 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9246
Fix memory leaks and bad memory accesses in c1222 dissector.

From me: use realloc in a handoff function since it may get called multiple
times, and we only need the latest.

svn path=/trunk/; revision=52497
2013-10-10 16:18:49 +00:00
Michael Mann 94f0e1fe21 Fully support relative AP-titles in C12.22. Bug 9196 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9196)
From Ed Beroset

svn path=/trunk/; revision=52394
2013-10-06 02:42:14 +00:00
Anders Broman 408ba7bade From beroset@mindspring.com:
c1222 dissector has wrong tag value for BER-encoding of calling_AE_qualifier

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9193

svn path=/trunk/; revision=52225
2013-09-26 21:15:44 +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
Michael Mann 00dd0adc0d expert_add_info_format_text -> expert_add_info_format
svn path=/trunk/; revision=51851
2013-09-09 00:28:48 +00:00
Alexis La Goutte 467ece42b3 Fix (-W)documentation error found by Clang
../../asn1/c1222/packet-c1222-template.c:348:15: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param pinfo
   ~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:349:14: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tree
   ~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:350:16: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param length
   ~~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:351:16: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param offset
   ~~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:758:11: error: parameter 'keybuf' not
      found in the function declaration [-Werror,-Wdocumentation]
 * \param keybuf is updated with a copy of the key data if successful lookup.
          ^~~~~~
../../asn1/c1222/packet-c1222-template.c:758:11: note: did you mean 'keybuff'?
 * \param keybuf is updated with a copy of the key data if successful lookup.
          ^~~~~~
          keybuff
../../asn1/c1222/packet-c1222-template.c:879:13: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tvb
   ~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:880:16: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param offset
   ~~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:881:13: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param len
   ~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:882:15: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param pinfo
   ~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:883:14: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tree
   ~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1023:13: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tvb
   ~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1024:15: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param pinfo
   ~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1025:14: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tree
   ~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1047:15: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param pinfo
   ~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1048:13: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tvb
   ~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1049:16: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param offset
   ~~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1068:13: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tvb
   ~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1069:15: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param pinfo
   ~~~~~~~~~~~^
../../asn1/c1222/packet-c1222-template.c:1070:14: error: empty paragraph passed
      to '\param' command [-Werror,-Wdocumentation]
 * \param tree
   ~~~~~~~~~~^

svn path=/trunk/; revision=51272
2013-08-10 21:30:38 +00:00
Jeff Morriss 2df54da6e2 Move a bunch of the crypt modules and pint.h into wsutil.
This means wsutil now links against libcrypt.

Protect a bunch of the crypt header files from multiple inclusion.

svn path=/trunk/; revision=51100
2013-08-01 23:34:47 +00:00
Guy Harris b2475c1c29 Squelch some warnings that show up with, for example, the GCC 4.2.1 that
comes with Xcode 3.2.6 (it's not a real problem, but that requires more
flow analysis than that version of the compiler does, apparently).

svn path=/trunk/; revision=50419
2013-07-06 19:34:21 +00:00
Michael Mann 225698ef0b Fix display filter errors caught by checkfiltername.pl
svn path=/trunk/; revision=50399
2013-07-06 02:53:45 +00:00
Pascal Quantin 1bb2081fd2 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8746 :
Add procedure numbers to C12.22 dissection

svn path=/trunk/; revision=49775
2013-06-04 20:21:17 +00:00
Jeff Morriss 29d51623c2 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8762 :
Remove dead code (condition can never happen).

svn path=/trunk/; revision=49743
2013-06-04 01:38:53 +00:00
Michael Mann 7fe5422c4b Convert ASN.1 dissectors to use filterable expert info.
NOTE: Kerberos ASN.1 template was updated, but not generated to source.

svn path=/trunk/; revision=49707
2013-06-03 03:42:36 +00:00
Pascal Quantin c553280339 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8745 :
Upgrade AP-title ASN.1 description

svn path=/trunk/; revision=49684
2013-06-01 23:10:37 +00:00
Pascal Quantin c310bd7dcc Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8744 :
Display C12.22 Invocation Id as unsigned integer

svn path=/trunk/; revision=49682
2013-06-01 20:51:14 +00:00
Pascal Quantin 0ee4d0a00a Postfix FT_NONE fields with "_element" string to reduce number of incompatible filters in ASN.1 dissectors
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2402

svn path=/trunk/; revision=49599
2013-05-27 20:26:49 +00:00
Anders Broman e9f90d8c42 Make C12.22 work over UDP.
svn path=/trunk/; revision=49104
2013-05-01 08:34:40 +00:00
Pascal Quantin a37c044203 Update the ASN.1 based dissectors following the changes done in r48812
svn path=/trunk/; revision=48820
2013-04-11 18:14:53 +00:00
Guy Harris 29715ccc8f How can I get a new tvbuff that starts at an offset within a given
tvbuff and runs to the end of the tvbuff?  Let me count the ways....

Replace a bunch of different ways of doing that (some incorrect, in that
they're not properly handling tvbuffs where the captured and reported
lengths are different) with tvb_new_subset_remaining().

svn path=/trunk/; revision=47751
2013-02-19 23:17:07 +00:00
Michael Mann fd44f9a339 Remove C++ incompatibilities in c1222 dissector.
Also addresses an implicit cast in the epan/uat.h file

Bug 8342 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8342)

svn path=/trunk/; revision=47721
2013-02-17 22:15:16 +00:00
Jakub Zawadzki 7a9d27c33f Regenerate asn.1 dissectors.
svn path=/trunk/; revision=45110
2012-09-24 19:38:46 +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
Chris Maynard a592bd657c tvb_length_remaining() can return -1, so don't assign its return value to an unsigned integer. Fixes Coverity CID 281367: Improper use of negative value.
svn path=/trunk/; revision=43698
2012-07-13 21:03:54 +00:00
Guy Harris 659cf0527a UATs could be put into "categories". The categories were defined only
implicitly by the #define name and string they were defined to; not all
UATs neatly fit into any of the categories, so some of them were put
into categories that weren't obviously correct for them, and one - the
display filter macro UAT - wasn't put into any category at all (which
caused crashes when editing them, as the GUI code that handled UAT
changes from a dialog assumed the category field was non-null).

The category was, in practice, used only to decide, in the
aforementioned GUI code, whether the packet summary pane needed to be
updated or not.  It also offered no option of "don't update the packet
summary pane *and* don't redissect anything", which is what would be
appropriate for the display filter macro UAT.

Replace the category with a set of fields indicating what the UAT
affects; we currently offer "dissection", which applies to most UATs
(any UAT in libwireshark presumably affects dissection at a minimum) and
"the set of named fields that exist".  Changing any UAT that affects
dissection requires a redissection; changing any UAT that affects the
set of named fields that exist requires a redissection *and* rebuilding
the packet summary pane.

Perhaps we also need "filtering", so that if you change a display filter
macro, we re-filter, in case the display is currently filtered with a
display filter that uses a macro that changed.

svn path=/trunk/; revision=43603
2012-07-08 01:00:46 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Chris Maynard 8fd9342f7d tvb_length_remaining() can return a negative number, so be sure to handle it. Fixes Coverity CID 281367.
svn path=/trunk/; revision=42840
2012-05-25 00:29:46 +00:00
Guy Harris 25917db46e Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_bitmask() calls.

svn path=/trunk/; revision=42568
2012-05-11 08:10:42 +00:00
Guy Harris 6eaf0037f8 Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls.

svn path=/trunk/; revision=42477
2012-05-07 18:06:47 +00:00
Stig Bjørlykke 1301b98e25 Use _U_ for unused arguments.
svn path=/trunk/; revision=41478
2012-03-11 12:00:00 +00:00
Alexis La Goutte 7857dc50fb Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=41299
2012-03-02 11:02:02 +00:00
Jörg Mayer de0bf160b9 The warning fix overdid things: It removed functionality.
Now I only remove the variable ft and everything looks good.

svn path=/trunk/; revision=40516
2012-01-15 17:07:55 +00:00
Jörg Mayer 6197143d6c Ed Beroset <beroset@mindspring.com> via bug 5531
The ANSI C12.22 protocol is a smart grid protocol for utility meters, including
gas, water and electric.  The dissector implemented in the patch file includes
full support for all EPSEM (Extended Protocol Specification for Electricity
Metering) services and includes a full implementation of the C12.22 security
modes.

[...]

To decrypt the attached sample file, you need to set up the key table in the
preferences to include key 0 with a value of 6624C7E23034E4036FE5CB3A8B5DAB44.

Me: Fixes for:

[ 64%] Building C object epan/CMakeFiles/epan.dir/dissectors/packet-c1222.c.o            
../../asn1/c1222/packet-c1222-template.c: In function ‘dissect_epsem’:                   
../../asn1/c1222/packet-c1222-template.c:860:15: error: variable ‘ft’ set but not used [-Werror=unused-but-set-variable]

[  5%] Building C object epan/CMakeFiles/epan.dir/dissectors/packet-c1222.c.o
../../asn1/c1222/packet-c1222-template.c:103:19: error: ‘c1222_flags’ defined but not used [-Werror=unused-variable]



svn path=/trunk/; revision=40500
2012-01-14 15:22:10 +00:00