Wireshark  4.3.0
The Wireshark network protocol analyzer
packet_range.h
Go to the documentation of this file.
1 
15 #ifndef __PACKET_RANGE_H__
16 #define __PACKET_RANGE_H__
17 
18 #include <glib.h>
19 
20 #include <epan/range.h>
21 #include <epan/frame_data.h>
22 
23 #include "cfile.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 
29 extern uint32_t curr_selected_frame;
30 
31 typedef enum {
32  range_process_all,
33  range_process_selected,
34  range_process_marked,
35  range_process_marked_range,
36  range_process_user_range
37 } packet_range_e;
38 
39 typedef struct packet_range_tag {
40  /* values coming from the UI */
41  packet_range_e process; /* which range to process */
42  bool process_filtered; /* captured or filtered packets */
43  bool remove_ignored; /* remove ignored packets */
44  bool include_dependents; /* True if packets which are dependents of others should be processed */
45 
46  /* user specified range(s) and, if null, error status */
47  range_t *user_range;
48  convert_ret_t user_range_status;
49 
50  /* calculated values */
51  range_t *selection_range; /* the currently selected packets */
52  convert_ret_t selection_range_status;
53 
54  /* current packet counts (captured) */
55  capture_file *cf; /* Associated capture file. */
56  uint32_t mark_range_cnt; /* packets in marked range */
57  uint32_t user_range_cnt; /* packets in user specified range */
58  uint32_t selection_range_cnt; /* packets in the selected range */
59  uint32_t marked_plus_depends_cnt;
60  uint32_t mark_range_plus_depends_cnt;
61  uint32_t user_range_plus_depends_cnt;
62  uint32_t selected_plus_depends_cnt;
63  uint32_t ignored_cnt; /* packets ignored */
64  uint32_t ignored_marked_cnt; /* packets ignored and marked */
65  uint32_t ignored_mark_range_cnt; /* packets ignored in marked range */
66  uint32_t ignored_user_range_cnt; /* packets ignored in user specified range */
67  uint32_t ignored_selection_range_cnt; /* packets ignored in the selected range */
68 
69  /* current packet counts (displayed) */
70  uint32_t displayed_cnt;
71  uint32_t displayed_plus_dependents_cnt;
72  uint32_t displayed_marked_cnt;
73  uint32_t displayed_mark_range_cnt;
74  uint32_t displayed_user_range_cnt;
75  uint32_t displayed_marked_plus_depends_cnt;
76  uint32_t displayed_mark_range_plus_depends_cnt;
77  uint32_t displayed_user_range_plus_depends_cnt;
78  uint32_t displayed_selection_range_cnt;
79  uint32_t displayed_selected_plus_depends_cnt;
80  uint32_t displayed_ignored_cnt;
81  uint32_t displayed_ignored_marked_cnt;
82  uint32_t displayed_ignored_mark_range_cnt;
83  uint32_t displayed_ignored_user_range_cnt;
84  uint32_t displayed_ignored_selection_range_cnt;
85 
86  /* Sets of the chosen frames plus any they depend on for each case */
87  GHashTable *marked_plus_depends;
88  GHashTable *displayed_marked_plus_depends;
89  GHashTable *mark_range_plus_depends;
90  GHashTable *displayed_mark_range_plus_depends;
91  GHashTable *user_range_plus_depends;
92  GHashTable *displayed_user_range_plus_depends;
93  GHashTable *selected_plus_depends;
94  GHashTable *displayed_selected_plus_depends;
95 
96  /* "enumeration" values */
97  bool marked_range_active; /* marked range is currently processed */
98  uint32_t marked_range_left; /* marked range packets left to do */
100 
101 typedef enum {
102  range_process_this, /* process this packet */
103  range_process_next, /* skip this packet, process next */
104  range_processing_finished /* stop processing, required packets done */
105 } range_process_e;
106 
107 /* init the range structure */
108 extern void packet_range_init(packet_range_t *range, capture_file *cf);
109 
110 /* Cleanup the range structure before the caller frees "range". */
111 extern void packet_range_cleanup(packet_range_t *range);
112 
113 /* check whether the packet range is OK */
114 extern convert_ret_t packet_range_check(packet_range_t *range);
115 
116 /* init the processing run */
117 extern void packet_range_process_init(packet_range_t *range);
118 
119 /* do we have to process all packets? */
120 extern bool packet_range_process_all(packet_range_t *range);
121 
122 /* do we have to process this packet? */
123 extern range_process_e packet_range_process_packet(packet_range_t *range, frame_data *fdata);
124 
125 /* convert user given string to the internal user specified range representation */
126 extern void packet_range_convert_str(packet_range_t *range, const char *es);
127 
128 /* convert user given string to the internal selection specified range representation */
129 extern void packet_range_convert_selection_str(packet_range_t *range, const char *es);
130 
131 /* return the number of packets that will be processed.
132  */
133 extern uint32_t packet_range_count(const packet_range_t *range);
134 #ifdef __cplusplus
135 }
136 #endif /* __cplusplus */
137 
138 #endif /* __PACKET_RANGE_H__ */
convert_ret_t
Definition: range.h:50
Definition: cfile.h:67
Definition: range.h:42
Definition: packet_range.h:39