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