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, int32_t no_of_bits);
122
135 uint32_t bit_offset, int32_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
296WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length_caplen(tvbuff_t *backing,
297 const int backing_offset, const int backing_length,
298 const int reported_length);
299
314WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length(tvbuff_t *backing,
315 const int backing_offset, const int reported_length);
316
327WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_remaining(tvbuff_t *backing,
328 const int backing_offset);
329
339WS_DLL_PUBLIC void tvb_composite_append(tvbuff_t *tvb, tvbuff_t *member);
340
350extern void tvb_composite_prepend(tvbuff_t *tvb, tvbuff_t *member);
351
357WS_DLL_PUBLIC tvbuff_t *tvb_new_composite(void);
358
359
368WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb);
369
370
381WS_DLL_PUBLIC unsigned tvb_captured_length(const tvbuff_t *tvb);
382
396WS_DLL_PUBLIC int tvb_captured_length_remaining(const tvbuff_t *tvb, const int offset);
397
411WS_DLL_PUBLIC unsigned tvb_ensure_captured_length_remaining(const tvbuff_t *tvb,
412 const int offset);
413
428WS_DLL_PUBLIC bool tvb_bytes_exist(const tvbuff_t *tvb, const int offset,
429 const int length);
430
443WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb,
444 const int offset, const uint64_t length);
445
457WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb,
458 const int offset, const int length);
459
468WS_DLL_PUBLIC bool tvb_offset_exists(const tvbuff_t *tvb,
469 const int offset);
470
478WS_DLL_PUBLIC unsigned tvb_reported_length(const tvbuff_t *tvb);
479
492WS_DLL_PUBLIC int tvb_reported_length_remaining(const tvbuff_t *tvb,
493 const int offset);
494
505WS_DLL_PUBLIC unsigned tvb_ensure_reported_length_remaining(const tvbuff_t *tvb,
506 const int offset);
507
520WS_DLL_PUBLIC void tvb_set_reported_length(tvbuff_t *tvb, const unsigned reported_length);
521
522
532WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb);
533
545WS_DLL_PUBLIC unsigned tvb_offset_from_real_beginning(const tvbuff_t *tvb);
546
558WS_DLL_PUBLIC int tvb_raw_offset(tvbuff_t *tvb);
559
569WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb);
570
582WS_DLL_PUBLIC struct tvbuff *tvb_get_ds_tvb(tvbuff_t *tvb);
583
584
585/************** START OF ACCESSORS ****************/
586/* All accessors will throw an exception if appropriate */
587
599WS_DLL_PUBLIC uint8_t tvb_get_uint8(tvbuff_t *tvb, const int offset);
600
614WS_DEPRECATED_X("Use tvb_get_uint8 instead")
615static inline uint8_t tvb_get_guint8(tvbuff_t *tvb, const int offset) {
616 return tvb_get_uint8(tvb, offset);
617}
618
630WS_DLL_PUBLIC int8_t tvb_get_int8(tvbuff_t *tvb, const int offset);
631
645WS_DEPRECATED_X("Use tvb_get_int8 instead")
646static inline int8_t tvb_get_gint8(tvbuff_t *tvb, const int offset) { return tvb_get_int8(tvb, offset); }
647
664WS_DLL_PUBLIC uint16_t tvb_get_ntohs(tvbuff_t *tvb, const int offset);
665
682WS_DLL_PUBLIC int16_t tvb_get_ntohis(tvbuff_t *tvb, const int offset);
683
700WS_DLL_PUBLIC uint32_t tvb_get_ntoh24(tvbuff_t *tvb, const int offset);
701
718WS_DLL_PUBLIC int32_t tvb_get_ntohi24(tvbuff_t *tvb, const int offset);
719
736WS_DLL_PUBLIC uint32_t tvb_get_ntohl(tvbuff_t *tvb, const int offset);
737
754WS_DLL_PUBLIC int32_t tvb_get_ntohil(tvbuff_t *tvb, const int offset);
755
772WS_DLL_PUBLIC uint64_t tvb_get_ntoh40(tvbuff_t *tvb, const int offset);
773
790WS_DLL_PUBLIC int64_t tvb_get_ntohi40(tvbuff_t *tvb, const int offset);
791
808WS_DLL_PUBLIC uint64_t tvb_get_ntoh48(tvbuff_t *tvb, const int offset);
809
826WS_DLL_PUBLIC int64_t tvb_get_ntohi48(tvbuff_t *tvb, const int offset);
827
844WS_DLL_PUBLIC uint64_t tvb_get_ntoh56(tvbuff_t *tvb, const int offset);
845
862WS_DLL_PUBLIC int64_t tvb_get_ntohi56(tvbuff_t *tvb, const int offset);
863
880WS_DLL_PUBLIC uint64_t tvb_get_ntoh64(tvbuff_t *tvb, const int offset);
881
898WS_DLL_PUBLIC int64_t tvb_get_ntohi64(tvbuff_t *tvb, const int offset);
899
916WS_DLL_PUBLIC float tvb_get_ntohieee_float(tvbuff_t *tvb, const int offset);
917
934WS_DLL_PUBLIC double tvb_get_ntohieee_double(tvbuff_t *tvb,
935 const int offset);
936
953WS_DLL_PUBLIC uint16_t tvb_get_letohs(tvbuff_t *tvb, const int offset);
954
971WS_DLL_PUBLIC int16_t tvb_get_letohis(tvbuff_t *tvb, const int offset);
972
989WS_DLL_PUBLIC uint32_t tvb_get_letoh24(tvbuff_t *tvb, const int offset);
990
1007WS_DLL_PUBLIC int32_t tvb_get_letohi24(tvbuff_t *tvb, const int offset);
1008
1025WS_DLL_PUBLIC uint32_t tvb_get_letohl(tvbuff_t *tvb, const int offset);
1026
1043WS_DLL_PUBLIC int32_t tvb_get_letohil(tvbuff_t *tvb, const int offset);
1044
1061WS_DLL_PUBLIC uint64_t tvb_get_letoh40(tvbuff_t *tvb, const int offset);
1062
1079WS_DLL_PUBLIC int64_t tvb_get_letohi40(tvbuff_t *tvb, const int offset);
1080
1097WS_DLL_PUBLIC uint64_t tvb_get_letoh48(tvbuff_t *tvb, const int offset);
1098
1115WS_DLL_PUBLIC int64_t tvb_get_letohi48(tvbuff_t *tvb, const int offset);
1116
1133WS_DLL_PUBLIC uint64_t tvb_get_letoh56(tvbuff_t *tvb, const int offset);
1134
1151WS_DLL_PUBLIC int64_t tvb_get_letohi56(tvbuff_t *tvb, const int offset);
1152
1169WS_DLL_PUBLIC uint64_t tvb_get_letoh64(tvbuff_t *tvb, const int offset);
1170
1187WS_DLL_PUBLIC int64_t tvb_get_letohi64(tvbuff_t *tvb, const int offset);
1188
1205WS_DLL_PUBLIC float tvb_get_letohieee_float(tvbuff_t *tvb, const int offset);
1206
1223WS_DLL_PUBLIC double tvb_get_letohieee_double(tvbuff_t *tvb,
1224 const int offset);
1225
1241WS_DLL_PUBLIC uint16_t tvb_get_uint16(tvbuff_t *tvb, const int offset, const unsigned encoding);
1242
1257WS_DEPRECATED_X("Use tvb_get_uint16 instead")
1258static inline uint16_t tvb_get_guint16(tvbuff_t *tvb, const int offset, const unsigned encoding) {
1259 return tvb_get_uint16(tvb, offset, encoding);
1260}
1261
1277WS_DLL_PUBLIC int16_t tvb_get_int16(tvbuff_t *tvb, const int offset, const unsigned encoding);
1278
1293WS_DEPRECATED_X("Use tvb_get_int16 instead")
1294static inline int16_t tvb_get_gint16(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int16(tvb, offset, encoding); }
1295
1311WS_DLL_PUBLIC uint32_t tvb_get_uint24(tvbuff_t *tvb, const int offset, const unsigned encoding);
1312
1327WS_DEPRECATED_X("Use tvb_get_uint24 instead")
1328static inline uint32_t tvb_get_guint24(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint24(tvb, offset, encoding); }
1329
1345WS_DLL_PUBLIC int32_t tvb_get_int24(tvbuff_t *tvb, const int offset, const unsigned encoding);
1346
1361WS_DEPRECATED_X("Use tvb_get_int24 instead")
1362static inline int32_t tvb_get_gint24(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int24(tvb, offset, encoding); }
1363
1379WS_DLL_PUBLIC uint32_t tvb_get_uint32(tvbuff_t *tvb, const int offset, const unsigned encoding);
1380
1395WS_DEPRECATED_X("Use tvb_get_uint32 instead")
1396static inline uint32_t tvb_get_guint32(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint32(tvb, offset, encoding); }
1397
1413WS_DLL_PUBLIC int32_t tvb_get_int32(tvbuff_t *tvb, const int offset, const unsigned encoding);
1414
1429WS_DEPRECATED_X("Use tvb_get_int32 instead")
1430static inline int32_t tvb_get_gint32(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int32(tvb, offset, encoding); }
1431
1447WS_DLL_PUBLIC uint64_t tvb_get_uint40(tvbuff_t *tvb, const int offset, const unsigned encoding);
1448
1463WS_DEPRECATED_X("Use tvb_get_uint40 instead")
1464static inline uint64_t tvb_get_guint40(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint40(tvb, offset, encoding); }
1465
1481WS_DLL_PUBLIC int64_t tvb_get_int40(tvbuff_t *tvb, const int offset, const unsigned encoding);
1482
1497WS_DEPRECATED_X("Use tvb_get_int40 instead")
1498static inline int64_t tvb_get_gint40(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int40(tvb, offset, encoding); }
1499
1515WS_DLL_PUBLIC uint64_t tvb_get_uint48(tvbuff_t *tvb, const int offset, const unsigned encoding);
1516
1531WS_DEPRECATED_X("Use tvb_get_uint48 instead")
1532static inline uint64_t tvb_get_guint48(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint48(tvb, offset, encoding); }
1533
1549WS_DLL_PUBLIC int64_t tvb_get_int48(tvbuff_t *tvb, const int offset, const unsigned encoding);
1550
1565WS_DEPRECATED_X("Use tvb_get_int48 instead")
1566static inline int64_t tvb_get_gint48(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int48(tvb, offset, encoding); }
1567
1583WS_DLL_PUBLIC uint64_t tvb_get_uint56(tvbuff_t *tvb, const int offset, const unsigned encoding);
1584
1599WS_DEPRECATED_X("Use tvb_get_uint56 instead")
1600static inline uint64_t tvb_get_guint56(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_uint56(tvb, offset, encoding); }
1601
1617WS_DLL_PUBLIC int64_t tvb_get_int56(tvbuff_t *tvb, const int offset, const unsigned encoding);
1618
1633WS_DEPRECATED_X("Use tvb_get_int56 instead")
1634static inline int64_t tvb_get_gint56(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int56(tvb, offset, encoding); }
1635
1653WS_DLL_PUBLIC uint64_t tvb_get_uint64(tvbuff_t *tvb, const int offset, const unsigned encoding);
1654
1673WS_DLL_PUBLIC uint64_t tvb_get_uint64_with_length(tvbuff_t *tvb, const int offset, unsigned length, const unsigned encoding);
1674
1689WS_DEPRECATED_X("Use tvb_get_uint64 instead")
1690static inline uint64_t tvb_get_guint64(tvbuff_t *tvb, const int offset, const unsigned encoding) {return tvb_get_uint64(tvb, offset, encoding); }
1691
1707WS_DLL_PUBLIC int64_t tvb_get_int64(tvbuff_t *tvb, const int offset, const unsigned encoding);
1708
1723WS_DEPRECATED_X("Use tvb_get_int64 instead")
1724static inline int64_t tvb_get_gint64(tvbuff_t *tvb, const int offset, const unsigned encoding) { return tvb_get_int64(tvb, offset, encoding); }
1725
1743WS_DLL_PUBLIC float tvb_get_ieee_float(tvbuff_t *tvb, const int offset, const unsigned encoding);
1744
1762WS_DLL_PUBLIC double tvb_get_ieee_double(tvbuff_t *tvb, const int offset, const unsigned encoding);
1763
1781#if G_BYTE_ORDER == G_LITTLE_ENDIAN
1782#define tvb_get_h_uint16 tvb_get_letohs
1783#define tvb_get_h_uint32 tvb_get_letohl
1784#elif G_BYTE_ORDER == G_BIG_ENDIAN
1785#define tvb_get_h_uint16 tvb_get_ntohs
1786#define tvb_get_h_uint32 tvb_get_ntohl
1787#else
1788#error "Unsupported byte order"
1789#endif
1790
1818WS_DLL_PUBLIC
1819nstime_t* tvb_get_string_time(tvbuff_t *tvb, const int offset, const int length,
1820 const unsigned encoding, nstime_t* ns, int *endoff);
1821
1843WS_DLL_PUBLIC
1844GByteArray* tvb_get_string_bytes(tvbuff_t *tvb, const int offset, const int length,
1845 const unsigned encoding, GByteArray* bytes, int *endoff);
1846
1864WS_DLL_PUBLIC uint32_t tvb_get_ipv4(tvbuff_t *tvb, const int offset);
1865
1882WS_DLL_PUBLIC void tvb_get_ipv6(tvbuff_t *tvb, const int offset, ws_in6_addr *addr);
1883
1896extern int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset,
1897 ws_in4_addr *addr, uint32_t prefix_len);
1898
1912extern int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int offset,
1913 ws_in6_addr *addr, uint32_t prefix_len);
1914
1926WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const int offset, e_guid_t *guid);
1927
1939WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const int offset, e_guid_t *guid);
1940
1954WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const int offset, e_guid_t *guid, const unsigned encoding);
1955
1975WS_DLL_PUBLIC uint8_t* tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb,
1976 const int offset, size_t length, size_t *data_length, const unsigned encoding);
1977
1997WS_DLL_PUBLIC uint8_t tvb_get_bits8(tvbuff_t *tvb, unsigned bit_offset,
1998 const int no_of_bits);
1999
2021WS_DLL_PUBLIC uint16_t tvb_get_bits16(tvbuff_t *tvb, unsigned bit_offset,
2022 const int no_of_bits, const unsigned encoding);
2023
2045WS_DLL_PUBLIC uint32_t tvb_get_bits32(tvbuff_t *tvb, unsigned bit_offset,
2046 const int no_of_bits, const unsigned encoding);
2047
2069WS_DLL_PUBLIC uint64_t tvb_get_bits64(tvbuff_t *tvb, unsigned bit_offset,
2070 const int no_of_bits, const unsigned encoding);
2071
2089WS_DLL_PUBLIC
2090WS_DEPRECATED_X("Use tvb_get_bits32() instead")
2091uint32_t tvb_get_bits(tvbuff_t *tvb, const unsigned bit_offset,
2092 const int no_of_bits, const unsigned encoding);
2093
2113WS_DLL_PUBLIC void *tvb_memcpy(tvbuff_t *tvb, void *target, const int offset,
2114 size_t length);
2115
2136WS_DLL_PUBLIC void *tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb,
2137 const int offset, size_t length);
2138
2174WS_DLL_PUBLIC const uint8_t *tvb_get_ptr(tvbuff_t *tvb, const int offset,
2175 const int length);
2176
2195WS_DLL_PUBLIC int tvb_find_uint8(tvbuff_t *tvb, const int offset,
2196 const int maxlength, const uint8_t needle);
2197
2219WS_DEPRECATED_X("Use tvb_find_uint8 instead")
2220static inline int tvb_find_guint8(tvbuff_t* tvb, const int offset,
2221 const int maxlength, const uint8_t needle) { return tvb_find_uint8(tvb, offset, maxlength, needle); }
2222
2243WS_DLL_PUBLIC int tvb_find_uint16(tvbuff_t *tvb, const int offset,
2244 const int maxlength, const uint16_t needle);
2245
2267WS_DEPRECATED_X("Use tvb_find_uint16 instead")
2268static inline int tvb_find_guint16(tvbuff_t* tvb, const int offset,
2269 const int maxlength, const uint16_t needle) {
2270 return tvb_find_uint16(tvb, offset, maxlength, needle);
2271}
2272
2291WS_DLL_PUBLIC int tvb_ws_mempbrk_pattern_uint8(tvbuff_t *tvb, const int offset,
2292 const int maxlength, const ws_mempbrk_pattern* pattern, unsigned char *found_needle);
2293
2319WS_DEPRECATED_X("Use tvb_ws_mempbrk_pattern_uint8 instead")
2320static inline int tvb_ws_mempbrk_pattern_guint8(tvbuff_t* tvb, const int offset,
2321 const int maxlength, const ws_mempbrk_pattern* pattern, unsigned char* found_needle) {
2322 return tvb_ws_mempbrk_pattern_uint8(tvb, offset, maxlength, pattern, found_needle);
2323}
2324
2339WS_DLL_PUBLIC unsigned tvb_strsize(tvbuff_t *tvb, const int offset);
2340
2355WS_DLL_PUBLIC unsigned tvb_unicode_strsize(tvbuff_t *tvb, const int offset);
2356
2372WS_DLL_PUBLIC int tvb_strnlen(tvbuff_t *tvb, const int offset,
2373 const unsigned maxlength);
2374
2391WS_DLL_PUBLIC char *tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset,
2392 const int size);
2393
2411WS_DLL_PUBLIC char *tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const int offset,
2412 const int size);
2413
2431extern char *tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset,
2432 const int size);
2433
2452extern char *tvb_format_stringzpad_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const int offset,
2453 const int size);
2454
2476WS_DLL_PUBLIC uint8_t *tvb_get_string_enc(wmem_allocator_t *scope,
2477 tvbuff_t *tvb, const int offset, const int length, const unsigned encoding);
2478
2503 tvbuff_t *tvb, const int bit_offset, int no_of_chars);
2504
2529 tvbuff_t *tvb, const int offset, int length);
2530
2555 tvbuff_t *tvb, const int offset, int length);
2556
2580WS_DLL_PUBLIC char *tvb_get_ascii_7bits_string(wmem_allocator_t *scope,
2581 tvbuff_t *tvb, const int bit_offset, int no_of_chars);
2582
2607WS_DLL_PUBLIC uint8_t *tvb_get_stringzpad(wmem_allocator_t *scope,
2608 tvbuff_t *tvb, const int offset, const int length, const unsigned encoding);
2609
2634WS_DLL_PUBLIC uint8_t *tvb_get_stringz_enc(wmem_allocator_t *scope,
2635 tvbuff_t *tvb, const int offset, int *lengthp, const unsigned encoding);
2636
2667WS_DLL_PUBLIC
2668WS_DEPRECATED_X("Use APIs that return a valid UTF-8 string instead")
2669const uint8_t *tvb_get_const_stringz(tvbuff_t *tvb,
2670 const int offset, int *lengthp);
2671
2691WS_DLL_PUBLIC int tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const int offset,
2692 const unsigned bufsize, uint8_t *buffer);
2693
2709WS_DLL_PUBLIC int tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const int offset, char *buffer, size_t bufsize);
2710
2724WS_DLL_PUBLIC bool tvb_ascii_isprint(tvbuff_t *tvb, const int offset,
2725 const int length);
2726
2745WS_DLL_PUBLIC bool tvb_utf_8_isprint(tvbuff_t *tvb, const int offset,
2746 const int length);
2747
2761WS_DLL_PUBLIC bool tvb_ascii_isdigit(tvbuff_t *tvb, const int offset,
2762 const int length);
2763
2788WS_DLL_PUBLIC int tvb_find_line_end(tvbuff_t *tvb, const int offset, int len,
2789 int *next_offset, const bool desegment);
2790
2812WS_DLL_PUBLIC int tvb_find_line_end_unquoted(tvbuff_t *tvb, const int offset,
2813 int len, int *next_offset);
2814
2832WS_DLL_PUBLIC int tvb_skip_wsp(tvbuff_t *tvb, const int offset,
2833 const int maxlength);
2834
2849WS_DLL_PUBLIC int tvb_skip_wsp_return(tvbuff_t *tvb, const int offset);
2850
2868int tvb_skip_uint8(tvbuff_t *tvb, int offset, const int maxlength, const uint8_t ch);
2869
2891WS_DEPRECATED_X("Use tvb_skip_uint8 instead")
2892static inline int tvb_skip_guint8(tvbuff_t *tvb, int offset, const int maxlength, const uint8_t ch) {
2893 return tvb_skip_uint8(tvb, offset, maxlength, ch);
2894}
2895
2920WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const int offset, int len, int *next_offset, const bool desegment);
2921
2938WS_DLL_PUBLIC int tvb_strneql(tvbuff_t *tvb, const int offset,
2939 const char *str, const size_t size);
2940
2961WS_DLL_PUBLIC int tvb_strncaseeql(tvbuff_t *tvb, const int offset,
2962 const char *str, const size_t size);
2963
2981WS_DLL_PUBLIC int tvb_memeql(tvbuff_t *tvb, const int offset,
2982 const uint8_t *str, size_t size);
2983
3003WS_DLL_PUBLIC char *tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset,
3004 const int len, const char punct);
3005
3026WS_DLL_PUBLIC char *tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb,
3027 const int offset, const int len);
3028
3043typedef struct dgt_set_t
3044{
3045 const unsigned char out[16];
3046}
3048
3073WS_DLL_PUBLIC const char *tvb_bcd_dig_to_str(wmem_allocator_t *scope,
3074 tvbuff_t *tvb, const int offset, const int len, const dgt_set_t *dgt,
3075 bool skip_first);
3076
3103WS_DLL_PUBLIC const char *tvb_bcd_dig_to_str_be(wmem_allocator_t *scope,
3104 tvbuff_t *tvb, const int offset, const int len, const dgt_set_t *dgt,
3105 bool skip_first);
3106
3138WS_DLL_PUBLIC char *tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb,
3139 const int offset, int len, const dgt_set_t *dgt,
3140 bool skip_first, bool odd, bool bigendian);
3141
3157WS_DLL_PUBLIC int tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
3158 const int haystack_offset);
3159
3160/* From tvbuff_zlib.c */
3180WS_DEPRECATED_X("Use tvb_uncompress_zlib instead")
3181WS_DLL_PUBLIC tvbuff_t *tvb_uncompress(tvbuff_t *tvb, const int offset,
3182 int comprlen);
3183
3205WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zlib(tvbuff_t *tvb, const int offset,
3206 int comprlen);
3207
3229WS_DEPRECATED_X("Use tvb_child_uncompress_zlib instead")
3230WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb,
3231 const int offset, int comprlen);
3232
3249WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zlib(tvbuff_t *parent, tvbuff_t *tvb,
3250 const int offset, int comprlen);
3251
3252/* From tvbuff_brotli.c */
3253
3275WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_brotli(tvbuff_t *tvb, const int offset,
3276 int comprlen);
3277
3296WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb,
3297 const int offset, int comprlen);
3298
3299/* From tvbuff_snappy.c */
3300
3318WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_snappy(tvbuff_t *tvb, const int offset,
3319 int comprlen);
3320
3339WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb,
3340 const int offset, int comprlen);
3341
3342/* From tvbuff_lz77.c */
3343
3365WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77(tvbuff_t *tvb,
3366 const int offset, int comprlen);
3367
3387WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77(tvbuff_t *parent,
3388 tvbuff_t *tvb, const int offset, int comprlen);
3389
3390/* From tvbuff_lz77huff.c */
3391
3413WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77huff(tvbuff_t *tvb,
3414 const int offset, int comprlen);
3415
3435WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77huff(tvbuff_t *parent,
3436 tvbuff_t *tvb, const int offset, int comprlen);
3437
3438/* From tvbuff_lznt1.c */
3439
3461WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lznt1(tvbuff_t *tvb,
3462 const int offset, int comprlen);
3463
3483WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lznt1(tvbuff_t *parent,
3484 tvbuff_t *tvb, const int offset, int comprlen);
3485
3507WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zstd(tvbuff_t *tvb,
3508 const int offset, int comprlen);
3509
3529WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zstd(tvbuff_t *parent,
3530 tvbuff_t *tvb, const int offset, int comprlen);
3531
3532/* From tvbuff_base64.c */
3533
3548extern tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
3549
3568extern tvbuff_t* base64_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
3569
3589extern tvbuff_t* base64uri_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
3590
3591/* From tvbuff_hpackhuff.c */
3592
3610 tvbuff_t *tvb, const int offset, const int len);
3611
3631 int offset, int length);
3632
3655WS_DLL_PUBLIC unsigned tvb_get_varint(tvbuff_t *tvb, unsigned offset, unsigned maxlen, uint64_t *value, const unsigned encoding);
3656
3657/************** END OF ACCESSORS ****************/
3658
3659#ifdef __cplusplus
3660}
3661#endif /* __cplusplus */
3662
3663#endif /* __TVBUFF_H__ */
3664
3665/*
3666 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3667 *
3668 * Local variables:
3669 * c-basic-offset: 4
3670 * tab-width: 8
3671 * indent-tabs-mode: nil
3672 * End:
3673 *
3674 * vi: set shiftwidth=4 tabstop=8 expandtab:
3675 * :indentSize=4:tabSize=8:noTabs=true:
3676 */
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:4129
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:4160
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:2503
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:1258
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:4747
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:1600
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:2679
WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb)
Repair a tvbuff when captured length exceeds reported length.
Definition tvbuff.c:824
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:1168
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:1213
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:2135
WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb)
Set the "this is a fragment" flag on a tvbuff.
Definition tvbuff.c:4785
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:1285
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:1666
WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const int offset, int len, int *next_offset, const bool desegment)
Determine the length of a token in a tvbuff, optionally desegmenting.
Definition tvbuff.c:4541
WS_DLL_PUBLIC char * tvb_get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, int length)
Extract and convert a string encoded per ETSI TS 102 221 Annex A from a tvbuff to UTF-8.
Definition tvbuff.c:3096
WS_DLL_PUBLIC int tvb_strneql(tvbuff_t *tvb, const int offset, const char *str, const size_t size)
Compare a string in a tvbuff to a reference string using strncmp semantics.
Definition tvbuff.c:2707
const unsigned char out[16]
Definition tvbuff.h:3045
WS_DLL_PUBLIC tvbuff_t * tvb_new_octet_aligned(tvbuff_t *tvb, uint32_t bit_offset, int32_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:371
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:1186
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:1204
WS_DLL_PUBLIC void tvb_free(tvbuff_t *tvb)
Free a tvbuff_t and all tvbuffs chained from it.
Definition tvbuff.c:109
WS_DLL_PUBLIC char * tvb_get_ascii_7bits_string(wmem_allocator_t *scope, tvbuff_t *tvb, const int bit_offset, int no_of_chars)
Extract and convert an ASCII 7-bit encoded string from a tvbuff to UTF-8.
Definition tvbuff.c:3108
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:1075
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:1694
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:1112
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_length(tvbuff_t *backing, const int backing_offset, const int reported_length)
Create a subset tvbuff with captured length fitting within backing and reported lengths.
Definition tvbuff_subset.c:191
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:2177
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:1020
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 unsigned tvb_ensure_captured_length_remaining(const tvbuff_t *tvb, const int offset)
Same as tvb_captured_length_remaining, but throws an exception if the offset is out of bounds.
Definition tvbuff.c:578
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:1121
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:4079
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:1240
WS_DLL_PUBLIC char * tvb_format_text_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const int offset, const int size)
Format tvbuff data as printable text, omitting C-style escapes.
Definition tvbuff.c:2803
WS_DLL_PUBLIC unsigned tvb_reported_length(const tvbuff_t *tvb)
Get reported length of buffer.
Definition tvbuff.c:756
WS_DLL_PUBLIC uint8_t * tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, int *lengthp, const unsigned encoding)
Extract and convert a null-terminated string from a tvbuff to UTF-8 using the specified encoding.
Definition tvbuff.c:3795
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:4634
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:1222
WS_DLL_PUBLIC uint8_t * tvb_get_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int length, const unsigned encoding)
Extract and convert a null-padded string from a tvbuff to UTF-8.
Definition tvbuff.c:3564
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:1231
WS_DLL_PUBLIC unsigned tvb_unicode_strsize(tvbuff_t *tvb, const int offset)
Determine the size of a UCS-2 or UTF-16 NUL-terminated string in a tvbuff.
Definition tvbuff.c:2658
WS_DLL_PUBLIC void tvb_free_chain(tvbuff_t *tvb)
Free the tvbuff_t and all tvbuffs chained from it.
Definition tvbuff.c:115
WS_DLL_PUBLIC tvbuff_t * tvb_clone(tvbuff_t *tvb)
Creates a full clone of the given tvbuff.
Definition tvbuff.c:535
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 uint8_t * tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int length, const unsigned encoding)
Extract and convert a string from a tvbuff to UTF-8 using the specified encoding.
Definition tvbuff.c:3298
WS_DLL_PUBLIC bool tvb_offset_exists(const tvbuff_t *tvb, const int offset)
Checks (without throwing an exception) whether the offset exists in the buffer.
Definition tvbuff.c:738
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:845
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:1731
WS_DLL_PUBLIC const uint8_t * tvb_get_const_stringz(tvbuff_t *tvb, const int offset, int *lengthp)
Deprecated function to retrieve a raw, unmodifiable null-terminated string from a tvbuff.
Definition tvbuff.c:3663
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:4612
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 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 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:2251
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:1352
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:2228
WS_DLL_PUBLIC char * tvb_get_ts_23_038_7bits_string_unpacked(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, int length)
Extract and convert a 3GPP TS 23.038 7-bit unpacked string from a tvbuff to UTF-8.
Definition tvbuff.c:3084
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:127
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:1102
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:2259
WS_DLL_PUBLIC int tvb_raw_offset(tvbuff_t *tvb)
Returns the offset from the first byte of real data.
Definition tvbuff.c:4779
WS_DLL_PUBLIC unsigned tvb_captured_length(const tvbuff_t *tvb)
Get the amount of captured data in the buffer.
Definition tvbuff.c:541
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:2199
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:1675
WS_DLL_PUBLIC char * tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int size)
Format a block of tvbuff data as printable text.
Definition tvbuff.c:2788
WS_DLL_PUBLIC unsigned tvb_ensure_reported_length_remaining(const tvbuff_t *tvb, const int offset)
Same as tvb_reported_length_remaining but throws an exception if the offset is out of bounds.
Definition tvbuff.c:782
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:216
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:324
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:1056
WS_DLL_PUBLIC tvbuff_t * tvb_new_composite(void)
Create an empty composite tvbuff.
Definition tvbuff_composite.c:201
WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb, const int offset, const int length)
Checks that the bytes referred to by 'offset' and 'length' actually exist in the buffer.
Definition tvbuff.c:653
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:1029
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:318
WS_DLL_PUBLIC int tvb_strncaseeql(tvbuff_t *tvb, const int offset, const char *str, const size_t size)
Case-insensitive comparison of tvbuff bytes against a reference string.
Definition tvbuff.c:2734
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:4717
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:1131
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:1628
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:1249
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:1711
WS_DLL_PUBLIC struct tvbuff * tvb_get_ds_tvb(tvbuff_t *tvb)
Retrieve the data source tvbuff from a given tvbuff.
Definition tvbuff.c:4791
WS_DLL_PUBLIC char * tvb_get_ts_23_038_7bits_string_packed(wmem_allocator_t *scope, tvbuff_t *tvb, const int bit_offset, int no_of_chars)
Extract and convert a 3GPP TS 23.038 7-bit packed string from a tvbuff to UTF-8.
Definition tvbuff.c:3070
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:2243
WS_DLL_PUBLIC int tvb_find_uint8(tvbuff_t *tvb, const int offset, const int maxlength, const uint8_t needle)
Find the first occurrence of a byte value in a tvbuff.
Definition tvbuff.c:2464
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:1610
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 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:1343
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_reported_length_remaining(const tvbuff_t *tvb, const int offset)
Computes bytes of reported packet data from the given offset to the end of buffer.
Definition tvbuff.c:764
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:1637
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:1013
WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb, const int offset, const uint64_t length)
Checks that the bytes referred to by 'offset' and 'length' actually exist in the buffer.
Definition tvbuff.c:636
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:4726
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:1065
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:1276
WS_DLL_PUBLIC int tvb_captured_length_remaining(const tvbuff_t *tvb, const int offset)
Computes bytes to end of buffer from the given offset.
Definition tvbuff.c:563
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:309
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:2110
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 int tvb_find_line_end(tvbuff_t *tvb, const int offset, int len, int *next_offset, const bool desegment)
Locate the end of a line in a tvbuff, optionally desegmenting.
Definition tvbuff.c:4197
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:1195
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:1685
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_remaining(tvbuff_t *backing, const int backing_offset)
Similar to tvb_new_subset_length_caplen() but with backing_length and reported_length set to -1.
Definition tvbuff_subset.c:240
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:1047
WS_DLL_PUBLIC void * tvb_memcpy(tvbuff_t *tvb, void *target, const int offset, size_t length)
Copy a range of bytes from a tvbuff into a pre-allocated target buffer.
Definition tvbuff.c:936
WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb)
Mark a composite tvbuff as finalized.
Definition tvbuff_composite.c:262
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:4498
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:1140
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:1544
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 uint16_t tvb_get_ntohs(tvbuff_t *tvb, const int offset)
Retrieve a 16-bit unsigned value in network byte order.
Definition tvbuff.c:1038
WS_DLL_PUBLIC int tvb_memeql(tvbuff_t *tvb, const int offset, const uint8_t *str, size_t size)
Compare raw bytes in a tvbuff to a reference buffer using memcmp semantics.
Definition tvbuff.c:2762
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:1806
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:2188
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:521
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 uint64_t tvb_get_ntoh40(tvbuff_t *tvb, const int offset)
Retrieve a 40-bit unsigned value in network byte order.
Definition tvbuff.c:1093
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:1159
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 tvbuff_t * tvb_new_subset_length_caplen(tvbuff_t *backing, const int backing_offset, const int backing_length, const int reported_length)
Create a subset tvbuff with an explicitly limited captured length.
Definition tvbuff_subset.c:155
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:4514
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:4146
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:1619
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:1656
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:4738
WS_DLL_PUBLIC tvbuff_t * tvb_new_octet_right_aligned(tvbuff_t *tvb, uint32_t bit_offset, int32_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:437
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
char * tvb_format_stringzpad_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const int offset, const int size)
Format a null-padded string from a tvbuff as printable text, preserving whitespace.
Definition tvbuff.c:2838
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:2156
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:1150
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:1582
WS_DLL_PUBLIC unsigned tvb_strsize(tvbuff_t *tvb, const int offset)
Determine the size of a NUL-terminated string in a tvbuff.
Definition tvbuff.c:2628
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:1858
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:2267
WS_DLL_PUBLIC bool tvb_bytes_exist(const tvbuff_t *tvb, const int offset, const int length)
Check that the specified bytes exist in the tvbuff without throwing an exception.
Definition tvbuff.c:611
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:1573
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:805
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:1177
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:1084
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:1524
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:1591
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:1267
WS_DLL_PUBLIC int tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const int offset, char *buffer, size_t bufsize)
Extract raw bytes from a tvbuff into a buffer as a NUL-terminated string.
Definition tvbuff.c:4103
WS_DLL_PUBLIC int tvb_ws_mempbrk_pattern_uint8(tvbuff_t *tvb, const int 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:2584
WS_DLL_PUBLIC void * tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, size_t length)
Duplicate a block of data from a tvbuff into a newly allocated buffer.
Definition tvbuff.c:994
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:1361
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:4469
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 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:1647
char * tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const int offset, const int size)
Format a null-padded string from a tvbuff as printable text.
Definition tvbuff.c:2819
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:4797
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_snappy(tvbuff_t *tvb, const int offset, int comprlen)
Uncompress Snappy-compressed data from a tvbuff.
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:239
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:2434
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:2122
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.
WS_DLL_PUBLIC int tvb_find_line_end_unquoted(tvbuff_t *tvb, const int offset, int len, int *next_offset)
Locate the end of a line in a tvbuff, ignoring newlines inside quoted strings.
Definition tvbuff.c:4320
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
Definition wmem_allocator.h:27
Internal structure representing a wmem-allocated string buffer.
Definition wmem_strbuf.h:48
Definition mcast_stream.h:30
Digit mapping table for BCD decoding.
Definition tvbuff.h:3044
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