MSWSP: WIP: dissect_CPMSetBindings()
[wireshark-wip.git] / sync_pipe.h
blobbdc8ce5c74dd33fe0cd1263c41d0e384df3d396c
1 /* sync_pipe.h
2 * Low-level synchronization pipe routines for use by Wireshark/TShark
3 * and dumpcap
5 * $Id$
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 /** @file
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).
52 * We might want to switch to something like Thrift
53 * (http://thrift.apache.org/) or Protocol Buffers
54 * (http://code.google.com/p/protobuf-c/) if we ever need to use more
55 * complex messages.
57 #define SP_FILE 'F' /* the name of the recently opened file */
58 #define SP_ERROR_MSG 'E' /* error message */
59 #define SP_BAD_FILTER 'B' /* error message for bad capture filter */
60 #define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
61 #define SP_DROPS 'D' /* count of packets dropped in capture */
62 #define SP_SUCCESS 'S' /* success indication, no extra data */
64 * Win32 only: Indications sent out on the signal pipe (from parent to child)
65 * (UNIX-like sends signals for this)
67 #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
69 /* write a single message header to the recipient pipe */
70 extern ssize_t
71 pipe_write_header(int pipe_fd, char indicator, int length);
73 /* write a message to the recipient pipe in the standard format
74 (3 digit message length (excluding length and indicator field),
75 1 byte message indicator and the rest is the message).
76 If msg is NULL, the message has only a length and indicator. */
77 extern void
78 pipe_write_block(int pipe_fd, char indicator, const char *msg);
80 /** the child encountered an error, notify the parent */
81 extern void
82 sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
83 const char *secondary_error_msg);
85 /** Has the parent signalled the child to stop? */
86 #define SIGNAL_PIPE_CTRL_ID_NONE "none"
87 #ifdef _WIN32
88 #define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
89 #endif
91 #endif /* sync_pipe.h */