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 int reported_length);
243
257WS_DLL_PUBLIC tvbuff_t *tvb_new_real_data(const uint8_t *data,
258 const unsigned length, const int 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
392WS_DLL_PUBLIC int tvb_captured_length_remaining(const tvbuff_t *tvb, const unsigned offset);
393
410WS_DLL_PUBLIC unsigned tvb_ensure_captured_length_remaining(const tvbuff_t *tvb,
411 const unsigned offset);
412
427WS_DLL_PUBLIC bool tvb_bytes_exist(const tvbuff_t *tvb, const unsigned offset,
428 const int length);
429
442WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb,
443 const unsigned offset, const uint64_t length);
444
456WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb,
457 const unsigned offset, const int length);
458
467WS_DLL_PUBLIC bool tvb_offset_exists(const tvbuff_t *tvb,
468 const unsigned offset);
469
477WS_DLL_PUBLIC unsigned tvb_reported_length(const tvbuff_t *tvb);
478
491WS_DLL_PUBLIC int tvb_reported_length_remaining(const tvbuff_t *tvb,
492 const unsigned offset);
493
508WS_DLL_PUBLIC unsigned tvb_ensure_reported_length_remaining(const tvbuff_t *tvb,
509 const unsigned offset);
510
523WS_DLL_PUBLIC void tvb_set_reported_length(tvbuff_t *tvb, const unsigned reported_length);
524
525
535WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb);
536
548WS_DLL_PUBLIC unsigned tvb_offset_from_real_beginning(const tvbuff_t *tvb);
549
561WS_DLL_PUBLIC int tvb_raw_offset(tvbuff_t *tvb);
562
572WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb);
573
585WS_DLL_PUBLIC struct tvbuff *tvb_get_ds_tvb(tvbuff_t *tvb);
586
587
588/************** START OF ACCESSORS ****************/
589/* All accessors will throw an exception if appropriate */
590
602WS_DLL_PUBLIC uint8_t tvb_get_uint8(tvbuff_t *tvb, const int offset);
603
617WS_DEPRECATED_X("Use tvb_get_uint8 instead")
618static inline uint8_t tvb_get_guint8(tvbuff_t *tvb, const int offset) {
619 return tvb_get_uint8(tvb, offset);
620}
621
633WS_DLL_PUBLIC int8_t tvb_get_int8(tvbuff_t *tvb, const int offset);
634
648WS_DEPRECATED_X("Use tvb_get_int8 instead")
649static inline int8_t tvb_get_gint8(tvbuff_t *tvb, const int offset) { return tvb_get_int8(tvb, offset); }
650
667WS_DLL_PUBLIC uint16_t tvb_get_ntohs(tvbuff_t *tvb, const int offset);
668
685WS_DLL_PUBLIC int16_t tvb_get_ntohis(tvbuff_t *tvb, const int offset);
686
703WS_DLL_PUBLIC uint32_t tvb_get_ntoh24(tvbuff_t *tvb, const int offset);
704
721WS_DLL_PUBLIC int32_t tvb_get_ntohi24(tvbuff_t *tvb, const int offset);
722
739WS_DLL_PUBLIC uint32_t tvb_get_ntohl(tvbuff_t *tvb, const int offset);
740
757WS_DLL_PUBLIC int32_t tvb_get_ntohil(tvbuff_t *tvb, const int offset);
758
775WS_DLL_PUBLIC uint64_t tvb_get_ntoh40(tvbuff_t *tvb, const int offset);
776
793WS_DLL_PUBLIC int64_t tvb_get_ntohi40(tvbuff_t *tvb, const int offset);
794
811WS_DLL_PUBLIC uint64_t tvb_get_ntoh48(tvbuff_t *tvb, const int offset);
812
829WS_DLL_PUBLIC int64_t tvb_get_ntohi48(tvbuff_t *tvb, const int offset);
830
847WS_DLL_PUBLIC uint64_t tvb_get_ntoh56(tvbuff_t *tvb, const int offset);
848
865WS_DLL_PUBLIC int64_t tvb_get_ntohi56(tvbuff_t *tvb, const int offset);
866
883WS_DLL_PUBLIC uint64_t tvb_get_ntoh64(tvbuff_t *tvb, const int offset);
884
901WS_DLL_PUBLIC int64_t tvb_get_ntohi64(tvbuff_t *tvb, const int offset);
902
919WS_DLL_PUBLIC float tvb_get_ntohieee_float(tvbuff_t *tvb, const int offset);
920
937WS_DLL_PUBLIC double tvb_get_ntohieee_double(tvbuff_t *tvb,
938 const int offset);
939
956WS_DLL_PUBLIC uint16_t tvb_get_letohs(tvbuff_t *tvb, const int offset);
957
974WS_DLL_PUBLIC int16_t tvb_get_letohis(tvbuff_t *tvb, const int offset);
975
992WS_DLL_PUBLIC uint32_t tvb_get_letoh24(tvbuff_t *tvb, const int offset);
993
1010WS_DLL_PUBLIC int32_t tvb_get_letohi24(tvbuff_t *tvb, const int offset);
1011
1028WS_DLL_PUBLIC uint32_t tvb_get_letohl(tvbuff_t *tvb, const int offset);
1029
1046WS_DLL_PUBLIC int32_t tvb_get_letohil(tvbuff_t *tvb, const int offset);
1047
1064WS_DLL_PUBLIC uint64_t tvb_get_letoh40(tvbuff_t *tvb, const int offset);
1065
1082WS_DLL_PUBLIC int64_t tvb_get_letohi40(tvbuff_t *tvb, const int offset);
1083
1100WS_DLL_PUBLIC uint64_t tvb_get_letoh48(tvbuff_t *tvb, const int offset);
1101
1118WS_DLL_PUBLIC int64_t tvb_get_letohi48(tvbuff_t *tvb, const int offset);
1119
1136WS_DLL_PUBLIC uint64_t tvb_get_letoh56(tvbuff_t *tvb, const int offset);
1137
1154WS_DLL_PUBLIC int64_t tvb_get_letohi56(tvbuff_t *tvb, const int offset);
1155
1172WS_DLL_PUBLIC uint64_t tvb_get_letoh64(tvbuff_t *tvb, const int offset);
1173
1190WS_DLL_PUBLIC int64_t tvb_get_letohi64(tvbuff_t *tvb, const int offset);
1191
1208WS_DLL_PUBLIC float tvb_get_letohieee_float(tvbuff_t *tvb, const int offset);
1209
1226WS_DLL_PUBLIC double tvb_get_letohieee_double(tvbuff_t *tvb,
1227 const int offset);
1228
1244WS_DLL_PUBLIC uint16_t tvb_get_uint16(tvbuff_t *tvb, const int offset, const unsigned encoding);
1245
1260WS_DEPRECATED_X("Use tvb_get_uint16 instead")
1261static inline uint16_t tvb_get_guint16(tvbuff_t *tvb, const int offset, const unsigned encoding) {
1262 return tvb_get_uint16(tvb, offset, encoding);
1263}
1264
1280WS_DLL_PUBLIC int16_t tvb_get_int16(tvbuff_t *tvb, const int offset, const unsigned encoding);
1281
1296WS_DEPRECATED_X("Use tvb_get_int16 instead")
1297static inline int16_t tvb_get_gint16(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int16(tvb, offset, encoding); }
1298
1314WS_DLL_PUBLIC uint32_t tvb_get_uint24(tvbuff_t *tvb, const int offset, const unsigned encoding);
1315
1330WS_DEPRECATED_X("Use tvb_get_uint24 instead")
1331static inline uint32_t tvb_get_guint24(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint24(tvb, offset, encoding); }
1332
1348WS_DLL_PUBLIC int32_t tvb_get_int24(tvbuff_t *tvb, const int offset, const unsigned encoding);
1349
1364WS_DEPRECATED_X("Use tvb_get_int24 instead")
1365static inline int32_t tvb_get_gint24(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int24(tvb, offset, encoding); }
1366
1382WS_DLL_PUBLIC uint32_t tvb_get_uint32(tvbuff_t *tvb, const int offset, const unsigned encoding);
1383
1398WS_DEPRECATED_X("Use tvb_get_uint32 instead")
1399static inline uint32_t tvb_get_guint32(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint32(tvb, offset, encoding); }
1400
1416WS_DLL_PUBLIC int32_t tvb_get_int32(tvbuff_t *tvb, const int offset, const unsigned encoding);
1417
1432WS_DEPRECATED_X("Use tvb_get_int32 instead")
1433static inline int32_t tvb_get_gint32(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int32(tvb, offset, encoding); }
1434
1450WS_DLL_PUBLIC uint64_t tvb_get_uint40(tvbuff_t *tvb, const int offset, const unsigned encoding);
1451
1466WS_DEPRECATED_X("Use tvb_get_uint40 instead")
1467static inline uint64_t tvb_get_guint40(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint40(tvb, offset, encoding); }
1468
1484WS_DLL_PUBLIC int64_t tvb_get_int40(tvbuff_t *tvb, const int offset, const unsigned encoding);
1485
1500WS_DEPRECATED_X("Use tvb_get_int40 instead")
1501static inline int64_t tvb_get_gint40(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int40(tvb, offset, encoding); }
1502
1518WS_DLL_PUBLIC uint64_t tvb_get_uint48(tvbuff_t *tvb, const int offset, const unsigned encoding);
1519
1534WS_DEPRECATED_X("Use tvb_get_uint48 instead")
1535static inline uint64_t tvb_get_guint48(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint48(tvb, offset, encoding); }
1536
1552WS_DLL_PUBLIC int64_t tvb_get_int48(tvbuff_t *tvb, const int offset, const unsigned encoding);
1553
1568WS_DEPRECATED_X("Use tvb_get_int48 instead")
1569static inline int64_t tvb_get_gint48(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int48(tvb, offset, encoding); }
1570
1586WS_DLL_PUBLIC uint64_t tvb_get_uint56(tvbuff_t *tvb, const int offset, const unsigned encoding);
1587
1602WS_DEPRECATED_X("Use tvb_get_uint56 instead")
1603static inline uint64_t tvb_get_guint56(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint56(tvb, offset, encoding); }
1604
1620WS_DLL_PUBLIC int64_t tvb_get_int56(tvbuff_t *tvb, const int offset, const unsigned encoding);
1621
1636WS_DEPRECATED_X("Use tvb_get_int56 instead")
1637static inline int64_t tvb_get_gint56(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int56(tvb, offset, encoding); }
1638
1656WS_DLL_PUBLIC uint64_t tvb_get_uint64(tvbuff_t *tvb, const int offset, const unsigned encoding);
1657
1676WS_DLL_PUBLIC uint64_t tvb_get_uint64_with_length(tvbuff_t *tvb, const int offset, unsigned length, const unsigned encoding);
1677
1692WS_DEPRECATED_X("Use tvb_get_uint64 instead")
1693static inline uint64_t tvb_get_guint64(tvbuff_t *tvb, const int offset, const unsigned encoding) {return tvb_get_uint64(tvb, offset, encoding); }
1694
1710WS_DLL_PUBLIC int64_t tvb_get_int64(tvbuff_t *tvb, const int offset, const unsigned encoding);
1711
1726WS_DEPRECATED_X("Use tvb_get_int64 instead")
1727static inline int64_t tvb_get_gint64(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int64(tvb, offset, encoding); }
1728
1746WS_DLL_PUBLIC float tvb_get_ieee_float(tvbuff_t *tvb, const int offset, const unsigned encoding);
1747
1765WS_DLL_PUBLIC double tvb_get_ieee_double(tvbuff_t *tvb, const int offset, const unsigned encoding);
1766
1784#if G_BYTE_ORDER == G_LITTLE_ENDIAN
1785#define tvb_get_h_uint16 tvb_get_letohs
1786#define tvb_get_h_uint32 tvb_get_letohl
1787#elif G_BYTE_ORDER == G_BIG_ENDIAN
1788#define tvb_get_h_uint16 tvb_get_ntohs
1789#define tvb_get_h_uint32 tvb_get_ntohl
1790#else
1791#error "Unsupported byte order"
1792#endif
1793
1822WS_DLL_PUBLIC
1823nstime_t* tvb_get_string_time(tvbuff_t *tvb, const int offset, const int length,
1824 const unsigned encoding, nstime_t* ns, int *endoff);
1825
1847WS_DLL_PUBLIC
1848GByteArray* tvb_get_string_bytes(tvbuff_t *tvb, const int offset, const int length,
1849 const unsigned encoding, GByteArray* bytes, int *endoff);
1850
1868WS_DLL_PUBLIC uint32_t tvb_get_ipv4(tvbuff_t *tvb, const int offset);
1869
1886WS_DLL_PUBLIC void tvb_get_ipv6(tvbuff_t *tvb, const int offset, ws_in6_addr *addr);
1887
1900WS_DLL_PUBLIC int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset,
1901 ws_in4_addr *addr, uint32_t prefix_len);
1902
1916WS_DLL_PUBLIC int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int offset,
1917 ws_in6_addr *addr, uint32_t prefix_len);
1918
1930WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const int offset, e_guid_t *guid);
1931
1943WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const int offset, e_guid_t *guid);
1944
1958WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const int offset, e_guid_t *guid, const unsigned encoding);
1959
1979WS_DLL_PUBLIC uint8_t* tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb,
1980 const int offset, size_t length, size_t *data_length, const unsigned encoding);
1981
2001WS_DLL_PUBLIC uint8_t tvb_get_bits8(tvbuff_t *tvb, unsigned bit_offset,
2002 const int no_of_bits);
2003
2025WS_DLL_PUBLIC uint16_t tvb_get_bits16(tvbuff_t *tvb, unsigned bit_offset,
2026 const int no_of_bits, const unsigned encoding);
2027
2049WS_DLL_PUBLIC uint32_t tvb_get_bits32(tvbuff_t *tvb, unsigned bit_offset,
2050 const int no_of_bits, const unsigned encoding);
2051
2073WS_DLL_PUBLIC uint64_t tvb_get_bits64(tvbuff_t *tvb, unsigned bit_offset,
2074 const int no_of_bits, const unsigned encoding);
2075
2093WS_DLL_PUBLIC
2094WS_DEPRECATED_X("Use tvb_get_bits32() instead")
2095uint32_t tvb_get_bits(tvbuff_t *tvb, const unsigned bit_offset,
2096 const int no_of_bits, const unsigned encoding);
2097
2117WS_DLL_PUBLIC void *tvb_memcpy(tvbuff_t *tvb, void *target, const unsigned offset,
2118 size_t length);
2119
2140WS_DLL_PUBLIC void *tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb,
2141 const unsigned offset, size_t length);
2142
2178WS_DLL_PUBLIC const uint8_t *tvb_get_ptr(tvbuff_t *tvb, const int offset,
2179 const int length);
2180
2199WS_DLL_PUBLIC int tvb_find_uint8(tvbuff_t *tvb, const unsigned offset,
2200 const int maxlength, const uint8_t needle);
2201
2223WS_DEPRECATED_X("Use tvb_find_uint8 instead")
2224static inline int tvb_find_guint8(tvbuff_t* tvb, const unsigned offset,
2225 const int maxlength, const uint8_t needle) { return tvb_find_uint8(tvb, offset, maxlength, needle); }
2226
2251WS_DLL_PUBLIC int tvb_find_uint16(tvbuff_t *tvb, const int offset,
2252 const int maxlength, const uint16_t needle);
2253
2275WS_DEPRECATED_X("Use tvb_find_uint16 instead")
2276static inline int tvb_find_guint16(tvbuff_t* tvb, const int offset,
2277 const int maxlength, const uint16_t needle) {
2278 return tvb_find_uint16(tvb, offset, maxlength, needle);
2279}
2280
2299WS_DLL_PUBLIC int tvb_ws_mempbrk_pattern_uint8(tvbuff_t *tvb, const unsigned offset,
2300 const int maxlength, const ws_mempbrk_pattern* pattern, unsigned char *found_needle);
2301
2327WS_DEPRECATED_X("Use tvb_ws_mempbrk_pattern_uint8 instead")
2328static inline int tvb_ws_mempbrk_pattern_guint8(tvbuff_t* tvb, const int offset,
2329 const int maxlength, const ws_mempbrk_pattern* pattern, unsigned char* found_needle) {
2330 return tvb_ws_mempbrk_pattern_uint8(tvb, offset, maxlength, pattern, found_needle);
2331}
2332
2349WS_DLL_PUBLIC unsigned tvb_strsize(tvbuff_t *tvb, const unsigned offset);
2350
2365WS_DLL_PUBLIC unsigned tvb_unicode_strsize(tvbuff_t *tvb, const unsigned offset);
2366
2384WS_DLL_PUBLIC int tvb_strnlen(tvbuff_t *tvb, const int offset,
2385 const unsigned maxlength);
2386
2403WS_DLL_PUBLIC char *tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset,
2404 const unsigned size);
2405
2423WS_DLL_PUBLIC char *tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const unsigned offset,
2424 const unsigned size);
2425
2443WS_DLL_PUBLIC char *tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const unsigned offset,
2444 const unsigned size);
2445
2464WS_DLL_PUBLIC char *tvb_format_stringzpad_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const unsigned offset,
2465 const unsigned size);
2466
2488WS_DLL_PUBLIC uint8_t *tvb_get_string_enc(wmem_allocator_t *scope,
2489 tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding);
2490
2515 tvbuff_t *tvb, const unsigned bit_offset, unsigned no_of_chars);
2516
2541 tvbuff_t *tvb, const unsigned offset, unsigned length);
2542
2567 tvbuff_t *tvb, const unsigned offset, unsigned length);
2568
2592WS_DLL_PUBLIC char *tvb_get_ascii_7bits_string(wmem_allocator_t *scope,
2593 tvbuff_t *tvb, const unsigned bit_offset, unsigned no_of_chars);
2594
2619WS_DLL_PUBLIC uint8_t *tvb_get_stringzpad(wmem_allocator_t *scope,
2620 tvbuff_t *tvb, const unsigned offset, const unsigned length, const unsigned encoding);
2621
2646WS_DLL_PUBLIC uint8_t *tvb_get_stringz_enc(wmem_allocator_t *scope,
2647 tvbuff_t *tvb, const unsigned offset, unsigned *lengthp, const unsigned encoding);
2648
2679WS_DLL_PUBLIC
2680WS_DEPRECATED_X("Use APIs that return a valid UTF-8 string instead")
2681const uint8_t *tvb_get_const_stringz(tvbuff_t *tvb,
2682 const unsigned offset, unsigned *lengthp);
2683
2703WS_DLL_PUBLIC int tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const int offset,
2704 const unsigned bufsize, uint8_t *buffer);
2705
2721WS_DLL_PUBLIC unsigned tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const unsigned offset, char *buffer, size_t bufsize);
2722
2736WS_DLL_PUBLIC bool tvb_ascii_isprint(tvbuff_t *tvb, const int offset,
2737 const int length);
2738
2757WS_DLL_PUBLIC bool tvb_utf_8_isprint(tvbuff_t *tvb, const int offset,
2758 const int length);
2759
2773WS_DLL_PUBLIC bool tvb_ascii_isdigit(tvbuff_t *tvb, const int offset,
2774 const int length);
2775
2800WS_DLL_PUBLIC int tvb_find_line_end(tvbuff_t *tvb, const unsigned offset, int len,
2801 int *next_offset, const bool desegment);
2802
2824WS_DLL_PUBLIC int tvb_find_line_end_unquoted(tvbuff_t *tvb, const unsigned offset,
2825 int len, int *next_offset);
2826
2844WS_DLL_PUBLIC int tvb_skip_wsp(tvbuff_t *tvb, const int offset,
2845 const int maxlength);
2846
2861WS_DLL_PUBLIC int tvb_skip_wsp_return(tvbuff_t *tvb, const int offset);
2862
2880WS_DLL_PUBLIC int tvb_skip_uint8(tvbuff_t *tvb, int offset, const int maxlength, const uint8_t ch);
2881
2903WS_DEPRECATED_X("Use tvb_skip_uint8 instead")
2904static inline int tvb_skip_guint8(tvbuff_t *tvb, int offset, const int maxlength, const uint8_t ch) {
2905 return tvb_skip_uint8(tvb, offset, maxlength, ch);
2906}
2907
2932WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const unsigned offset, int len, int *next_offset, const bool desegment);
2933
2950WS_DLL_PUBLIC int tvb_strneql(tvbuff_t *tvb, const unsigned offset,
2951 const char *str, const size_t size);
2952
2973WS_DLL_PUBLIC int tvb_strncaseeql(tvbuff_t *tvb, const unsigned offset,
2974 const char *str, const size_t size);
2975
2993WS_DLL_PUBLIC int tvb_memeql(tvbuff_t *tvb, const unsigned offset,
2994 const uint8_t *str, size_t size);
2995
3015WS_DLL_PUBLIC char *tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset,
3016 const int len, const char punct);
3017
3038WS_DLL_PUBLIC char *tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb,
3039 const int offset, const int len);
3040
3055typedef struct dgt_set_t
3056{
3057 const unsigned char out[16];
3058}
3060
3085WS_DLL_PUBLIC const char *tvb_bcd_dig_to_str(wmem_allocator_t *scope,
3086 tvbuff_t *tvb, const int offset, const int len, const dgt_set_t *dgt,
3087 bool skip_first);
3088
3115WS_DLL_PUBLIC const char *tvb_bcd_dig_to_str_be(wmem_allocator_t *scope,
3116 tvbuff_t *tvb, const int offset, const int len, const dgt_set_t *dgt,
3117 bool skip_first);
3118
3150WS_DLL_PUBLIC char *tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb,
3151 const int offset, int len, const dgt_set_t *dgt,
3152 bool skip_first, bool odd, bool bigendian);
3153
3169WS_DLL_PUBLIC int tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
3170 const int haystack_offset);
3171
3172/* From tvbuff_zlib.c */
3192WS_DEPRECATED_X("Use tvb_uncompress_zlib instead")
3193WS_DLL_PUBLIC tvbuff_t *tvb_uncompress(tvbuff_t *tvb, const int offset,
3194 int comprlen);
3195
3217WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zlib(tvbuff_t *tvb, const int offset,
3218 int comprlen);
3219
3241WS_DEPRECATED_X("Use tvb_child_uncompress_zlib instead")
3242WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb,
3243 const int offset, int comprlen);
3244
3261WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zlib(tvbuff_t *parent, tvbuff_t *tvb,
3262 const int offset, int comprlen);
3263
3264/* From tvbuff_brotli.c */
3265
3287WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_brotli(tvbuff_t *tvb, const int offset,
3288 int comprlen);
3289
3308WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb,
3309 const int offset, int comprlen);
3310
3311/* From tvbuff_snappy.c */
3312
3330WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_snappy(tvbuff_t *tvb, const int offset,
3331 int comprlen);
3332
3351WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb,
3352 const int offset, int comprlen);
3353
3354/* From tvbuff_lz77.c */
3355
3377WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77(tvbuff_t *tvb,
3378 const int offset, int comprlen);
3379
3399WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77(tvbuff_t *parent,
3400 tvbuff_t *tvb, const int offset, int comprlen);
3401
3402/* From tvbuff_lz77huff.c */
3403
3425WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77huff(tvbuff_t *tvb,
3426 const int offset, int comprlen);
3427
3447WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77huff(tvbuff_t *parent,
3448 tvbuff_t *tvb, const int offset, int comprlen);
3449
3450/* From tvbuff_lznt1.c */
3451
3473WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lznt1(tvbuff_t *tvb,
3474 const int offset, int comprlen);
3475
3495WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lznt1(tvbuff_t *parent,
3496 tvbuff_t *tvb, const int offset, int comprlen);
3497
3519WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zstd(tvbuff_t *tvb,
3520 const int offset, int comprlen);
3521
3541WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zstd(tvbuff_t *parent,
3542 tvbuff_t *tvb, const int offset, int comprlen);
3543
3544/* From tvbuff_base64.c */
3545
3560WS_DLL_PUBLIC tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
3561
3580WS_DLL_PUBLIC tvbuff_t* base64_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
3581
3601WS_DLL_PUBLIC tvbuff_t* base64uri_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
3602
3603/* From tvbuff_hpackhuff.c */
3604
3622 tvbuff_t *tvb, const int offset, const int len);
3623
3643 int offset, int length);
3644
3667WS_DLL_PUBLIC unsigned tvb_get_varint(tvbuff_t *tvb, unsigned offset, unsigned maxlen, uint64_t *value, const unsigned encoding);
3668
3669/************** END OF ACCESSORS ****************/
3670
3671#ifdef __cplusplus
3672}
3673#endif /* __cplusplus */
3674
3675#endif /* __TVBUFF_H__ */
3676
3677/*
3678 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3679 *
3680 * Local variables:
3681 * c-basic-offset: 4
3682 * tab-width: 8
3683 * indent-tabs-mode: nil
3684 * End:
3685 *
3686 * vi: set shiftwidth=4 tabstop=8 expandtab:
3687 * :indentSize=4:tabSize=8:noTabs=true:
3688 */
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:835
WS_DLL_PUBLIC bool tvb_ascii_isprint(tvbuff_t *tvb, const int offset, const int length)
Check whether all bytes in a tvbuff range are ASCII printable characters.
Definition tvbuff.c:4212
WS_DLL_PUBLIC bool tvb_ascii_isdigit(tvbuff_t *tvb, const int offset, const int length)
Check if all bytes in a tvbuff range are ASCII digits.
Definition tvbuff.c:4243
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:2612
WS_DLL_PUBLIC uint64_t tvb_get_uint56(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 56-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1368
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:4826
WS_DLL_PUBLIC int32_t tvb_get_letohi24(tvbuff_t *tvb, const int offset)
Retrieve a 24-bit signed value in little-endian byte order.
Definition tvbuff.c:1710
WS_DLL_PUBLIC int tvb_strnlen(tvbuff_t *tvb, const int offset, const unsigned maxlength)
Find the length of a NUL-terminated string in a tvbuff, up to a maximum limit.
Definition tvbuff.c:2790
WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb)
Repair a tvbuff when captured length exceeds reported length.
Definition tvbuff.c:876
WS_DLL_PUBLIC uint16_t tvb_get_uint16(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 16-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1278
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:799
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Brotli-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_brotli.c:173
WS_DLL_PUBLIC int32_t tvb_get_int32(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 32-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1323
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:3212
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:4620
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:4185
WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb)
Set the "this is a fragment" flag on a tvbuff.
Definition tvbuff.c:4864
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:2926
WS_DLL_PUBLIC uint64_t tvb_get_uint64_with_length(tvbuff_t *tvb, const int 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:1395
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:3663
WS_DLL_PUBLIC uint64_t tvb_get_letoh56(tvbuff_t *tvb, const int offset)
Retrieve a 56-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1776
const unsigned char out[16]
Definition tvbuff.h:3057
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:2736
WS_DLL_PUBLIC uint32_t tvb_get_uint24(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 24-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1296
WS_DLL_PUBLIC uint32_t tvb_get_uint32(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 32-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1314
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 uint32_t tvb_get_ntohl(tvbuff_t *tvb, const int offset)
Retrieve a 32-bit unsigned value in network byte order.
Definition tvbuff.c:1185
WS_DLL_PUBLIC int64_t tvb_get_letohi64(tvbuff_t *tvb, const int offset)
Retrieve a 64-bit signed value in little-endian byte order.
Definition tvbuff.c:1804
WS_DLL_PUBLIC uint64_t tvb_get_ntoh48(tvbuff_t *tvb, const int offset)
Retrieve a 48-bit unsigned value in network byte order.
Definition tvbuff.c:1222
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:2693
WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const int offset, e_guid_t *guid)
Retrieve a GUID from a tvbuff in network byte order.
Definition tvbuff.c:2287
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:3402
WS_DLL_PUBLIC uint8_t tvb_get_uint8(tvbuff_t *tvb, const int offset)
Retrieve an 8-bit unsigned value from a tvbuff at the specified offset.
Definition tvbuff.c:1130
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lz77huff(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Microsoft LZ77+Huffman-compressed data from a tvbuff.
Definition tvbuff_lz77huff.c:360
WS_DLL_PUBLIC int64_t tvb_get_ntohi48(tvbuff_t *tvb, const int offset)
Retrieve a 48-bit signed value in network byte order.
Definition tvbuff.c:1231
WS_DLL_PUBLIC int tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const int 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:4161
WS_DLL_PUBLIC uint64_t tvb_get_uint48(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 48-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1350
WS_DLL_PUBLIC unsigned tvb_reported_length(const tvbuff_t *tvb)
Get reported length of buffer.
Definition tvbuff.c:810
WS_DLL_PUBLIC char * tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, int 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:4713
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lznt1(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Microsoft LZNT1-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_lznt1.c:148
WS_DLL_PUBLIC uint64_t tvb_get_uint40(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 40-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1332
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:182
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:4280
WS_DLL_PUBLIC int64_t tvb_get_int40(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 40-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1341
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 tvbuff_t * tvb_clone(tvbuff_t *tvb)
Creates a full clone of the given tvbuff.
Definition tvbuff.c:621
WS_DLL_PUBLIC wmem_strbuf_t * tvb_get_hpack_huffman_strbuf(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int len)
Decode HPACK Huffman-encoded data from a tvbuff into a string buffer.
Definition tvbuff_hpackhuff.c:51
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:897
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:1036
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 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:4403
WS_DLL_PUBLIC double tvb_get_letohieee_double(tvbuff_t *tvb, const int offset)
Retrieve a 64-bit IEEE double in little-endian byte order.
Definition tvbuff.c:1841
WS_DLL_PUBLIC char * tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int len, const char punct)
Format a sequence of bytes from a tvbuff as a string with a custom separator.
Definition tvbuff.c:4691
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_zstd(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int 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 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:2765
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_hpack_huff(tvbuff_t *parent, int offset, int 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 * base64_tvb_to_new_tvb(tvbuff_t *parent, int offset, int 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 uint16_t tvb_get_bits16(tvbuff_t *tvb, unsigned bit_offset, const int no_of_bits, const unsigned encoding)
Retrieve 1–16 bits from a tvbuff and return them as a uint16_t.
Definition tvbuff.c:2361
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:2820
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:733
WS_DLL_PUBLIC float tvb_get_ieee_float(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 32-bit IEEE float from a tvbuff using the specified encoding.
Definition tvbuff.c:1462
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:96
void(* tvbuff_free_cb_t)(void *)
Definition tvbuff.h:104
WS_DLL_PUBLIC uint8_t * tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb, const int 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:2338
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 int64_t tvb_get_ntohi40(tvbuff_t *tvb, const int offset)
Retrieve a 40-bit signed value in network byte order.
Definition tvbuff.c:1212
WS_DLL_PUBLIC uint32_t tvb_get_bits32(tvbuff_t *tvb, unsigned bit_offset, const int no_of_bits, const unsigned encoding)
Retrieve 1–32 bits from a tvbuff and return them as a uint32_t.
Definition tvbuff.c:2369
WS_DLL_PUBLIC int tvb_raw_offset(tvbuff_t *tvb)
Returns the offset from the first byte of real data.
Definition tvbuff.c:4858
WS_DLL_PUBLIC unsigned tvb_captured_length(const tvbuff_t *tvb)
Get the amount of captured data in the buffer.
Definition tvbuff.c:627
WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const int offset, e_guid_t *guid, const unsigned encoding)
Retrieve a GUID from a tvbuff using the specified encoding.
Definition tvbuff.c:2309
WS_DLL_PUBLIC tvbuff_t * base64uri_tvb_to_new_tvb(tvbuff_t *parent, int offset, int length)
Decode a base64url-encoded string from a tvbuff region and attach the result to a parent tvbuff.
Definition tvbuff_base64.c:202
WS_DLL_PUBLIC int64_t tvb_get_letohi56(tvbuff_t *tvb, const int offset)
Retrieve a 56-bit signed value in little-endian byte order.
Definition tvbuff.c:1785
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:245
WS_DLL_PUBLIC int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int 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:2245
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:2913
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Deprecated interface for uncompressing data and chaining the result to a parent tvbuff.
Definition tvbuff_zlib.c:330
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:2847
WS_DLL_PUBLIC uint32_t tvb_get_ntoh24(tvbuff_t *tvb, const int offset)
Retrieve a 24-bit unsigned value in network byte order.
Definition tvbuff.c:1166
WS_DLL_PUBLIC tvbuff_t * tvb_new_composite(void)
Create an empty composite tvbuff.
Definition tvbuff_composite.c:233
WS_DLL_PUBLIC int8_t tvb_get_int8(tvbuff_t *tvb, const int offset)
Retrieve an 8-bit signed value from a tvbuff at the specified offset.
Definition tvbuff.c:1139
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
Deprecated interface for uncompressing data from a tvbuff using zlib.
Definition tvbuff_zlib.c:324
WS_DLL_PUBLIC const char * tvb_bcd_dig_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int len, const dgt_set_t *dgt, bool skip_first)
Convert BCD-encoded digits from a tvbuff into a formatted string.
Definition tvbuff.c:4796
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:3887
WS_DLL_PUBLIC uint64_t tvb_get_ntoh56(tvbuff_t *tvb, const int offset)
Retrieve a 56-bit unsigned value in network byte order.
Definition tvbuff.c:1241
WS_DLL_PUBLIC uint64_t tvb_get_letoh40(tvbuff_t *tvb, const int offset)
Retrieve a 40-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1738
WS_DLL_PUBLIC int64_t tvb_get_int48(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 48-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1359
WS_DLL_PUBLIC float tvb_get_letohieee_float(tvbuff_t *tvb, const int offset)
Retrieve a 32-bit IEEE float in little-endian byte order.
Definition tvbuff.c:1821
WS_DLL_PUBLIC struct tvbuff * tvb_get_ds_tvb(tvbuff_t *tvb)
Retrieve the data source tvbuff from a given tvbuff.
Definition tvbuff.c:4870
WS_DLL_PUBLIC uint8_t tvb_get_bits8(tvbuff_t *tvb, unsigned bit_offset, const int no_of_bits)
Retrieve 1–8 bits from a tvbuff and return them as a uint8_t.
Definition tvbuff.c:2353
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:271
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:530
WS_DLL_PUBLIC uint32_t tvb_get_letohl(tvbuff_t *tvb, const int offset)
Retrieve a 32-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1720
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Snappy-compressed data from a tvbuff and attach the result to a parent tvbuff.
Definition tvbuff_snappy.c:66
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:2942
WS_DLL_PUBLIC int64_t tvb_get_int64(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 64-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1453
WS_DLL_PUBLIC int64_t tvb_get_letohi40(tvbuff_t *tvb, const int offset)
Retrieve a 40-bit signed value in little-endian byte order.
Definition tvbuff.c:1747
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:3200
WS_DLL_PUBLIC const uint8_t * tvb_get_ptr(tvbuff_t *tvb, const int offset, const int length)
Returns a raw pointer to tvbuff data. Use with extreme caution.
Definition tvbuff.c:1123
WS_DLL_PUBLIC const char * tvb_bcd_dig_to_str_be(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int 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:4805
WS_DLL_PUBLIC int32_t tvb_get_ntohi24(tvbuff_t *tvb, const int offset)
Retrieve a 24-bit signed value in network byte order.
Definition tvbuff.c:1175
WS_DLL_PUBLIC uint64_t tvb_get_uint64(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 64-bit unsigned value from a tvbuff using the specified encoding.
Definition tvbuff.c:1386
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_zlib(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int 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 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:664
WS_DLL_PUBLIC uint32_t tvb_get_ipv4(tvbuff_t *tvb, const int offset)
Retrieve an IPv4 address from a tvbuff in network byte order.
Definition tvbuff.c:2220
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lznt1(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Microsoft LZNT1-compressed data from a tvbuff.
Definition tvbuff_lznt1.c:109
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:471
WS_DLL_PUBLIC int32_t tvb_get_int24(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 24-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1305
WS_DLL_PUBLIC uint64_t tvb_get_letoh64(tvbuff_t *tvb, const int offset)
Retrieve a 64-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1795
WS_DLL_PUBLIC int tvb_skip_uint8(tvbuff_t *tvb, int offset, const int maxlength, const uint8_t ch)
Skip consecutive occurrences of a specific byte value in a tvbuff.
Definition tvbuff.c:4593
WS_DLL_PUBLIC int16_t tvb_get_ntohis(tvbuff_t *tvb, const int offset)
Retrieve a 16-bit signed value in network byte order.
Definition tvbuff.c:1157
WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb)
Mark a composite tvbuff as finalized.
Definition tvbuff_composite.c:297
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:750
WS_DLL_PUBLIC int tvb_skip_wsp_return(tvbuff_t *tvb, const int offset)
Skip ASCII whitespace in a tvbuff and return the next non-whitespace offset.
Definition tvbuff.c:4577
WS_DLL_PUBLIC int64_t tvb_get_ntohi56(tvbuff_t *tvb, const int offset)
Retrieve a 56-bit signed value in network byte order.
Definition tvbuff.c:1250
WS_DLL_PUBLIC double tvb_get_ntohieee_double(tvbuff_t *tvb, const int offset)
Retrieve a 64-bit IEEE double in network byte order.
Definition tvbuff.c:1654
WS_DLL_PUBLIC uint16_t tvb_get_ntohs(tvbuff_t *tvb, const int offset)
Retrieve a 16-bit unsigned value in network byte order.
Definition tvbuff.c:1148
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:699
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:3759
WS_DLL_PUBLIC GByteArray * tvb_get_string_bytes(tvbuff_t *tvb, const int offset, const int length, const unsigned encoding, GByteArray *bytes, int *endoff)
Parse a case-insensitive hex string with optional separators into a byte array.
Definition tvbuff.c:1916
WS_DLL_PUBLIC int 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:818
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:155
WS_DLL_PUBLIC int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int 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:2266
WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const int offset, e_guid_t *guid)
Retrieve a GUID from a tvbuff in little-endian byte order.
Definition tvbuff.c:2298
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:607
WS_DLL_PUBLIC uint64_t tvb_get_ntoh40(tvbuff_t *tvb, const int offset)
Retrieve a 40-bit unsigned value in network byte order.
Definition tvbuff.c:1203
WS_DLL_PUBLIC int64_t tvb_get_ntohi64(tvbuff_t *tvb, const int offset)
Retrieve a 64-bit signed value in network byte order.
Definition tvbuff.c:1269
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lz77(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int 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 bool tvb_utf_8_isprint(tvbuff_t *tvb, const int offset, const int length)
Check if a portion of a tvbuff contains only valid, printable UTF-8 characters.
Definition tvbuff.c:4229
WS_DLL_PUBLIC int32_t tvb_get_letohil(tvbuff_t *tvb, const int offset)
Retrieve a 32-bit signed value in little-endian byte order.
Definition tvbuff.c:1729
WS_DLL_PUBLIC int64_t tvb_get_letohi48(tvbuff_t *tvb, const int offset)
Retrieve a 48-bit signed value in little-endian byte order.
Definition tvbuff.c:1766
WS_DLL_PUBLIC char * tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb, const int offset, const int len)
Format a sequence of bytes from a tvbuff as a hexadecimal string.
Definition tvbuff.c:4817
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:1079
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:86
WS_DLL_PUBLIC int tvb_captured_length_remaining(const tvbuff_t *tvb, const unsigned offset)
Computes bytes to end of buffer from the given offset.
Definition tvbuff.c:649
WS_DLL_PUBLIC uint64_t tvb_get_ntoh64(tvbuff_t *tvb, const int offset)
Retrieve a 64-bit unsigned value in network byte order.
Definition tvbuff.c:1260
WS_DLL_PUBLIC int16_t tvb_get_letohis(tvbuff_t *tvb, const int offset)
Retrieve a 16-bit signed value in little-endian byte order.
Definition tvbuff.c:1692
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:3188
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:206
WS_DLL_PUBLIC nstime_t * tvb_get_string_time(tvbuff_t *tvb, const int offset, const int length, const unsigned encoding, nstime_t *ns, int *endoff)
Fetch a time value from an ASCII-style string in the tvbuff.
Definition tvbuff.c:1968
WS_DLL_PUBLIC uint64_t tvb_get_bits64(tvbuff_t *tvb, unsigned bit_offset, const int no_of_bits, const unsigned encoding)
Retrieve 1–64 bits from a tvbuff and return them as a uint64_t.
Definition tvbuff.c:2377
WS_DLL_PUBLIC uint16_t tvb_get_letohs(tvbuff_t *tvb, const int offset)
Retrieve a 16-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1683
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:857
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_brotli(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Brotli-compressed data from a tvbuff.
WS_DLL_PUBLIC int16_t tvb_get_int16(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 16-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1287
WS_DLL_PUBLIC int32_t tvb_get_ntohil(tvbuff_t *tvb, const int offset)
Retrieve a 32-bit signed value in network byte order.
Definition tvbuff.c:1194
WS_DLL_PUBLIC float tvb_get_ntohieee_float(tvbuff_t *tvb, const int offset)
Retrieve a 32-bit IEEE float in network byte order.
Definition tvbuff.c:1634
WS_DLL_PUBLIC uint32_t tvb_get_letoh24(tvbuff_t *tvb, const int offset)
Retrieve a 24-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1701
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lz77huff(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int 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 int64_t tvb_get_int56(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 56-bit signed value from a tvbuff using the specified encoding.
Definition tvbuff.c:1377
WS_DLL_PUBLIC double tvb_get_ieee_double(tvbuff_t *tvb, const int offset, const unsigned encoding)
Retrieve a 64-bit IEEE double from a tvbuff using the specified encoding.
Definition tvbuff.c:1471
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:2574
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:3174
WS_DLL_PUBLIC int tvb_skip_wsp(tvbuff_t *tvb, const int offset, const int maxlength)
Skip ASCII whitespace in a tvbuff and return the offset of the first non-whitespace byte.
Definition tvbuff.c:4548
WS_DLL_PUBLIC tvbuff_t * tvb_new_real_data(const uint8_t *data, const unsigned length, const int reported_length)
Create a tvbuff backed by existing data.
Definition tvbuff_real.c:58
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:2875
WS_DLL_PUBLIC uint64_t tvb_get_letoh48(tvbuff_t *tvb, const int offset)
Retrieve a 48-bit unsigned value in little-endian byte order.
Definition tvbuff.c:1757
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:2901
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:4876
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_snappy(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Snappy-compressed data from a tvbuff.
WS_DLL_PUBLIC uint32_t tvb_get_bits(tvbuff_t *tvb, const unsigned bit_offset, const int no_of_bits, const unsigned encoding)
Deprecated accessor for extracting bits from a tvbuff.
Definition tvbuff.c:2544
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_zstd(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Zstandard (ZSTD)-compressed data from a tvbuff.
Definition tvbuff_zstd.c:28
WS_DLL_PUBLIC void tvb_get_ipv6(tvbuff_t *tvb, const int offset, ws_in6_addr *addr)
Retrieve an IPv6 address from a tvbuff.
Definition tvbuff.c:2232
WS_DLL_PUBLIC tvbuff_t * tvb_new_child_real_data(tvbuff_t *parent, const uint8_t *data, const unsigned length, const int reported_length)
Create a new child tvbuff with real data.
Definition tvbuff_real.c:106
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lz77(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Microsoft Plain LZ77-compressed data from a tvbuff.
Definition tvbuff_lz77.c:97
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_zlib(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress zlib-compressed data from a tvbuff.
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:3056
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
Definition nstime.h:26
Definition tvbuff-int.h:35
unsigned length
Definition tvbuff-int.h:61
unsigned reported_length
Definition tvbuff-int.h:67
Definition ws_mempbrk.h:21