Add interface name when outputting packets dropped.
[metze/wireshark/wip.git] / capchild / capture_session.h
1 /* capture_session.h
2  * State of a capture session
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10
11 #ifndef __CAPCHILD_CAPTURE_SESSION_H__
12 #define __CAPCHILD_CAPTURE_SESSION_H__
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17
18 #ifndef _WIN32
19 #include <sys/types.h>
20 #include <stdint.h>
21 #endif
22
23 #include "capture_opts.h"
24
25 #include <wsutil/processes.h>
26
27 #ifdef HAVE_LIBPCAP
28 /* Current state of capture engine. XXX - differentiate states */
29 typedef enum {
30     CAPTURE_STOPPED,        /**< stopped */
31     CAPTURE_PREPARING,      /**< preparing, but still no response from capture child */
32     CAPTURE_RUNNING         /**< capture child signalled ok, capture is running now */
33 } capture_state;
34
35 #include "cfile.h"
36 struct _info_data;
37 /*
38  * State of a capture session.
39  */
40 typedef struct _capture_session {
41     ws_process_id fork_child;             /**< If not WS_INVALID_PID, in parent, process ID of child */
42     int       fork_child_status;          /**< Child exit status */
43 #ifdef _WIN32
44     int       signal_pipe_write_fd;       /**< the pipe to signal the child */
45 #endif
46     capture_state state;                  /**< current state of the capture engine */
47 #ifndef _WIN32
48     uid_t     owner;                      /**< owner of the cfile */
49     gid_t     group;                      /**< group of the cfile */
50 #endif
51     gboolean  session_started;
52     guint32   count;                      /**< Total number of frames captured */
53     capture_options *capture_opts;        /**< options for this capture */
54     capture_file *cf;                     /**< handle to cfile */
55     struct _info_data *cap_data_info;          /**< stats for this capture */
56 } capture_session;
57
58 extern void
59 capture_session_init(capture_session *cap_session, capture_file *cf);
60 #else
61
62 /* dummy is needed because clang throws the error: empty struct has size 0 in C, size 1 in C++ */
63 typedef struct _capture_session {int dummy;} capture_session;
64
65 #endif /* HAVE_LIBPCAP */
66
67 #ifdef __cplusplus
68 }
69 #endif /* __cplusplus */
70
71 #endif /* __CAPCHILD_CAPTURE_SESSION_H__ */