Commit Graph

195 Commits

Author SHA1 Message Date
Guy Harris b3c51deb24 Rename the last argument to tvb_new_subset_length().
In tvb_new_subset_length_caplen(), the captured length argument is
backing_length and the reported length argument is reported_length.  The
length argument to tvb_new_subset_length() is a reported length, not a
captured length, so call it reported_length, not backing_length.

Change-Id: Ibfb30e15bdd885d3c0fd66e2b4b07c4a45327f14
Reviewed-on: https://code.wireshark.org/review/26863
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-10 17:53:05 +00:00
Guy Harris c7970d9356 Add, and use, "fetch signed value" for lengths < 40 bits.
Add 8-bit, 16-bit, 24-bit, and 32-bit "fetch signed value" routines, and
use them rather than casting the result of the 8/16/24/32-bit "fetch
unsigned value" routines to a signed type (which, BTW, isn't sufficient
for 24-bit values, so this appears to fix a bug
in epan/dissectors/packet-zbee-zcl.c).

Use numbers rather than sizeof()s in various tvb_get_ routines.

Change-Id: I0e48a57fac9f70fe42de815c3fa915f1592548bd
Reviewed-on: https://code.wireshark.org/review/26844
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-10 14:55:45 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Guy Harris af0f49e80d Use pcapng as the name of the file format.
At one point, I remember a discussion resulting in the official name of
the next-generation replacement for pcap format being changed to
"pcapng", with no hyphen.

Make Wireshark reflect that.

Change-Id: Ie66fb13a0fe3a8682143106dab601952e9154e2a
Reviewed-on: https://code.wireshark.org/review/25214
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-09 00:38:51 +00:00
Alexis La Goutte 0bde3e96f0 Add ENC_VARINT_QUIC
Used to support variable length in QUIC protocol

Bug: 13881
Change-Id: Ia274b1530152376c5fb4e364fc4cf5ab246be1b3
Reviewed-on: https://code.wireshark.org/review/24990
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Craig Jackson <cejackson51@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-02 05:29:39 +00:00
Guy Harris 458c3c026e Add a ws_in6_addr typedef for struct e_in6_addr.
That allows a parallel typedef of ws_in4_addr for guint32.

Change-Id: I03b230247065e0e3840eb87635315a8e523ef562
Reviewed-on: https://code.wireshark.org/review/24073
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 08:50:34 +00:00
Michael Mann d8d60b4980 Add ENC_VARINT_PROTOBUF
Encoding of integer datatypes of Protocol buffers
https://developers.google.cn/protocol-buffers/docs/encoding

Change-Id: I9f6d65ddca099c15c0634984e9394131f98d35a9
Reviewed-on: https://code.wireshark.org/review/23813
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-09 11:31:19 +00:00
Michael Mann cc479321c3 Have tvb_format_text use wmem_packet_scope() memory.
It's only use is in dissectors or other tree creation APIs (where
packet scope is valid), so have it use format_text_wmem with
wmem_packet_scope().

Change-Id: I1f34e284a870c9844c6b27f4ae08a1e7efe54098
Reviewed-on: https://code.wireshark.org/review/19883
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>
2017-01-31 06:34:40 +00:00
Michael Mann ad5cb2eb72 Have tvb_format_stringzpad use wmem_packet_scope() memory.
It's only use is in dissectors, so have it use
format_text_wmem with wmem_packet_scope().

Change-Id: I22121324fd47aee32174b65104458ad2ef329bd7
Reviewed-on: https://code.wireshark.org/review/19856
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31 02:28:01 +00:00
Michael Mann f789c91a5e Have format_text_wsp use wmem allocated memory.
format_text_wsp is fed into by tvb_format_text_wsp and tvb_format_stringzpad_wsp
so those functions need to add a wmem allocated parameter as well.
Most of the changes came from tvb_format_text_wsp and tvb_format_stringzpad_wsp
being changed more so than format_text_wsp.

Change-Id: I52214ca107016f0e96371a9a8430aa89336f91d7
Reviewed-on: https://code.wireshark.org/review/19851
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-30 02:25:45 +00:00
Guy Harris c303679d99 Decode TBCD strings in GSM MAP as per the GSM MAP spec.
Hex digits 0xa through 0xe are '*', '#', 'a', 'b', and 'c',
respectively.

Constify the dgt_set_t argument to tvb_bcd_dig_to_wmem_packet_str(),
while we're at it.

Bug: 13316
Change-Id: I7586f35d23fd262453779d99946e7ccad4b6ffab
Reviewed-on: https://code.wireshark.org/review/19620
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-13 07:16:30 +00:00
Guy Harris 7cd6906056 Rename tvb_new_subset() to tvb_new_subset_length_caplen().
This emphasizes that there is no such thing as *the* routine to
construct a subset tvbuff; you need to choose one of
tvb_new_subset_remaining() (if you want a new tvbuff that contains
everything past a certain point in an existing tvbuff),
tvb_new_subset_length() (if you want a subset that contains everything
past a certain point, for some number of bytes, in an existing tvbuff),
and tvb_new_subset_length_caplen() (for all other cases).

Many of the calls to tvb_new_subset_length_caplen() should really be
calling one of the other routines; that's the next step.  (This also
makes it easier to find the calls that need fixing.)

Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b
Reviewed-on: https://code.wireshark.org/review/19597
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-10 06:19:37 +00:00
Francesco Fondelli b682bbd6ee add tvb_find_guint16() utility
Change-Id: I75c0165948325c2e50918706d8a821411761727b
Signed-off-by: Francesco Fondelli <francesco.fondelli@gmail.com>
Reviewed-on: https://code.wireshark.org/review/17734
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 03:21:44 +00:00
Guy Harris fa7cf8737c Rename ipv6-utils.h to ipv6.h.
By analogy to ipv4.h.

Change-Id: I147565b332024b1bb88e9cd15889255773d04524
Reviewed-on: https://code.wireshark.org/review/13034
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 21:42:32 +00:00
Guy Harris ee1b845fa8 If you want nstime_t, include <wsutil/nstime.h>.
Don't just define struct nstime_t yourself.

Change-Id: I275f53c6c9f34813898e7ffe4493583017fbf7f0
Reviewed-on: https://code.wireshark.org/review/13021
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 07:13:14 +00:00
Guy Harris 8363733e30 If you want struct e_in6_addr, include <epan/ipv6-utils.h>.
Don't just define it yourself.

(And especially don't define it yourself if you're already including
epan/ipv6-utils.h.)

Change-Id: I9970d0edecef0c820b2a7fdce34509b54e7b3106
Reviewed-on: https://code.wireshark.org/review/13020
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 04:01:39 +00:00
Michael Mann 3606f80d9e Officially remove tvb_get_string and tvb_get_stringz.
Almost all replacements were done awhile ago, just put the final nail in the coffin.

Change-Id: I0a708d886da5a500c2a1e2c9ee2736794bdb9411
Reviewed-on: https://code.wireshark.org/review/12206
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-27 05:11:25 +00:00
Michael Mann 0af048b7e4 Remove calls of tvb_ensure_length_remaining.
The remaining calls seem to fall into 3 categories:
1. passing it to tvb_find_line_end when -1 (for length) will do.
2. duplicating the checking of tvb_reported_length_remaining, which is already in use near the tvb_ensure_length_remaining call.
3. Those that (probably) need tvb_ensure_capture_length_remaining

Change-Id: I1e77695251e055644bcbbb89f3c181c65d1671ca
Reviewed-on: https://code.wireshark.org/review/10268
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-08-27 04:34:10 +00:00
Evan Huus 95ac3908d8 Remove the last deprecated tvb_length calls
And remove the shims themselves!

Change-Id: I511c06eb21eaf68d1dc36bbb9558408807472f9c
Reviewed-on: https://code.wireshark.org/review/9088
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-24 17:32:40 +00:00
Guy Harris bfb4327291 Remove tvb_ from the names of wsutil mempbrk routines.
Routines that don't take a tvbuff as an argument shouldn't have tvb_ in
the name.

Change-Id: I3550256551e30b3f329cbbfca71ef27c727d29c0
Reviewed-on: https://code.wireshark.org/review/7302
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-21 20:39:25 +00:00
Hadriel Kaplan a837570d02 Combine SSE and pre-compiled patterns for faster pbrk
This combines the SSE4.2 instructions usage, with pre-compiled
pattern searching usage, for a faster pbrk search method.

Testing against large files of HTTP and SIP, there is about
a 5% performance improvement by using pre-"compiled" patterns
for guint8_pbrk() instead of passing it the search string and
having it build the match array every time.
Similar to regular expressions, "compiling" the pattern match array
in advance only once and using the "compiled" patterns for
the searches is faster than compiling it every time.

Change-Id: Ifcbc14a6c93f32d15663a10d974bacdca5119a8e
Ping-Bug: 10798
Reviewed-on: https://code.wireshark.org/review/6990
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-11 09:14:50 +00:00
Michael Mann 64a7bac641 tvb_bytes_to_ep_str -> tvb_bytes_to_str
Change-Id: I79c613cbdd8dc939dd4c29ebc477fb6eefd5bfc4
Reviewed-on: https://code.wireshark.org/review/6371
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-07 18:16:23 +00:00
Michael Mann 9cfe67fde6 tvb_bytes_to_ep_str_punct -> tvb_bytes_to_str_punct
Also change bytestring_to_str to match bytes_to_ep_str_punct functionality (limiting byte string size)

Change-Id: Idb958c7f0c203d103629469302b81fa922714f7e
Reviewed-on: https://code.wireshark.org/review/6369
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:05:35 +00:00
Hadriel Kaplan fac8356610 Make all Lua code use wmem not emem
Changed all remaining code in wslua that was using emem, to use wmem or
simpler methods.

Bug: 9927
Change-Id: I3d19a770e0fd77d996bdb6b61a76a722cc2bcd55
Reviewed-on: https://code.wireshark.org/review/6109
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-04 21:02:38 +00:00
Evan Huus 55c385e610 tvb: implement endianness-paramterized getters
e.g. tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN)

Change-Id: Iea02fd59b13678aca741d028fb1f66f334447498
Reviewed-on: https://code.wireshark.org/review/6191
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: Evan Huus <eapache@gmail.com>
2015-01-02 04:07:19 +00:00
Alexis La Goutte 5248c0df21 Fix unknown command tag name [-Wdocumentation-unknown-command]
Change-Id: I6c2564a86e13d9321001856ba1f51681a9f20976
Reviewed-on: https://code.wireshark.org/review/5979
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-12-22 15:24:28 +00:00
Guy Harris 785ef83964 Revert "Add QNX' QNET protocol"
This reverts commit 72b91a56f8.

value_string_ext tables ***MUST*** be sorted numerically, otherwise the code prints warnings such as the ones in

    http://buildbot.wireshark.org/trunk/builders/Ubuntu%2014.04%20x64/builds/1419/steps/test.sh/logs/stdio

Fix this and resubmit.

Change-Id: I448025bb7b19a607e992831202ed31d243ce70d8
Reviewed-on: https://code.wireshark.org/review/5530
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-29 07:26:52 +00:00
Alexis La Goutte 72b91a56f8 Add QNX' QNET protocol
no ethertype 0x8203-0x8205 support in trunk.
0x8204 is QNX OS VER 6's qnet ethernet protocol number.

Bug:3934
Change-Id: I5f3e910876bb7fb86de2111f856d026fdf220917
Reviewed-on: https://code.wireshark.org/review/2954
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-11-29 02:56:08 +00:00
Jeff Morriss 923ba9d312 Fix a comment typo: tvb_bcd_dig_to_wmem_packet_str() returns a WMEM-allocated
string, not an EP-allocated one.

Change-Id: I3918ed66429c588d4503d98e10dc460b099e550e
Reviewed-on: https://code.wireshark.org/review/3795
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-08-22 18:40:50 +00:00
Guy Harris f4d24216be Add a routine to check whether all bytes implied by a 64-bit length exist.
This lets us blow up with oversized 64-bit length values, before casting
them to the 31-bit lengths we can actually handle in Wireshark, rather
than blindly casting them with weird results.

Use that in the MySQL dissector, and, if we get past the test, cast the
lengths to int to squelch warnings.

Change-Id: I3a5e9bd0027fa4ddcb9622f77952dba8f6b23c27
Reviewed-on: https://code.wireshark.org/review/3362
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-02 18:33:11 +00:00
Evan Huus a1b939313f Revert "Don't throw for offset at end of TVB with len -1."
This reverts commit fe195c0c97.

Conflicts:
	epan/tvbuff.c

Change-Id: I1af618d0bd1e6211281b6d67c0ad197cfa513a0c
Reviewed-on: https://code.wireshark.org/review/1639
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-14 17:12:12 +00:00
Evan Huus fe195c0c97 Don't throw for offset at end of TVB with len -1.
g867a1827e7dc88896ee27a107eb35c4b3973d270 introduced a change to cleanup/fix
handling of bounds checks for -1 length fields, but it ended up guaranteeing a
throw for 0-length tvbs, which isn't good; we ought to be able to add 0-length
FT_PROTOCOL items at the very least.

Better names for the function than _cheat are welcome, but I want to shut up the
buildbot.

Change-Id: I24610f947d03dac32766e2a0ffa0ff7bcc74c3e8
Reviewed-on: https://code.wireshark.org/review/1303
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-23 15:57:13 +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
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
Alexis La Goutte 58a6487b54 Add WS_DLL_PUBLIC for p_remove_proto_data and tvb_child_uncompres function
Change-Id: If043683f366fedd849688ca3c512707954221a3b
Reviewed-on: https://code.wireshark.org/review/984
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-07 04:09:10 +00:00
Bill Meier c0b0a11e4e (Pedantic): set editor modelines tab-width & etc to 8; Also: fix some indentation in packet-sip.c
Change-Id: I623fc5e4c1247dbe5e15f0f33270f4f0994268ab
Reviewed-on: https://code.wireshark.org/review/943
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-04-03 15:31:56 +00:00
Guy Harris e2ed48a8d3 Have NFLOG TLV type and length be in host byte order.
When capturing, they'll be in host byte order.  The top of the libpcap
trunk and 1.5 branch, when reading a file, will, if necessary, byte-swap
the type and length values so that they're in the byte order of the host
reading the file (rather than the host that wrote the file).

Do the same when we read a file, and have the NFLOG dissector assume
host byte order for those fields.

Change-Id: I493aed1e07b626af1157d75f3bc293b0a694ad07
Reviewed-on: https://code.wireshark.org/review/148
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-06 05:53: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
Guy Harris 46d8abe252 Document tvb_memdup() in more detail.
Change-Id: Iec94342b7d033fb6e8597bbffea563128182316b
Reviewed-on: https://code.wireshark.org/review/417
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-26 22:28:48 +00:00
Guy Harris a8ef66f250 Regularize the formatting of some comments.
Change-Id: I1009c75d5a4f074767dbc3600e7a6edfd0031460
Reviewed-on: https://code.wireshark.org/review/416
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-26 22:25:00 +00:00
Guy Harris 5de2dacde8 Fix a copy-and-pasteo.
Change-Id: Ied8830e2e7a689197870a4d839fd08b36546c75f
Reviewed-on: https://code.wireshark.org/review/414
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-26 22:23:04 +00:00
Guy Harris 910949ce84 Some g_free() -> wmem_free() changes missed in earlier checkins.
Change-Id: I5858e0ee8fc8584b35145c943e19e8e5f7dba77c
Reviewed-on: https://code.wireshark.org/review/413
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-26 22:15:03 +00:00
Guy Harris 8d234a0d8c More tvbuff API deprecation, comment expansion, and documentation updates.
Do with tvb_get_stringz() what was done with tvb_get_string().

Redo the comments for the string get routines to try to give more detail
in a fashion that's a bit less hard to read.

Warn, in comments, of the problems with using
tvb_get_string()/tvb_get_stringz() (i.e., if your strings are non-ASCII,
all bytes with the 8th bit set are going be replaced by the Unicode
REPLACEMENT CHARACTER, and displayed as such).

Warn, in a comment, of the problems with tvb_get_const_stringz() (i.e.,
it gives you raw bytes, rather than guaranteed-to-be-valid UTF-8).

Update documentation and release notes appropriately.

Change-Id: Ibd3efb92a203861f507ce71bc8d04d19d9d38a93
Reviewed-on: https://code.wireshark.org/review/327
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-26 22:04:08 +00:00
Evan Huus 22149c5523 TVB API deprecations and cleanup
- rename tvb_length and similar to tvb_captured_length and similar; leave
  #defines in place for backwards-compat, but mark them clearly as deprecated in
  code comments and in checkAPI
- remove tvb_get_string as C code and just leave a #define in place for
  backwards-compat; mark it clearly as deprecated in code comment and checkAPI
- update READMEs and sample dissector for all of the above
- while in the neighbourhood, make checkAPI skip (and warn) for missing files
  instead of bailing on the whole check, so subsequent files still get checked

Change-Id: I32fc437896ca86ca73e9b49d5f50400adf8ec5ad
Reviewed-on: https://code.wireshark.org/review/311
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-22 15:02:01 +00:00
Guy Harris 4d9475e4ef Get rid of tvb_get_faked_unicode() - tvb_get_string_enc() does the job
better.

We don't need eventlog_get_unicode_string_length() in the eventlog
dissector, either - tvb_unicode_strsize() does the job just as well.

svn path=/trunk/; revision=54874
2014-01-21 09:56:34 +00:00
Guy Harris 45d5b74219 Fix declaration of tvb_get_string().
svn path=/trunk/; revision=54870
2014-01-21 01:44:58 +00:00
Guy Harris 9cdf8dd5f5 Don't do the byte-with-8th-bit-set-to-REPLACEMENT-CHARACTER mapping for
UTF-8 strings.

Add that mapping for null-terminated ASCII strings.

Factor out some common parts of comments about string routines, and
clean up some other comments.

svn path=/trunk/; revision=54868
2014-01-21 01:23:29 +00:00
Martin Kaiser 933e95c8ec tvb_get_string(): replace 8bit characters with the unicode replacement char
svn path=/trunk/; revision=54864
2014-01-20 21:39:00 +00:00