Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
tvbuff-int.h
Go to the documentation of this file.
1
12#ifndef __TVBUFF_INT_H__
13#define __TVBUFF_INT_H__
14
15struct tvbuff;
16
17struct tvb_ops {
18 size_t tvb_size;
19 void (*tvb_free)(struct tvbuff *tvb);
20 unsigned (*tvb_offset)(const struct tvbuff *tvb, unsigned counter);
21 const uint8_t *(*tvb_get_ptr)(struct tvbuff *tvb, unsigned abs_offset, unsigned abs_length);
22 void *(*tvb_memcpy)(struct tvbuff *tvb, void *target, unsigned offset, unsigned length);
23
24 bool (*tvb_find_uint8)(tvbuff_t *tvb, unsigned abs_offset, unsigned limit, uint8_t needle, unsigned *found_offset);
25 bool (*tvb_ws_mempbrk_pattern_uint8)(tvbuff_t *tvb, unsigned abs_offset, unsigned limit, const ws_mempbrk_pattern* pattern, unsigned *found_offset, unsigned char *found_needle);
26
27 tvbuff_t *(*tvb_clone)(tvbuff_t *tvb, unsigned abs_offset, unsigned abs_length);
28};
29
30/*
31 * Tvbuff flags.
32 */
33#define TVBUFF_FRAGMENT 0x00000001 /* this is a fragment */
34#define TVBUFF_RAW_OFFSET 0x00000002 /* raw_offset has been set */
35
36struct tvbuff {
37 /* Doubly linked list pointers */
38 tvbuff_t *next;
39
40 /* Record-keeping */
41 const struct tvb_ops *ops;
42 bool initialized;
43 unsigned flags;
44 struct tvbuff *ds_tvb;
53 const uint8_t *real_data;
54
62 unsigned length;
63
69
85
86 /* Offset from beginning of first "real" tvbuff.
87 * This is calculated lazily. (XXX - Does it need to be?) */
88 unsigned raw_offset;
89};
90
91tvbuff_t *tvb_new(const struct tvb_ops *ops);
92
93tvbuff_t *tvb_new_proxy(tvbuff_t *backing);
94
95void tvb_add_to_chain(tvbuff_t *parent, tvbuff_t *child);
96
97unsigned tvb_offset_from_real_beginning_counter(const tvbuff_t *tvb, const unsigned counter);
98
99void tvb_validate_offset_length(const tvbuff_t *tvb, const unsigned offset, const unsigned length);
100void tvb_validate_offset_and_remaining(const tvbuff_t *tvb, const unsigned offset, unsigned *rem_len);
101
102void tvb_check_offset_length(const tvbuff_t *tvb, const int offset, int const length_val, unsigned *offset_ptr, unsigned *length_ptr);
103#endif
int tvb_ws_mempbrk_pattern_uint8(tvbuff_t *tvb, const unsigned offset, const int maxlength, const ws_mempbrk_pattern *pattern, unsigned char *found_needle)
Find the first occurrence of any needle from a pre-compiled pattern in a tvbuff.
Definition tvbuff.c:2839
int tvb_find_uint8(tvbuff_t *tvb, const unsigned offset, const int maxlength, const uint8_t needle)
Find the first occurrence of a byte value in a tvbuff.
Definition tvbuff.c:2597
Definition tvbuff-int.h:17
Definition tvbuff-int.h:36
unsigned length
Definition tvbuff-int.h:62
unsigned reported_length
Definition tvbuff-int.h:68
const uint8_t * real_data
Definition tvbuff-int.h:53
unsigned contained_length
Definition tvbuff-int.h:84
struct tvbuff * ds_tvb
Definition tvbuff-int.h:44
Definition ws_mempbrk.h:21