Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
process_lookup.h
Go to the documentation of this file.
1
12
13#ifndef __WSUTIL_PROCESS_LOOKUP_H__
14#define __WSUTIL_PROCESS_LOOKUP_H__
15
16#include <wireshark.h>
17#include <wsutil/inet_addr.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif /* __cplusplus */
22
31typedef struct ws_process_info {
32 uint32_t pid;
33 bool has_ppid;
34 uint32_t ppid;
35 bool has_uid;
36 uint32_t uid;
37 char *name;
38 char *path;
39 char *user;
40 uint8_t *cmdline;
41 size_t cmdline_len;
42 uint64_t start_time_ns;
44
51typedef enum {
52 WS_PROCESS_LOOKUP_TCP = 6,
53 WS_PROCESS_LOOKUP_UDP = 17
55
59typedef struct ws_socket_endpoint {
60 uint8_t ip_version;
61 union {
64 } addr;
65 uint16_t port;
67
76
82WS_DLL_PUBLIC bool
84
92WS_DLL_PUBLIC ws_process_lookup_t *
93ws_process_lookup_new(char **err_msg);
94
100WS_DLL_PUBLIC void
102
114
124WS_DLL_PUBLIC void
126
140WS_DLL_PUBLIC void
142
150WS_DLL_PUBLIC bool
151ws_process_lookup_refresh(ws_process_lookup_t *lookup, char **err_msg);
152
177WS_DLL_PUBLIC unsigned
180 const ws_socket_endpoint_t *local,
181 const ws_socket_endpoint_t *remote,
182 GPtrArray *processes);
183
192WS_DLL_PUBLIC const ws_process_info_t *
193ws_process_lookup_pid(ws_process_lookup_t *lookup, uint32_t pid);
194
195#ifdef __cplusplus
196}
197#endif /* __cplusplus */
198
199#endif /* __WSUTIL_PROCESS_LOOKUP_H__ */
200
201/*
202 * Editor modelines - https://www.wireshark.org/tools/modelines.html
203 *
204 * Local variables:
205 * c-basic-offset: 4
206 * tab-width: 8
207 * indent-tabs-mode: nil
208 * End:
209 *
210 * vi: set shiftwidth=4 tabstop=8 expandtab:
211 * :indentSize=4:tabSize=8:noTabs=true:
212 */
struct e_in6_addr ws_in6_addr
Represents a 128-bit IPv6 address.
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
WS_DLL_PUBLIC unsigned ws_process_lookup_socket(ws_process_lookup_t *lookup, ws_process_lookup_protocol_t protocol, const ws_socket_endpoint_t *local, const ws_socket_endpoint_t *remote, GPtrArray *processes)
Find the processes that have a socket open.
Definition process_lookup.c:383
WS_DLL_PUBLIC bool ws_process_lookup_refresh(ws_process_lookup_t *lookup, char **err_msg)
Read the operating system's socket tables again now.
Definition process_lookup.c:238
WS_DLL_PUBLIC const ws_process_info_t * ws_process_lookup_pid(ws_process_lookup_t *lookup, uint32_t pid)
Describe a process by its ID.
Definition process_lookup.c:437
WS_DLL_PUBLIC ws_process_lookup_t * ws_process_lookup_new(char **err_msg)
Create a lookup context.
Definition process_lookup.c:140
WS_DLL_PUBLIC void ws_process_lookup_set_detail(ws_process_lookup_t *lookup, ws_process_detail_t detail)
Set how much is found out about the processes.
Definition process_lookup.c:209
ws_process_detail_t
How much is found out about a process.
Definition process_lookup.h:110
@ WS_PROCESS_DETAIL_FULL
Definition process_lookup.h:112
@ WS_PROCESS_DETAIL_BASIC
Definition process_lookup.h:111
struct ws_process_info ws_process_info_t
What the operating system knows about a process.
struct ws_process_lookup ws_process_lookup_t
A lookup context.
Definition process_lookup.h:75
struct ws_socket_endpoint ws_socket_endpoint_t
One end of a socket: an IPv4 or IPv6 address and a port.
WS_DLL_PUBLIC void ws_process_lookup_set_refresh_interval(ws_process_lookup_t *lookup, unsigned interval_ms)
Set how soon the socket tables may be read again after a miss.
Definition process_lookup.c:215
WS_DLL_PUBLIC void ws_process_lookup_free(ws_process_lookup_t *lookup)
Free a lookup context and every ws_process_info_t it returned.
Definition process_lookup.c:194
WS_DLL_PUBLIC bool ws_process_lookup_supported(void)
Whether the operating system's socket tables can be read on this platform.
Definition process_lookup.c:134
ws_process_lookup_protocol_t
The transport protocols of the sockets that can be looked up.
Definition process_lookup.h:51
What the operating system knows about a process.
Definition process_lookup.h:31
char * user
Definition process_lookup.h:39
bool has_ppid
Definition process_lookup.h:33
uint32_t uid
Definition process_lookup.h:36
char * name
Definition process_lookup.h:37
uint64_t start_time_ns
Definition process_lookup.h:42
uint8_t * cmdline
Definition process_lookup.h:40
size_t cmdline_len
Definition process_lookup.h:41
uint32_t pid
Definition process_lookup.h:32
uint32_t ppid
Definition process_lookup.h:34
bool has_uid
Definition process_lookup.h:35
char * path
Definition process_lookup.h:38
Definition process_lookup.c:27
One end of a socket: an IPv4 or IPv6 address and a port.
Definition process_lookup.h:59
ws_in4_addr ipv4
Definition process_lookup.h:62
uint8_t ip_version
Definition process_lookup.h:60
uint16_t port
Definition process_lookup.h:65
ws_in6_addr ipv6
Definition process_lookup.h:63