Commit Graph

64 Commits

Author SHA1 Message Date
João Valverde 4c330cc0e4 Fix constness
Change-Id: I29723dae83373768edd254c60e48a717abf20694
Reviewed-on: https://code.wireshark.org/review/13436
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-20 16:12:07 +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 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 d6da7a01b1 Fix warnings + remove some v. old comment from strutil.h
svn path=/trunk/; revision=54078
2013-12-13 23:11:14 +00:00
Alexis La Goutte bd5f16acf4 Fix (-W)documentation error found by Clang
../../epan/strutil.h:95:11: error: parameter 'line' not found in the function declaration [-Werror,-Wdocumentation]
 * @param line A pointer to the input string
          ^~~~
../../epan/strutil.h:95:11: note: did you mean 'string'?
 * @param line A pointer to the input string
          ^~~~
          string

svn path=/trunk/; revision=53721
2013-12-02 13:46:20 +00:00
Alexis La Goutte e13ef4109d Fix typo (for generated Documentation)
svn path=/trunk/; revision=53268
2013-11-12 09:23:13 +00:00
Jakub Zawadzki 7b64bcf0b8 Move prototype of bytes_to_str, bytes_to_str_punct to correct header.
svn path=/trunk/; revision=53214
2013-11-10 09:44:02 +00:00
Jakub Zawadzki 0b0bbf0965 Replace STRINGIFY with glib version.
svn path=/trunk/; revision=53193
2013-11-09 14:37:13 +00:00
Jakub Zawadzki 3b2e519422 Remove comment (leftovers from r49444) + add missing WS_DLL_PUBLIC for adler32
(modifing files to be commited when svn commit is already running is no good).

svn path=/trunk/; revision=53192
2013-11-09 14:19:19 +00:00
Evan Huus fa1027a004 From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9229
Add a new strutil function format_text_chr that replaces unprintable characters
with a single passed-in char (eg a '.' or a '-') instead of a C-style escape.
This is useful for displaying binary data that frequently but not always
contains text; otherwise the number of C escape codes makes it unreadable.

svn path=/trunk/; revision=52563
2013-10-12 12:38:56 +00:00
Michael Mann ee208c8dcc Add support for RELATIVE-OID ASN.1 type. Bug 9192 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192)
From Ed Beroset.

svn path=/trunk/; revision=52393
2013-10-06 02:31:10 +00:00
Gerald Combs c0702583d3 Make the minimum supported GLib version 2.16.
svn path=/trunk/; revision=49444
2013-05-20 17:27:05 +00:00
Guy Harris 04c02451aa Add WS_DLL_PUBLIC to all functions declared here.
svn path=/trunk/; revision=49150
2013-05-03 23:37:06 +00:00
Evan Huus 63ef04ec84 Fix a whole bunch of doxygen warnings, mostly typos or renamed parameters.
svn path=/trunk/; revision=49053
2013-04-26 18:28:21 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Bill Meier 96a24cc79f Fix spelling/typos found using a list of commonly misspelled words.
The misspellings were mostly in comments but some were
in text strings visible to the user.


svn path=/trunk/; revision=47899
2013-02-26 04:42:26 +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
Anders Broman e9f13d771c g_strcmp0 first occures in GLIB 2.16 define it localy if it does not exist
to make builds on Fedora 8 with GTK 2.12 work.

svn path=/trunk/; revision=45707
2012-10-22 12:20:36 +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
Gerald Combs 6b178bd415 Add 'extern "C"' wrappers and #include guards to various header files.
svn path=/trunk/; revision=40321
2011-12-29 00:08:47 +00:00
Stephen Fisher 9246c41703 Change ws_strdup_escape_underscore() function to be more general, by
accepting any character as the escaped character.  Change existing
uses to use '_' for the underscore escaping.


svn path=/trunk/; revision=36627
2011-04-13 16:56:24 +00:00
Anders Broman a009cc0605 Doxygen changes.
svn path=/trunk/; revision=33990
2010-08-29 10:47:38 +00:00
Gerald Combs fa5f6cced7 From Edgar Gladkich:
This is an extension to the Wireshark context sensitive protocol help. Rows in
TreeView window are analyzed and suitable help file (as HTML) is opened in a
browser.

The help part (large file, 23 MB) of the Protocol Help can be downloaded under
www.inacon.com/dowload/stuff/protocol_help.tar.gz

This protocol help "light" provides descriptive content for the most frequently
used standard protocols, including IP, TCP or SMTP.

From me:

Changes:

Rename "ph_" in some function names to "proto_help_". Move the protocol
help code to its own module.

Make a bunch of functions static. Remove unused code.

Use browser_open_url() instead of a custom function.

Increase the logging levels. Don't clobber the normal log handler.

Update some Doxygen comments to match the format in the rest of the code
base.

Removed GTK version checks. We've been 2.x only for a while.

Move ph_replace_string to string_replace() in epan/strutil.[ch].

Fix a bunch of memory leaks.

Add a NULL pointer check.

Reformat the overview menu label.

Document the file format and locations.

Add Edgar to AUTHORS.

svn path=/trunk/; revision=32995
2010-05-27 15:51:25 +00:00
Gerasimos Dimitriadis c08fa6f3cf Move underscore escaping/unscaping function to strutil.c;
Update decoding of IS-801 Request GPS Acquisition Assistance

svn path=/trunk/; revision=31685
2010-01-26 18:21:17 +00:00
Anders Broman f82442badc Move IA5_7BIT_decode to strutil.c
svn path=/trunk/; revision=30669
2009-10-23 01:56:09 +00:00
Anders Broman 7ec476b88a From Didier Gautheron:
Part 2
Extracted from optimizations patch http://wiki.wireshark.org/Development/Optimization
Optimize expert info.
Slightly changed by me.

svn path=/trunk/; revision=29478
2009-08-19 18:37:13 +00:00
Gerald Combs 2c74073079 Add a couple of size_t casts to packet-dnp.c.
Make the length arguments of format_text() and format_text_wsp()
size_t's, since it's natural to use strlen() for that.

svn path=/trunk/; revision=27891
2009-03-30 03:40:12 +00:00
Gerald Combs 95ddd62076 Add a string utility function "string_or_null" which can be used to
guarantee a non-null string value. Use it in the LDAP dissector. Fixes
the crash on Windows (and other platforms) reported in bug 3262.

svn path=/trunk/; revision=27478
2009-02-17 23:15:35 +00:00
Guy Harris 1ad79116ed Get rid of old GLib 1.2[.x] stuff, as we now require GLib 2.x.
svn path=/trunk/; revision=25192
2008-04-29 08:44:57 +00:00
Ronnie Sahlberg 7885237398 add a g_byte_array_sized_new() helper if we compile for glib < 2
svn path=/trunk/; revision=23373
2007-11-06 05:51:49 +00:00
Anders Broman 1143ab41b1 Apply yet another set of the optimization patches:
- Use a fast path for the most common use of tvb_get_xxx functions:
offset is >= 0 and tvb->real_data is set (this one is always true).
- match_strval() is a linear search, put the most common protocols
TCP/UDP/RDP first.
- fix gtk1 g_strlcat declaration Use g_strlcat

svn path=/trunk/; revision=23285
2007-10-27 14:44:29 +00:00
Anders Broman 3a16fb20a3 Apply yet another set of the optimization patches:
Replace strncpy with g_strlcpy.
Add g_strlcat for GTK1 and don't use g_snprintf in GTK1 g_strlcpy
printf family is very slow.

svn path=/trunk/; revision=23273
2007-10-26 05:42:12 +00:00
Luis Ontanon 92fd73681d From: Gisle Vanem
The file epan/dissectors/packet-k12.c uses the function
strcasestr() which is not available on e.g. Windows. So I cooked
up a patch to epan/strutil.c to add epan_strcasestr() (is there a more
suited place for such a function?)





svn path=/trunk/; revision=20734
2007-02-07 13:45:28 +00:00
Gerald Combs def1f435fc Fix compilation problems under Windows. In the GTK code, convert SSIDs
to GByteArrays.  Add format_uri() to strutil, which formats a byte string
with percent-escapes.  Fixup whitespace and indentation.

svn path=/trunk/; revision=20397
2007-01-11 22:12:33 +00:00
Gerald Combs 983f496f69 Add uri_str_to_bytes(), byte_array_dup(), and byte_array_equal()
functions to strutil.  Use GByteArrays to store SSIDs for decryption,
and let the user specify arbitrary byte strings using percent-encoded
strings.  We should probably add percent encoding for pass phrases as
well, so you can escape the ":" character.

Move the key struct key conversion utilities to airpdcap.c, and remove
duplicate code from packet-ieee80211.c.  Fix a lot of indentation.

svn path=/trunk/; revision=20388
2007-01-11 02:42:34 +00:00
Ronnie Sahlberg d6e5083c7f gtk1 does not provide g_ascii_isxdigit so provide it through strutil.h instead
svn path=/trunk/; revision=20233
2006-12-29 21:57:19 +00:00
Gerald Combs 9e23f31e5f Add support for reading from stdin under Windows. Based on a patch sent
in last year by Gianluca Varenni.

Add partial support for reading from named pipes (currently disabled).

Move utf_8to16() and utf_16to8() to a separate module (unicode-utils.[ch])
so that we don't have to cut and paste code in dumpcap.c.

Fix up whitespace.

svn path=/trunk/; revision=19291
2006-09-22 21:14:54 +00:00
Anders Broman 764e3ac167 New rutine tvb_format_text_wsp() which will change "whiite space" characters to space
before output.

svn path=/trunk/; revision=18519
2006-06-19 15:53:03 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Gerald Combs 9406c5db24 Use Unicode for all native Win32 calls. Unicode Windows applications
use UTF-16 internally and GTK+ 2.x uses UTF-8, which means we have to
do a lots of conversions.

Add utf_8to16() and utf_16to8 convenience functions to strutil.c.

svn path=/trunk/; revision=17534
2006-03-08 20:55:32 +00:00
Ronnie Sahlberg 4a38167d00 create a real function to emulate g_strlcat() for GTK<2
so that the linker will find it.

This eliminates the need to include strutil.h (where this was previously a macro)  in all callers of this function.


svn path=/trunk/; revision=17392
2006-02-23 21:49:30 +00:00
Tomas Kukosa dcae7d303f new field type FT_OID for OBJECT IDENTIFIERs
svn path=/trunk/; revision=16652
2005-12-02 13:16:58 +00:00
Guy Harris 378ebd81a6 g_strlcat() and g_ascii_isprint() don't exist in GTK+ at all - they
exist in GLib 2.x, but not in 1.2[.x].  Check the version number of
GLIB, not of GTK+, to decide whether to #define them.

svn path=/trunk/; revision=16522
2005-11-17 04:15:01 +00:00
Ronnie Sahlberg bde7f8d3b6 add a g_ascii_isprint() macro so that this symbol can be used for gtk1 platforms as well
svn path=/trunk/; revision=16519
2005-11-16 23:15:04 +00:00
Ronnie Sahlberg 898dc49980 add a simple g_strlcat define in strutil for gtk==1 where this symbol does not exist
svn path=/trunk/; revision=16511
2005-11-16 09:27:43 +00:00
Ulf Lamping e0bbf855d9 fix doxygen tags
svn path=/trunk/; revision=12404
2004-10-27 04:45:00 +00:00
Gerald Combs 2875ddd269 Move convert_string_to_hex() and convert_string_case() from gtk/find_dlg.c
to epan/strutil.c

svn path=/trunk/; revision=11733
2004-08-13 02:39:49 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Gerald Combs 4a0a8b7e72 Add a "force_separators" parameter to hex_str_to_bytes so that it's
possible to paste in WEP keys without any separators.

Add doxygen comments to strutil.h.

svn path=/trunk/; revision=11123
2004-06-06 14:29:07 +00:00
Olivier Biot 2650b49679 Add an XML escaping routine: xml_escape()
svn path=/trunk/; revision=10759
2004-05-01 20:46:24 +00:00