Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / extcap / extcap-base.h
blobb0fa872b964a104a053baa561b467f7eef554dec
1 /** @file
3 * Base function for extcaps
5 * Copyright 2016, Dario Lombardo
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __EXTCAP_BASE_H__
14 #define __EXTCAP_BASE_H__
16 #include <glib.h>
17 #include <glib/gprintf.h>
18 #include <stdlib.h>
19 #include <stdint.h>
20 #include <stdbool.h>
22 #include <wsutil/ws_getopt.h>
24 #ifdef _WIN32
25 #include <io.h>
26 #endif
28 #include <wsutil/socket.h>
30 #ifdef __cplusplus
31 extern "C" {
32 #endif // __cplusplus
34 #define EXTCAP_BASE_OPTIONS_ENUM \
35 EXTCAP_OPT_LIST_INTERFACES, \
36 EXTCAP_OPT_VERSION, \
37 EXTCAP_OPT_LIST_DLTS, \
38 EXTCAP_OPT_INTERFACE, \
39 EXTCAP_OPT_CONFIG, \
40 EXTCAP_OPT_CAPTURE, \
41 EXTCAP_OPT_CAPTURE_FILTER, \
42 EXTCAP_OPT_FIFO, \
43 EXTCAP_OPT_LOG_LEVEL, \
44 EXTCAP_OPT_LOG_FILE
47 #define EXTCAP_BASE_OPTIONS \
48 { "extcap-interfaces", ws_no_argument, NULL, EXTCAP_OPT_LIST_INTERFACES}, \
49 { "extcap-version", ws_optional_argument, NULL, EXTCAP_OPT_VERSION}, \
50 { "extcap-dlts", ws_no_argument, NULL, EXTCAP_OPT_LIST_DLTS}, \
51 { "extcap-interface", ws_required_argument, NULL, EXTCAP_OPT_INTERFACE}, \
52 { "extcap-config", ws_no_argument, NULL, EXTCAP_OPT_CONFIG}, \
53 { "capture", ws_no_argument, NULL, EXTCAP_OPT_CAPTURE}, \
54 { "extcap-capture-filter", ws_required_argument, NULL, EXTCAP_OPT_CAPTURE_FILTER}, \
55 { "fifo", ws_required_argument, NULL, EXTCAP_OPT_FIFO}, \
56 { "log-level", ws_required_argument, NULL, EXTCAP_OPT_LOG_LEVEL}, \
57 { "log-file", ws_required_argument, NULL, EXTCAP_OPT_LOG_FILE}
59 typedef struct _extcap_parameters
61 char * exename;
62 char * fifo;
63 char * interface;
64 char * capture_filter;
66 char * version;
67 char * compiled_with;
68 char * running_with;
69 char * helppage;
70 uint8_t capture;
71 uint8_t show_config;
73 char * ws_version;
75 /* private content */
76 GList * interfaces;
77 uint8_t do_version;
78 uint8_t do_list_dlts;
79 uint8_t do_list_interfaces;
81 char * help_header;
82 GList * help_options;
84 enum ws_log_level debug;
85 } extcap_parameters;
87 /* used to inform to extcap application that end of application is requested */
88 extern bool extcap_end_application;
90 void extcap_base_register_interface(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltdescription );
91 void extcap_base_register_interface_ext(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltname, const char * dltdescription );
93 /* used to inform extcap framework that graceful shutdown supported by the extcap
95 bool extcap_base_register_graceful_shutdown_cb(extcap_parameters * extcap, void (*callback)(void));
97 void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename, const char * major, const char * minor, const char * release, const char * helppage);
98 void extcap_base_set_compiled_with(extcap_parameters * extcap, const char *fmt, ...);
99 void extcap_base_set_running_with(extcap_parameters * extcap, const char *fmt, ...);
100 uint8_t extcap_base_parse_options(extcap_parameters * extcap, int result, char * optargument);
101 uint8_t extcap_base_handle_interface(extcap_parameters * extcap);
102 void extcap_base_cleanup(extcap_parameters ** extcap);
103 void extcap_help_add_header(extcap_parameters * extcap, char * help_header);
104 void extcap_help_add_option(extcap_parameters * extcap, const char * help_option_name, const char * help_optionn_desc);
105 void extcap_version_print(extcap_parameters * extcap);
106 void extcap_help_print(extcap_parameters * extcap);
107 void extcap_cmdline_debug(char** ar, const unsigned n);
108 void extcap_config_debug(unsigned* count);
109 void extcap_base_help(void);
110 void extcap_log_init(const char *progname);
112 #ifdef __cplusplus
114 #endif // __cplusplus
116 #endif // __EXTCAP_BASE_H__
119 * Editor modelines - https://www.wireshark.org/tools/modelines.html
121 * Local variables:
122 * c-basic-offset: 4
123 * tab-width: 8
124 * indent-tabs-mode: nil
125 * End:
127 * vi: set shiftwidth=4 tabstop=8 expandtab:
128 * :indentSize=4:tabSize=8:noTabs=true: