package dissectors
[wireshark-sm.git] / ui / packet_range.h
blob70727db4aeb0e54fb7e7f6e89abf8cfd1c27a4d1
1 /** @file
3 * Packet range routines (save, print, ...)
5 * Dick Gooris <gooris@lucent.com>
6 * Ulf Lamping <ulf.lamping@web.de>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #ifndef __PACKET_RANGE_H__
16 #define __PACKET_RANGE_H__
18 #include <glib.h>
20 #include <epan/range.h>
21 #include <epan/frame_data.h>
23 #include "cfile.h"
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
29 extern uint32_t curr_selected_frame;
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;
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 */
46 /* user specified range(s) and, if null, error status */
47 range_t *user_range;
48 convert_ret_t user_range_status;
50 /* calculated values */
51 range_t *selection_range; /* the currently selected packets */
52 convert_ret_t selection_range_status;
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 */
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;
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;
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 */
99 } packet_range_t;
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;
107 /* init the range structure */
108 extern void packet_range_init(packet_range_t *range, capture_file *cf);
110 /* Cleanup the range structure before the caller frees "range". */
111 extern void packet_range_cleanup(packet_range_t *range);
113 /* check whether the packet range is OK */
114 extern convert_ret_t packet_range_check(packet_range_t *range);
116 /* init the processing run */
117 extern void packet_range_process_init(packet_range_t *range);
119 /* do we have to process all packets? */
120 extern bool packet_range_process_all(packet_range_t *range);
122 /* do we have to process this packet? */
123 extern range_process_e packet_range_process_packet(packet_range_t *range, frame_data *fdata);
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);
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);
131 /* return the number of packets that will be processed.
133 extern uint32_t packet_range_count(const packet_range_t *range);
134 #ifdef __cplusplus
136 #endif /* __cplusplus */
138 #endif /* __PACKET_RANGE_H__ */