| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
drange.h
Go to the documentation of this file.
1
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
26 typedef enum {
27 DRANGE_NODE_END_T_UNINITIALIZED,
28 DRANGE_NODE_END_T_LENGTH,
29 DRANGE_NODE_END_T_OFFSET,
30 DRANGE_NODE_END_T_TO_THE_END
31} drange_node_end_t;
32
33 typedef struct _drange_node {
34 int start_offset;
35 int length;
36 int end_offset;
37 drange_node_end_t ending;
38} drange_node;
39
40 typedef struct _drange {
41 GSList* range_list;
42 bool has_total_length;
43 int total_length;
44 int min_start_offset;
45 int max_start_offset;
46} drange_t;
47
48/* drange_node constructor */
49
55 drange_node* drange_node_new(void);
56
57/* drange_node constructor */
58
66 drange_node* drange_node_from_str(const char *range_str, char **err_ptr);
67
68/* drange_node destructor */
69
75 void drange_node_free(drange_node* drnode);
76
77/* Call drange_node destructor on all list items */
83 void drange_node_free_list(GSList* list);
84
85/* drange_node accessors */
86
93 int drange_node_get_start_offset(drange_node* drnode);
100 int drange_node_get_length(drange_node* drnode);
101
108 int drange_node_get_end_offset(drange_node* drnode);
109
116drange_node_end_t drange_node_get_ending(drange_node* drnode);
117
118/* drange_node mutators */
119
126 void drange_node_set_start_offset(drange_node* drnode, int offset);
127
134 void drange_node_set_length(drange_node* drnode, int length);
135
142 void drange_node_set_end_offset(drange_node* drnode, int offset);
143
149 void drange_node_set_to_the_end(drange_node* drnode);
150
157 drange_t * drange_new(drange_node* drnode);
158
165 drange_t * drange_new_from_list(GSList *list);
166
173 drange_t * drange_dup(drange_t *org);
174
180 void drange_free(drange_t* dr);
181
182/* drange accessors */
183
190 bool drange_has_total_length(drange_t* dr);
191
198 int drange_get_total_length(drange_t* dr);
199
206 int drange_get_min_start_offset(drange_t* dr);
207
214 int drange_get_max_start_offset(drange_t* dr);
215
216/* drange mutators */
217
224 void drange_append_drange_node(drange_t* dr, drange_node* drnode);
225
232 void drange_prepend_drange_node(drange_t* dr, drange_node* drnode);
233
241 void drange_foreach_drange_node(drange_t* dr, GFunc func, void *funcdata);
242
250 char *drange_node_tostr(const drange_node *rn);
251
259 char *drange_tostr(const drange_t *dr);
260
261#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_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_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_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
Definition drange.h:33
_drange
Definition drange.h:40