Commit Graph

296 Commits

Author SHA1 Message Date
Jakub Zawadzki d7bd2ecf9f Add new proto_tree_add_format_text() function
There are lot of text dissectors which want just to add escaped (not filtrable) text,
add new function proto_tree_add_format_text() which just do this in optimized way.

Change-Id: Ia0e189b620cc0a5b74cfdaef1ad4571d766bb2ab
Reviewed-on: https://code.wireshark.org/review/1678
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-19 02:27:12 +00:00
Evan Huus d47ae54806 Replace linked list of proto fields with array
This is substantially more memory-efficient, shaving another ~1.5MB off our base
usage. It also lets us remove the annoying extra "last_field" pointer and
simplify proto_register_field_common(). It also accidentally fixed what may
have been a memory leak in proto_unregister_field().

It unfortunately complicates proto_get_next_protocol_field() to require
refetching the protocol each time, but that is itself just an array-lookup under
the covers (and isn't much used), so I don't expect the performance hit to be
noticable.

Change-Id: I8e1006b2326d6563fc3b710b827cc99b54440df1
Reviewed-on: https://code.wireshark.org/review/1225
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-21 15:37:06 +00:00
Hadriel Kaplan f52626cc83 Add tvb_get and proto_tree_add for string-encoded byte arrays
This commit adds tvb_get_string_bytes and proto_tree_add_bytes_item routines for
getting GByteArrays fields from the tvb when they are encoded in ASCII hex string form.

The proto_tree_add_bytes_item routine is also usable for normal
binary encoded byte arrays, and has the advantage of retrieving
the array values even if there's no proto tree.

It also exposes the routines to Lua, both so that a Lua script can take
advantage of this, but also so I can write a testsuite to test the functions.

Change-Id: I112a038653df6482a5d0ebe7c95708f207319e20
Reviewed-on: https://code.wireshark.org/review/1158
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-17 14:04:19 +00:00
Alexis La Goutte cb51bd0acb Fix warning when generate documentation (doxygen)
build/epan/proto.h:384: warning: Found unknown command `\uXXXX'

Change-Id: Ic42730e49ba9b956090269a3b80ffd7a87da33d3
Reviewed-on: https://code.wireshark.org/review/1133
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14 20:21:51 +00:00
Hadriel Kaplan dd002649c3 Add tvb_get and proto_tree_add for string-encoded timestamps
This commit adds tvb_get_string_time and proto_tree_add_time_item routines for
getting nstime fields from the tvb when they are encoded in ASCII string form.

The proto_tree_add_time_item routine is also usable for normal
big/little-endian encoded time_t, and has the advantage of retrieving
the value even if there's no proto tree.

It also exposes the routines to Lua, both so that a Lua script can take
advantage of this, but also so I can write a testsuite to test the functions.

Change-Id: I955da10f68f2680e3da3a5be5ad8fdce7ed6808c
Reviewed-on: https://code.wireshark.org/review/1084
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14 11:47:39 +00:00
Pascal Quantin cfe11b1097 Add ENC_ASCII_7BITS encoding
Change-Id: I01ec87ff4181afb5b2de487fd5f5200f8d62f17d
Reviewed-on: https://code.wireshark.org/review/1088
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-13 20:02:52 +00:00
Guy Harris cb16dff992 Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically
fixed-length fields, where the string can be up to the length of the
field, and is null-padded if it's shorter than that), and use it.  Use
IS_FT_STRING() in more cases, so that less code needs to know what types
are string types.

Add a tvb_get_stringzpad() routine, which gets null-padded strings.
Currently, it does the same thing that tvb_get_string_enc() does, but
that might change if we don't store string values as null-terminated
strings.

Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66
Reviewed-on: https://code.wireshark.org/review/1082
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-12 22:27:22 +00:00
Guy Harris ae127f23fa Add Mac Roman and DOS CP437.
Change-Id: Ib96f2cf4ea71cd0cc2c703d58b9d254bf4c1248a
Reviewed-on: https://code.wireshark.org/review/1077
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-12 08:54:06 +00:00
Gerald Combs a5cb72fe9e Add a Qt I/O Graph dialog.
For each graph you can set:
- Its visibility
- A name
- A display filter
- Color, from a fixed list
- Plot style: Line, Impulse, Bar, Stacked Bar, Dot, Square, Diamond
- Basic Y Axes (packets/s, bytes/s, bits/s)
- Computed Y Axes (SUM, MIN, AVG, MAX)
- Smoothing

You can pan and zoom using the mouse and keyboard. Clicking on a graph
selects the last packet for that interval. If all graphs have the same Y
axis a single label is shown, otherwise a legend is shown.

The time scale (X axis) can be toggled between relative seconds and the
time of day.

Graphs can be saved as PDF, PNG, BMP, and JPEG. Settings are "sticky"
via the io_graphs UAT.

To do:
- Minimize graph drawing delays.
- Figure out why smoothing differs from GTK+
- Everything else at the top of io_graph_dialog.cpp
- Fix empty resets.

A fair amount of code was copied from TCPStreamDialog. We might want to
subclass QCustomPlot and place the shared code there.

Move common syntax checking to SyntaxLineEdit.

Move some common code from ui/gtk/io_stat.c to ui/io_graph_item.[ch] and
use it in both GTK+ and Qt.

Make the io_graph_item_t array allocation in io_stat.c static. The
behavior should be identical and this gives us additional compile-time
checks.

Change-Id: I9a3d544469b7048f0761fdbf7bcf20f44ae76577
Reviewed-on: https://code.wireshark.org/review/435
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
2014-04-07 20:56:42 +00:00
Martin Kaiser eee21a6e1e redefine proto_tree_add_float_format_value() if we're using the new
proto tree api, similar to other proto_tree_add_...() functions

Change-Id: Iaef0711b8221a7bbb24f1004c81a1438f5674e42
Reviewed-on: https://code.wireshark.org/review/926
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-04-02 19:23:57 +00:00
Hadriel Kaplan da1af6e549 Add filterable expert info for Lua
This adds the ability for a Lua script to register expert info fields,
similar to C-code dissectors. This change also removes the need for
the expert_add_info_format_internal() function. Existing Lua scripts
do not have to change, because the existing expert info function
uses the internal "_ws.lua" protocol instead of nothing; but using
the new functionality provides more benefits since it correctly
registers the expert info fields to the dissector's protocol.

The test suite was amended to generate both old and new forms.

Change-Id: Ib5ae74e927cfa81312baf7b04ff4104b0b4f936e
Reviewed-on: https://code.wireshark.org/review/830
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26 05:20:17 +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
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Michal Labedzki e07e697e4d USB: Fix Linux header byte-order
Linux USB Header should be in Host Endian.
Also add ENC_HOST_ENDIAN to simplify code.

Change-Id: I95e7d97014633e8fc1d7739d0728780d70c60442
Reviewed-on: https://code.wireshark.org/review/15
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-04 13:01:23 +00:00
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
Anders Broman 95ed1b4977 As spotted by Joerg; make a HFILL_INIT(hf) macro and use it to init the private part of the hf structure.
svn path=/trunk/; revision=54843
2014-01-19 09:40:04 +00:00
Guy Harris 61867d0b2f Eliminate fvalue_set() in favor of routines that take arguments
appropriate for particular FT_ types.  This lets us do some more type
checking and lets us use const pointers when appropriate.

Constify a bunch of stuff, and don't cast away constness.

svn path=/trunk/; revision=54811
2014-01-15 01:05:03 +00:00
Anders Broman ef399fb652 Try to fix warning: initializer element is not computable at load time.
svn path=/trunk/; revision=54616
2014-01-06 15:30:01 +00:00
Pascal Quantin 6ebc058f47 Add proto_tree_add_ts_23_038_7bits_item() / tvb_get_ts_23_038_7bits_string() functions and update dissectors to use it.
Remove gsm_sms_char_7bit_unpack() / gsm_sms_chars_to_utf8() functions.
Update documentation a bit.

svn path=/trunk/; revision=54534
2014-01-01 14:33:19 +00:00
Martin Kaiser fba61a31be add ssl detection to proto_get_frame_protocols()
svn path=/trunk/; revision=54439
2013-12-24 13:44:00 +00:00
Guy Harris 0d7a48a8bf Add a ENC_3GPP_TS_23_038 encoding, for the standard SMS alphabet in a
bit-packed string, and use it in some places.

svn path=/trunk/; revision=54428
2013-12-24 00:20:09 +00:00
Guy Harris fc7a77189d Add UCS-4 support, and use it.
Shuffle the character ENC_ values around a bit, keeping the Unicode
encodings together, moving the Windows code pages (only one for now)
after the ISO 8859 encodings, and putting "I can't believe it's not
ASCII!" at the end.

Fix some comment typoes, and update another comment, while we're at it.

svn path=/trunk/; revision=54351
2013-12-22 08:45:57 +00:00
Guy Harris f231a273f2 Add the rest of ISO-8859-n, thanks to Jakub's "generate a mapping table"
program.

Put the character-encoding cases in order.

svn path=/trunk/; revision=54344
2013-12-21 21:55:46 +00:00
Jakub Zawadzki 099294dd16 Add charset table for ISO/IEC 8859-9 (ENC_ISO_8859_9)
svn path=/trunk/; revision=54239
2013-12-18 23:32:06 +00:00
Martin Kaiser a07c0ff146 add support for ISO 8859-5
svn path=/trunk/; revision=54132
2013-12-15 19:13:31 +00:00
Gerald Combs 5be6dd5feb Remove config.h includes from proto.h and tap.h.
svn path=/trunk/; revision=53913
2013-12-10 20:23:33 +00:00
Jakub Zawadzki 5fa7d37e37 Fix epan building with undefined HAVE_PLUGINS
+ guard prototypes with HAVE_PLUGINS in .h files to get errors before linking.

svn path=/trunk/; revision=53909
2013-12-10 19:13:09 +00:00
Pascal Quantin a944c8ef7a Remove proto_tree_add_unicode_string()
svn path=/trunk/; revision=53869
2013-12-08 20:15:07 +00:00
Guy Harris b4b18b314a Expand a comment.
svn path=/trunk/; revision=53839
2013-12-08 01:21:58 +00:00
Guy Harris 562348fbb8 Add ENC_ISO_8859_1.
Move the Wikipedia links for the code page layouts in front of the
tables whose contents reflect the code page layouts.

svn path=/trunk/; revision=53837
2013-12-08 01:05:35 +00:00
Jakub Zawadzki 0e5bc8a49c Add string encoding for ISO/IEC 8859-2 (ENC_ISO_8859_2)
svn path=/trunk/; revision=53826
2013-12-07 15:02:55 +00:00
Jakub Zawadzki ffb4e79de9 Add STR_ASCII, STR_UNICODE as possible displays for field_display_e
svn path=/trunk/; revision=53822
2013-12-07 11:50:43 +00:00
Jakub Zawadzki c67d38cf15 Rename base_display_* to field_display
This is preparation to support ->display for FT_STRING values.

svn path=/trunk/; revision=53820
2013-12-07 10:41:42 +00:00
Jakub Zawadzki 113b078a4d Add new string proto encoding for windows-1250 (ENC_WINDOWS_1250)
- Move windows-1250 to unicode encoding table to charset.c
- Add tvb_get_string_unichar2, tvb_get_stringz_unichar2 functions which recode tvb-string to UTF-8.

svn path=/trunk/; revision=53819
2013-12-07 10:10:03 +00:00
Jakub Zawadzki b75354ebe8 Avoid including <epan/epan.h> in dissectors.
svn path=/trunk/; revision=53774
2013-12-03 23:49:51 +00:00
Guy Harris 0cc1545d05 Move most of the plugin code from epan to wsutil and remove all
knowledge of particular types of plugins.  Instead, let particular types
of plugins register with the common plugin code, giving a name and a
routine to recognize that type of plugin.

In particular applications, only process the relevant plugin types.

Add a Makefile.common to the codecs directory.

svn path=/trunk/; revision=53710
2013-12-02 08:30:29 +00:00
Gerald Combs b3a24c5cc4 Replace similar code with a common routine.
svn path=/trunk/; revision=53519
2013-11-23 01:06:30 +00:00
Jakub Zawadzki b5916f0f12 Expand CHECK_DISPLAY_AS_X ('this macro looks like a hack') macro in packet-ieee80211.c, remove it.
svn path=/trunk/; revision=53327
2013-11-14 22:40:40 +00:00
Jakub Zawadzki 6f6d04e2f9 Move REPORT_DISSECTOR_BUG() body to proto_report_dissector_bug() function. Remove exceptions.h include from proto.h
svn path=/trunk/; revision=53231
2013-11-10 16:04:15 +00:00
Jakub Zawadzki 8b73d378a4 exceptions.h not needed by tvbuff.h (no much progress because it's needed by proto.h)
svn path=/trunk/; revision=53219
2013-11-10 11:48:03 +00:00
Jörg Mayer 7c2c2d89f5 Fix:
cd /home/jmayer/work/wireshark/svn/build/qt-gtk3/epan && /usr/bin/cc  -DG_DISABLE_DEPRc
In file included from /home/jmayer/work/wireshark/svn/trunk/epan/packet.h:29:0,
                 from /home/jmayer/work/wireshark/svn/trunk/epan/dissectors/packet-2dp:
/home/jmayer/work/wireshark/svn/trunk/epan/dissectors/packet-2dparityfec.c: In functio:
/home/jmayer/work/wireshark/svn/trunk/epan/proto.h:2128:2: error: ISO C90 forbids mixe]
  extern header_field_info __start__data_ ##proto[]; \
  ^
/home/jmayer/work/wireshark/svn/trunk/epan/dissectors/packet-2dparityfec.c:331:4: note’
    proto_register_fields(proto_2dparityfec, hfi, array_length(hfi));
    ^
cc1: all warnings being treated as errors


svn path=/trunk/; revision=53152
2013-11-08 00:01:19 +00:00
Jakub Zawadzki 1dffd1a949 GCC on amd64 align header_field_info variables to 16-bytes, this cause problems with proto_register_fields_section().
sizeof(void *) alignment should be enough, use it in HFI_INIT.

This fixes http://www.wireshark.org/lists/wireshark-dev/201311/msg00069.html

svn path=/trunk/; revision=53150
2013-11-07 23:20:06 +00:00
Jakub Zawadzki ce6ca9a05d Add infrastructure for section-initializing protocol hfis (without array).
configure implementation later.

svn path=/trunk/; revision=53146
2013-11-07 20:14:18 +00:00
Evan Huus 8a0ef07000 Effectively remove the tree memory pool and port some of its behaviour to the
pinfo memory pool, they have exactly the same scope. Simplification and minor
performance win (one GHashTable we longer have to create/destroy on every
packet).

svn path=/trunk/; revision=53076
2013-11-04 14:12:59 +00:00
Jakub Zawadzki bad81b517f Reintroduce back epan_dissect_reset(), proto_tree_reset()
This time it makes more sense, cause for each dissection we need two wmem allocators.
Reseting wmem allocator is much faster than destroy & create.

svn path=/trunk/; revision=52706
2013-10-20 10:21:25 +00:00
Evan Huus c2b2d204db Redo r52569 in a way that doesn't break the GUI. Add a mem_pool member to
tree_data and reference it directly when allocating/freeing tree items. This
lets us keep multiple around when we need them, and still lets us use
wmem_free_all for a major speedup. It also, coincidentally, lets us get rid of
the annoying fi_tmp hack that was needed before, since that element gets swept
up in the free_all with everything else.

Keep one pool cached to avoid creating/destroying a pool for each packet,
another minor performance win.

The various changes in approach seem to balance out pretty much exactly, this
still gives ~11% over pre-52569.

svn path=/trunk/; revision=52573
2013-10-12 21:01:17 +00:00
Michael Mann a891f3e70b Make expert items used in "low level" proto functions filterable (and ensure they are called even with a NULL tree). I don't really like the Type Length Mismatch "protocol", but it doesn't seem that much different than the exception "protocols".
svn path=/trunk/; revision=52341
2013-10-03 01:54:02 +00:00
Jörg Mayer 1e762e315d Remove epan.h from ftypes.h, address.h and tpg.h,
add it to proto.h as it contains macros that require emem.h

svn path=/trunk/; revision=52001
2013-09-13 09:13:09 +00:00
Guy Harris 8d8c56d3e4 Note what the various ENC_TIME_ encodings are.
svn path=/trunk/; revision=51980
2013-09-12 20:30:55 +00:00
Evan Huus f8693e35e0 From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9072
Add support for Time-of-Day timestamp format from z/OS.

svn path=/trunk/; revision=51974
2013-09-12 16:56:37 +00:00