2006-04-03 01:56:53 +00:00
|
|
|
/* sync_pipe.h
|
2007-09-29 01:15:11 +00:00
|
|
|
* Low-level synchronization pipe routines for use by Wireshark/TShark
|
|
|
|
* and dumpcap
|
2006-04-03 01:56:53 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2006-04-03 01:56:53 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2006-04-03 01:56:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/** @file
|
2013-01-07 16:26:45 +00:00
|
|
|
*
|
2006-04-03 01:56:53 +00:00
|
|
|
* Low-level sync pipe interfaces.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SYNC_PIPE_H__
|
|
|
|
#define __SYNC_PIPE_H__
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Maximum length of sync pipe message data. Must be < 2^24, as the
|
|
|
|
* message length is 3 bytes.
|
|
|
|
* XXX - this must be large enough to handle a Really Big Filter
|
|
|
|
* Expression, as the error message for an incorrect filter expression
|
|
|
|
* is a bit larger than the filter expression.
|
|
|
|
*/
|
2015-02-13 17:05:26 +00:00
|
|
|
#define SP_MAX_MSG_LEN 4096
|
2006-04-03 01:56:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Size of buffer to hold decimal representation of
|
|
|
|
signed/unsigned 64-bit int */
|
|
|
|
#define SP_DECISIZE 20
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Indications sent out on the sync pipe (from child to parent).
|
2013-01-07 16:26:45 +00:00
|
|
|
* We might want to switch to something like Thrift
|
|
|
|
* (http://thrift.apache.org/) or Protocol Buffers
|
|
|
|
* (http://code.google.com/p/protobuf-c/) if we ever need to use more
|
|
|
|
* complex messages.
|
2006-04-03 01:56:53 +00:00
|
|
|
*/
|
|
|
|
#define SP_FILE 'F' /* the name of the recently opened file */
|
|
|
|
#define SP_ERROR_MSG 'E' /* error message */
|
|
|
|
#define SP_BAD_FILTER 'B' /* error message for bad capture filter */
|
|
|
|
#define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
|
|
|
|
#define SP_DROPS 'D' /* count of packets dropped in capture */
|
2010-05-17 18:40:23 +00:00
|
|
|
#define SP_SUCCESS 'S' /* success indication, no extra data */
|
2017-04-15 21:30:30 +00:00
|
|
|
#define SP_TOOLBAR_CTRL 'T' /* interface toolbar control packet */
|
2006-04-03 01:56:53 +00:00
|
|
|
/*
|
|
|
|
* Win32 only: Indications sent out on the signal pipe (from parent to child)
|
|
|
|
* (UNIX-like sends signals for this)
|
|
|
|
*/
|
|
|
|
#define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
|
|
|
|
|
|
|
|
/* write a single message header to the recipient pipe */
|
2012-12-26 12:14:59 +00:00
|
|
|
extern ssize_t
|
2008-06-23 21:24:48 +00:00
|
|
|
pipe_write_header(int pipe_fd, char indicator, int length);
|
2006-04-03 01:56:53 +00:00
|
|
|
|
2013-01-07 16:26:45 +00:00
|
|
|
/* write a message to the recipient pipe in the standard format
|
|
|
|
(3 digit message length (excluding length and indicator field),
|
2006-04-03 01:56:53 +00:00
|
|
|
1 byte message indicator and the rest is the message).
|
|
|
|
If msg is NULL, the message has only a length and indicator. */
|
|
|
|
extern void
|
2008-06-23 21:24:48 +00:00
|
|
|
pipe_write_block(int pipe_fd, char indicator, const char *msg);
|
2006-04-03 01:56:53 +00:00
|
|
|
|
|
|
|
/** the child encountered an error, notify the parent */
|
2013-01-07 16:26:45 +00:00
|
|
|
extern void
|
2008-06-23 21:24:48 +00:00
|
|
|
sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
|
2006-04-03 01:56:53 +00:00
|
|
|
const char *secondary_error_msg);
|
|
|
|
|
2012-01-04 03:02:13 +00:00
|
|
|
/** Has the parent signalled the child to stop? */
|
|
|
|
#define SIGNAL_PIPE_CTRL_ID_NONE "none"
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
|
|
|
|
#endif
|
|
|
|
|
2014-10-14 19:58:21 +00:00
|
|
|
#endif /* sync_pipe.h */
|
|
|
|
|
2014-10-12 18:56:12 +00:00
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-10-12 18:56:12 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|