| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
drange.h
Go to the documentation of this file.
1
12
13#ifndef __DRANGE_H__
14#define __DRANGE_H__
15
16#include <wireshark.h>
17
18/* Please don't directly manipulate these structs. Please use
19 * the methods provided. If you REALLY can't do what you need to
20 * do with the methods provided please write new methods that do
21 * what you need, put them into the drange object here, and limit
22 * your direct manipulation of the drange and drange_node structs to
23 * here.
24 */
25
29 typedef enum {
30 DRANGE_NODE_END_T_UNINITIALIZED,
31 DRANGE_NODE_END_T_LENGTH,
32 DRANGE_NODE_END_T_OFFSET,
33 DRANGE_NODE_END_T_TO_THE_END
34} drange_node_end_t;
35
36
40 typedef struct _drange_node {
41 int start_offset;
42 int length;
43 int end_offset;
44 drange_node_end_t ending;
45} drange_node;
46
47
51 typedef struct _drange {
52 GSList *range_list;
53 bool has_total_length;
54 int total_length;
55 int min_start_offset;
56 int max_start_offset;
57} drange_t;
58
59/* drange_node constructor */
60
66 drange_node* drange_node_new(void);
67
68/* drange_node constructor */
69
77 drange_node* drange_node_from_str(const char *range_str, char **err_ptr);
78
79/* drange_node destructor */
80
86 void drange_node_free(drange_node* drnode);
87
88/* Call drange_node destructor on all list items */
94 void drange_node_free_list(GSList* list);
95
96/* drange_node accessors */
97
104 int drange_node_get_start_offset(drange_node* drnode);
111 int drange_node_get_length(drange_node* drnode);
112
119 int drange_node_get_end_offset(drange_node* drnode);
120
127 drange_node_end_t drange_node_get_ending(drange_node* drnode);
128
129/* drange_node mutators */
130
137 void drange_node_set_start_offset(drange_node* drnode, int offset);
138
145 void drange_node_set_length(drange_node* drnode, int length);
146
153 void drange_node_set_end_offset(drange_node* drnode, int offset);
154
160 void drange_node_set_to_the_end(drange_node* drnode);
161
168 drange_t * drange_new(drange_node* drnode);
169
176 drange_t * drange_new_from_list(GSList *list);
177
184 drange_t * drange_dup(drange_t *org);
185
191 void drange_free(drange_t* dr);
192
193/* drange accessors */
194
201 bool drange_has_total_length(drange_t* dr);
202
209 int drange_get_total_length(drange_t* dr);
210
217 int drange_get_min_start_offset(drange_t* dr);
218
225 int drange_get_max_start_offset(drange_t* dr);
226
227/* drange mutators */
228
235 void drange_append_drange_node(drange_t* dr, drange_node* drnode);
236
243 void drange_prepend_drange_node(drange_t* dr, drange_node* drnode);
244
252 void drange_foreach_drange_node(drange_t* dr, GFunc func, void *funcdata);
253
260
261 char *drange_node_tostr(const drange_node *rn);
262
269
270 char *drange_tostr(const drange_t *dr);
271
272#endif /* ! __DRANGE_H__ */
drange_tostr
char * drange_tostr(const drange_t *dr)
Convert a drange_t structure to its string representation.
Definition drange.c:376
drange_new_from_list
drange_t * drange_new_from_list(GSList *list)
Create a new drange_t from a GSList of ranges.
Definition drange.c:272
drange_node_get_end_offset
int drange_node_get_end_offset(drange_node *drnode)
Get the end offset of a drange_node.
Definition drange.c:203
drange_node_tostr
char * drange_node_tostr(const drange_node *rn)
Convert a drange_node to its string representation.
Definition drange.c:363
drange_node_set_end_offset
void drange_node_set_end_offset(drange_node *drnode, int offset)
Set the end offset of a drange_node.
Definition drange.c:231
drange_node_get_start_offset
int drange_node_get_start_offset(drange_node *drnode)
Get the start offset of a drange_node.
Definition drange.c:189
drange_node_set_length
void drange_node_set_length(drange_node *drnode, int length)
Set the length of a drange node.
Definition drange.c:224
drange_get_min_start_offset
int drange_get_min_start_offset(drange_t *dr)
Get the minimum start offset of a drange.
Definition drange.c:317
drange_foreach_drange_node
void drange_foreach_drange_node(drange_t *dr, GFunc func, void *funcdata)
Iterates over each node in a drange_t structure and applies a function to it.
Definition drange.c:357
drange_node_new
drange_node * drange_node_new(void)
Creates a new empty drange_node.
Definition drange.c:22
drange_has_total_length
bool drange_has_total_length(drange_t *dr)
Check if the drange has a total length.
Definition drange.c:315
drange_node_free
void drange_node_free(drange_node *drnode)
Frees a drange_node structure.
Definition drange.c:182
drange_new
drange_t * drange_new(drange_node *drnode)
Creates a new drange_t object.
Definition drange.c:246
drange_node_free_list
void drange_node_free_list(GSList *list)
Frees all elements in the provided GSList.
Definition drange.c:309
drange_t
struct _drange drange_t
A display filter range composed of one or more drange_node slices.
drange_node_get_ending
drange_node_end_t drange_node_get_ending(drange_node *drnode)
Get the ending type of a drange_node.
Definition drange.c:210
drange_node_get_length
int drange_node_get_length(drange_node *drnode)
Get the length of a drange_node.
Definition drange.c:196
drange_free
void drange_free(drange_t *dr)
Frees a drange_t structure and all its associated resources.
Definition drange.c:301
drange_node_end_t
drange_node_end_t
Discriminator tag describing how the end boundary of a drange_node is expressed.
Definition drange.h:29
DRANGE_NODE_END_T_OFFSET
@ DRANGE_NODE_END_T_OFFSET
Definition drange.h:32
DRANGE_NODE_END_T_TO_THE_END
@ DRANGE_NODE_END_T_TO_THE_END
Definition drange.h:33
DRANGE_NODE_END_T_LENGTH
@ DRANGE_NODE_END_T_LENGTH
Definition drange.h:31
DRANGE_NODE_END_T_UNINITIALIZED
@ DRANGE_NODE_END_T_UNINITIALIZED
Definition drange.h:30
drange_prepend_drange_node
void drange_prepend_drange_node(drange_t *dr, drange_node *drnode)
Prepends a drange_node to the beginning of a drange_t.
Definition drange.c:339
drange_node_set_start_offset
void drange_node_set_start_offset(drange_node *drnode, int offset)
Set the start offset of a drange_node.
Definition drange.c:218
drange_get_total_length
int drange_get_total_length(drange_t *dr)
Get the total length of a drange.
Definition drange.c:316
drange_node_set_to_the_end
void drange_node_set_to_the_end(drange_node *drnode)
Sets the drange_node to the end.
Definition drange.c:239
drange_node_from_str
drange_node * drange_node_from_str(const char *range_str, char **err_ptr)
Creates a new drange_node from a string representation.
Definition drange.c:56
drange_node
struct _drange_node drange_node
A single contiguous slice within a display filter range expression.
drange_dup
drange_t * drange_dup(drange_t *org)
Creates a duplicate of the given drange_t.
Definition drange.c:282
drange_append_drange_node
void drange_append_drange_node(drange_t *dr, drange_node *drnode)
Appends a drange_node to the end of a drange_t.
Definition drange.c:348
drange_get_max_start_offset
int drange_get_max_start_offset(drange_t *dr)
Get the maximum start offset of a drange.
Definition drange.c:318
_drange_node
A single contiguous slice within a display filter range expression.
Definition drange.h:40
_drange_node::length
int length
Definition drange.h:42
_drange_node::end_offset
int end_offset
Definition drange.h:43
_drange_node::start_offset
int start_offset
Definition drange.h:41
_drange_node::ending
drange_node_end_t ending
Definition drange.h:44
_drange
A display filter range composed of one or more drange_node slices.
Definition drange.h:51
_drange::total_length
int total_length
Definition drange.h:54
_drange::max_start_offset
int max_start_offset
Definition drange.h:56
_drange::has_total_length
bool has_total_length
Definition drange.h:53
_drange::range_list
GSList * range_list
Definition drange.h:52
_drange::min_start_offset
int min_start_offset
Definition drange.h:55