Wireshark  4.3.0
The Wireshark network protocol analyzer
/builds/wireshark/wireshark/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 <gerald@wireshark.org>
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.
29  */
30 #define SP_MAX_MSG_LEN 4096
31 
32 /*
33  * Indications sent out on the sync pipe (from child to parent).
34  * We might want to switch to something like Thrift
35  * (http://thrift.apache.org/) or Protocol Buffers
36  * (http://code.google.com/p/protobuf-c/) if we ever need to use more
37  * complex messages.
38  */
39 #define SP_EXEC_FAILED 'X' /* errno value for the exec failing */
40 #define SP_FILE 'F' /* the name of the recently opened file */
41 #define SP_ERROR_MSG 'E' /* error message */
42 #define SP_BAD_FILTER 'B' /* error message for bad capture filter */
43 #define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
44 #define SP_DROPS 'D' /* count of packets dropped in capture */
45 #define SP_SUCCESS 'S' /* success indication, no extra data */
46 #define SP_TOOLBAR_CTRL 'T' /* interface toolbar control packet */
47 /*
48  * Win32 only: Indications sent out on the signal pipe (from parent to child)
49  * (UNIX-like sends signals for this)
50  */
51 #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
52 
53 /* Write a message, with a string body, to the recipient pipe in the
54  standard format (1-byte message indicator, 3-byte message length
55  (excluding length and indicator field), and the string.
56  If msg is NULL, the message has only a length and indicator. */
57 extern void
58 sync_pipe_write_string_msg(int pipe_fd, char indicator, const char *msg);
59 
60 /* Write a message, with an unsigned integer body, to the recipient
61  pipe in the standard format (1-byte message indicator, 3-byte
62  message length (excluding length and indicator field), and the
63  unsigned integer, as a string. */
64 extern void
65 sync_pipe_write_uint_msg(int pipe_fd, char indicator, unsigned int num);
66 
67 /* Write a message, with an integer body, to the recipient pipe in the
68  standard format (1-byte message indicator, 3-byte message length
69  (excluding length and indicator field), and the integer, as a string. */
70 extern void
71 sync_pipe_write_int_msg(int pipe_fd, char indicator, int num);
72 
74 extern void
75 sync_pipe_write_errmsgs_to_parent(int pipe_fd, const char *error_msg,
76  const char *secondary_error_msg);
77 
79 #define SIGNAL_PIPE_CTRL_ID_NONE "none"
80 #ifdef _WIN32
81 #define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
82 #endif
83 
84 #endif /* sync_pipe.h */
85 
86 /*
87  * Editor modelines - https://www.wireshark.org/tools/modelines.html
88  *
89  * Local variables:
90  * c-basic-offset: 4
91  * tab-width: 8
92  * indent-tabs-mode: nil
93  * End:
94  *
95  * vi: set shiftwidth=4 tabstop=8 expandtab:
96  * :indentSize=4:tabSize=8:noTabs=true:
97  */
void sync_pipe_write_errmsgs_to_parent(int pipe_fd, const char *error_msg, const char *secondary_error_msg)
Definition: sync_pipe_write.c:121