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 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * Low-level sync pipe interfaces.
30 #ifndef __SYNC_PIPE_H__
31 #define __SYNC_PIPE_H__
35 * Maximum length of sync pipe message data. Must be < 2^24, as the
36 * message length is 3 bytes.
37 * XXX - this must be large enough to handle a Really Big Filter
38 * Expression, as the error message for an incorrect filter expression
39 * is a bit larger than the filter expression.
41 #define SP_MAX_MSG_LEN 4096
44 /* Size of buffer to hold decimal representation of
45 signed/unsigned 64-bit int */
46 #define SP_DECISIZE 20
49 * Indications sent out on the sync pipe (from child to parent).
50 * We might want to switch to something like Thrift
51 * (http://thrift.apache.org/) or Protocol Buffers
52 * (http://code.google.com/p/protobuf-c/) if we ever need to use more
55 #define SP_FILE 'F' /* the name of the recently opened file */
56 #define SP_ERROR_MSG 'E' /* error message */
57 #define SP_BAD_FILTER 'B' /* error message for bad capture filter */
58 #define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
59 #define SP_DROPS 'D' /* count of packets dropped in capture */
60 #define SP_SUCCESS 'S' /* success indication, no extra data */
61 #define SP_TOOLBAR_CTRL 'T' /* interface toolbar control packet */
63 * Win32 only: Indications sent out on the signal pipe (from parent to child)
64 * (UNIX-like sends signals for this)
66 #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
68 /* write a single message header to the recipient pipe */
70 pipe_write_header(int pipe_fd, char indicator, int length);
72 /* write a message to the recipient pipe in the standard format
73 (3 digit message length (excluding length and indicator field),
74 1 byte message indicator and the rest is the message).
75 If msg is NULL, the message has only a length and indicator. */
77 pipe_write_block(int pipe_fd, char indicator, const char *msg);
79 /** the child encountered an error, notify the parent */
81 sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
82 const char *secondary_error_msg);
84 /** Has the parent signalled the child to stop? */
85 #define SIGNAL_PIPE_CTRL_ID_NONE "none"
87 #define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
90 #endif /* sync_pipe.h */
93 * Editor modelines - http://www.wireshark.org/tools/modelines.html
98 * indent-tabs-mode: nil
101 * vi: set shiftwidth=4 tabstop=8 expandtab:
102 * :indentSize=4:tabSize=8:noTabs=true: