Commit Graph

42 Commits

Author SHA1 Message Date
Evan Huus 9b5b7c1a90 Remove deprecated tvb_length calls
Trust that the files in epan/ immediately (not dissectors) know what they're
doing so just blindly convert them to captured length.

Change-Id: I872f7d58b2e15ae82c75fd56f4873996fbc97be7
Reviewed-on: https://code.wireshark.org/review/9083
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-24 00:31:25 +00:00
Martin Kaiser 2b7f87587c change several (mutually exclusive) if statements into one big if-else
Change-Id: Ib3614431c3ff8f6e53fa0993e296ffea70926d03
Reviewed-on: https://code.wireshark.org/review/7911
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-04-04 17:18:28 +00:00
Martin Kaiser e4da62fefe Coverity 1158848, 1158849 (logically dead code)
the option parameter of output_fields_set_option() is always a
0-terminated string
therefore, option_value can't possibly be NULL, remove the NULL checks

if someone runs 'tshark ... -E header=', option_value is an empty
string, bail out in this case, don't parse *option_value and
*(option_value++) in the switch statements

Change-Id: I734b04aff653e8dbe990f546220595546e7503b0
Reviewed-on: https://code.wireshark.org/review/7904
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-04-04 17:09:02 +00:00
Martin Kaiser 66c4c14ceb we may see an empty option string in output_fields_set_option()
Change-Id: I45a4cbef7cb38a851c207fbe26ff412ffc502240
Reviewed-on: https://code.wireshark.org/review/7903
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-04-04 11:36:12 +00:00
Gerald Combs 7787c1b464 Fixup our anonsvn URLs.
Change-Id: Id18d392bf7ff948fc78b684d8222c5c3725d302a
Reviewed-on: https://code.wireshark.org/review/7886
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-04-02 19:21:41 +00:00
Michael Mann e7fd1bfdf7 Reduce epan dependence on dissectors by having print module "cache" the protocol and field ids that it needs.
Change-Id: I4ec48067e9ca2cbe88e1cf2e6c9dc1e382379221
Reviewed-on: https://code.wireshark.org/review/7767
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-20 05:30:52 +00:00
JC Wren e2bcee6ac4 Make FT_{U}INT64 behave more like FT_{U}INT32, add support for FT_{U}INT{40,48,56}
Change-Id: I57354c309ecf3a0c8f0c7cff485638027f30bb19
Reviewed-on: https://code.wireshark.org/review/5813
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-21 16:57:52 +00:00
Gerald Combs e11d7ef08f Fix diagnostics macros and squelch a gcc warning.
Both clang and gcc define __GNUC__. Make sure we account for that when
defining diagnostic macros.

Use DIAG_OFF + DIAG_ON to suppress gcc -pedantic warnings about
frame_data.

Get rid of packet_char_enc casts.

Change-Id: Idbcc61bcdb35c1d20f185461c69451dcdf73bae9
Reviewed-on: https://code.wireshark.org/review/7106
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-14 19:46:42 +00:00
Bill Meier e88a11f5c9 (Trivial) Fix printf-related 'Mismatch on sign' warnings
Found by MSVC2013 Code Analysis

Change-Id: I58063946dd558e98308c87b36eeac0ddbe1a6e79
Reviewed-on: https://code.wireshark.org/review/7045
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-09 18:57:14 +00:00
Michael Mann a1f2342e13 Miscellaneous ep_strdup_printf replacement.
Change-Id: I973c672e9d573ad67e9b9fd82a5610aaf8a74efa
Reviewed-on: https://code.wireshark.org/review/6605
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18 04:15:18 +00:00
Michael Mann 553da37446 Create BASE_DOT, BASE_DASH, and BASE_SEMICOLON types for the FT_BYTES field type.
These "bases" will put a ".", "-", or ":" respectively between hexidecimal bytes in the field in packet view and display filter.  FT_BYTES with BASE_NONE will have no separator in the packet view, but continue to have the ':' as a separator in the display filter.

Converted the "string" hf_ entries that used tvb_fc_to_str as a string to use proto_tree_add_item with FT_BYTES/BASE_DOT type.

Converted applicable tvb_bytes_to_ep_str_punct() calls to use the new BASE values.

Change-Id: I2442185bb314d04a3ff2ba57883652ecd738b5f9
Reviewed-on: https://code.wireshark.org/review/6098
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-04 16:32:03 +00:00
Guy Harris c1f30471ca Move the version_info.c stuff to wsutil/ws_version_info.c.
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde
Reviewed-on: https://code.wireshark.org/review/6153
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 03:41:02 +00:00
Bill Meier 94eeaf10f2 print.c: clean up #includes
Change-Id: I0ecf618cc79060d35b5480f3d8e7ebf8575761c4
Reviewed-on: https://code.wireshark.org/review/5969
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-22 04:59:19 +00:00
Guy Harris 81ab6012fe Clean up routine names, don't pass capture_file into libwireshark.
Give all routines in epan/print.c that write a particular format a name
beginning with write_{formatname}.

If routines write columns, rather than the raw protocol tree, don't give
it a name containing proto_tree.

Get rid of empty preamble/finale routines.

For CSV, the preamble routine writes out column titles, so call it
write_csv_column_titles().

For C arrays, the body routine writes out raw hex data, so call it
write_carrays_hex_data().

capture_file isn't a structure defined by libwireshark, so don't make it
an argument passed into libwireshark.

Change-Id: I5a7e04de9382cf51a59d9d9802f815b8b3558332
Reviewed-on: https://code.wireshark.org/review/5536
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-29 22:44:29 +00:00
Guy Harris 741db4c751 Get rid of another global in the print code.
Pass the "output only these protocols" hash table as an argument,
instead.

Change-Id: Id8540943037e7b9bbfe377120c3f60dbe54fe0f1
Reviewed-on: https://code.wireshark.org/review/5440
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 09:07:46 +00:00
Guy Harris b19b12a85d Get rid of write_headers global variable.
Have write_psml_preamble() and write_csv_preamble() take a capture_file *
as an argument, so they can print the column titles themselves, rather
than having to defer it to the routine that prints packet data.

Change-Id: Ifd1b7a13062be8ad46846315976922a752778153
Reviewed-on: https://code.wireshark.org/review/5438
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 08:07:24 +00:00
Guy Harris 7d7fc47a2a Split the low-level print stream code into a separate file.
Put the low-level print stream code from epan/print.c into
epan/print_stream.c, leaving the higher-level stuff in print.c

Change-Id: Iae961f168ec655a29f434257b1af0937fca9f025
Reviewed-on: https://code.wireshark.org/review/5436
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22 03:24:17 +00:00
Pascal Quantin 5e40aa45ca print: do not try to add an empty hex stream to PDML output for a text only hf
Bug: 10651
Change-Id: If38af2879b9a20f4755a7843f20c7327d66c95b1
Reviewed-on: https://code.wireshark.org/review/5054
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-11-01 21:32:53 +00:00
Bill Meier 23e78cd6bd Add editor modelines; Adjust whitespace as needed.
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50
Reviewed-on: https://code.wireshark.org/review/4594
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-10 14:50:08 +00:00
Gerald Combs 6397ad43c2 Revert "Qt: Try to fix a Visual C++ encoding warning."
Revert gafa8c02 since it didn't work on Windows. Use a pragma to squelch
Visual C++ instead.

Qt's rich text renderer doesn't handle "&apos;". Replace it with "&#x27;".
Remove a QDebug include.

Change-Id: I0e6308efda74a4bc0e67ce841a50a0a9b68f4a8b
Reviewed-on: https://code.wireshark.org/review/4511
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-06 23:34:56 +00:00
Evan Huus 8d2eaaab51 If we have no fields, don't try to iterate through them.
Otherwise glib throws an assertion since the array we pass it is NULL.

Change-Id: I9159c1f5ad99b280c040cd790df3cf352738601f
Reviewed-on: https://code.wireshark.org/review/2680
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-27 03:27:24 +00:00
Jeff Morriss 9d4af5fccd Check the validity of fields given to tshark with "-e": complain and exit if
they aren't valid.

Should help avoid confusion like that in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=10201

Bug: 10201
Change-Id: Iff7f51ae042ca1a92d1c803b6cb61aa5d81ce205
Reviewed-on: https://code.wireshark.org/review/2654
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-27 00:48:51 +00:00
Guy Harris c46329c27b Add a routine to return a version string including VCS information.
Add a routine get_ws_vcs_version_info() that, for builds from a tree
checked out from Wireshark's version control system, returns a string
that includes both the Wireshark version number and an indication of
what particular VCS version was checked out, and just returns
Wireshark's version number for other builds.

Use that routine rather than manually gluing VERSION and the Git version
number together.

("vcs", not "git", just in case we do something bizarre or mercurial
some day. :-))

Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d
Reviewed-on: https://code.wireshark.org/review/2529
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-22 01:06:25 +00:00
Evan Huus de00c49bd8 Convert a bunch of time_to_str functions to wmem
Change-Id: I24fe3cc4a3589dadc4528a77fe7ff13d06b1a983
Reviewed-on: https://code.wireshark.org/review/2245
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-16 17:26:25 +00:00
Michael Mann e5353bf119 Use g_ alloced memory (instead of emem) when printing fields. emem shouldn't be used for GUI functions anyway.
emem was exposed because of its memory limits trying to output PDML for a very large byte field in a capture file.

When converting from proto_construct_match_selected_string to fvalue_to_string_repr remember proto_construct_match_selected_string includes fieldname + value, not just value

bug:10081
Change-Id: I4fc6ea7fd1f63cff410207c8b30562771af40ada
Reviewed-on: https://code.wireshark.org/review/1578
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-19 01:46:55 +00:00
Evan Huus 877942c3fd Revert "Use g_ alloced memory (instead of emem) when printing fields. emem shouldn't be used for GUI functions."
It's causing a few different test failures - I've tracked down at least one of them, but the others are weirder and will require more digging.

This reverts commit 9edba650d1.

Change-Id: I897f8cf1cfbb2a189b2054e5002f59757befa47f
Reviewed-on: https://code.wireshark.org/review/1575
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-09 15:19:59 +00:00
Guy Harris e5cfd9e13a Squelch compiler warnings.
Some are legitimate warnings - get_node_field_value() now returns a
value that the callers are expected to g_free(), so we'd better not
return a string constant.

Change-Id: I937254316119044691c1d9a3da8c9615763e2e5a
Reviewed-on: https://code.wireshark.org/review/1571
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09 07:51:22 +00:00
Michael Mann 9edba650d1 Use g_ alloced memory (instead of emem) when printing fields. emem shouldn't be used for GUI functions.
emem was exposed because of its memory limits trying to output PDML for a very large byte field in a capture file.

bug:10081
Change-Id: I6346dfdfb5f6381e16761a99291c4be7851185d9
Reviewed-on: https://code.wireshark.org/review/1566
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-09 04:31:10 +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 9815a25971 Fix crash when exporting dissection summaries to a CSV file.
The while loop in question ends with tmp_str being NULL; the next loop
processes the same string, so you have to set tmp_str to csv_str before
looping.

Fix some comments while we're at it.

Change-Id: I69dd7dc276e0cb11226eceee7921be87e3cc7534
Reviewed-on: https://code.wireshark.org/review/352
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-25 09:08:29 +00:00
Pascal Quantin 8f15d3aa8d Fix display of right arrow in CSV export
Changeset 1d8a895fa4 introduced the use of UTF-8 righ arrow to indicate the direction in TCP dissector.
While it displays nicely in Wireshark GUI or in a text export of packets, an export to CSV results in an escaped string.
This patch is a naive attempt to display the right arrow in a more friendly way when exporting to CSV.
Any smarter fix is welcome.

Change-Id: Ife787268696fa69dafc24a5cf9706af4c4832831
2014-01-29 21:32:31 +01:00
Jakub Zawadzki 746ee39329 Drop isprint.h use g_ascii_isprint() when this include hack was enabled.
svn path=/trunk/; revision=54327
2013-12-21 15:01:45 +00:00
Evan Huus 2ae8edccea Rename more to_str functions to have ep_ in the name if they return ephemeral
buffers. Remove two unused functions.

svn path=/trunk/; revision=54250
2013-12-19 16:28:39 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Jakub Zawadzki 12d1509aa1 Move struct _ftype_t + callback typedefs + free macro to ftypes-int.h
svn path=/trunk/; revision=53223
2013-11-10 13:14:09 +00:00
Jakub Zawadzki 1899903f69 Include <epan/to_str.h> only when needed.
svn path=/trunk/; revision=53189
2013-11-09 13:41:10 +00:00
Evan Huus ee6916b838 When printing PDML, don't assume that all values with bitmasks are represented
as guint32 internally - they may be signed and/or 64-bit.

svn path=/trunk/; revision=52587
2013-10-13 16:10:43 +00:00
Michael Mann ba3e8e070a Make column "filter name" prefixed with _ws. to be the same as other "*shark application filters" created in r52462.
svn path=/trunk/; revision=52474
2013-10-09 19:43:02 +00:00
Pascal Quantin 7b71fa4782 Try to fix error: ignoring return value of 'fwrite', declared with attribute warn_unused_result
svn path=/trunk/; revision=50722
2013-07-18 07:01:02 +00:00
Jakub Zawadzki 8cefe3b406 Optimize print_line_text
- fill spaces[] array once
- use fwrite()

svn path=/trunk/; revision=50705
2013-07-17 20:13:54 +00:00
Jakub Zawadzki 3845249a7f Optimize proto_tree_print_node() + fix possible memleak when -O is used
svn path=/trunk/; revision=50699
2013-07-17 17:16:22 +00:00
Jeff Morriss 4dcc156cf3 Move the print modules into epan.
svn path=/trunk/; revision=50526
2013-07-12 03:50:50 +00:00