Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
/home/wireshark/builders/wireshark-master/ubuntu-16.04-x64/build/sync_pipe.h
Go to the documentation of this file.
1 /* sync_pipe.h
2  * Low-level synchronization pipe routines for use by Wireshark/TShark
3  * and dumpcap
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 
18 #ifndef __SYNC_PIPE_H__
19 #define __SYNC_PIPE_H__
20 
21 
22 /*
23  * Maximum length of sync pipe message data. Must be < 2^24, as the
24  * message length is 3 bytes.
25  * XXX - this must be large enough to handle a Really Big Filter
26  * Expression, as the error message for an incorrect filter expression
27  * is a bit larger than the filter expression.
28  */
29 #define SP_MAX_MSG_LEN 4096
30 
31 
32 /* Size of buffer to hold decimal representation of
33  signed/unsigned 64-bit int */
34 #define SP_DECISIZE 20
35 
36 /*
37  * Indications sent out on the sync pipe (from child to parent).
38  * We might want to switch to something like Thrift
39  * (http://thrift.apache.org/) or Protocol Buffers
40  * (http://code.google.com/p/protobuf-c/) if we ever need to use more
41  * complex messages.
42  */
43 #define SP_FILE 'F' /* the name of the recently opened file */
44 #define SP_ERROR_MSG 'E' /* error message */
45 #define SP_BAD_FILTER 'B' /* error message for bad capture filter */
46 #define SP_PACKET_COUNT 'P' /* count of packets captured since last message */
47 #define SP_DROPS 'D' /* count of packets dropped in capture */
48 #define SP_SUCCESS 'S' /* success indication, no extra data */
49 #define SP_TOOLBAR_CTRL 'T' /* interface toolbar control packet */
50 /*
51  * Win32 only: Indications sent out on the signal pipe (from parent to child)
52  * (UNIX-like sends signals for this)
53  */
54 #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */
55 
56 /* write a single message header to the recipient pipe */
57 extern ssize_t
58 pipe_write_header(int pipe_fd, char indicator, int length);
59 
60 /* write a message to the recipient pipe in the standard format
61  (3 digit message length (excluding length and indicator field),
62  1 byte message indicator and the rest is the message).
63  If msg is NULL, the message has only a length and indicator. */
64 extern void
65 pipe_write_block(int pipe_fd, char indicator, const char *msg);
66 
68 extern void
69 sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
70  const char *secondary_error_msg);
71 
73 #define SIGNAL_PIPE_CTRL_ID_NONE "none"
74 #ifdef _WIN32
75 #define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
76 #endif
77 
78 #endif /* sync_pipe.h */
79 
80 /*
81  * Editor modelines - http://www.wireshark.org/tools/modelines.html
82  *
83  * Local variables:
84  * c-basic-offset: 4
85  * tab-width: 8
86  * indent-tabs-mode: nil
87  * End:
88  *
89  * vi: set shiftwidth=4 tabstop=8 expandtab:
90  * :indentSize=4:tabSize=8:noTabs=true:
91  */
void sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg, const char *secondary_error_msg)
Definition: sync_pipe_write.c:84