| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
capture-pcap-util.h
Go to the documentation of this file.
1
11
12#ifndef __CAPTURE_PCAP_UTIL_H__
13#define __CAPTURE_PCAP_UTIL_H__
14
15#include <wsutil/feature_list.h>
16
17#ifdef HAVE_LIBPCAP
18
19#include <pcap/pcap.h>
20
21#include "ui/capture_opts.h"
22
23#endif
24
25#ifdef __cplusplus
26 extern "C" {
27#endif /* __cplusplus */
28
29#ifdef HAVE_LIBPCAP
30/*
31 * A snapshot length of 0 is useless - and libpcap/WinPcap/Npcap don't guarantee
32 * that a snapshot length of 0 will work, and, on some platforms, it won't
33 * (with BPF, for example, the kernel is told the snapshot length via the
34 * return value of the BPF program, and a return value of 0 means "drop
35 * the packet"), so the minimum packet size is 1 byte.
36 */
37#define MIN_PACKET_SIZE 1 /* minimum amount of packet data we can read */
38
47GList *get_local_interface_list_ws(int *err, char **err_str);
48
57GList* get_local_interface_list_ss(int* err, char** err_str);
58
59#ifdef HAVE_PCAP_REMOTE
74GList *get_remote_interface_list(const char *hostname, const char *port,
75 bool wireshark_remote,
76 int auth_type, const char *username,
77 const char *passwd,
78 int *err, char **err_str);
79#endif /* HAVE_PCAP_REMOTE */
80
88 const char *linktype_val_to_name(int dlt);
89
96 int linktype_name_to_val(const char *linktype);
97
105
106 int get_pcap_datalink(pcap_t *pch, const char *devicename);
107
120 bool set_pcap_datalink(pcap_t *pcap_h, int datalink, char *name,
121 char *errmsg, size_t errmsg_len,
122 char *secondary_errmsg, size_t secondary_errmsg_len);
123
133 bool have_high_resolution_timestamp(pcap_t *pcap_h);
134
135/*
136 * Capture device open status values.
137 */
138 typedef enum {
139 /* No error and no warning */
140 CAP_DEVICE_OPEN_NO_ERR,
141
142 /* Errors corresponding to libpcap errors */
143 CAP_DEVICE_OPEN_ERROR_NO_SUCH_DEVICE,
144 CAP_DEVICE_OPEN_ERROR_RFMON_NOTSUP,
145 CAP_DEVICE_OPEN_ERROR_PERM_DENIED,
146 CAP_DEVICE_OPEN_ERROR_IFACE_NOT_UP,
147 CAP_DEVICE_OPEN_ERROR_PROMISC_PERM_DENIED,
148
149 /* Error, none of the above */
150 CAP_DEVICE_OPEN_ERROR_OTHER,
151
152 /* Error from pcap_open_live() or pcap_open() rather than pcap_activate() */
153 CAP_DEVICE_OPEN_ERROR_GENERIC,
154
155 /* Warnings corresponding to libpcap warnings */
156 CAP_DEVICE_OPEN_WARNING_PROMISC_NOTSUP,
157 CAP_DEVICE_OPEN_WARNING_TSTAMP_TYPE_NOTSUP,
158
159 /* Warning, none of the above */
160 CAP_DEVICE_OPEN_WARNING_OTHER
161} cap_device_open_status;
162 extern if_capabilities_t *get_if_capabilities(interface_options *interface_opts,
163 cap_device_open_status *status, char **status_str);
164 extern pcap_t *open_capture_device(capture_options *capture_opts,
165 interface_options *interface_opts,
166 int timeout, cap_device_open_status *open_status,
167 char (*open_status_str)[PCAP_ERRBUF_SIZE]);
168
169#endif /* HAVE_LIBPCAP */
170
175 extern void gather_caplibs_compile_info(feature_list l);
176
188 extern void gather_caplibs_runtime_info(feature_list l);
189
190#ifdef _WIN32
191 extern bool caplibs_have_npcap(void);
192
200 extern bool caplibs_get_npcap_version(unsigned int *major,
201 unsigned int *minor);
202#endif
203
204#ifdef __cplusplus
205}
206#endif /* __cplusplus */
207
208#endif /* __CAPTURE_PCAP_UTIL_H__ */
gather_caplibs_compile_info
void gather_caplibs_compile_info(feature_list l)
Append to a GString an indication of the version of capture libraries with which we're running,...
Definition capture-pcap-util-unix.c:159
gather_caplibs_runtime_info
void gather_caplibs_runtime_info(feature_list l)
Append runtime capture‑library version information to a feature list.
Definition capture-pcap-util-unix.c:165
capture_opts.h
interface_options
struct interface_options_tag interface_options
Holds the full set of configuration options for a single capture interface session.
feature_list.h
feature_list
GList ** feature_list
Semi-opaque handle to a list of features or dependencies.
Definition feature_list.h:33
if_capabilities_t
Describes the capabilities of a single capture interface.
Definition capture_ifinfo.h:46