| 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
26typedef 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 drange_node* drange_node_new(void);
50
51/* drange_node constructor */
52 drange_node* drange_node_from_str(const char *range_str, char **err_ptr);
53
54/* drange_node destructor */
55void drange_node_free(drange_node* drnode);
56
57/* Call drange_node destructor on all list items */
58void drange_node_free_list(GSList* list);
59
60/* drange_node accessors */
61int drange_node_get_start_offset(drange_node* drnode);
62int drange_node_get_length(drange_node* drnode);
63int drange_node_get_end_offset(drange_node* drnode);
64drange_node_end_t drange_node_get_ending(drange_node* drnode);
65
66/* drange_node mutators */
67void drange_node_set_start_offset(drange_node* drnode, int offset);
68void drange_node_set_length(drange_node* drnode, int length);
69void drange_node_set_end_offset(drange_node* drnode, int offset);
70void drange_node_set_to_the_end(drange_node* drnode);
71
72/* drange constructor */
73 drange_t * drange_new(drange_node* drnode);
74 drange_t * drange_new_from_list(GSList *list);
75 drange_t * drange_dup(drange_t *org);
76
77/* drange destructor, only use this if you used drange_new() to creat
78 * the drange
79 */
80void drange_free(drange_t* dr);
81
82/* drange accessors */
83bool drange_has_total_length(drange_t* dr);
84int drange_get_total_length(drange_t* dr);
85int drange_get_min_start_offset(drange_t* dr);
86int drange_get_max_start_offset(drange_t* dr);
87
88/* drange mutators */
89void drange_append_drange_node(drange_t* dr, drange_node* drnode);
90void drange_prepend_drange_node(drange_t* dr, drange_node* drnode);
91void drange_foreach_drange_node(drange_t* dr, GFunc func, void *funcdata);
92
93char *drange_node_tostr(const drange_node *rn);
94
95char *drange_tostr(const drange_t *dr);
96
97#endif /* ! __DRANGE_H__ */
_drange_node
Definition drange.h:33
_drange
Definition drange.h:40