Put special pipe-handling code into libwsutil.
[metze/wireshark/wip.git] / wsutil / 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+
10  */
11
12 #ifndef __WS_PIPE_H__
13 #define __WS_PIPE_H__
14
15 #include "ws_symbol_export.h"
16
17 #ifdef _WIN32
18 #include <windows.h>
19 #include <io.h>
20 #define ws_pipe_handle                  HANDLE
21 #define ws_get_pipe_handle(pipe_fd)     ((HANDLE)_get_osfhandle(pipe_fd))
22 #else
23 #define ws_pipe_handle                  int
24 #define ws_get_pipe_handle(pipe_fd)     (pipe_fd)
25 #endif
26
27 WS_DLL_PUBLIC gboolean ws_pipe_data_available(int pipe_fd);
28
29 WS_DLL_PUBLIC gboolean ws_read_string_from_pipe(ws_pipe_handle read_pipe,
30     gchar *buffer, size_t buffer_size);
31
32 #endif /* __WS_PIPE_H__ */