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