Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
sync_pipe.h
Go to the documentation of this file.
1/* sync_pipe.h
2 * Low-level synchronization pipe routines for use by Wireshark/TShark
3 * and dumpcap
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12
18#ifndef __SYNC_PIPE_H__
19#define __SYNC_PIPE_H__
20
21#include <ws_posix_compat.h>
22
23/*
24 * Maximum length of sync pipe message data. Must be < 2^24, as the
25 * message length is 3 bytes.
26 * XXX - this must be large enough to handle a Really Big Filter
27 * Expression, as the error message for an incorrect filter expression
28 * is a bit larger than the filter expression, and large enough to
29 * handle a large interface list.
30 * 4096 is a typical PIPE_BUF size for atomic writes, but we should have
31 * only one writer and one reader so that shouldn't be an issue.
32 */
33#define SP_MAX_MSG_LEN (512 * 1000)
34
35/*
36 * Indications sent out on the sync pipe (from child to parent).
37 * We might want to switch to something like Thrift
38 * (http://thrift.apache.org/) or Protocol Buffers
39 * (http://code.google.com/p/protobuf-c/) if we ever need to use more
40 * complex messages.
41 */
42#define SP_EXEC_FAILED 'X' /* errno value for the exec failing */
43#define SP_FILE 'F' /* the name of the recently opened file */
44#define SP_ERROR_MSG 'E' /* error message */
45#define SP_LOG_MSG 'L' /* log message */
46#define SP_BAD_FILTER 'B' /* error message for bad capture filter */
47#define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
48#define SP_DROPS 'D' /* count of packets dropped in capture */
49#define SP_SUCCESS 'S' /* success indication, no extra data */
50#define SP_TOOLBAR_CTRL 'T' /* interface toolbar control packet */
51#define SP_IFACE_LIST 'I' /* interface list */
52/*
53 * Win32 only: Indications sent out on the signal pipe (from parent to child)
54 * (UNIX-like sends signals for this)
55 */
56#define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
57
70extern void
71sync_pipe_write_string_msg(int pipe_fd, char indicator, const char *msg);
72
85extern void
86sync_pipe_write_uint_msg(int pipe_fd, char indicator, unsigned int num);
87
100extern void
101sync_pipe_write_int_msg(int pipe_fd, char indicator, int num);
102
109extern void
110sync_pipe_write_errmsgs_to_parent(int pipe_fd, const char *error_msg,
111 const char *secondary_error_msg);
112
114#define SIGNAL_PIPE_CTRL_ID_NONE "none"
115#ifdef _WIN32
116#define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
117#endif
118
119#endif /* sync_pipe.h */
120
121/*
122 * Editor modelines - https://www.wireshark.org/tools/modelines.html
123 *
124 * Local variables:
125 * c-basic-offset: 4
126 * tab-width: 8
127 * indent-tabs-mode: nil
128 * End:
129 *
130 * vi: set shiftwidth=4 tabstop=8 expandtab:
131 * :indentSize=4:tabSize=8:noTabs=true:
132 */
void sync_pipe_write_uint_msg(int pipe_fd, char indicator, unsigned int num)
Writes a string message to the recipient pipe.
Definition sync_pipe_write.c:91
void sync_pipe_write_int_msg(int pipe_fd, char indicator, int num)
Writes a string message to the recipient pipe.
Definition sync_pipe_write.c:104
void sync_pipe_write_errmsgs_to_parent(int pipe_fd, const char *error_msg, const char *secondary_error_msg)
Notify the parent that the child encountered an error.
Definition sync_pipe_write.c:120
void sync_pipe_write_string_msg(int pipe_fd, char indicator, const char *msg)
Writes a string message to the recipient pipe.
Definition sync_pipe_write.c:48