Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
ws_pipe.h
1 /* ws_pipe.h
2  *
3  * Routines for handling pipes.
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 #ifndef __WS_PIPE_H__
13 #define __WS_PIPE_H__
14 
15 // ws_symbol_export and WS_INVALID_PID
16 #include "wsutil/processes.h"
17 
18 #include <glib.h>
19 
20 #ifdef _WIN32
21 #include <windows.h>
22 #include <io.h>
23 #define ws_pipe_handle HANDLE
24 #define ws_get_pipe_handle(pipe_fd) ((HANDLE)_get_osfhandle(pipe_fd))
25 #else
26 #define ws_pipe_handle int
27 #define ws_get_pipe_handle(pipe_fd) (pipe_fd)
28 #endif
29 
30 typedef struct _ws_pipe_t {
31  GPid pid;
32  gchar *stderr_msg;
33  gint exitcode;
34  gint stdin_fd;
35  gint stdout_fd;
36  gint stderr_fd;
37 #ifdef _WIN32
38  HANDLE threadId;
39 #endif
40 } ws_pipe_t;
41 
52 WS_DLL_PUBLIC gboolean ws_pipe_spawn_sync ( gchar * dirname, gchar * command, gint argc, gchar ** argv, gchar ** command_output );
53 
58 WS_DLL_PUBLIC void ws_pipe_init(ws_pipe_t *ws_pipe);
59 
63 static inline gboolean ws_pipe_valid(ws_pipe_t *ws_pipe)
64 {
65  return ws_pipe && ws_pipe->pid && ws_pipe->pid != WS_INVALID_PID;
66 }
67 
74 WS_DLL_PUBLIC GPid ws_pipe_spawn_async (ws_pipe_t * ws_pipe, GPtrArray * args );
75 
76 #ifdef _WIN32
77 
84 WS_DLL_PUBLIC gboolean ws_pipe_wait_for_pipe(HANDLE * pipe_handles, int num_pipe_handles, HANDLE pid);
85 #endif
86 
92 WS_DLL_PUBLIC gboolean ws_pipe_data_available(int pipe_fd);
93 
101 WS_DLL_PUBLIC gboolean ws_read_string_from_pipe(ws_pipe_handle read_pipe,
102  gchar *buffer, size_t buffer_size);
103 
104 #endif /* __WS_PIPE_H__ */
105 
106 /*
107  * Editor modelines - http://www.wireshark.org/tools/modelines.html
108  *
109  * Local variables:
110  * c-basic-offset: 4
111  * tab-width: 8
112  * indent-tabs-mode: nil
113  * End:
114  *
115  * vi: set shiftwidth=4 tabstop=8 expandtab:
116  * :indentSize=4:tabSize=8:noTabs=true:
117  */
Definition: ws_pipe.h:30
Definition: mcast_stream.h:30