2 * Low-level synchronization pipe routines for use by Wireshark/TShark
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
15 * Low-level sync pipe interfaces.
18 #ifndef __SYNC_PIPE_H__
19 #define __SYNC_PIPE_H__
23 * Maximum length of sync pipe message data. Must be < 2^24, as the
24 * message length is 3 bytes.
25 * XXX - this must be large enough to handle a Really Big Filter
26 * Expression, as the error message for an incorrect filter expression
27 * is a bit larger than the filter expression.
29 #define SP_MAX_MSG_LEN 4096
32 /* Size of buffer to hold decimal representation of
33 signed/unsigned 64-bit int */
34 #define SP_DECISIZE 20
37 * Indications sent out on the sync pipe (from child to parent).
38 * We might want to switch to something like Thrift
39 * (http://thrift.apache.org/) or Protocol Buffers
40 * (http://code.google.com/p/protobuf-c/) if we ever need to use more
43 #define SP_FILE 'F' /* the name of the recently opened file */
44 #define SP_ERROR_MSG 'E' /* error message */
45 #define SP_BAD_FILTER 'B' /* error message for bad capture filter */
46 #define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
47 #define SP_DROPS 'D' /* count of packets dropped in capture */
48 #define SP_SUCCESS 'S' /* success indication, no extra data */
49 #define SP_TOOLBAR_CTRL 'T' /* interface toolbar control packet */
51 * Win32 only: Indications sent out on the signal pipe (from parent to child)
52 * (UNIX-like sends signals for this)
54 #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
56 /* write a single message header to the recipient pipe */
58 pipe_write_header(int pipe_fd, char indicator, int length);
60 /* write a message to the recipient pipe in the standard format
61 (3 digit message length (excluding length and indicator field),
62 1 byte message indicator and the rest is the message).
63 If msg is NULL, the message has only a length and indicator. */
65 pipe_write_block(int pipe_fd, char indicator, const char *msg);
67 /** the child encountered an error, notify the parent */
69 sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
70 const char *secondary_error_msg);
72 /** Has the parent signalled the child to stop? */
73 #define SIGNAL_PIPE_CTRL_ID_NONE "none"
75 #define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
78 #endif /* sync_pipe.h */
81 * Editor modelines - http://www.wireshark.org/tools/modelines.html
86 * indent-tabs-mode: nil
89 * vi: set shiftwidth=4 tabstop=8 expandtab:
90 * :indentSize=4:tabSize=8:noTabs=true: