Wireshark  4.3.0
The Wireshark network protocol analyzer
tvbuff.h
Go to the documentation of this file.
1 
21 #ifndef __TVBUFF_H__
22 #define __TVBUFF_H__
23 
24 #include <glib.h>
25 #include <epan/guid-utils.h>
26 #include <epan/wmem_scopes.h>
27 #include <epan/ipv6.h>
28 
29 #include <wsutil/nstime.h>
30 #include "wsutil/ws_mempbrk.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35 
46 struct tvbuff;
47 typedef struct tvbuff tvbuff_t;
48 
102 typedef void (*tvbuff_free_cb_t)(void*);
103 
109 WS_DLL_PUBLIC tvbuff_t *tvb_new_octet_aligned(tvbuff_t *tvb,
110  guint32 bit_offset, gint32 no_of_bits);
111 
115 WS_DLL_PUBLIC tvbuff_t *tvb_new_octet_right_aligned(tvbuff_t *tvb,
116  guint32 bit_offset, gint32 no_of_bits);
117 
118 WS_DLL_PUBLIC tvbuff_t *tvb_new_chain(tvbuff_t *parent, tvbuff_t *backing);
119 
120 WS_DLL_PUBLIC tvbuff_t *tvb_clone(tvbuff_t *tvb);
121 
122 WS_DLL_PUBLIC tvbuff_t *tvb_clone_offset_len(tvbuff_t *tvb, guint offset,
123  guint len);
124 
130 WS_DLL_PUBLIC void tvb_free(tvbuff_t *tvb);
131 
137 WS_DLL_PUBLIC void tvb_free_chain(tvbuff_t *tvb);
138 
143 WS_DLL_PUBLIC void tvb_set_free_cb(tvbuff_t *tvb, const tvbuff_free_cb_t func);
144 
154 WS_DLL_PUBLIC void tvb_set_child_real_data_tvbuff(tvbuff_t *parent,
155  tvbuff_t *child);
156 
157 WS_DLL_PUBLIC tvbuff_t *tvb_new_child_real_data(tvbuff_t *parent,
158  const guint8 *data, const guint length, const gint reported_length);
159 
164 WS_DLL_PUBLIC tvbuff_t *tvb_new_real_data(const guint8 *data,
165  const guint length, const gint reported_length);
166 
200 WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length_caplen(tvbuff_t *backing,
201  const gint backing_offset, const gint backing_length,
202  const gint reported_length);
203 
209 WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_length(tvbuff_t *backing,
210  const gint backing_offset, const gint reported_length);
211 
214 WS_DLL_PUBLIC tvbuff_t *tvb_new_subset_remaining(tvbuff_t *backing,
215  const gint backing_offset);
216 
217 /*
218 * Both tvb_composite_append and tvb_composite_prepend can throw
219  * BoundsError if member_offset/member_length goes beyond bounds of
220  * the 'member' tvbuff. */
221 
223 WS_DLL_PUBLIC void tvb_composite_append(tvbuff_t *tvb, tvbuff_t *member);
224 
226 extern void tvb_composite_prepend(tvbuff_t *tvb, tvbuff_t *member);
227 
229 WS_DLL_PUBLIC tvbuff_t *tvb_new_composite(void);
230 
233 WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb);
234 
235 
236 /* Get amount of captured data in the buffer (which is *NOT* necessarily the
237  * length of the packet). You probably want tvb_reported_length instead. */
238 WS_DLL_PUBLIC guint tvb_captured_length(const tvbuff_t *tvb);
239 
244 WS_DLL_PUBLIC gint tvb_captured_length_remaining(const tvbuff_t *tvb, const gint offset);
245 
247 WS_DLL_PUBLIC guint tvb_ensure_captured_length_remaining(const tvbuff_t *tvb,
248  const gint offset);
249 
250 /* Checks (w/o throwing exception) that the bytes referred to by
251  * 'offset'/'length' actually exist in the buffer */
252 WS_DLL_PUBLIC gboolean tvb_bytes_exist(const tvbuff_t *tvb, const gint offset,
253  const gint length);
254 
258 WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb,
259  const gint offset, const guint64 length);
260 
263 WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb,
264  const gint offset, const gint length);
265 
266 /* Checks (w/o throwing exception) that offset exists in buffer */
267 WS_DLL_PUBLIC gboolean tvb_offset_exists(const tvbuff_t *tvb,
268  const gint offset);
269 
270 /* Get reported length of buffer */
271 WS_DLL_PUBLIC guint tvb_reported_length(const tvbuff_t *tvb);
272 
277 WS_DLL_PUBLIC gint tvb_reported_length_remaining(const tvbuff_t *tvb,
278  const gint offset);
279 
281 WS_DLL_PUBLIC guint tvb_ensure_reported_length_remaining(const tvbuff_t *tvb,
282  const gint offset);
283 
290 WS_DLL_PUBLIC void tvb_set_reported_length(tvbuff_t *tvb, const guint);
291 
292 /* Repair a tvbuff where the captured length is greater than the
293  * reported length; such a tvbuff makes no sense, as it's impossible
294  * to capture more data than is in the packet.
295  */
296 WS_DLL_PUBLIC void tvb_fix_reported_length(tvbuff_t *tvb);
297 
298 WS_DLL_PUBLIC guint tvb_offset_from_real_beginning(const tvbuff_t *tvb);
299 
300 /* Returns the offset from the first byte of real data. */
301 WS_DLL_PUBLIC gint tvb_raw_offset(tvbuff_t *tvb);
302 
306 WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb);
307 
308 WS_DLL_PUBLIC struct tvbuff *tvb_get_ds_tvb(tvbuff_t *tvb);
309 
310 
311 /************** START OF ACCESSORS ****************/
312 /* All accessors will throw an exception if appropriate */
313 
314 WS_DLL_PUBLIC guint8 tvb_get_guint8(tvbuff_t *tvb, const gint offset);
315 WS_DLL_PUBLIC gint8 tvb_get_gint8(tvbuff_t *tvb, const gint offset);
316 
317 WS_DLL_PUBLIC guint16 tvb_get_ntohs(tvbuff_t *tvb, const gint offset);
318 WS_DLL_PUBLIC gint16 tvb_get_ntohis(tvbuff_t *tvb, const gint offset);
319 WS_DLL_PUBLIC guint32 tvb_get_ntoh24(tvbuff_t *tvb, const gint offset);
320 WS_DLL_PUBLIC gint32 tvb_get_ntohi24(tvbuff_t *tvb, const gint offset);
321 WS_DLL_PUBLIC guint32 tvb_get_ntohl(tvbuff_t *tvb, const gint offset);
322 WS_DLL_PUBLIC gint32 tvb_get_ntohil(tvbuff_t *tvb, const gint offset);
323 WS_DLL_PUBLIC guint64 tvb_get_ntoh40(tvbuff_t *tvb, const gint offset);
324 WS_DLL_PUBLIC gint64 tvb_get_ntohi40(tvbuff_t *tvb, const gint offset);
325 WS_DLL_PUBLIC guint64 tvb_get_ntoh48(tvbuff_t *tvb, const gint offset);
326 WS_DLL_PUBLIC gint64 tvb_get_ntohi48(tvbuff_t *tvb, const gint offset);
327 WS_DLL_PUBLIC guint64 tvb_get_ntoh56(tvbuff_t *tvb, const gint offset);
328 WS_DLL_PUBLIC gint64 tvb_get_ntohi56(tvbuff_t *tvb, const gint offset);
329 WS_DLL_PUBLIC guint64 tvb_get_ntoh64(tvbuff_t *tvb, const gint offset);
330 WS_DLL_PUBLIC gint64 tvb_get_ntohi64(tvbuff_t *tvb, const gint offset);
331 WS_DLL_PUBLIC gfloat tvb_get_ntohieee_float(tvbuff_t *tvb, const gint offset);
332 WS_DLL_PUBLIC gdouble tvb_get_ntohieee_double(tvbuff_t *tvb,
333  const gint offset);
334 
335 WS_DLL_PUBLIC guint16 tvb_get_letohs(tvbuff_t *tvb, const gint offset);
336 WS_DLL_PUBLIC gint16 tvb_get_letohis(tvbuff_t *tvb, const gint offset);
337 WS_DLL_PUBLIC guint32 tvb_get_letoh24(tvbuff_t *tvb, const gint offset);
338 WS_DLL_PUBLIC gint32 tvb_get_letohi24(tvbuff_t *tvb, const gint offset);
339 WS_DLL_PUBLIC guint32 tvb_get_letohl(tvbuff_t *tvb, const gint offset);
340 WS_DLL_PUBLIC gint32 tvb_get_letohil(tvbuff_t *tvb, const gint offset);
341 WS_DLL_PUBLIC guint64 tvb_get_letoh40(tvbuff_t *tvb, const gint offset);
342 WS_DLL_PUBLIC gint64 tvb_get_letohi40(tvbuff_t *tvb, const gint offset);
343 WS_DLL_PUBLIC guint64 tvb_get_letoh48(tvbuff_t *tvb, const gint offset);
344 WS_DLL_PUBLIC gint64 tvb_get_letohi48(tvbuff_t *tvb, const gint offset);
345 WS_DLL_PUBLIC guint64 tvb_get_letoh56(tvbuff_t *tvb, const gint offset);
346 WS_DLL_PUBLIC gint64 tvb_get_letohi56(tvbuff_t *tvb, const gint offset);
347 WS_DLL_PUBLIC guint64 tvb_get_letoh64(tvbuff_t *tvb, const gint offset);
348 WS_DLL_PUBLIC gint64 tvb_get_letohi64(tvbuff_t *tvb, const gint offset);
349 WS_DLL_PUBLIC gfloat tvb_get_letohieee_float(tvbuff_t *tvb, const gint offset);
350 WS_DLL_PUBLIC gdouble tvb_get_letohieee_double(tvbuff_t *tvb,
351  const gint offset);
352 
353 WS_DLL_PUBLIC guint16 tvb_get_guint16(tvbuff_t *tvb, const gint offset, const guint encoding);
354 WS_DLL_PUBLIC gint16 tvb_get_gint16(tvbuff_t *tvb, const gint offset, const guint encoding);
355 WS_DLL_PUBLIC guint32 tvb_get_guint24(tvbuff_t *tvb, const gint offset, const guint encoding);
356 WS_DLL_PUBLIC gint32 tvb_get_gint24(tvbuff_t *tvb, const gint offset, const guint encoding);
357 WS_DLL_PUBLIC guint32 tvb_get_guint32(tvbuff_t *tvb, const gint offset, const guint encoding);
358 WS_DLL_PUBLIC gint32 tvb_get_gint32(tvbuff_t *tvb, const gint offset, const guint encoding);
359 WS_DLL_PUBLIC guint64 tvb_get_guint40(tvbuff_t *tvb, const gint offset, const guint encoding);
360 WS_DLL_PUBLIC gint64 tvb_get_gint40(tvbuff_t *tvb, const gint offset, const guint encoding);
361 WS_DLL_PUBLIC guint64 tvb_get_guint48(tvbuff_t *tvb, const gint offset, const guint encoding);
362 WS_DLL_PUBLIC gint64 tvb_get_gint48(tvbuff_t *tvb, const gint offset, const guint encoding);
363 WS_DLL_PUBLIC guint64 tvb_get_guint56(tvbuff_t *tvb, const gint offset, const guint encoding);
364 WS_DLL_PUBLIC gint64 tvb_get_gint56(tvbuff_t *tvb, const gint offset, const guint encoding);
365 WS_DLL_PUBLIC guint64 tvb_get_guint64(tvbuff_t *tvb, const gint offset, const guint encoding);
366 WS_DLL_PUBLIC gint64 tvb_get_gint64(tvbuff_t *tvb, const gint offset, const guint encoding);
367 WS_DLL_PUBLIC gfloat tvb_get_ieee_float(tvbuff_t *tvb, const gint offset, const guint encoding);
368 WS_DLL_PUBLIC gdouble tvb_get_ieee_double(tvbuff_t *tvb, const gint offset, const guint encoding);
369 
370 /*
371  * Fetch 16-bit and 32-bit values in host byte order.
372  * Used for some pseudo-headers in pcap/pcapng files, in which the
373  * headers are, when capturing, in the byte order of the host, and
374  * are converted to the byte order of the host reading the file
375  * when reading a capture file.
376  */
377 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
378 #define tvb_get_h_guint16 tvb_get_letohs
379 #define tvb_get_h_guint32 tvb_get_letohl
380 #elif G_BYTE_ORDER == G_BIG_ENDIAN
381 #define tvb_get_h_guint16 tvb_get_ntohs
382 #define tvb_get_h_guint32 tvb_get_ntohl
383 #else
384 #error "Unsupported byte order"
385 #endif
386 
387 
388 /* Fetch a time value from an ASCII-style string in the tvb.
389  *
390  * @param[in] offset The beginning offset in the tvb (cannot be negative)
391  * @param[in] length The field's length in the tvb (or -1 for remaining)
392  * @param[in] encoding The ENC_* that defines the format (e.g., ENC_ISO_8601_DATE_TIME)
393  * @param[in,out] ns The pre-allocated nstime_t that will be set to the decoded value
394  * @param[out] endoff if not NULL, should point to a gint that this
395  * routine will then set to be the offset to the character after
396  * the last character used in the conversion. This is useful because
397  * they may not consume the whole section.
398  *
399  * @return a pointer to the nstime_t passed-in, or NULL on failure; if no
400  * valid conversion could be performed, *endoff is set to 0, and the
401  * nstime_t* passed-in will be cleared.
402  *
403  * @note The conversion ignores leading spaces, and will succeed even if it does
404  * not consume the entire string. If you care about such things, always compare
405  * the *endoff to where you expect it to be (namely, offset+length).
406  *
407  * This routine will not throw an error unless the passed-in arguments are
408  * invalid (e.g., offset is beyond the tvb's length).
409  *
410  * @warning This only works for string encodings which encode ASCII characters in
411  * a single byte: ENC_ASCII, ENC_UTF_8, ENC_ISO_8859_*, etc. It does NOT work
412  * for purely multi-byte encodings such as ENC_UTF_16, ENC_UCS_*, etc.
413  */
414 WS_DLL_PUBLIC
415 nstime_t* tvb_get_string_time(tvbuff_t *tvb, const gint offset, const gint length,
416  const guint encoding, nstime_t* ns, gint *endoff);
417 
418 /* Similar to above, but returns a GByteArray based on the case-insensitive
419  * hex-char strings with optional separators, and with optional leading spaces.
420  * The separators allowed are based on the ENC_SEP_* passed in the encoding param.
421  *
422  * The passed-in bytes is set to the values, and its pointer is also the return
423  * value or NULL on error. The GByteArray bytes must be pre-constructed with
424  * g_byte_array_new().
425  */
426 WS_DLL_PUBLIC
427 GByteArray* tvb_get_string_bytes(tvbuff_t *tvb, const gint offset, const gint length,
428  const guint encoding, GByteArray* bytes, gint *endoff);
429 
434 WS_DLL_PUBLIC guint32 tvb_get_ipv4(tvbuff_t *tvb, const gint offset);
435 
436 /* Fetch an IPv6 address. */
437 WS_DLL_PUBLIC void tvb_get_ipv6(tvbuff_t *tvb, const gint offset,
438  ws_in6_addr *addr);
439 
440 /* Fetch a GUID. */
441 WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const gint offset,
442  e_guid_t *guid);
443 WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const gint offset,
444  e_guid_t *guid);
445 WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const gint offset,
446  e_guid_t *guid, const guint encoding);
447 
448 /* Fetches a byte array given a bit offset in a tvb */
449 WS_DLL_PUBLIC guint8* tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb,
450  const gint offset, size_t length, size_t *data_length, const guint encoding);
451 
452 /* Fetch a specified number of bits from bit offset in a tvb. All of these
453  * functions are equivalent, except for the type of the return value. Note
454  * that the parameter encoding (where supplied) is meaningless and ignored */
455 
456 /* get 1 - 8 bits returned in a guint8 */
457 WS_DLL_PUBLIC guint8 tvb_get_bits8(tvbuff_t *tvb, guint bit_offset,
458  const gint no_of_bits);
459 /* get 1 - 16 bits returned in a guint16 */
460 WS_DLL_PUBLIC guint16 tvb_get_bits16(tvbuff_t *tvb, guint bit_offset,
461  const gint no_of_bits, const guint encoding);
462 /* get 1 - 32 bits returned in a guint32 */
463 WS_DLL_PUBLIC guint32 tvb_get_bits32(tvbuff_t *tvb, guint bit_offset,
464  const gint no_of_bits, const guint encoding);
465 /* get 1 - 64 bits returned in a guint64 */
466 WS_DLL_PUBLIC guint64 tvb_get_bits64(tvbuff_t *tvb, guint bit_offset,
467  const gint no_of_bits, const guint encoding);
468 
473 WS_DLL_PUBLIC guint32 tvb_get_bits(tvbuff_t *tvb, const guint bit_offset,
474  const gint no_of_bits, const guint encoding);
475 
482 WS_DLL_PUBLIC void *tvb_memcpy(tvbuff_t *tvb, void *target, const gint offset,
483  size_t length);
484 
500 WS_DLL_PUBLIC void *tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb,
501  const gint offset, size_t length);
502 
528 WS_DLL_PUBLIC const guint8 *tvb_get_ptr(tvbuff_t *tvb, const gint offset,
529  const gint length);
530 
538 WS_DLL_PUBLIC gint tvb_find_guint8(tvbuff_t *tvb, const gint offset,
539  const gint maxlength, const guint8 needle);
540 
542 WS_DLL_PUBLIC gint tvb_find_guint16(tvbuff_t *tvb, const gint offset,
543  const gint maxlength, const guint16 needle);
544 
553 WS_DLL_PUBLIC gint tvb_ws_mempbrk_pattern_guint8(tvbuff_t *tvb, const gint offset,
554  const gint maxlength, const ws_mempbrk_pattern* pattern, guchar *found_needle);
555 
556 
562 WS_DLL_PUBLIC guint tvb_strsize(tvbuff_t *tvb, const gint offset);
563 
570 WS_DLL_PUBLIC guint tvb_unicode_strsize(tvbuff_t *tvb, const gint offset);
571 
576 WS_DLL_PUBLIC gint tvb_strnlen(tvbuff_t *tvb, const gint offset,
577  const guint maxlength);
578 
582 WS_DLL_PUBLIC gchar *tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
583  const gint size);
584 
589 WS_DLL_PUBLIC gchar *tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const gint offset,
590  const gint size);
591 
596 extern gchar *tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
597  const gint size);
598 
603 extern gchar *tvb_format_stringzpad_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const gint offset,
604  const gint size);
605 
626 WS_DLL_PUBLIC guint8 *tvb_get_string_enc(wmem_allocator_t *scope,
627  tvbuff_t *tvb, const gint offset, const gint length, const guint encoding);
628 
650 WS_DLL_PUBLIC gchar *tvb_get_ts_23_038_7bits_string_packed(wmem_allocator_t *scope,
651  tvbuff_t *tvb, const gint bit_offset, gint no_of_chars);
652 
675  tvbuff_t *tvb, const gint offset, gint length);
676 
697 WS_DLL_PUBLIC gchar *tvb_get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope,
698  tvbuff_t *tvb, const gint offset, gint length);
699 
720 WS_DLL_PUBLIC gchar *tvb_get_ascii_7bits_string(wmem_allocator_t *scope,
721  tvbuff_t *tvb, const gint bit_offset, gint no_of_chars);
722 
743 WS_DLL_PUBLIC guint8 *tvb_get_stringzpad(wmem_allocator_t *scope,
744  tvbuff_t *tvb, const gint offset, const gint length, const guint encoding);
745 
772 WS_DLL_PUBLIC guint8 *tvb_get_stringz_enc(wmem_allocator_t *scope,
773  tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding);
774 
799 WS_DLL_PUBLIC
800 WS_DEPRECATED_X("Use APIs that return a valid UTF-8 string instead")
801 const guint8 *tvb_get_const_stringz(tvbuff_t *tvb,
802  const gint offset, gint *lengthp);
803 
813 WS_DLL_PUBLIC gint tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const gint offset,
814  const guint bufsize, guint8 *buffer);
815 
816 /*
817  * Given a tvbuff, an offset into the tvbuff, a buffer, and a buffer size,
818  * extract as many raw bytes from the tvbuff, starting at the offset,
819  * as 1) are available in the tvbuff and 2) will fit in the buffer, leaving
820  * room for a terminating NUL.
821  */
822 WS_DLL_PUBLIC gint tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const gint offset, char *buffer, size_t bufsize);
823 
828 WS_DLL_PUBLIC gboolean tvb_ascii_isprint(tvbuff_t *tvb, const gint offset,
829  const gint length);
830 
840 WS_DLL_PUBLIC gboolean tvb_utf_8_isprint(tvbuff_t *tvb, const gint offset,
841  const gint length);
842 
847 WS_DLL_PUBLIC gboolean tvb_ascii_isdigit(tvbuff_t *tvb, const gint offset,
848  const gint length);
849 
869 WS_DLL_PUBLIC gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len,
870  gint *next_offset, const gboolean desegment);
871 
890 WS_DLL_PUBLIC gint tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset,
891  int len, gint *next_offset);
892 
910 WS_DLL_PUBLIC gint tvb_skip_wsp(tvbuff_t *tvb, const gint offset,
911  const gint maxlength);
912 
913 WS_DLL_PUBLIC gint tvb_skip_wsp_return(tvbuff_t *tvb, const gint offset);
914 
915 int tvb_skip_guint8(tvbuff_t *tvb, int offset, const int maxlength, const guint8 ch);
916 
935 WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment);
936 
941 WS_DLL_PUBLIC gint tvb_strneql(tvbuff_t *tvb, const gint offset,
942  const gchar *str, const size_t size);
943 
948 WS_DLL_PUBLIC gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset,
949  const gchar *str, const size_t size);
950 
955 WS_DLL_PUBLIC gint tvb_memeql(tvbuff_t *tvb, const gint offset,
956  const guint8 *str, size_t size);
957 
963 WS_DLL_PUBLIC gchar *tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
964  const gint len, const gchar punct);
965 
970 WS_DLL_PUBLIC gchar *tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb,
971  const gint offset, const gint len);
972 
983 typedef struct dgt_set_t
984 {
985  const unsigned char out[16];
986 }
988 
989 WS_DLL_PUBLIC const gchar *tvb_bcd_dig_to_str(wmem_allocator_t *scope,
990  tvbuff_t *tvb, const gint offset, const gint len, const dgt_set_t *dgt,
991  gboolean skip_first);
992 
1004 WS_DLL_PUBLIC const gchar *tvb_bcd_dig_to_str_be(wmem_allocator_t *scope,
1005  tvbuff_t *tvb, const gint offset, const gint len, const dgt_set_t *dgt,
1006  gboolean skip_first);
1007 
1023 WS_DLL_PUBLIC gchar *tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb,
1024  const gint offset, gint len, const dgt_set_t *dgt,
1025  gboolean skip_first, gboolean odd, gboolean bigendian);
1026 
1031 WS_DLL_PUBLIC gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
1032  const gint haystack_offset);
1033 
1034 /* From tvbuff_zlib.c */
1035 
1045 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress(tvbuff_t *tvb, const int offset,
1046  int comprlen);
1047 
1053 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb,
1054  const int offset, int comprlen);
1055 
1056 /* From tvbuff_brotli.c */
1057 
1067 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_brotli(tvbuff_t *tvb, const int offset,
1068  int comprlen);
1069 
1075 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb,
1076  const int offset, int comprlen);
1077 
1078 /* From tvbuff_lz77.c */
1079 
1090 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77(tvbuff_t *tvb,
1091  const int offset, int comprlen);
1092 
1099 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77(tvbuff_t *parent,
1100  tvbuff_t *tvb, const int offset, int comprlen);
1101 
1102 /* From tvbuff_lz77huff.c */
1103 
1114 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77huff(tvbuff_t *tvb,
1115  const int offset, int comprlen);
1116 
1123 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77huff(tvbuff_t *parent,
1124  tvbuff_t *tvb, const int offset, int comprlen);
1125 
1126 /* From tvbuff_lznt1.c */
1127 
1138 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lznt1(tvbuff_t *tvb,
1139  const int offset, int comprlen);
1140 
1147 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lznt1(tvbuff_t *parent,
1148  tvbuff_t *tvb, const int offset, int comprlen);
1149 
1160 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zstd(tvbuff_t *tvb,
1161  const int offset, int comprlen);
1162 
1169 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zstd(tvbuff_t *parent,
1170  tvbuff_t *tvb, const int offset, int comprlen);
1171 
1172 /* From tvbuff_base64.c */
1173 
1183 extern tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
1184 
1185 
1195 extern tvbuff_t* base64_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
1196 
1197 extern tvbuff_t* base64uri_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
1211 WS_DLL_PUBLIC guint tvb_get_varint(tvbuff_t *tvb, guint offset, guint maxlen, guint64 *value, const guint encoding);
1212 
1213 /************** END OF ACCESSORS ****************/
1214 
1217 #ifdef __cplusplus
1218 }
1219 #endif /* __cplusplus */
1220 
1221 #endif /* __TVBUFF_H__ */
1222 
1223 /*
1224  * Editor modelines - https://www.wireshark.org/tools/modelines.html
1225  *
1226  * Local variables:
1227  * c-basic-offset: 4
1228  * tab-width: 8
1229  * indent-tabs-mode: nil
1230  * End:
1231  *
1232  * vi: set shiftwidth=4 tabstop=8 expandtab:
1233  * :indentSize=4:tabSize=8:noTabs=true:
1234  */
WS_DLL_PUBLIC guint tvb_strsize(tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:2519
WS_DLL_PUBLIC guint tvb_ensure_reported_length_remaining(const tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:775
WS_DLL_PUBLIC gchar * tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint len, const dgt_set_t *dgt, gboolean skip_first, gboolean odd, gboolean bigendian)
Definition: tvbuff.c:4522
WS_DLL_PUBLIC guint32 tvb_get_ipv4(tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:2045
WS_DLL_PUBLIC gint tvb_strnlen(tvbuff_t *tvb, const gint offset, const guint maxlength)
Definition: tvbuff.c:2570
WS_DLL_PUBLIC gint tvb_captured_length_remaining(const tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:558
WS_DLL_PUBLIC void tvb_set_fragment(tvbuff_t *tvb)
Definition: tvbuff.c:4664
gchar * tvb_format_stringzpad_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2731
WS_DLL_PUBLIC gchar * tvb_get_ts_23_038_7bits_string_unpacked(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint length)
Definition: tvbuff.c:2977
WS_DLL_PUBLIC const guint8 * tvb_get_ptr(tvbuff_t *tvb, const gint offset, const gint length)
Definition: tvbuff.c:1006
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lz77huff(tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_lz77huff.c:358
WS_DLL_PUBLIC tvbuff_t * tvb_new_real_data(const guint8 *data, const guint length, const gint reported_length)
Definition: tvbuff_real.c:58
WS_DLL_PUBLIC void tvb_free(tvbuff_t *tvb)
Definition: tvbuff.c:109
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_zstd(tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_zstd.c:28
WS_DLL_PUBLIC void tvb_ensure_bytes_exist(const tvbuff_t *tvb, const gint offset, const gint length)
Definition: tvbuff.c:648
WS_DLL_PUBLIC gboolean tvb_ascii_isprint(tvbuff_t *tvb, const gint offset, const gint length)
Definition: tvbuff.c:4021
WS_DLL_PUBLIC gint tvb_memeql(tvbuff_t *tvb, const gint offset, const guint8 *str, size_t size)
Definition: tvbuff.c:2653
WS_DLL_PUBLIC gchar * tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint len)
Definition: tvbuff.c:4617
WS_DLL_PUBLIC gchar * tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint len, const gchar punct)
Definition: tvbuff.c:4502
WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment)
Definition: tvbuff.c:4431
WS_DLL_PUBLIC void * tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, size_t length)
Definition: tvbuff.c:987
WS_DLL_PUBLIC void tvb_free_chain(tvbuff_t *tvb)
Definition: tvbuff.c:115
WS_DLL_PUBLIC guint8 * tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding)
Definition: tvbuff.c:3688
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_length_caplen(tvbuff_t *backing, const gint backing_offset, const gint backing_length, const gint reported_length)
Definition: tvbuff_subset.c:155
struct dgt_set_t dgt_set_t
tvbuff_t * base64_to_tvb(tvbuff_t *parent, const char *base64)
Definition: tvbuff_base64.c:169
WS_DLL_PUBLIC gchar * tvb_get_ts_23_038_7bits_string_packed(wmem_allocator_t *scope, tvbuff_t *tvb, const gint bit_offset, gint no_of_chars)
Definition: tvbuff.c:2963
WS_DLL_PUBLIC tvbuff_t * tvb_new_octet_aligned(tvbuff_t *tvb, guint32 bit_offset, gint32 no_of_bits)
Definition: tvbuff.c:366
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_length(tvbuff_t *backing, const gint backing_offset, const gint reported_length)
Definition: tvbuff_subset.c:191
WS_DLL_PUBLIC const guint8 * tvb_get_const_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp)
Definition: tvbuff.c:3556
WS_DLL_PUBLIC void tvb_set_child_real_data_tvbuff(tvbuff_t *parent, tvbuff_t *child)
Definition: tvbuff_real.c:96
void(* tvbuff_free_cb_t)(void *)
Definition: tvbuff.h:102
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_zlib.c:313
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lz77huff(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_lz77huff.c:404
WS_DLL_PUBLIC tvbuff_t * tvb_new_composite(void)
Definition: tvbuff_composite.c:195
WS_DLL_PUBLIC gint tvb_find_guint16(tvbuff_t *tvb, const gint offset, const gint maxlength, const guint16 needle)
Definition: tvbuff.c:2394
WS_DLL_PUBLIC const gchar * tvb_bcd_dig_to_str_be(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint len, const dgt_set_t *dgt, gboolean skip_first)
Definition: tvbuff.c:4605
WS_DLL_PUBLIC void tvb_composite_append(tvbuff_t *tvb, tvbuff_t *member)
Definition: tvbuff_composite.c:209
WS_DLL_PUBLIC void tvb_ensure_bytes_exist64(const tvbuff_t *tvb, const gint offset, const guint64 length)
Definition: tvbuff.c:631
WS_DLL_PUBLIC gint tvb_find_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, const guint8 needle)
Definition: tvbuff.c:2355
WS_DLL_PUBLIC gchar * tvb_get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint length)
Definition: tvbuff.c:2989
WS_DLL_PUBLIC gchar * tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2680
WS_DLL_PUBLIC gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
Definition: tvbuff.c:2625
WS_DLL_PUBLIC gint tvb_strneql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
Definition: tvbuff.c:2598
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_zstd(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_zstd.c:101
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_brotli.c:173
WS_DLL_PUBLIC tvbuff_t * tvb_new_octet_right_aligned(tvbuff_t *tvb, guint32 bit_offset, gint32 no_of_bits)
Definition: tvbuff.c:432
WS_DLL_PUBLIC gint tvb_ws_mempbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, const ws_mempbrk_pattern *pattern, guchar *found_needle)
Definition: tvbuff.c:2475
WS_DLL_PUBLIC gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, const gint haystack_offset)
Definition: tvbuff.c:4626
WS_DLL_PUBLIC void tvb_composite_finalize(tvbuff_t *tvb)
Definition: tvbuff_composite.c:255
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lznt1(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_lznt1.c:148
WS_DLL_PUBLIC gint tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8 *buffer)
Definition: tvbuff.c:3972
WS_DLL_PUBLIC guint8 * tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint length, const guint encoding)
Definition: tvbuff.c:3191
WS_DLL_PUBLIC gchar * tvb_format_text_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2695
WS_DLL_PUBLIC gint tvb_skip_wsp(tvbuff_t *tvb, const gint offset, const gint maxlength)
Definition: tvbuff.c:4359
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_brotli(tvbuff_t *tvb, const int offset, int comprlen)
WS_DLL_PUBLIC gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment)
Definition: tvbuff.c:4087
tvbuff_t * base64_tvb_to_new_tvb(tvbuff_t *parent, int offset, int length)
Definition: tvbuff_base64.c:184
WS_DLL_PUBLIC guint tvb_get_varint(tvbuff_t *tvb, guint offset, guint maxlen, guint64 *value, const guint encoding)
Definition: tvbuff.c:4676
WS_DLL_PUBLIC gboolean tvb_utf_8_isprint(tvbuff_t *tvb, const gint offset, const gint length)
Definition: tvbuff.c:4037
WS_DLL_PUBLIC guint8 * tvb_get_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint length, const guint encoding)
Definition: tvbuff.c:3457
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_lz77(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_lz77.c:137
WS_DLL_PUBLIC void * tvb_memcpy(tvbuff_t *tvb, void *target, const gint offset, size_t length)
Definition: tvbuff.c:929
WS_DLL_PUBLIC void tvb_set_free_cb(tvbuff_t *tvb, const tvbuff_free_cb_t func)
Definition: tvbuff_real.c:86
WS_DLL_PUBLIC gint tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next_offset)
Definition: tvbuff.c:4210
WS_DLL_PUBLIC gint tvb_reported_length_remaining(const tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:757
WS_DLL_PUBLIC gchar * tvb_get_ascii_7bits_string(wmem_allocator_t *scope, tvbuff_t *tvb, const gint bit_offset, gint no_of_chars)
Definition: tvbuff.c:3001
WS_DLL_PUBLIC void tvb_set_reported_length(tvbuff_t *tvb, const guint)
Definition: tvbuff.c:798
WS_DLL_PUBLIC gboolean tvb_ascii_isdigit(tvbuff_t *tvb, const gint offset, const gint length)
Definition: tvbuff.c:4050
WS_DLL_PUBLIC guint tvb_ensure_captured_length_remaining(const tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:573
WS_DLL_PUBLIC guint tvb_unicode_strsize(tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:2549
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lz77(tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_lz77.c:98
gchar * tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2712
WS_DLL_PUBLIC guint32 tvb_get_bits(tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits, const guint encoding)
Definition: tvbuff.c:2325
void tvb_composite_prepend(tvbuff_t *tvb, tvbuff_t *member)
Definition: tvbuff_composite.c:232
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_lznt1(tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_lznt1.c:109
WS_DLL_PUBLIC tvbuff_t * tvb_new_subset_remaining(tvbuff_t *backing, const gint backing_offset)
Definition: tvbuff_subset.c:240
Definition: guid-utils.h:22
Definition: wmem_allocator.h:27
Definition: mcast_stream.h:30
Definition: tvbuff.h:984
Definition: inet_ipv6.h:21
Definition: nstime.h:26
Definition: tvbuff-int.h:35
guint reported_length
Definition: tvbuff-int.h:67
guint length
Definition: tvbuff-int.h:61
Definition: ws_mempbrk.h:21