[Automatic update for 2016-10-09]
[metze/wireshark/wip.git] / capture_info.h
1 /* capture_info.h
2  * capture info functions
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23
24 /** @file
25  *
26  * Capture info functions.
27  *
28  */
29
30 /*
31  * GTK+ only.
32  * If we add this to the Qt UI we should modernize the statistics we show.
33  * At the very least we should remove or hide IPX and VINES.
34  */
35
36 #ifndef __CAPTURE_INFO_H__
37 #define __CAPTURE_INFO_H__
38
39 #include "capture_opts.h"
40 #include <capchild/capture_session.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif /* __cplusplus */
45
46 typedef struct {
47     GHashTable*       counts_hash; /* packet counters keyed by proto */
48     gint              other;      /* Packets not counted in the hash total */
49     gint              total;      /* Cache of total packets */
50
51 } packet_counts;
52
53 /** Current Capture info. */
54 typedef struct {
55     /* handle */
56     gpointer        ui;             /**< user interface handle */
57
58     /* capture info */
59     packet_counts   *counts;        /**< protocol specific counters */
60     time_t          running_time;   /**< running time since last update */
61     gint            new_packets;    /**< packets since last update */
62 } capture_info;
63
64 typedef struct _info_data {
65     packet_counts     counts;     /* Packet counting */
66     struct wtap*      wtap;       /* current wtap file */
67     capture_info      ui;         /* user interface data */
68 } info_data_t;
69
70 /* open the info - init values (wtap, counts), create dialog */
71 extern void capture_info_open(capture_session *cap_session, info_data_t* cap_info);
72
73 /* new file arrived - (eventually close old wtap), open wtap */
74 extern gboolean capture_info_new_file(const char *new_filename, info_data_t* cap_info);
75
76 /* new packets arrived - read from wtap, count */
77 extern void capture_info_new_packets(int to_read, info_data_t* cap_info);
78
79 /* close the info - close wtap, destroy dialog */
80 extern void capture_info_close(info_data_t* cap_info);
81
82 /** Create the capture info dialog */
83 extern void
84 capture_info_ui_create(capture_info *cinfo, capture_session *cap_session);
85
86 /** Update the capture info counters in the dialog */
87 extern void capture_info_ui_update(
88 capture_info    *cinfo);
89
90 /** Destroy the capture info dialog again */
91 extern void capture_info_ui_destroy(
92 capture_info    *cinfo);
93
94 #ifdef __cplusplus
95 }
96 #endif /* __cplusplus */
97
98 #endif /* capture_info.h */
99
100 /*
101  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
102  *
103  * Local variables:
104  * c-basic-offset: 4
105  * tab-width: 8
106  * indent-tabs-mode: nil
107  * End:
108  *
109  * vi: set shiftwidth=4 tabstop=8 expandtab:
110  * :indentSize=4:tabSize=8:noTabs=true:
111  */