Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
tvbuff.h
Go to the documentation of this file.
1
21#ifndef __TVBUFF_H__
22#define __TVBUFF_H__
23
24#include <ws_symbol_export.h>
25#include <ws_attributes.h>
26
27#include <epan/guid-utils.h>
28
29#include <wsutil/inet_addr.h>
30#include <wsutil/nstime.h>
31#include "wsutil/ws_mempbrk.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
48struct tvbuff;
49typedef struct tvbuff tvbuff_t;
50
104typedef void (*tvbuff_free_cb_t)(void*);
105
120WS_DLL_PUBLIC tvbuff_t *tvb_new_octet_aligned(tvbuff_t *tvb,
121 uint32_t bit_offset, uint32_t no_of_bits);
122
135 uint32_t bit_offset, uint32_t no_of_bits);
136
150WS_DLL_PUBLIC tvbuff_t *tvb_new_chain(tvbuff_t *parent, tvbuff_t *backing);
151
158WS_DLL_PUBLIC tvbuff_t *tvb_clone(tvbuff_t *tvb);
159
174WS_DLL_PUBLIC tvbuff_t *tvb_clone_offset_len(tvbuff_t *tvb, unsigned offset,
175 unsigned len);
176
185WS_DLL_PUBLIC void tvb_free(tvbuff_t *tvb);
186
195WS_DLL_PUBLIC void tvb_free_chain(tvbuff_t *tvb);
196
206WS_DLL_PUBLIC void tvb_set_free_cb(tvbuff_t *tvb, const tvbuff_free_cb_t func);
207
225WS_DLL_PUBLIC void tvb_set_child_real_data_tvbuff(tvbuff_t *parent,
226 tvbuff_t *child);
227
241WS_DLL_PUBLIC tvbuff_t *tvb_new_child_real_data(tvbuff_t *parent,
242 const uint8_t *data, const unsigned length, const unsigned reported_length);
243
257WS_DLL_PUBLIC tvbuff_t *tvb_new_real_data(const uint8_t *data,
258 const unsigned length, const unsigned reported_length);
259
291WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length_caplen(tvbuff_t *backing,
292 const unsigned backing_offset, const unsigned backing_length,
293 const unsigned reported_length);
294
309WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length(tvbuff_t *backing,
310 const unsigned backing_offset, const unsigned reported_length);
311
323WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_remaining(tvbuff_t *backing,
324 const unsigned backing_offset);
325
335WS_DLL_PUBLIC void tvb_composite_append(tvbuff_t *tvb, tvbuff_t *member);
336
346WS_DLL_PUBLIC void tvb_composite_prepend(tvbuff_t *tvb, tvbuff_t *member);
347
353WS_DLL_PUBLIC tvbuff_t *tvb_new_composite(void);
354
355
364WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb);
365
366
377WS_DLL_PUBLIC unsigned tvb_captured_length(const tvbuff_t *tvb);
378
391WS_DLL_PUBLIC unsigned tvb_captured_length_remaining(const tvbuff_t *tvb, const unsigned offset);
392
409WS_DLL_PUBLIC unsigned tvb_ensure_captured_length_remaining(const tvbuff_t *tvb,
410 const unsigned offset);
411
426WS_DLL_PUBLIC bool tvb_bytes_exist(const tvbuff_t *tvb, const unsigned offset,
427 const int length);
428
441WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb,
442 const unsigned offset, const uint64_t length);
443
455WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb,
456 const unsigned offset, const int length);
457
466WS_DLL_PUBLIC bool tvb_offset_exists(const tvbuff_t *tvb,
467 const unsigned offset);
468
476WS_DLL_PUBLIC unsigned tvb_reported_length(const tvbuff_t *tvb);
477
490WS_DLL_PUBLIC unsigned tvb_reported_length_remaining(const tvbuff_t *tvb,
491 const unsigned offset);
492
507WS_DLL_PUBLIC unsigned tvb_ensure_reported_length_remaining(const tvbuff_t *tvb,
508 const unsigned offset);
509
522WS_DLL_PUBLIC void tvb_set_reported_length(tvbuff_t *tvb, const unsigned reported_length);
523
524
534WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb);
535
553WS_DLL_PUBLIC unsigned tvb_offset_from_real_beginning(const tvbuff_t *tvb);
554
571WS_DLL_PUBLIC unsigned tvb_raw_offset(tvbuff_t *tvb);
572
582WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb);
583
595WS_DLL_PUBLIC struct tvbuff *tvb_get_ds_tvb(tvbuff_t *tvb);
596
597
598/************** START OF ACCESSORS ****************/
599/* All accessors will throw an exception if appropriate */
600
612WS_DLL_PUBLIC uint8_t tvb_get_uint8(tvbuff_t *tvb, const unsigned offset);
613
627WS_DEPRECATED_X("Use tvb_get_uint8 instead")
628static inline uint8_t tvb_get_guint8(tvbuff_t *tvb, const unsigned offset) {
629 return tvb_get_uint8(tvb, offset);
630}
631
643WS_DLL_PUBLIC int8_t tvb_get_int8(tvbuff_t *tvb, const unsigned offset);
644
658WS_DEPRECATED_X("Use tvb_get_int8 instead")
659static inline int8_t tvb_get_gint8(tvbuff_t *tvb, const unsigned offset) { return tvb_get_int8(tvb, offset); }
660
677WS_DLL_PUBLIC uint16_t tvb_get_ntohs(tvbuff_t *tvb, const unsigned offset);
678
695WS_DLL_PUBLIC int16_t tvb_get_ntohis(tvbuff_t *tvb, const unsigned offset);
696
713WS_DLL_PUBLIC uint32_t tvb_get_ntoh24(tvbuff_t *tvb, const unsigned offset);
714
731WS_DLL_PUBLIC int32_t tvb_get_ntohi24(tvbuff_t *tvb, const unsigned offset);
732
749WS_DLL_PUBLIC uint32_t tvb_get_ntohl(tvbuff_t *tvb, const unsigned offset);
750
767WS_DLL_PUBLIC int32_t tvb_get_ntohil(tvbuff_t *tvb, const unsigned offset);
768
785WS_DLL_PUBLIC uint64_t tvb_get_ntoh40(tvbuff_t *tvb, const unsigned offset);
786
803WS_DLL_PUBLIC int64_t tvb_get_ntohi40(tvbuff_t *tvb, const unsigned offset);
804
821WS_DLL_PUBLIC uint64_t tvb_get_ntoh48(tvbuff_t *tvb, const unsigned offset);
822
839WS_DLL_PUBLIC int64_t tvb_get_ntohi48(tvbuff_t *tvb, const unsigned offset);
840
857WS_DLL_PUBLIC uint64_t tvb_get_ntoh56(tvbuff_t *tvb, const unsigned offset);
858
875WS_DLL_PUBLIC int64_t tvb_get_ntohi56(tvbuff_t *tvb, const unsigned offset);
876
893WS_DLL_PUBLIC uint64_t tvb_get_ntoh64(tvbuff_t *tvb, const unsigned offset);
894
911WS_DLL_PUBLIC int64_t tvb_get_ntohi64(tvbuff_t *tvb, const unsigned offset);
912
929WS_DLL_PUBLIC float tvb_get_ntohieee_float(tvbuff_t *tvb, const unsigned offset);
930
947WS_DLL_PUBLIC double tvb_get_ntohieee_double(tvbuff_t *tvb,
948 const unsigned offset);
949
966WS_DLL_PUBLIC uint16_t tvb_get_letohs(tvbuff_t *tvb, const unsigned offset);
967
984WS_DLL_PUBLIC int16_t tvb_get_letohis(tvbuff_t *tvb, const unsigned offset);
985
1002WS_DLL_PUBLIC uint32_t tvb_get_letoh24(tvbuff_t *tvb, const unsigned offset);
1003
1020WS_DLL_PUBLIC int32_t tvb_get_letohi24(tvbuff_t *tvb, const unsigned offset);
1021
1038WS_DLL_PUBLIC uint32_t tvb_get_letohl(tvbuff_t *tvb, const unsigned offset);
1039
1056WS_DLL_PUBLIC int32_t tvb_get_letohil(tvbuff_t *tvb, const unsigned offset);
1057
1074WS_DLL_PUBLIC uint64_t tvb_get_letoh40(tvbuff_t *tvb, const unsigned offset);
1075
1092WS_DLL_PUBLIC int64_t tvb_get_letohi40(tvbuff_t *tvb, const unsigned offset);
1093
1110WS_DLL_PUBLIC uint64_t tvb_get_letoh48(tvbuff_t *tvb, const unsigned offset);
1111
1128WS_DLL_PUBLIC int64_t tvb_get_letohi48(tvbuff_t *tvb, const unsigned offset);
1129
1146WS_DLL_PUBLIC uint64_t tvb_get_letoh56(tvbuff_t *tvb, const unsigned offset);
1147
1164WS_DLL_PUBLIC int64_t tvb_get_letohi56(tvbuff_t *tvb, const unsigned offset);
1165
1182WS_DLL_PUBLIC uint64_t tvb_get_letoh64(tvbuff_t *tvb, const unsigned offset);
1183
1200WS_DLL_PUBLIC int64_t tvb_get_letohi64(tvbuff_t *tvb, const unsigned offset);
1201
1218WS_DLL_PUBLIC float tvb_get_letohieee_float(tvbuff_t *tvb, const unsigned offset);
1219
1236WS_DLL_PUBLIC double tvb_get_letohieee_double(tvbuff_t *tvb,
1237 const unsigned offset);
1238
1254WS_DLL_PUBLIC uint16_t tvb_get_uint16(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1255
1270WS_DEPRECATED_X("Use tvb_get_uint16 instead")
1271static inline uint16_t tvb_get_guint16(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) {
1272 return tvb_get_uint16(tvb, offset, encoding);
1273}
1274
1290WS_DLL_PUBLIC int16_t tvb_get_int16(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1291
1306WS_DEPRECATED_X("Use tvb_get_int16 instead")
1307static inline int16_t tvb_get_gint16(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int16(tvb, offset, encoding); }
1308
1324WS_DLL_PUBLIC uint32_t tvb_get_uint24(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1325
1340WS_DEPRECATED_X("Use tvb_get_uint24 instead")
1341static inline uint32_t tvb_get_guint24(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_uint24(tvb, offset, encoding); }
1342
1358WS_DLL_PUBLIC int32_t tvb_get_int24(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1359
1374WS_DEPRECATED_X("Use tvb_get_int24 instead")
1375static inline int32_t tvb_get_gint24(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int24(tvb, offset, encoding); }
1376
1392WS_DLL_PUBLIC uint32_t tvb_get_uint32(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1393
1408WS_DEPRECATED_X("Use tvb_get_uint32 instead")
1409static inline uint32_t tvb_get_guint32(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_uint32(tvb, offset, encoding); }
1410
1426WS_DLL_PUBLIC int32_t tvb_get_int32(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1427
1442WS_DEPRECATED_X("Use tvb_get_int32 instead")
1443static inline int32_t tvb_get_gint32(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int32(tvb, offset, encoding); }
1444
1460WS_DLL_PUBLIC uint64_t tvb_get_uint40(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1461
1476WS_DEPRECATED_X("Use tvb_get_uint40 instead")
1477static inline uint64_t tvb_get_guint40(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_uint40(tvb, offset, encoding); }
1478
1494WS_DLL_PUBLIC int64_t tvb_get_int40(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1495
1510WS_DEPRECATED_X("Use tvb_get_int40 instead")
1511static inline int64_t tvb_get_gint40(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int40(tvb, offset, encoding); }
1512
1528WS_DLL_PUBLIC uint64_t tvb_get_uint48(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1529
1544WS_DEPRECATED_X("Use tvb_get_uint48 instead")
1545static inline uint64_t tvb_get_guint48(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_uint48(tvb, offset, encoding); }
1546
1562WS_DLL_PUBLIC int64_t tvb_get_int48(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1563
1578WS_DEPRECATED_X("Use tvb_get_int48 instead")
1579static inline int64_t tvb_get_gint48(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int48(tvb, offset, encoding); }
1580
1596WS_DLL_PUBLIC uint64_t tvb_get_uint56(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1597
1612WS_DEPRECATED_X("Use tvb_get_uint56 instead")
1613static inline uint64_t tvb_get_guint56(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_uint56(tvb, offset, encoding); }
1614
1630WS_DLL_PUBLIC int64_t tvb_get_int56(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1631
1646WS_DEPRECATED_X("Use tvb_get_int56 instead")
1647static inline int64_t tvb_get_gint56(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int56(tvb, offset, encoding); }
1648
1666WS_DLL_PUBLIC uint64_t tvb_get_uint64(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1667
1686WS_DLL_PUBLIC uint64_t tvb_get_uint64_with_length(tvbuff_t *tvb, const unsigned offset, unsigned length, const unsigned encoding);
1687
1702WS_DEPRECATED_X("Use tvb_get_uint64 instead")
1703static inline uint64_t tvb_get_guint64(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) {return tvb_get_uint64(tvb, offset, encoding); }
1704
1720WS_DLL_PUBLIC int64_t tvb_get_int64(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1721
1736WS_DEPRECATED_X("Use tvb_get_int64 instead")
1737static inline int64_t tvb_get_gint64(tvbuff_t *tvb, const unsigned offset, const unsigned encoding) { return tvb_get_int64(tvb, offset, encoding); }
1738
1756WS_DLL_PUBLIC float tvb_get_ieee_float(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1757
1775WS_DLL_PUBLIC double tvb_get_ieee_double(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
1776
1794#if G_BYTE_ORDER == G_LITTLE_ENDIAN
1795#define tvb_get_h_uint16 tvb_get_letohs
1796#define tvb_get_h_uint32 tvb_get_letohl
1797#elif G_BYTE_ORDER == G_BIG_ENDIAN
1798#define tvb_get_h_uint16 tvb_get_ntohs
1799#define tvb_get_h_uint32 tvb_get_ntohl
1800#else
1801#error "Unsupported byte order"
1802#endif
1803
1832WS_DLL_PUBLIC
1833nstime_t* tvb_get_string_time(tvbuff_t *tvb, const unsigned offset, const unsigned length,
1834 const unsigned encoding, nstime_t* ns, unsigned *endoff);
1835
1857WS_DLL_PUBLIC
1858GByteArray* tvb_get_string_bytes(tvbuff_t *tvb, const unsigned offset, const unsigned length,
1859 const unsigned encoding, GByteArray* bytes, unsigned *endoff);
1860
1878WS_DLL_PUBLIC uint32_t tvb_get_ipv4(tvbuff_t *tvb, const unsigned offset);
1879
1896WS_DLL_PUBLIC void tvb_get_ipv6(tvbuff_t *tvb, const unsigned offset, ws_in6_addr *addr);
1897
1910WS_DLL_PUBLIC int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, const unsigned offset,
1911 ws_in4_addr *addr, uint32_t prefix_len);
1912
1926WS_DLL_PUBLIC int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, const unsigned offset,
1927 ws_in6_addr *addr, uint32_t prefix_len);
1928
1940WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const unsigned offset, e_guid_t *guid);
1941
1953WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const unsigned offset, e_guid_t *guid);
1954
1968WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const unsigned offset, e_guid_t *guid, const unsigned encoding);
1969
1989WS_DLL_PUBLIC uint8_t* tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb,
1990 const unsigned offset, size_t length, size_t *data_length, const unsigned encoding);
1991
2011WS_DLL_PUBLIC uint8_t tvb_get_bits8(tvbuff_t *tvb, unsigned bit_offset,
2012 const unsigned no_of_bits);
2013
2035WS_DLL_PUBLIC uint16_t tvb_get_bits16(tvbuff_t *tvb, unsigned bit_offset,
2036 const unsigned no_of_bits, const unsigned encoding);
2037
2059WS_DLL_PUBLIC uint32_t tvb_get_bits32(tvbuff_t *tvb, unsigned bit_offset,
2060 const unsigned no_of_bits, const unsigned encoding);
2061
2083WS_DLL_PUBLIC uint64_t tvb_get_bits64(tvbuff_t *tvb, unsigned bit_offset,
2084 const unsigned no_of_bits, const unsigned encoding);
2085
2103WS_DLL_PUBLIC
2104WS_DEPRECATED_X("Use tvb_get_bits32() instead")
2105uint32_t tvb_get_bits(tvbuff_t *tvb, const unsigned bit_offset,
2106 const unsigned no_of_bits, const unsigned encoding);
2107
2127WS_DLL_PUBLIC void *tvb_memcpy(tvbuff_t *tvb, void *target, const unsigned offset,
2128 size_t length);
2129
2150WS_DLL_PUBLIC void *tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb,
2151 const unsigned offset, size_t length);
2152
2188WS_DLL_PUBLIC const uint8_t *tvb_get_ptr(tvbuff_t *tvb, const unsigned offset,
2189 const unsigned length);
2190
2211WS_DLL_PUBLIC bool tvb_find_uint8_remaining(tvbuff_t *tvb, const unsigned offset,
2212 const uint8_t needle, unsigned *found_offset);
2213
2236WS_DLL_PUBLIC bool tvb_find_uint8_length(tvbuff_t *tvb, const unsigned offset,
2237 const unsigned maxlength, const uint8_t needle, unsigned *found_offset);
2238
2257WS_DLL_PUBLIC int tvb_find_uint8(tvbuff_t *tvb, const unsigned offset,
2258 const int maxlength, const uint8_t needle);
2259
2281WS_DEPRECATED_X("Use tvb_find_uint8 instead")
2282static inline int tvb_find_guint8(tvbuff_t* tvb, const unsigned offset,
2283 const int maxlength, const uint8_t needle) { return tvb_find_uint8(tvb, offset, maxlength, needle); }
2284
2310WS_DLL_PUBLIC bool tvb_find_uint16_remaining(tvbuff_t *tvb, const unsigned offset,
2311 const uint16_t needle, unsigned *found_offset);
2312
2340WS_DLL_PUBLIC bool tvb_find_uint16_length(tvbuff_t *tvb, const unsigned offset,
2341 const unsigned maxlength, const uint16_t needle, unsigned *found_offset);
2342
2367WS_DLL_PUBLIC int tvb_find_uint16(tvbuff_t *tvb, const int offset,
2368 const int maxlength, const uint16_t needle);
2369
2391WS_DEPRECATED_X("Use tvb_find_uint16 instead")
2392static inline int tvb_find_guint16(tvbuff_t* tvb, const int offset,
2393 const int maxlength, const uint16_t needle) {
2394 return tvb_find_uint16(tvb, offset, maxlength, needle);
2395}
2396
2419WS_DLL_PUBLIC bool tvb_ws_mempbrk_uint8_remaining(tvbuff_t *tvb, const unsigned offset,
2420 const ws_mempbrk_pattern* pattern, unsigned *found_offset, unsigned char *found_needle);
2421
2447WS_DLL_PUBLIC bool tvb_ws_mempbrk_uint8_length(tvbuff_t *tvb, const unsigned offset,
2448 const unsigned maxlength, const ws_mempbrk_pattern* pattern,
2449 unsigned *found_offset, unsigned char *found_needle);
2450
2469WS_DLL_PUBLIC int tvb_ws_mempbrk_pattern_uint8(tvbuff_t *tvb, const unsigned offset,
2470 const int maxlength, const ws_mempbrk_pattern* pattern, unsigned char *found_needle);
2471
2497WS_DEPRECATED_X("Use tvb_ws_mempbrk_pattern_uint8 instead")
2498static inline int tvb_ws_mempbrk_pattern_guint8(tvbuff_t* tvb, const int offset,
2499 const int maxlength, const ws_mempbrk_pattern* pattern, unsigned char* found_needle) {
2500 return tvb_ws_mempbrk_pattern_uint8(tvb, offset, maxlength, pattern, found_needle);
2501}
2502
2520WS_DLL_PUBLIC unsigned tvb_strsize(tvbuff_t *tvb, const unsigned offset);
2521
2538WS_DLL_PUBLIC unsigned tvb_unicode_strsize(tvbuff_t *tvb, const unsigned offset);
2539
2563WS_DLL_PUBLIC unsigned tvb_strsize_enc(tvbuff_t *tvb, const unsigned offset, const unsigned encoding);
2564
2582WS_DLL_PUBLIC int tvb_strnlen(tvbuff_t *tvb, const unsigned offset,
2583 const unsigned maxlength);
2584
2601WS_DLL_PUBLIC char *tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset,
2602 const unsigned size);
2603
2621WS_DLL_PUBLIC char *tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const unsigned offset,
2622 const unsigned size);
2623
2641WS_DLL_PUBLIC char *tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset,
2642 const unsigned size);
2643
2662WS_DLL_PUBLIC char *tvb_format_stringzpad_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const unsigned offset,
2663 const unsigned size);
2664
2686WS_DLL_PUBLIC uint8_t *tvb_get_string_enc(wmem_allocator_t *scope,
2687 tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding);
2688
2713 tvbuff_t *tvb, const unsigned bit_offset, unsigned no_of_chars);
2714
2739 tvbuff_t *tvb, const unsigned offset, unsigned length);
2740
2765 tvbuff_t *tvb, const unsigned offset, unsigned length);
2766
2790WS_DLL_PUBLIC char *tvb_get_ascii_7bits_string(wmem_allocator_t *scope,
2791 tvbuff_t *tvb, const unsigned bit_offset, unsigned no_of_chars);
2792
2817WS_DLL_PUBLIC uint8_t *tvb_get_stringzpad(wmem_allocator_t *scope,
2818 tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding);
2819
2844WS_DLL_PUBLIC uint8_t *tvb_get_stringz_enc(wmem_allocator_t *scope,
2845 tvbuff_t *tvb, const unsigned offset, unsigned *lengthp, const unsigned encoding);
2846
2877WS_DLL_PUBLIC
2878WS_DEPRECATED_X("Use APIs that return a valid UTF-8 string instead")
2879const uint8_t *tvb_get_const_stringz(tvbuff_t *tvb,
2880 const unsigned offset, unsigned *lengthp);
2881
2906WS_DLL_PUBLIC unsigned tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const unsigned offset,
2907 const unsigned bufsize, uint8_t *buffer);
2908
2926WS_DLL_PUBLIC unsigned tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const unsigned offset, char *buffer, size_t bufsize);
2927
2941WS_DLL_PUBLIC bool tvb_ascii_isprint(tvbuff_t *tvb, const unsigned offset,
2942 const unsigned length);
2943
2956WS_DLL_PUBLIC bool tvb_ascii_isprint_remaining(tvbuff_t *tvb, const unsigned offset);
2957
2977WS_DLL_PUBLIC bool tvb_utf_8_isprint(tvbuff_t *tvb, const unsigned offset,
2978 const unsigned length);
2979
2997WS_DLL_PUBLIC bool tvb_utf_8_isprint_remaining(tvbuff_t *tvb, const unsigned offset);
2998
3012WS_DLL_PUBLIC bool tvb_ascii_isdigit(tvbuff_t *tvb, const unsigned offset,
3013 const unsigned length);
3014
3039WS_DLL_PUBLIC int tvb_find_line_end(tvbuff_t *tvb, const unsigned offset, int len,
3040 int *next_offset, const bool desegment);
3041
3079WS_DLL_PUBLIC bool tvb_find_line_end_remaining(tvbuff_t *tvb, const unsigned offset,
3080 unsigned *linelen, unsigned *next_offset);
3081
3111WS_DLL_PUBLIC bool tvb_find_line_end_length(tvbuff_t *tvb, const unsigned offset,
3112 const unsigned maxlength, unsigned *linelen, unsigned *next_offset);
3113
3135WS_DLL_PUBLIC int tvb_find_line_end_unquoted(tvbuff_t *tvb, const unsigned offset,
3136 int len, int *next_offset);
3137
3165WS_DLL_PUBLIC bool tvb_find_line_end_unquoted_remaining(tvbuff_t *tvb, const unsigned offset,
3166 unsigned *linelen, unsigned *next_offset);
3167
3198WS_DLL_PUBLIC bool tvb_find_line_end_unquoted_length(tvbuff_t *tvb, const unsigned offset,
3199 const unsigned maxlength, unsigned *linelen, unsigned *next_offset);
3200
3223WS_DLL_PUBLIC unsigned tvb_skip_wsp(tvbuff_t *tvb, const unsigned offset,
3224 const unsigned maxlength);
3225
3254WS_DLL_PUBLIC unsigned tvb_skip_wsp_return(tvbuff_t *tvb, const unsigned offset);
3255
3273WS_DLL_PUBLIC unsigned tvb_skip_uint8(tvbuff_t *tvb, unsigned offset, const unsigned maxlength, const uint8_t ch);
3274
3296WS_DEPRECATED_X("Use tvb_skip_uint8 instead")
3297static inline unsigned tvb_skip_guint8(tvbuff_t *tvb, unsigned offset, const unsigned maxlength, const uint8_t ch) {
3298 return tvb_skip_uint8(tvb, offset, maxlength, ch);
3299}
3300
3325WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const unsigned offset, int len, int *next_offset, const bool desegment);
3326
3356WS_DLL_PUBLIC bool tvb_get_token_len_remaining(tvbuff_t *tvb, const unsigned offset, unsigned *tokenlen, unsigned *next_offset);
3357
3385WS_DLL_PUBLIC bool tvb_get_token_len_length(tvbuff_t *tvb, const unsigned offset, unsigned maxlength, unsigned *tokenlen, unsigned *next_offset);
3386
3403WS_DLL_PUBLIC int tvb_strneql(tvbuff_t *tvb, const unsigned offset,
3404 const char *str, const size_t size);
3405
3426WS_DLL_PUBLIC int tvb_strncaseeql(tvbuff_t *tvb, const unsigned offset,
3427 const char *str, const size_t size);
3428
3446WS_DLL_PUBLIC int tvb_memeql(tvbuff_t *tvb, const unsigned offset,
3447 const uint8_t *str, size_t size);
3448
3468WS_DLL_PUBLIC char *tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset,
3469 const unsigned len, const char punct);
3470
3491WS_DLL_PUBLIC char *tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb,
3492 const unsigned offset, const unsigned len);
3493
3508typedef struct dgt_set_t
3509{
3510 const unsigned char out[16];
3511}
3513
3541WS_DLL_PUBLIC const char *tvb_bcd_dig_to_str(wmem_allocator_t *scope,
3542 tvbuff_t *tvb, const unsigned offset, const unsigned len, const dgt_set_t *dgt,
3543 bool skip_first);
3544
3572WS_DLL_PUBLIC const char *tvb_bcd_dig_to_str_be(wmem_allocator_t *scope,
3573 tvbuff_t *tvb, const unsigned offset, const unsigned len, const dgt_set_t *dgt,
3574 bool skip_first);
3575
3607WS_DLL_PUBLIC char *tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb,
3608 const unsigned offset, unsigned len, const dgt_set_t *dgt,
3609 bool skip_first, bool odd, bool bigendian);
3610
3626WS_DLL_PUBLIC int tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
3627 const int haystack_offset);
3628
3644WS_DLL_PUBLIC bool tvb_find_tvb_remaining(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
3645 const unsigned haystack_offset, unsigned *found_offset);
3646
3647/* From tvbuff_zlib.c */
3667WS_DEPRECATED_X("Use tvb_uncompress_zlib instead")
3668WS_DLL_PUBLIC tvbuff_t *tvb_uncompress(tvbuff_t *tvb, const unsigned offset,
3669 unsigned comprlen);
3670
3692WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zlib(tvbuff_t *tvb, const unsigned offset,
3693 unsigned comprlen);
3694
3716WS_DEPRECATED_X("Use tvb_child_uncompress_zlib instead")
3717WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb,
3718 const unsigned offset, unsigned comprlen);
3719
3736WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zlib(tvbuff_t *parent, tvbuff_t *tvb,
3737 const unsigned offset, unsigned comprlen);
3738
3739/* From tvbuff_brotli.c */
3740
3762WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_brotli(tvbuff_t *tvb, const unsigned offset,
3763 unsigned comprlen);
3764
3783WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb,
3784 const unsigned offset, unsigned comprlen);
3785
3786/* From tvbuff_snappy.c */
3787
3805WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_snappy(tvbuff_t *tvb, const unsigned offset,
3806 unsigned comprlen);
3807
3826WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb,
3827 const unsigned offset, unsigned comprlen);
3828
3829/* From tvbuff_lz77.c */
3830
3852WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77(tvbuff_t *tvb,
3853 const unsigned offset, unsigned comprlen);
3854
3874WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77(tvbuff_t *parent,
3875 tvbuff_t *tvb, const unsigned offset, unsigned comprlen);
3876
3877/* From tvbuff_lz77huff.c */
3878
3900WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77huff(tvbuff_t *tvb,
3901 const unsigned offset, unsigned comprlen);
3902
3922WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77huff(tvbuff_t *parent,
3923 tvbuff_t *tvb, const unsigned offset, unsigned comprlen);
3924
3925/* From tvbuff_lznt1.c */
3926
3948WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lznt1(tvbuff_t *tvb,
3949 const unsigned offset, unsigned comprlen);
3950
3970WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lznt1(tvbuff_t *parent,
3971 tvbuff_t *tvb, const unsigned offset, unsigned comprlen);
3972
3994WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zstd(tvbuff_t *tvb,
3995 const unsigned offset, unsigned comprlen);
3996
4016WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zstd(tvbuff_t *parent,
4017 tvbuff_t *tvb, const unsigned offset, unsigned comprlen);
4018
4019/* From tvbuff_base64.c */
4020
4035WS_DLL_PUBLIC tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
4036
4055WS_DLL_PUBLIC tvbuff_t* base64_tvb_to_new_tvb(tvbuff_t* parent, unsigned offset, unsigned length);
4056
4076WS_DLL_PUBLIC tvbuff_t* base64uri_tvb_to_new_tvb(tvbuff_t* parent, unsigned offset, unsigned length);
4077
4078/* From tvbuff_hpackhuff.c */
4079
4097 tvbuff_t *tvb, const unsigned offset, const unsigned len);
4098
4118 unsigned offset, unsigned length);
4119
4142WS_DLL_PUBLIC unsigned tvb_get_varint(tvbuff_t *tvb, unsigned offset, unsigned maxlen, uint64_t *value, const unsigned encoding);
4143
4144/************** END OF ACCESSORS ****************/
4145
4146#ifdef __cplusplus
4147}
4148#endif /* __cplusplus */
4149
4150#endif /* __TVBUFF_H__ */
4151
4152/*
4153 * Editor modelines - https://www.wireshark.org/tools/modelines.html
4154 *
4155 * Local variables:
4156 * c-basic-offset: 4
4157 * tab-width: 8
4158 * indent-tabs-mode: nil
4159 * End:
4160 *
4161 * vi: set shiftwidth=4 tabstop=8 expandtab:
4162 * :indentSize=4:tabSize=8:noTabs=true:
4163 */
WS_DLL_PUBLIC unsigned tvb_ensure_reported_length_remaining(const tvbuff_t *tvb, const unsigned offset)
Same as tvb_reported_length_remaining but throws an exception if the offset is out of bounds.
Definition tvbuff.c:844
WS_DLL_PUBLIC int64_t tvb_get_int64(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 64-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1469
WS_DLL_PUBLIC int tvb_find_uint16(tvbuff_t *tvb, const int offset, const int maxlength, const uint16_t needle)
Find the first occurrence of a 16-bit value in a tvbuff.
Definition tvbuff.c:2743
WS_DLL_PUBLIC int64_t tvb_get_int48(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 48-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1375
WS_DLL_PUBLIC int tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, const int haystack_offset)
Search for a sub-tvbuff within another tvbuff starting at a given offset.
Definition tvbuff.c:5327
WS_DLL_PUBLIC unsigned tvb_skip_wsp(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength)
Skip ASCII whitespace in a tvbuff and return the offset of the first non-whitespace byte.
Definition tvbuff.c:4988
WS_DLL_PUBLIC uint16_t tvb_get_uint16(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 16-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1294
WS_DLL_PUBLIC float tvb_get_ntohieee_float(tvbuff_t *tvb, const unsigned offset)
Retrieve a 32-bit IEEE float in network byte order.
Definition tvbuff.c:1650
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lz77(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Microsoft Plain LZ77-compressed data from a tvbuff and attach the result to a parent tvbuf...
Definition tvbuff_lz77.c:136
WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb)
Repair a tvbuff when captured length exceeds reported length.
Definition tvbuff.c:885
WS_DLL_PUBLIC tvbuff_t * tvb_new_child_real_data(tvbuff_t *parent, const uint8_t *data, const unsigned length, const unsigned reported_length)
Create a new child tvbuff with real data.
Definition tvbuff_real.c:104
WS_DLL_PUBLIC bool tvb_offset_exists(const tvbuff_t *tvb, const unsigned offset)
Checks (without throwing an exception) whether the offset exists in the buffer.
Definition tvbuff.c:808
WS_DLL_PUBLIC unsigned tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const unsigned offset, const unsigned bufsize, uint8_t *buffer)
Copy up to a specified number of bytes from a tvbuff into a buffer as a NUL-terminated string.
Definition tvbuff.c:4451
WS_DLL_PUBLIC uint64_t tvb_get_letoh40(tvbuff_t *tvb, const unsigned offset)
Retrieve a 40-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1754
WS_DLL_PUBLIC uint16_t tvb_get_letohs(tvbuff_t *tvb, const unsigned offset)
Retrieve a 16-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1699
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_brotli(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Brotli-compressed data from a tvbuff.
WS_DLL_PUBLIC char * tvb_get_ascii_7bits_string(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned bit_offset, unsigned no_of_chars)
Extract and convert an ASCII 7-bit encoded string from a tvbuff to UTF-8.
Definition tvbuff.c:3507
WS_DLL_PUBLIC double tvb_get_ntohieee_double(tvbuff_t *tvb, const unsigned offset)
Retrieve a 64-bit IEEE double in network byte order.
Definition tvbuff.c:1670
WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const unsigned offset, int len, int *next_offset, const bool desegment)
Determine the length of a token in a tvbuff, optionally desegmenting.
Definition tvbuff.c:5136
WS_DLL_PUBLIC int16_t tvb_get_letohis(tvbuff_t *tvb, const unsigned offset)
Retrieve a 16-bit signed value in little-endian byte order.
Definition tvbuff.c:1708
WS_DLL_PUBLIC unsigned tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const unsigned offset, char *buffer, size_t bufsize)
Extract raw bytes from a tvbuff into a buffer as a NUL-terminated string.
Definition tvbuff.c:4467
WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb)
Set the "this is a fragment" flag on a tvbuff.
Definition tvbuff.c:5407
WS_DLL_PUBLIC uint64_t tvb_get_uint64(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 64-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1402
WS_DLL_PUBLIC bool tvb_find_uint16_length(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength, const uint16_t needle, unsigned *found_offset)
Find the first occurrence of a 16-bit value in a tvbuff up to a limit.
Definition tvbuff.c:2770
WS_DLL_PUBLIC char * tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned size)
Format a null-padded string from a tvbuff as printable text.
Definition tvbuff.c:3231
WS_DLL_PUBLIC bool tvb_find_tvb_remaining(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, const unsigned haystack_offset, unsigned *found_offset)
Search for a sub-tvbuff within another tvbuff starting at a given offset.
Definition tvbuff.c:5360
WS_DLL_PUBLIC uint8_t * tvb_get_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding)
Extract and convert a null-padded string from a tvbuff to UTF-8.
Definition tvbuff.c:3958
WS_DLL_PUBLIC bool tvb_find_line_end_unquoted_length(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength, unsigned *linelen, unsigned *next_offset)
Locate the end of a line in a tvbuff, scanning up to a certain length and ignoring newlines within qu...
Definition tvbuff.c:4950
WS_DLL_PUBLIC bool tvb_utf_8_isprint(tvbuff_t *tvb, const unsigned offset, const unsigned length)
Check if a portion of a tvbuff contains only valid, printable UTF-8 characters.
Definition tvbuff.c:4531
WS_DLL_PUBLIC unsigned tvb_strsize_enc(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Determine the size of a NUL-terminated string in a given encoding in a tvbuff.
Definition tvbuff.c:3025
WS_DLL_PUBLIC int32_t tvb_get_ntohil(tvbuff_t *tvb, const unsigned offset)
Retrieve a 32-bit signed value in network byte order.
Definition tvbuff.c:1210
WS_DLL_PUBLIC int64_t tvb_get_ntohi48(tvbuff_t *tvb, const unsigned offset)
Retrieve a 48-bit signed value in network byte order.
Definition tvbuff.c:1247
const unsigned char out[16]
Definition tvbuff.h:3510
WS_DLL_PUBLIC uint64_t tvb_get_ntoh64(tvbuff_t *tvb, const unsigned offset)
Retrieve a 64-bit unsigned value in network byte order.
Definition tvbuff.c:1276
WS_DLL_PUBLIC unsigned tvb_strsize(tvbuff_t *tvb, const unsigned offset)
Determine the size of a NUL-terminated string in a tvbuff.
Definition tvbuff.c:2954
WS_DLL_PUBLIC int16_t tvb_get_ntohis(tvbuff_t *tvb, const unsigned offset)
Retrieve a 16-bit signed value in network byte order.
Definition tvbuff.c:1173
WS_DLL_PUBLIC bool tvb_ascii_isprint_remaining(tvbuff_t *tvb, const unsigned offset)
Check whether all bytes in a tvbuff starting at an offset are ASCII printable characters.
Definition tvbuff.c:4510
WS_DLL_PUBLIC void tvb_free(tvbuff_t *tvb)
Free a tvbuff_t and all tvbuffs chained from it.
Definition tvbuff.c:112
WS_DLL_PUBLIC int32_t tvb_get_int24(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 24-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1321
WS_DLL_PUBLIC unsigned tvb_reported_length_remaining(const tvbuff_t *tvb, const unsigned offset)
Computes bytes of reported packet data from the given offset to the end of buffer.
Definition tvbuff.c:827
WS_DLL_PUBLIC int32_t tvb_get_letohi24(tvbuff_t *tvb, const unsigned offset)
Retrieve a 24-bit signed value in little-endian byte order.
Definition tvbuff.c:1726
WS_DLL_PUBLIC bool tvb_find_line_end_length(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength, unsigned *linelen, unsigned *next_offset)
Locate the end of a line in a tvbuff, scanning up to a certain length.
Definition tvbuff.c:4737
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_zlib(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress a zlib-compressed packet inside a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_zlib.c:315
WS_DLL_PUBLIC int tvb_ws_mempbrk_pattern_uint8(tvbuff_t *tvb, const unsigned offset, const int maxlength, const ws_mempbrk_pattern *pattern, unsigned char *found_needle)
Find the first occurrence of any needle from a pre-compiled pattern in a tvbuff.
Definition tvbuff.c:2839
WS_DLL_PUBLIC uint8_t * tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding)
Extract and convert a string from a tvbuff to UTF-8 using the specified encoding.
Definition tvbuff.c:3697
WS_DLL_PUBLIC uint8_t tvb_get_bits8(tvbuff_t *tvb, unsigned bit_offset, const unsigned no_of_bits)
Retrieve 1–8 bits from a tvbuff and return them as a uint8_t.
Definition tvbuff.c:2369
WS_DLL_PUBLIC uint64_t tvb_get_uint40(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 40-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1348
WS_DLL_PUBLIC int64_t tvb_get_ntohi56(tvbuff_t *tvb, const unsigned offset)
Retrieve a 56-bit signed value in network byte order.
Definition tvbuff.c:1266
WS_DLL_PUBLIC int64_t tvb_get_letohi64(tvbuff_t *tvb, const unsigned offset)
Retrieve a 64-bit signed value in little-endian byte order.
Definition tvbuff.c:1820
WS_DLL_PUBLIC unsigned tvb_reported_length(const tvbuff_t *tvb)
Get reported length of buffer.
Definition tvbuff.c:819
WS_DLL_PUBLIC uint64_t tvb_get_ntoh56(tvbuff_t *tvb, const unsigned offset)
Retrieve a 56-bit unsigned value in network byte order.
Definition tvbuff.c:1257
WS_DLL_PUBLIC int16_t tvb_get_int16(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 16-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1303
WS_DLL_PUBLIC const char * tvb_bcd_dig_to_str_be(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned len, const dgt_set_t *dgt, bool skip_first)
Convert BCD-encoded digits from a tvbuff to a formatted string (big-endian nibble order).
Definition tvbuff.c:5307
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_length(tvbuff_t *backing, const unsigned backing_offset, const unsigned reported_length)
Create a subset tvbuff with captured length fitting within backing and reported lengths.
Definition tvbuff_subset.c:188
WS_DLL_PUBLIC bool tvb_utf_8_isprint_remaining(tvbuff_t *tvb, const unsigned offset)
Check if a tvbuff contains only valid, printable UTF-8 characters.
Definition tvbuff.c:4543
WS_DLL_PUBLIC int tvb_find_line_end(tvbuff_t *tvb, const unsigned offset, int len, int *next_offset, const bool desegment)
Locate the end of a line in a tvbuff, optionally desegmenting.
Definition tvbuff.c:4692
WS_DLL_PUBLIC unsigned tvb_skip_uint8(tvbuff_t *tvb, unsigned offset, const unsigned maxlength, const uint8_t ch)
Skip consecutive occurrences of a specific byte value in a tvbuff.
Definition tvbuff.c:5040
WS_DLL_PUBLIC int tvb_strnlen(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength)
Find the length of a NUL-terminated string in a tvbuff, up to a maximum limit.
Definition tvbuff.c:3100
WS_DLL_PUBLIC void tvb_free_chain(tvbuff_t *tvb)
Free the tvbuff_t and all tvbuffs chained from it.
Definition tvbuff.c:118
WS_DLL_PUBLIC wmem_strbuf_t * tvb_get_hpack_huffman_strbuf(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned len)
Decode HPACK Huffman-encoded data from a tvbuff into a string buffer.
Definition tvbuff_hpackhuff.c:51
WS_DLL_PUBLIC tvbuff_t * tvb_clone(tvbuff_t *tvb)
Creates a full clone of the given tvbuff.
Definition tvbuff.c:628
WS_DLL_PUBLIC uint32_t tvb_get_bits(tvbuff_t *tvb, const unsigned bit_offset, const unsigned no_of_bits, const unsigned encoding)
Deprecated accessor for extracting bits from a tvbuff.
Definition tvbuff.c:2560
WS_DLL_PUBLIC uint8_t tvb_get_uint8(tvbuff_t *tvb, const unsigned offset)
Retrieve an 8-bit unsigned value from a tvbuff at the specified offset.
Definition tvbuff.c:1146
WS_DLL_PUBLIC unsigned tvb_offset_from_real_beginning(const tvbuff_t *tvb)
Returns the offset from the beginning of the real (backing) buffer.
Definition tvbuff.c:906
WS_DLL_PUBLIC void * tvb_memcpy(tvbuff_t *tvb, void *target, const unsigned offset, size_t length)
Copy a range of bytes from a tvbuff into a pre-allocated target buffer.
Definition tvbuff.c:1052
WS_DLL_PUBLIC tvbuff_t * base64_to_tvb(tvbuff_t *parent, const char *base64)
Decode a base64-encoded string into a tvbuff and attach it to a parent tvbuff.
Definition tvbuff_base64.c:169
WS_DLL_PUBLIC bool tvb_find_line_end_unquoted_remaining(tvbuff_t *tvb, const unsigned offset, unsigned *linelen, unsigned *next_offset)
Locate the end of a line in a tvbuff, ignoring newlines within quoted strings.
Definition tvbuff.c:4935
WS_DLL_PUBLIC int tvb_find_line_end_unquoted(tvbuff_t *tvb, const unsigned offset, int len, int *next_offset)
Locate the end of a line in a tvbuff, ignoring newlines inside quoted strings.
Definition tvbuff.c:4907
WS_DLL_PUBLIC unsigned tvb_unicode_strsize(tvbuff_t *tvb, const unsigned offset)
Determine the size of a UCS-2 or UTF-16 NUL-terminated string in a tvbuff.
Definition tvbuff.c:2982
WS_DLL_PUBLIC double tvb_get_letohieee_double(tvbuff_t *tvb, const unsigned offset)
Retrieve a 64-bit IEEE double in little-endian byte order.
Definition tvbuff.c:1857
WS_DLL_PUBLIC int tvb_strneql(tvbuff_t *tvb, const unsigned offset, const char *str, const size_t size)
Compare a string in a tvbuff to a reference string using strncmp semantics.
Definition tvbuff.c:3125
WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb, const unsigned offset, const uint64_t length)
Checks that the bytes referred to by 'offset' and 'length' actually exist in the buffer.
Definition tvbuff.c:740
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_zlib(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress zlib-compressed data from a tvbuff.
WS_DLL_PUBLIC void tvb_set_child_real_data_tvbuff(tvbuff_t *parent, tvbuff_t *child)
Attach a "real" tvbuff to a parent tvbuff.
Definition tvbuff_real.c:94
void(* tvbuff_free_cb_t)(void *)
Definition tvbuff.h:104
WS_DLL_PUBLIC int64_t tvb_get_letohi48(tvbuff_t *tvb, const unsigned offset)
Retrieve a 48-bit signed value in little-endian byte order.
Definition tvbuff.c:1782
WS_DLL_PUBLIC tvbuff_t * tvb_new_chain(tvbuff_t *parent, tvbuff_t *backing)
Create a new chained tvbuff from a parent and backing buffer.
Definition tvbuff.c:130
WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const unsigned offset, e_guid_t *guid)
Retrieve a GUID from a tvbuff in network byte order.
Definition tvbuff.c:2303
WS_DLL_PUBLIC uint16_t tvb_get_ntohs(tvbuff_t *tvb, const unsigned offset)
Retrieve a 16-bit unsigned value in network byte order.
Definition tvbuff.c:1164
WS_DLL_PUBLIC unsigned tvb_captured_length(const tvbuff_t *tvb)
Get the amount of captured data in the buffer.
Definition tvbuff.c:634
WS_DLL_PUBLIC void tvb_composite_append(tvbuff_t *tvb, tvbuff_t *member)
Append to the list of tvbuffs that make up this composite tvbuff.
Definition tvbuff_composite.c:247
WS_DLL_PUBLIC char * tvb_format_text_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const unsigned offset, const unsigned size)
Format tvbuff data as printable text, omitting C-style escapes.
Definition tvbuff.c:3218
WS_DLL_PUBLIC uint64_t tvb_get_uint48(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 48-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1366
WS_DLL_PUBLIC int tvb_strncaseeql(tvbuff_t *tvb, const unsigned offset, const char *str, const size_t size)
Case-insensitive comparison of tvbuff bytes against a reference string.
Definition tvbuff.c:3152
WS_DLL_PUBLIC unsigned tvb_raw_offset(tvbuff_t *tvb)
Returns the offset from the first byte of real data.
Definition tvbuff.c:5397
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lz77huff(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Microsoft LZ77+Huffman-compressed data from a tvbuff and attach the result to a parent tvb...
Definition tvbuff_lz77huff.c:406
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lz77huff(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Microsoft LZ77+Huffman-compressed data from a tvbuff.
Definition tvbuff_lz77huff.c:360
WS_DLL_PUBLIC tvbuff_t * tvb_new_composite(void)
Create an empty composite tvbuff.
Definition tvbuff_composite.c:235
WS_DLL_PUBLIC uint64_t tvb_get_uint56(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 56-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1384
WS_DLL_PUBLIC bool tvb_find_uint8_remaining(tvbuff_t *tvb, const unsigned offset, const uint8_t needle, unsigned *found_offset)
Find the first occurrence of a byte value in a tvbuff.
Definition tvbuff.c:2688
WS_DLL_PUBLIC nstime_t * tvb_get_string_time(tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding, nstime_t *ns, unsigned *endoff)
Fetch a time value from an ASCII-style string in the tvbuff.
Definition tvbuff.c:1984
WS_DLL_PUBLIC bool tvb_find_uint16_remaining(tvbuff_t *tvb, const unsigned offset, const uint16_t needle, unsigned *found_offset)
Find the first occurrence of a 16-bit value in a tvbuff.
Definition tvbuff.c:2792
WS_DLL_PUBLIC uint8_t * tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, unsigned *lengthp, const unsigned encoding)
Extract and convert a null-terminated string from a tvbuff to UTF-8 using the specified encoding.
Definition tvbuff.c:4172
WS_DLL_PUBLIC tvbuff_t * base64_tvb_to_new_tvb(tvbuff_t *parent, unsigned offset, unsigned length)
Decode a base64-encoded string from a tvbuff region and attach the result to a parent tvbuff.
Definition tvbuff_base64.c:184
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Brotli-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_brotli.c:173
WS_DLL_PUBLIC struct tvbuff * tvb_get_ds_tvb(tvbuff_t *tvb)
Retrieve the data source tvbuff from a given tvbuff.
Definition tvbuff.c:5413
WS_DLL_PUBLIC char * tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb, const unsigned offset, const unsigned len)
Format a sequence of bytes from a tvbuff as a hexadecimal string.
Definition tvbuff.c:5320
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lz77(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Microsoft Plain LZ77-compressed data from a tvbuff.
Definition tvbuff_lz77.c:97
WS_DLL_PUBLIC void tvb_composite_prepend(tvbuff_t *tvb, tvbuff_t *member)
Prepend to the list of tvbuffs that make up this composite tvbuff.
Definition tvbuff_composite.c:273
WS_DLL_PUBLIC uint8_t * tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, size_t length, size_t *data_length, const unsigned encoding)
Retrieve a byte array from a tvbuff using a bit-level offset and encoding.
Definition tvbuff.c:2354
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Deprecated interface for uncompressing data and chaining the result to a parent tvbuff.
Definition tvbuff_zlib.c:330
WS_DLL_PUBLIC tvbuff_t * tvb_new_octet_right_aligned(tvbuff_t *tvb, uint32_t bit_offset, uint32_t no_of_bits)
Extracts a specified number of bits starting at a given bit offset, with bits counted from least sign...
Definition tvbuff.c:537
WS_DLL_PUBLIC char * tvb_format_stringzpad_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const unsigned offset, const unsigned size)
Format a null-padded string from a tvbuff as printable text, preserving whitespace.
Definition tvbuff.c:3247
WS_DLL_PUBLIC bool tvb_get_token_len_length(tvbuff_t *tvb, const unsigned offset, unsigned maxlength, unsigned *tokenlen, unsigned *next_offset)
Determine the length of a token in a tvbuff.
Definition tvbuff.c:5181
WS_DLL_PUBLIC char * tvb_get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, unsigned length)
Extract and convert a string encoded per ETSI TS 102 221 Annex A from a tvbuff to UTF-8.
Definition tvbuff.c:3495
WS_DLL_PUBLIC bool tvb_get_token_len_remaining(tvbuff_t *tvb, const unsigned offset, unsigned *tokenlen, unsigned *next_offset)
Determine the length of a token in a tvbuff.
Definition tvbuff.c:5166
WS_DLL_PUBLIC uint32_t tvb_get_ntoh24(tvbuff_t *tvb, const unsigned offset)
Retrieve a 24-bit unsigned value in network byte order.
Definition tvbuff.c:1182
WS_DLL_PUBLIC double tvb_get_ieee_double(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 64-bit IEEE double from a tvbuff using the specified encoding.
Definition tvbuff.c:1487
WS_DLL_PUBLIC uint32_t tvb_get_bits32(tvbuff_t *tvb, unsigned bit_offset, const unsigned no_of_bits, const unsigned encoding)
Retrieve 1–32 bits from a tvbuff and return them as a uint32_t.
Definition tvbuff.c:2385
WS_DLL_PUBLIC bool tvb_ascii_isprint(tvbuff_t *tvb, const unsigned offset, const unsigned length)
Check whether all bytes in a tvbuff range are ASCII printable characters.
Definition tvbuff.c:4494
WS_DLL_PUBLIC float tvb_get_letohieee_float(tvbuff_t *tvb, const unsigned offset)
Retrieve a 32-bit IEEE float in little-endian byte order.
Definition tvbuff.c:1837
WS_DLL_PUBLIC unsigned tvb_ensure_captured_length_remaining(const tvbuff_t *tvb, const unsigned offset)
Same as tvb_captured_length_remaining, but throws an exception if the offset is out of bounds.
Definition tvbuff.c:671
WS_DLL_PUBLIC tvbuff_t * tvb_new_octet_aligned(tvbuff_t *tvb, uint32_t bit_offset, uint32_t no_of_bits)
Extracts a specified number of bits starting at a given bit offset, aligning the result to octet boun...
Definition tvbuff.c:478
WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const unsigned offset, e_guid_t *guid)
Retrieve a GUID from a tvbuff in little-endian byte order.
Definition tvbuff.c:2314
WS_DLL_PUBLIC uint64_t tvb_get_letoh64(tvbuff_t *tvb, const unsigned offset)
Retrieve a 64-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1811
WS_DLL_PUBLIC int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, const unsigned offset, ws_in4_addr *addr, uint32_t prefix_len)
Fetch an IPv4 address from a tvbuff and mask out bits not covered by a prefix length.
Definition tvbuff.c:2261
WS_DLL_PUBLIC int32_t tvb_get_ntohi24(tvbuff_t *tvb, const unsigned offset)
Retrieve a 24-bit signed value in network byte order.
Definition tvbuff.c:1191
WS_DLL_PUBLIC int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, const unsigned offset, ws_in6_addr *addr, uint32_t prefix_len)
Fetch an IPv6 address from a tvbuff and mask out bits not covered by a prefix length.
Definition tvbuff.c:2282
WS_DLL_PUBLIC int8_t tvb_get_int8(tvbuff_t *tvb, const unsigned offset)
Retrieve an 8-bit signed value from a tvbuff at the specified offset.
Definition tvbuff.c:1155
WS_DLL_PUBLIC uint64_t tvb_get_uint64_with_length(tvbuff_t *tvb, const unsigned offset, unsigned length, const unsigned encoding)
Retrieve a variable-length unsigned value (up to 64 bits) from a tvbuff using the specified encoding.
Definition tvbuff.c:1411
WS_DLL_PUBLIC uint32_t tvb_get_uint24(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 24-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1312
WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb)
Mark a composite tvbuff as finalized.
Definition tvbuff_composite.c:299
WS_DLL_PUBLIC GByteArray * tvb_get_string_bytes(tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding, GByteArray *bytes, unsigned *endoff)
Parse a case-insensitive hex string with optional separators into a byte array.
Definition tvbuff.c:1932
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_zstd(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Zstandard (ZSTD)-compressed data from a tvbuff.
Definition tvbuff_zstd.c:28
WS_DLL_PUBLIC uint64_t tvb_get_letoh48(tvbuff_t *tvb, const unsigned offset)
Retrieve a 48-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1773
WS_DLL_PUBLIC int64_t tvb_get_ntohi64(tvbuff_t *tvb, const unsigned offset)
Retrieve a 64-bit signed value in network byte order.
Definition tvbuff.c:1285
WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb, const unsigned offset, const int length)
Checks that the bytes referred to by 'offset' and 'length' actually exist in the buffer.
Definition tvbuff.c:759
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_zstd(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Zstandard (ZSTD)-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_zstd.c:101
WS_DLL_PUBLIC int64_t tvb_get_ntohi40(tvbuff_t *tvb, const unsigned offset)
Retrieve a 40-bit signed value in network byte order.
Definition tvbuff.c:1228
WS_DLL_PUBLIC int32_t tvb_get_int32(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 32-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1339
WS_DLL_PUBLIC uint32_t tvb_get_letohl(tvbuff_t *tvb, const unsigned offset)
Retrieve a 32-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1736
WS_DLL_PUBLIC uint32_t tvb_get_ipv4(tvbuff_t *tvb, const unsigned offset)
Retrieve an IPv4 address from a tvbuff in network byte order.
Definition tvbuff.c:2236
WS_DLL_PUBLIC void tvb_get_ipv6(tvbuff_t *tvb, const unsigned offset, ws_in6_addr *addr)
Retrieve an IPv6 address from a tvbuff.
Definition tvbuff.c:2248
WS_DLL_PUBLIC uint16_t tvb_get_bits16(tvbuff_t *tvb, unsigned bit_offset, const unsigned no_of_bits, const unsigned encoding)
Retrieve 1–16 bits from a tvbuff and return them as a uint16_t.
Definition tvbuff.c:2377
WS_DLL_PUBLIC bool tvb_bytes_exist(const tvbuff_t *tvb, const unsigned offset, const int length)
Check that the specified bytes exist in the tvbuff without throwing an exception.
Definition tvbuff.c:706
WS_DLL_PUBLIC const uint8_t * tvb_get_const_stringz(tvbuff_t *tvb, const unsigned offset, unsigned *lengthp)
Deprecated function to retrieve a raw, unmodifiable null-terminated string from a tvbuff.
Definition tvbuff.c:4054
WS_DLL_PUBLIC int64_t tvb_get_letohi40(tvbuff_t *tvb, const unsigned offset)
Retrieve a 40-bit signed value in little-endian byte order.
Definition tvbuff.c:1763
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_length_caplen(tvbuff_t *backing, const unsigned backing_offset, const unsigned backing_length, const unsigned reported_length)
Create a subset tvbuff with an explicitly limited captured length.
Definition tvbuff_subset.c:161
WS_DLL_PUBLIC tvbuff_t * tvb_clone_offset_len(tvbuff_t *tvb, unsigned offset, unsigned len)
Clones a portion of the given tvbuff starting at a specific offset and length.
Definition tvbuff.c:614
WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const unsigned offset, e_guid_t *guid, const unsigned encoding)
Retrieve a GUID from a tvbuff using the specified encoding.
Definition tvbuff.c:2325
WS_DLL_PUBLIC uint64_t tvb_get_ntoh40(tvbuff_t *tvb, const unsigned offset)
Retrieve a 40-bit unsigned value in network byte order.
Definition tvbuff.c:1219
WS_DLL_PUBLIC tvbuff_t * tvb_new_real_data(const uint8_t *data, const unsigned length, const unsigned reported_length)
Create a tvbuff backed by existing data.
Definition tvbuff_real.c:58
WS_DLL_PUBLIC tvbuff_t * base64uri_tvb_to_new_tvb(tvbuff_t *parent, unsigned offset, unsigned length)
Decode a base64url-encoded string from a tvbuff region and attach the result to a parent tvbuff.
Definition tvbuff_base64.c:211
WS_DLL_PUBLIC uint64_t tvb_get_bits64(tvbuff_t *tvb, unsigned bit_offset, const unsigned no_of_bits, const unsigned encoding)
Retrieve 1–64 bits from a tvbuff and return them as a uint64_t.
Definition tvbuff.c:2393
WS_DLL_PUBLIC int64_t tvb_get_int40(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 40-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1357
WS_DLL_PUBLIC bool tvb_ascii_isdigit(tvbuff_t *tvb, const unsigned offset, const unsigned length)
Check if all bytes in a tvbuff range are ASCII digits.
Definition tvbuff.c:4560
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Deprecated interface for uncompressing data from a tvbuff using zlib.
Definition tvbuff_zlib.c:324
WS_DLL_PUBLIC bool tvb_find_line_end_remaining(tvbuff_t *tvb, const unsigned offset, unsigned *linelen, unsigned *next_offset)
Locate the end of a line in a tvbuff.
Definition tvbuff.c:4722
WS_DLL_PUBLIC void * tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, size_t length)
Duplicate a block of data from a tvbuff into a newly allocated buffer.
Definition tvbuff.c:1095
WS_DLL_PUBLIC int32_t tvb_get_letohil(tvbuff_t *tvb, const unsigned offset)
Retrieve a 32-bit signed value in little-endian byte order.
Definition tvbuff.c:1745
WS_DLL_PUBLIC float tvb_get_ieee_float(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 32-bit IEEE float from a tvbuff using the specified encoding.
Definition tvbuff.c:1478
WS_DLL_PUBLIC void tvb_set_free_cb(tvbuff_t *tvb, const tvbuff_free_cb_t func)
Set a callback function to be called when a tvbuff is actually freed.
Definition tvbuff_real.c:84
WS_DLL_PUBLIC char * tvb_get_ts_23_038_7bits_string_unpacked(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, unsigned length)
Extract and convert a 3GPP TS 23.038 7-bit unpacked string from a tvbuff to UTF-8.
Definition tvbuff.c:3483
WS_DLL_PUBLIC unsigned tvb_skip_wsp_return(tvbuff_t *tvb, const unsigned offset)
Go backwards to find the offset after a token followed by optional ASCII whitespace.
Definition tvbuff.c:5017
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_remaining(tvbuff_t *backing, const unsigned backing_offset)
Create a subset tvbuff containing all the data starting at an offset into a backing tvbuff.
Definition tvbuff_subset.c:212
WS_DLL_PUBLIC void tvb_set_reported_length(tvbuff_t *tvb, const unsigned reported_length)
Set a tvbuff's reported_length to a given value.
Definition tvbuff.c:866
WS_DLL_PUBLIC const uint8_t * tvb_get_ptr(tvbuff_t *tvb, const unsigned offset, const unsigned length)
Returns a raw pointer to tvbuff data. Use with extreme caution.
Definition tvbuff.c:1139
WS_DLL_PUBLIC uint64_t tvb_get_ntoh48(tvbuff_t *tvb, const unsigned offset)
Retrieve a 48-bit unsigned value in network byte order.
Definition tvbuff.c:1238
WS_DLL_PUBLIC const char * tvb_bcd_dig_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned len, const dgt_set_t *dgt, bool skip_first)
Convert BCD-encoded digits from a tvbuff into a formatted string.
Definition tvbuff.c:5298
WS_DLL_PUBLIC char * tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, unsigned len, const dgt_set_t *dgt, bool skip_first, bool odd, bool bigendian)
Convert BCD-encoded digits from a tvbuff to a UTF-8 string with flexible nibble handling.
Definition tvbuff.c:5229
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lznt1(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Microsoft LZNT1-compressed data from a tvbuff.
Definition tvbuff_lznt1.c:118
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Snappy-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_snappy.c:66
WS_DLL_PUBLIC int tvb_find_uint8(tvbuff_t *tvb, const unsigned offset, const int maxlength, const uint8_t needle)
Find the first occurrence of a byte value in a tvbuff.
Definition tvbuff.c:2597
WS_DLL_PUBLIC int64_t tvb_get_letohi56(tvbuff_t *tvb, const unsigned offset)
Retrieve a 56-bit signed value in little-endian byte order.
Definition tvbuff.c:1801
WS_DLL_PUBLIC char * tvb_get_ts_23_038_7bits_string_packed(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned bit_offset, unsigned no_of_chars)
Extract and convert a 3GPP TS 23.038 7-bit packed string from a tvbuff to UTF-8.
Definition tvbuff.c:3469
WS_DLL_PUBLIC uint32_t tvb_get_letoh24(tvbuff_t *tvb, const unsigned offset)
Retrieve a 24-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1717
WS_DLL_PUBLIC bool tvb_ws_mempbrk_uint8_length(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength, const ws_mempbrk_pattern *pattern, unsigned *found_offset, unsigned char *found_needle)
Find the first occurrence of any needle from a pre-compiled pattern in a tvbuff up to a maximum searc...
Definition tvbuff.c:2926
WS_DLL_PUBLIC bool tvb_ws_mempbrk_uint8_remaining(tvbuff_t *tvb, const unsigned offset, const ws_mempbrk_pattern *pattern, unsigned *found_offset, unsigned char *found_needle)
Find the first occurrence of any needle from a pre-compiled pattern in a tvbuff.
Definition tvbuff.c:2910
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lznt1(tvbuff_t *parent, tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Microsoft LZNT1-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_lznt1.c:157
WS_DLL_PUBLIC uint32_t tvb_get_ntohl(tvbuff_t *tvb, const unsigned offset)
Retrieve a 32-bit unsigned value in network byte order.
Definition tvbuff.c:1201
WS_DLL_PUBLIC int tvb_memeql(tvbuff_t *tvb, const unsigned offset, const uint8_t *str, size_t size)
Compare raw bytes in a tvbuff to a reference buffer using memcmp semantics.
Definition tvbuff.c:3180
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_hpack_huff(tvbuff_t *parent, unsigned offset, unsigned length)
Decode HPACK Huffman-encoded data from a tvbuff region and attach the result to a parent tvbuff.
Definition tvbuff_hpackhuff.c:57
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_snappy(tvbuff_t *tvb, const unsigned offset, unsigned comprlen)
Uncompress Snappy-compressed data from a tvbuff.
WS_DLL_PUBLIC char * tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned size)
Format a block of tvbuff data as printable text.
Definition tvbuff.c:3206
WS_DLL_PUBLIC unsigned tvb_get_varint(tvbuff_t *tvb, unsigned offset, unsigned maxlen, uint64_t *value, const unsigned encoding)
Extract a variable-length integer from a tvbuff using the specified encoding.
Definition tvbuff.c:5419
WS_DLL_PUBLIC uint64_t tvb_get_letoh56(tvbuff_t *tvb, const unsigned offset)
Retrieve a 56-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1792
WS_DLL_PUBLIC unsigned tvb_captured_length_remaining(const tvbuff_t *tvb, const unsigned offset)
Computes bytes to end of buffer from the given offset.
Definition tvbuff.c:656
WS_DLL_PUBLIC int64_t tvb_get_int56(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 56-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1393
WS_DLL_PUBLIC bool tvb_find_uint8_length(tvbuff_t *tvb, const unsigned offset, const unsigned maxlength, const uint8_t needle, unsigned *found_offset)
Find the first occurrence of a byte value in a tvbuff up to a limit.
Definition tvbuff.c:2666
WS_DLL_PUBLIC uint32_t tvb_get_uint32(tvbuff_t *tvb, const unsigned offset, const unsigned encoding)
Retrieve a 32-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1330
WS_DLL_PUBLIC char * tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset, const unsigned len, const char punct)
Format a sequence of bytes from a tvbuff as a string with a custom separator.
Definition tvbuff.c:5208
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
Definition guid-utils.h:23
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Internal structure representing a wmem-allocated string buffer.
Definition wmem_strbuf.h:38
Definition mcast_stream.h:30
Digit mapping table for BCD decoding.
Definition tvbuff.h:3509
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
Definition nstime.h:26
Definition tvbuff-int.h:36
unsigned length
Definition tvbuff-int.h:62
unsigned reported_length
Definition tvbuff-int.h:68
Definition ws_mempbrk.h:21