Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

drange.h
1 /* drange.h
2 * Routines for providing general range support to the dfilter library
3 *
4 * Copyright (c) 2000 by Ed Warnicke <hagbard@physics.rutgers.edu>
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs
8 * Copyright 1999 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12 #ifndef __DRANGE_H__
13 #define __DRANGE_H__
14
15 #include <glib.h>
16 #include "ws_symbol_export.h"
17 #include "ws_attributes.h"
18
19 /* Please don't directly manipulate these structs. Please use
20 * the methods provided. If you REALLY can't do what you need to
21 * do with the methods provided please write new methods that do
22 * what you need, put them into the drange object here, and limit
23 * your direct manipulation of the drange and drange_node structs to
24 * here.
25 */
26
27 typedef enum {
28 DRANGE_NODE_END_T_UNINITIALIZED,
29 DRANGE_NODE_END_T_LENGTH,
30 DRANGE_NODE_END_T_OFFSET,
31 DRANGE_NODE_END_T_TO_THE_END
32 } drange_node_end_t;
33
34 typedef struct _drange_node {
35 gint start_offset;
36 gint length;
37 gint end_offset;
38 drange_node_end_t ending;
39 } drange_node;
40
41 typedef struct _drange {
42 GSList* range_list;
43 gboolean has_total_length;
44 gint total_length;
45 gint min_start_offset;
46 gint max_start_offset;
47 } drange_t;
48
49 /* drange_node constructor */
50 drange_node* drange_node_new(void);
51
52 /* drange_node destructor */
53 void drange_node_free(drange_node* drnode);
54
55 /* Call drange_node destructor on all list items */
56 void drange_node_free_list(GSList* list);
57
58 /* drange_node accessors */
59 gint drange_node_get_start_offset(drange_node* drnode);
60 gint drange_node_get_length(drange_node* drnode);
61 gint drange_node_get_end_offset(drange_node* drnode);
62 drange_node_end_t drange_node_get_ending(drange_node* drnode);
63
64 /* drange_node mutators */
65 void drange_node_set_start_offset(drange_node* drnode, gint offset);
66 void drange_node_set_length(drange_node* drnode, gint length);
67 void drange_node_set_end_offset(drange_node* drnode, gint offset);
68 void drange_node_set_to_the_end(drange_node* drnode);
69
70 /* drange constructor */
71 drange_t * drange_new(void);
72 drange_t * drange_new_from_list(GSList *list);
73 drange_t * drange_dup(drange_t *org);
74
75 /* drange destructor, only use this if you used drange_new() to creat
76 * the drange
77 */
78 void drange_free(drange_t* dr);
79
80 /* drange accessors */
81 gboolean drange_has_total_length(drange_t* dr);
82 gint drange_get_total_length(drange_t* dr);
83 gint drange_get_min_start_offset(drange_t* dr);
84 gint drange_get_max_start_offset(drange_t* dr);
85
86 /* drange mutators */
87 void drange_append_drange_node(drange_t* dr, drange_node* drnode);
88 void drange_prepend_drange_node(drange_t* dr, drange_node* drnode);
89 void drange_foreach_drange_node(drange_t* dr, GFunc func, gpointer funcdata);
90
91 #endif /* ! __DRANGE_H__ */
_drange_node
Definition: drange.h:34
_drange
Definition: drange.h:41