Remove all $Id$ from top of file
[metze/wireshark/wip.git] / epan / packet-range.h
1 /* packet-range.h
2  * Packet range routines (save, print, ...)
3  *
4  * Dick Gooris <gooris@lucent.com>
5  * Ulf Lamping <ulf.lamping@web.de>
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25
26 #ifndef __PACKET_RANGE_H__
27 #define __PACKET_RANGE_H__
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 #include <glib.h>
34
35 #include <epan/range.h>
36
37 #include "cfile.h"
38
39
40 extern guint32  curr_selected_frame;
41
42 typedef enum {
43     range_process_all,
44     range_process_selected,
45     range_process_marked,
46     range_process_marked_range,
47     range_process_user_range
48 } packet_range_e;
49
50 typedef struct packet_range_tag {
51     /* values coming from the UI */
52     packet_range_e  process;            /* which range to process */
53     gboolean        process_filtered;   /* captured or filtered packets */
54     gboolean        remove_ignored;     /* remove ignored packets */
55     gboolean        include_dependents; /* True if packets which are dependents of others should be processed */
56
57     /* user specified range(s) and, if null, error status */
58     range_t         *user_range;
59     convert_ret_t   user_range_status;
60
61     /* calculated values */
62     guint32  selected_packet;       /* the currently selected packet */
63
64     /* current packet counts (captured) */
65     capture_file *cf;                     /* Associated capture file. */
66     guint32       mark_range_cnt;         /* packets in marked range */
67     guint32       user_range_cnt;         /* packets in user specified range */
68     guint32       ignored_cnt;            /* packets ignored */
69     guint32       ignored_marked_cnt;     /* packets ignored and marked */
70     guint32       ignored_mark_range_cnt; /* packets ignored in marked range */
71     guint32       ignored_user_range_cnt; /* packets ignored in user specified range */
72
73     /* current packet counts (displayed) */
74     guint32  displayed_cnt;
75     guint32  displayed_plus_dependents_cnt;
76     guint32  displayed_marked_cnt;
77     guint32  displayed_mark_range_cnt;
78     guint32  displayed_user_range_cnt;
79     guint32  displayed_ignored_cnt;
80     guint32  displayed_ignored_marked_cnt;
81     guint32  displayed_ignored_mark_range_cnt;
82     guint32  displayed_ignored_user_range_cnt;
83
84     /* "enumeration" values */
85     gboolean marked_range_active;   /* marked range is currently processed */
86     guint32  marked_range_left;     /* marked range packets left to do */
87     gboolean selected_done;         /* selected packet already processed */
88 } packet_range_t;
89
90 typedef enum {
91     range_process_this,             /* process this packet */
92     range_process_next,             /* skip this packet, process next */
93     range_processing_finished       /* stop processing, required packets done */
94 } range_process_e;
95
96 /* init the range structure */
97 WS_DLL_PUBLIC void packet_range_init(packet_range_t *range, capture_file *cf);
98
99 /* check whether the packet range is OK */
100 WS_DLL_PUBLIC convert_ret_t packet_range_check(packet_range_t *range);
101
102 /* init the processing run */
103 WS_DLL_PUBLIC void packet_range_process_init(packet_range_t *range);
104
105 /* do we have to process all packets? */
106 WS_DLL_PUBLIC gboolean packet_range_process_all(packet_range_t *range);
107
108 /* do we have to process this packet? */
109 WS_DLL_PUBLIC range_process_e packet_range_process_packet(packet_range_t *range, frame_data *fdata);
110
111 /* convert user given string to the internal user specified range representation */
112 WS_DLL_PUBLIC void packet_range_convert_str(packet_range_t *range, const gchar *es);
113
114 #ifdef __cplusplus
115 }
116 #endif /* __cplusplus */
117
118 #endif /* __PACKET_RANGE_H__ */