2 * Low-level synchronization pipe routines for use by Wireshark/TShark
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 * Low-level sync pipe interfaces.
32 #ifndef __SYNC_PIPE_H__
33 #define __SYNC_PIPE_H__
37 * Maximum length of sync pipe message data. Must be < 2^24, as the
38 * message length is 3 bytes.
39 * XXX - this must be large enough to handle a Really Big Filter
40 * Expression, as the error message for an incorrect filter expression
41 * is a bit larger than the filter expression.
43 #define SP_MAX_MSG_LEN 4096
46 /* Size of buffer to hold decimal representation of
47 signed/unsigned 64-bit int */
48 #define SP_DECISIZE 20
51 * Indications sent out on the sync pipe (from child to parent).
53 #define SP_FILE 'F' /* the name of the recently opened file */
54 #define SP_ERROR_MSG 'E' /* error message */
55 #define SP_BAD_FILTER 'B' /* error message for bad capture filter */
56 #define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
57 #define SP_DROPS 'D' /* count of packets dropped in capture */
59 * Win32 only: Indications sent out on the signal pipe (from parent to child)
60 * (UNIX-like sends signals for this)
62 #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
64 /* write a single message header to the recipient pipe */
66 pipe_write_header(int pipe, char indicator, int length);
68 /* write a message to the recipient pipe in the standard format
69 (3 digit message length (excluding length and indicator field),
70 1 byte message indicator and the rest is the message).
71 If msg is NULL, the message has only a length and indicator. */
73 pipe_write_block(int pipe, char indicator, const char *msg);
75 /** the child encountered an error, notify the parent */
77 sync_pipe_errmsg_to_parent(int pipe, const char *error_msg,
78 const char *secondary_error_msg);
80 #endif /* sync_pipe.h */