Commit Graph

38 Commits

Author SHA1 Message Date
Michael Mann f509a83381 Add format_size_wmem
It's a "wmem version" of format_size (from wsutil/str_util.h).

Also improved the flexibility in formatting of format_size() to handle future
needs of format_size_wmem

Ping-Bug: 15360
Change-Id: Id9977bbd7ec29375bbac955f685d46e75b0cef2c
Reviewed-on: https://code.wireshark.org/review/31233
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-02 05:01:16 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Craig Jackson 52b7c8929a Z39.50: Implementation of Z39.50 Information Retrieval protocol
NISO Z39.50 is a protocol used by libraries and library vendors for information retrieval and catalog manipulation. It is defined using ASN.1 using BER encoding. It has an assigned TCP port of 210. This is an initial implementation.

Features:
- The Z39.50 standard OIDs are defined.
- The bib-1 attribute set is decoded.
- The bib-1 diagnostics are decoded.
- Some OCTET STRINGs which are nearly always printable ASCII are special-cased.
- The MARC (MAchine Readable Cataloging) format is decoded. Only the MARC21 variant is
  currently handled, but this is one of the most common variants. The most common tags
  are decoded. The MARC dissector is included in the Z39.50 dissector, but the code is
  structured in such away that it could be pulled out.

Todo:
- Add information to the Wiki about Z39.50.

As part of this work, the definition of isdigit_string() was fixed to avoid const complaints.

Change-Id: I29a7db53375ef8be83738a1ab98707761d878717
Reviewed-on: https://code.wireshark.org/review/31209
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-28 09:28:17 +00:00
Stig Bjørlykke 3924c6e544 lwm2mtlv: Handle String data type as UTF-8
Display element value as bytes if value is not a valid UTF-8 string.
Add a new utility function isprint_utf8_string().

Change-Id: I211d5ed423b53a9fd15eb260bbc6298b0b8f46a0
Reviewed-on: https://code.wireshark.org/review/27178
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-28 06:19:48 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Michael Mann 3d673da88c Convert to using use SPDX identifier on wsutil directory
Change-Id: Id73e641499e75bc1afc1dea29682418156f461fe
Reviewed-on: https://code.wireshark.org/review/24751
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-10 04:36:29 +00:00
João Valverde e1ef8e5f75 Test g_printf() thousands grouping flag at runtime
This tests the runtime environment so avoid hard-coding it during the build.

For now we avoid messing with locales for the test, unless it turns out to
be necessary (ISO C printf behaviour with invalid conversion specifier is
undefined).

Change-Id: I341c2ab5e716973689cf9002f13435404a41369f
Reviewed-on: https://code.wireshark.org/review/24038
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-24 22:00:46 +00:00
João Valverde ecb4dc396e Include ws_diag_control.h in config.h
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317
Reviewed-on: https://code.wireshark.org/review/14749
Petri-Dish: João Valverde <j@v6e.pt>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-04-04 23:05:31 +00:00
Gerald Combs 0e8cc9ab0a UDP multicast stream dialog.
Add the UDP multicast stream dialog. Abuse TapParameterDialog a bit more
so that we can edit parameters.

Remove some unused struct members and an unused function.

Change-Id: I962c70344e792f0959527e4bcba8a20bd7e8acf9
Reviewed-on: https://code.wireshark.org/review/10084
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-08-18 20:17:20 +00:00
Guy Harris e29dca79f2 Not all compilers support turning of "format=".
The clang on my machine doesn't; just do "format" instead.  (The best
way to handle this may be to do the formatting ourselves, so that we can
get thousands separators on *all* platforms, regardless of whether its
printf formatter supports it.)

Change-Id: I1948d1799688cb3cf1d7b0de0696c09f6bf23f1c
Reviewed-on: https://code.wireshark.org/review/7241
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-18 20:13:31 +00:00
Gerald Combs dd15191409 Suppress a printf grouping warning.
Suppress

    warning: ISO C does not support the ''' printf flag [-Wformat=]

We verify that we *do* support it via HAVE_GLIB_PRINTF_GROUPING.

Change-Id: Iedcf1d1856238e05babde5fe8ec23f64fbf2cdcf
Reviewed-on: https://code.wireshark.org/review/7238
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-18 18:37:34 +00:00
Guy Harris 63a3d043e3 Consistently use the "g_string_free returns a C string pointer" idiom.
g_string_free(str, FALSE) frees the GString container but not the
underlying g_malloc()ed string; instead, it returns a pointer to the
g_malloc()ed string.

Fix those places that didn't already get the string pointer from
g_string_free() to do so rather than manually extracting the string
themselves.

And fix one place that didn't even need to use a string - it was just
scanning a C string without even modifying it.

Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5
Reviewed-on: https://code.wireshark.org/review/6532
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 23:14:13 +00:00
Martin Mathieson e3efb80b45 Deleting unnecessary #includes from wsutil.
Will look at cleaning up and committing script afterwards.

Change-Id: Id785e581740ab62fe9258ecfcb0926761ad9c527
Reviewed-on: https://code.wireshark.org/review/6086
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-28 23:33:54 +00:00
Guy Harris 5fc398c328 Don't use ctype.h routines.
That avoids locale dependency and handles possibly-signed chars (which
we weren't doing before).

Change-Id: I189222eff624ad2d2e960bc0b69f3f22d35f351f
Reviewed-on: https://code.wireshark.org/review/4787
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17 21:11:44 +00:00
Bill Meier 10b83e6931 Add editor-modelines; adjust whitespace.
Change-Id: I8cad872cee972a6d22a72852dac57fd188daca84
Reviewed-on: https://code.wireshark.org/review/4683
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-14 16:45:09 +00:00
Jeff Morriss 2497482e34 Don't print non-printable characters in AX.25 addresses.
Add a new routine to wsutil to make this easy: printable_char_or_period().

Bug: 10439
Change-Id: I0eb2bb6bc0676a1035c3d845b5e20276fa04de60
Reviewed-on: https://code.wireshark.org/review/3981
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-04 12:46:06 +00:00
Guy Harris cda5c16667 Clean up capinfos output.
Make sure there's always a space between a number and "[TGMK]bytes",
"[TGMK]bits", and "[TGMK]packets".

Change-Id: I710385303e451e9aea6fc9bbea562f59ca0d22c9
Reviewed-on: https://code.wireshark.org/review/3810
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-24 08:57:13 +00:00
Gerald Combs 59ef97dd65 [WIP] Add a conversation dialog.
Items are sorted by value.

Move common conversation code to ui/conversation_hash.[ch]. Add a
conversation_type_e enum along with convenience functions for fetching
titles, tap names, etc.

We have a single main dialog instead of a main dialog + individual
protocol dialogs. It de-clutters the statistics menu and results in
simpler code. Conversation type tabs can be added and removed within the
dialog itself. The tab list is sticky and saved with the current profile
when the dialog closes. Data can be copied as CSV or YAML.

Add a FilterAction class and a corresponding filterAction slot to
MainWindow. Use it for the Conversations context menu.

Add an addressResolutionChanged signal and related plumbing.

Get rid of the iterator members in the conversation item struct. Update
the GTK+ code accordingly.

Excercise for the reader:
- Update TShark to use the common hash code.

Ping-Bug: 9231
Ping-Bug: 8703
Ping-Bug: 6727
Change-Id: I8728d771fc5b1a85937bed9d898e53c3ecc3a544
Reviewed-on: https://code.wireshark.org/review/2987
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-21 23:19:09 +00:00
AndersBroman 3157bf6ba5 isprint() -> g_ascii_isprint()
Change-Id: Ia586ef8ce500d5fc7578c52014206fa7a7eaea41
Reviewed-on: https://code.wireshark.org/review/1624
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13 16:14:07 +00:00
AndersBroman f7819de76a In ascii_xx_inplace use g_ascii_isupper/g_ascii_islower directly, it
*should* be slightly more efficient.

Change-Id: I3081e2e25f241cdb07fa46011f50709fd560fb1c
Reviewed-on: https://code.wireshark.org/review/1626
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13 16:07:08 +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
Jakub Zawadzki d28084d183 Move UAT xton() to wsutil library
Use ws_xton() in few more places.

svn path=/trunk/; revision=54642
2014-01-08 00:28:13 +00:00
Bill Meier 828d4e89f6 Define certain 'const char *...' arrays as static.
(That is: Don't create the array on the stack each time
  the function is called).

 Reduces code memory usage and execution time.
 (See SVN #50271)


svn path=/trunk/; revision=50300
2013-07-01 15:41:05 +00:00
Gerald Combs a79e5d5b94 Check to see if GLib's printf routines support the X/Open / POSIX
thousands grouping (') flag and use it in format_size if it's available.
As far as I can tell this translates to "everywhere except Windows and
OpenBSD". According to the various build logs at

https://build.opensuse.org/package/show?package=mingw32-glib2&project=windows%3Amingw%3Awin32

the OBS GLib packages enable GLib's internal printf implementation from
Gnulib which means we *should* be able to enable this on Windows.
Unfortunately this doesn't appear to be the case.

svn path=/trunk/; revision=48042
2013-03-03 19:34:58 +00:00
Jeff Morriss 98ea7d3a8d From Anders: revert r47934: it doesn't work everywhere.
See email discussion on -dev.

svn path=/trunk/; revision=47940
2013-02-28 15:16:46 +00:00
Gerald Combs 2f47e63a88 str_util.c: Although the glib documentation doesn't explicitly say so,
it looks like the thousands grouping (') modifier is supported so use it
in format_size.

capinfos.c: Set our locale.

svn path=/trunk/; revision=47934
2013-02-28 04:44:38 +00:00
Gerald Combs 0645396514 Print human-readable statistics by default. Raw values can be printed
using "-M". Based on a suggestion by Hansang Bae.

svn path=/trunk/; revision=47900
2013-02-26 06:40:25 +00:00
Evan Huus c2945ff831 Squash some sign-conversion warnings that g++ picks up but gcc does
not. QtShark now builds warning-free (for me at least).

svn path=/trunk/; revision=46786
2012-12-26 13:41:30 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Gerald Combs f003add90f Fix a copy+paste error and a missing include. Adjust the format_size
digit threshold.

svn path=/trunk/; revision=45456
2012-10-10 20:19:18 +00:00
Gerald Combs 98b0812341 Add a format_size function similar to g_format_size that renders a size
value in a human-readable format. Use it in the welcome screen, status
bar, and Win32 interface details.

Note that in the welcome screen and status bar we've switched from
customary binary prefixes to strict SI.

svn path=/trunk/; revision=45453
2012-10-10 19:17:31 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +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
Jeff Morriss 9e1359e2fa Revert 43481: linking dftest against libui was not the problem.
svn path=/trunk/; revision=43488
2012-06-25 22:21:58 +00:00
Jeff Morriss 8eeebf73e0 Move get_args_as_string from ui/util.c into wsutil (maybe not to the best
module, but...).

This makes dftest no longer dependent on libui, so stop linking against it.

svn path=/trunk/; revision=43481
2012-06-25 20:38:45 +00:00
Stephen Fisher 7a52947075 Move exec_isdigit_string() and exec_isprint_string() functions out of
the exec dissector and into wsutil/str_util.c.  Rename them to
isdigit_string() and isprint_string().  Also rename the variables they use
for consistency: string -> str and position -> pos.


svn path=/trunk/; revision=41053
2012-02-17 17:22:12 +00:00
Bill Meier 0147b08a4e Revise ascii...inplace to return a ptr to the string
svn path=/trunk/; revision=27253
2009-01-17 17:30:23 +00:00
Guy Harris 9d1b5335ac g_ascii_strdown() and g_ascii_strup(), unlike g_strdown() and g_strup(),
do *not* modify the string handed to them - they g_mallocate a new
string and return it.

Create routines that *do* ASCII-only case mapping in place, and use them
instead.

Clean up indentation.

svn path=/trunk/; revision=26131
2008-09-03 19:14:52 +00:00