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 
28 #include <wsutil/inet_cidr.h>
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 
450 extern int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset,
451  ws_in4_addr *addr, guint32 prefix_len);
452 
463 extern int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int offset,
464  ws_in6_addr *addr, guint32 prefix_len);
465 
466 /* Fetch a GUID. */
467 WS_DLL_PUBLIC void tvb_get_ntohguid(tvbuff_t *tvb, const gint offset,
468  e_guid_t *guid);
469 
470 WS_DLL_PUBLIC void tvb_get_letohguid(tvbuff_t *tvb, const gint offset,
471  e_guid_t *guid);
472 
473 WS_DLL_PUBLIC void tvb_get_guid(tvbuff_t *tvb, const gint offset,
474  e_guid_t *guid, const guint encoding);
475 
476 /* Fetches a byte array given a bit offset in a tvb */
477 WS_DLL_PUBLIC guint8* tvb_get_bits_array(wmem_allocator_t *scope, tvbuff_t *tvb,
478  const gint offset, size_t length, size_t *data_length, const guint encoding);
479 
480 /* Fetch a specified number of bits from bit offset in a tvb. All of these
481  * functions are equivalent, except for the type of the return value. Note
482  * that the parameter encoding (where supplied) is meaningless and ignored */
483 
484 /* get 1 - 8 bits returned in a guint8 */
485 WS_DLL_PUBLIC guint8 tvb_get_bits8(tvbuff_t *tvb, guint bit_offset,
486  const gint no_of_bits);
487 
488 /* get 1 - 16 bits returned in a guint16 */
489 WS_DLL_PUBLIC guint16 tvb_get_bits16(tvbuff_t *tvb, guint bit_offset,
490  const gint no_of_bits, const guint encoding);
491 
492 /* get 1 - 32 bits returned in a guint32 */
493 WS_DLL_PUBLIC guint32 tvb_get_bits32(tvbuff_t *tvb, guint bit_offset,
494  const gint no_of_bits, const guint encoding);
495 
496 /* get 1 - 64 bits returned in a guint64 */
497 WS_DLL_PUBLIC guint64 tvb_get_bits64(tvbuff_t *tvb, guint bit_offset,
498  const gint no_of_bits, const guint encoding);
499 
504 WS_DLL_PUBLIC guint32 tvb_get_bits(tvbuff_t *tvb, const guint bit_offset,
505  const gint no_of_bits, const guint encoding);
506 
513 WS_DLL_PUBLIC void *tvb_memcpy(tvbuff_t *tvb, void *target, const gint offset,
514  size_t length);
515 
531 WS_DLL_PUBLIC void *tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb,
532  const gint offset, size_t length);
533 
559 WS_DLL_PUBLIC const guint8 *tvb_get_ptr(tvbuff_t *tvb, const gint offset,
560  const gint length);
561 
569 WS_DLL_PUBLIC gint tvb_find_guint8(tvbuff_t *tvb, const gint offset,
570  const gint maxlength, const guint8 needle);
571 
573 WS_DLL_PUBLIC gint tvb_find_guint16(tvbuff_t *tvb, const gint offset,
574  const gint maxlength, const guint16 needle);
575 
584 WS_DLL_PUBLIC gint tvb_ws_mempbrk_pattern_guint8(tvbuff_t *tvb, const gint offset,
585  const gint maxlength, const ws_mempbrk_pattern* pattern, guchar *found_needle);
586 
587 
593 WS_DLL_PUBLIC guint tvb_strsize(tvbuff_t *tvb, const gint offset);
594 
601 WS_DLL_PUBLIC guint tvb_unicode_strsize(tvbuff_t *tvb, const gint offset);
602 
607 WS_DLL_PUBLIC gint tvb_strnlen(tvbuff_t *tvb, const gint offset,
608  const guint maxlength);
609 
613 WS_DLL_PUBLIC gchar *tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
614  const gint size);
615 
620 WS_DLL_PUBLIC gchar *tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const gint offset,
621  const gint size);
622 
627 extern gchar *tvb_format_stringzpad(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
628  const gint size);
629 
634 extern gchar *tvb_format_stringzpad_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const gint offset,
635  const gint size);
636 
657 WS_DLL_PUBLIC guint8 *tvb_get_string_enc(wmem_allocator_t *scope,
658  tvbuff_t *tvb, const gint offset, const gint length, const guint encoding);
659 
681 WS_DLL_PUBLIC gchar *tvb_get_ts_23_038_7bits_string_packed(wmem_allocator_t *scope,
682  tvbuff_t *tvb, const gint bit_offset, gint no_of_chars);
683 
706  tvbuff_t *tvb, const gint offset, gint length);
707 
728 WS_DLL_PUBLIC gchar *tvb_get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope,
729  tvbuff_t *tvb, const gint offset, gint length);
730 
751 WS_DLL_PUBLIC gchar *tvb_get_ascii_7bits_string(wmem_allocator_t *scope,
752  tvbuff_t *tvb, const gint bit_offset, gint no_of_chars);
753 
774 WS_DLL_PUBLIC guint8 *tvb_get_stringzpad(wmem_allocator_t *scope,
775  tvbuff_t *tvb, const gint offset, const gint length, const guint encoding);
776 
803 WS_DLL_PUBLIC guint8 *tvb_get_stringz_enc(wmem_allocator_t *scope,
804  tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding);
805 
830 WS_DLL_PUBLIC
831 WS_DEPRECATED_X("Use APIs that return a valid UTF-8 string instead")
832 const guint8 *tvb_get_const_stringz(tvbuff_t *tvb,
833  const gint offset, gint *lengthp);
834 
844 WS_DLL_PUBLIC gint tvb_get_raw_bytes_as_stringz(tvbuff_t *tvb, const gint offset,
845  const guint bufsize, guint8 *buffer);
846 
847 /*
848  * Given a tvbuff, an offset into the tvbuff, a buffer, and a buffer size,
849  * extract as many raw bytes from the tvbuff, starting at the offset,
850  * as 1) are available in the tvbuff and 2) will fit in the buffer, leaving
851  * room for a terminating NUL.
852  */
853 WS_DLL_PUBLIC gint tvb_get_raw_bytes_as_string(tvbuff_t *tvb, const gint offset, char *buffer, size_t bufsize);
854 
859 WS_DLL_PUBLIC gboolean tvb_ascii_isprint(tvbuff_t *tvb, const gint offset,
860  const gint length);
861 
871 WS_DLL_PUBLIC gboolean tvb_utf_8_isprint(tvbuff_t *tvb, const gint offset,
872  const gint length);
873 
878 WS_DLL_PUBLIC gboolean tvb_ascii_isdigit(tvbuff_t *tvb, const gint offset,
879  const gint length);
880 
900 WS_DLL_PUBLIC gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len,
901  gint *next_offset, const gboolean desegment);
902 
921 WS_DLL_PUBLIC gint tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset,
922  int len, gint *next_offset);
923 
941 WS_DLL_PUBLIC gint tvb_skip_wsp(tvbuff_t *tvb, const gint offset,
942  const gint maxlength);
943 
944 WS_DLL_PUBLIC gint tvb_skip_wsp_return(tvbuff_t *tvb, const gint offset);
945 
946 int tvb_skip_guint8(tvbuff_t *tvb, int offset, const int maxlength, const guint8 ch);
947 
966 WS_DLL_PUBLIC int tvb_get_token_len(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment);
967 
972 WS_DLL_PUBLIC gint tvb_strneql(tvbuff_t *tvb, const gint offset,
973  const gchar *str, const size_t size);
974 
979 WS_DLL_PUBLIC gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset,
980  const gchar *str, const size_t size);
981 
986 WS_DLL_PUBLIC gint tvb_memeql(tvbuff_t *tvb, const gint offset,
987  const guint8 *str, size_t size);
988 
994 WS_DLL_PUBLIC gchar *tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
995  const gint len, const gchar punct);
996 
1001 WS_DLL_PUBLIC gchar *tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb,
1002  const gint offset, const gint len);
1003 
1014 typedef struct dgt_set_t
1015 {
1016  const unsigned char out[16];
1017 }
1019 
1020 WS_DLL_PUBLIC const gchar *tvb_bcd_dig_to_str(wmem_allocator_t *scope,
1021  tvbuff_t *tvb, const gint offset, const gint len, const dgt_set_t *dgt,
1022  gboolean skip_first);
1023 
1035 WS_DLL_PUBLIC const gchar *tvb_bcd_dig_to_str_be(wmem_allocator_t *scope,
1036  tvbuff_t *tvb, const gint offset, const gint len, const dgt_set_t *dgt,
1037  gboolean skip_first);
1038 
1054 WS_DLL_PUBLIC gchar *tvb_get_bcd_string(wmem_allocator_t *scope, tvbuff_t *tvb,
1055  const gint offset, gint len, const dgt_set_t *dgt,
1056  gboolean skip_first, gboolean odd, gboolean bigendian);
1057 
1062 WS_DLL_PUBLIC gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
1063  const gint haystack_offset);
1064 
1065 /* From tvbuff_zlib.c */
1066 
1076 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress(tvbuff_t *tvb, const int offset,
1077  int comprlen);
1078 
1084 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb,
1085  const int offset, int comprlen);
1086 
1087 /* From tvbuff_brotli.c */
1088 
1098 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_brotli(tvbuff_t *tvb, const int offset,
1099  int comprlen);
1100 
1106 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_brotli(tvbuff_t *parent, tvbuff_t *tvb,
1107  const int offset, int comprlen);
1108 
1109 /* From tvbuff_snappy.c */
1110 
1116 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_snappy(tvbuff_t *tvb, const int offset,
1117  int comprlen);
1118 
1124 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb,
1125  const int offset, int comprlen);
1126 
1127 /* From tvbuff_lz77.c */
1128 
1139 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77(tvbuff_t *tvb,
1140  const int offset, int comprlen);
1141 
1148 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77(tvbuff_t *parent,
1149  tvbuff_t *tvb, const int offset, int comprlen);
1150 
1151 /* From tvbuff_lz77huff.c */
1152 
1163 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lz77huff(tvbuff_t *tvb,
1164  const int offset, int comprlen);
1165 
1172 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lz77huff(tvbuff_t *parent,
1173  tvbuff_t *tvb, const int offset, int comprlen);
1174 
1175 /* From tvbuff_lznt1.c */
1176 
1187 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_lznt1(tvbuff_t *tvb,
1188  const int offset, int comprlen);
1189 
1196 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_lznt1(tvbuff_t *parent,
1197  tvbuff_t *tvb, const int offset, int comprlen);
1198 
1209 WS_DLL_PUBLIC tvbuff_t *tvb_uncompress_zstd(tvbuff_t *tvb,
1210  const int offset, int comprlen);
1211 
1218 WS_DLL_PUBLIC tvbuff_t *tvb_child_uncompress_zstd(tvbuff_t *parent,
1219  tvbuff_t *tvb, const int offset, int comprlen);
1220 
1221 /* From tvbuff_base64.c */
1222 
1232 extern tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
1233 
1234 
1244 extern tvbuff_t* base64_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
1245 
1246 extern tvbuff_t* base64uri_tvb_to_new_tvb(tvbuff_t* parent, int offset, int length);
1247 
1248 /* From tvbuff_hpackhuff.c */
1249 
1250 WS_DLL_PUBLIC wmem_strbuf_t* tvb_get_hpack_huffman_strbuf(wmem_allocator_t *scope,
1251  tvbuff_t *tvb, const int offset, const int len);
1252 
1253 WS_DLL_PUBLIC tvbuff_t* tvb_child_uncompress_hpack_huff(tvbuff_t *parent,
1254  int offset, int length);
1255 
1269 WS_DLL_PUBLIC guint tvb_get_varint(tvbuff_t *tvb, guint offset, guint maxlen, guint64 *value, const guint encoding);
1270 
1271 /************** END OF ACCESSORS ****************/
1272 
1275 #ifdef __cplusplus
1276 }
1277 #endif /* __cplusplus */
1278 
1279 #endif /* __TVBUFF_H__ */
1280 
1281 /*
1282  * Editor modelines - https://www.wireshark.org/tools/modelines.html
1283  *
1284  * Local variables:
1285  * c-basic-offset: 4
1286  * tab-width: 8
1287  * indent-tabs-mode: nil
1288  * End:
1289  *
1290  * vi: set shiftwidth=4 tabstop=8 expandtab:
1291  * :indentSize=4:tabSize=8:noTabs=true:
1292  */
WS_DLL_PUBLIC guint tvb_strsize(tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:2564
WS_DLL_PUBLIC guint tvb_ensure_reported_length_remaining(const tvbuff_t *tvb, const gint offset)
Definition: tvbuff.c:775
WS_DLL_PUBLIC tvbuff_t * tvb_child_uncompress_snappy(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comprlen)
Definition: tvbuff_snappy.c:66
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:4567
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:2615
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:4718
gchar * tvb_format_stringzpad_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2774
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:3020
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
int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset, ws_in4_addr *addr, guint32 prefix_len)
Definition: tvbuff.c:2070
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:4064
WS_DLL_PUBLIC gint tvb_memeql(tvbuff_t *tvb, const gint offset, const guint8 *str, size_t size)
Definition: tvbuff.c:2698
WS_DLL_PUBLIC gchar * tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint len)
Definition: tvbuff.c:4671
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:4545
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:4474
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:3731
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:3006
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:3599
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:2439
int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int offset, ws_in6_addr *addr, guint32 prefix_len)
Definition: tvbuff.c:2091
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:4659
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:2400
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:3032
WS_DLL_PUBLIC gchar * tvb_format_text(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2724
WS_DLL_PUBLIC tvbuff_t * tvb_uncompress_snappy(tvbuff_t *tvb, const int offset, int comprlen)
WS_DLL_PUBLIC gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
Definition: tvbuff.c:2670
WS_DLL_PUBLIC gint tvb_strneql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
Definition: tvbuff.c:2643
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:2520
WS_DLL_PUBLIC gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, const gint haystack_offset)
Definition: tvbuff.c:4680
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:4015
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:3234
WS_DLL_PUBLIC gchar * tvb_format_text_wsp(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint size)
Definition: tvbuff.c:2739
WS_DLL_PUBLIC gint tvb_skip_wsp(tvbuff_t *tvb, const gint offset, const gint maxlength)
Definition: tvbuff.c:4402
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:4130
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:4730
WS_DLL_PUBLIC gboolean tvb_utf_8_isprint(tvbuff_t *tvb, const gint offset, const gint length)
Definition: tvbuff.c:4080
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:3500
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:4253
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:3044
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:4093
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:2594
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:2755
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:2370
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: wmem_strbuf.h:42
Definition: mcast_stream.h:30
Definition: tvbuff.h:1015
Definition: inet_addr.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