]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/winapi/include/boost/detail/winapi/pipes.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / winapi / include / boost / detail / winapi / pipes.hpp
CommitLineData
7c673cae
FG
1// pipes.hpp --------------------------------------------------------------//
2
3// Copyright 2016 Klemens D. Morgenstern
4// Copyright 2016 Andrey Semashev
5
6// Distributed under the Boost Software License, Version 1.0.
7// See http://www.boost.org/LICENSE_1_0.txt
8
9#ifndef BOOST_DETAIL_WINAPI_PIPES_HPP_
10#define BOOST_DETAIL_WINAPI_PIPES_HPP_
11
12#include <boost/detail/winapi/basic_types.hpp>
13#include <boost/detail/winapi/config.hpp>
14#include <boost/detail/winapi/overlapped.hpp>
15#include <boost/predef/platform.h>
16
17#ifdef BOOST_HAS_PRAGMA_ONCE
18#pragma once
19#endif
20
21#if BOOST_PLAT_WINDOWS_DESKTOP
22
23#if !defined( BOOST_USE_WINDOWS_H )
24extern "C" {
25
26BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI ImpersonateNamedPipeClient(
27 boost::detail::winapi::HANDLE_ hNamedPipe);
28
29BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI CreatePipe(
30 boost::detail::winapi::PHANDLE_ hReadPipe,
31 boost::detail::winapi::PHANDLE_ hWritePipe,
32 _SECURITY_ATTRIBUTES* lpPipeAttributes,
33 boost::detail::winapi::DWORD_ nSize);
34
35BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI ConnectNamedPipe(
36 boost::detail::winapi::HANDLE_ hNamedPipe,
37 _OVERLAPPED* lpOverlapped);
38
39BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI DisconnectNamedPipe(
40 boost::detail::winapi::HANDLE_ hNamedPipe);
41
42BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI SetNamedPipeHandleState(
43 boost::detail::winapi::HANDLE_ hNamedPipe,
44 boost::detail::winapi::LPDWORD_ lpMode,
45 boost::detail::winapi::LPDWORD_ lpMaxCollectionCount,
46 boost::detail::winapi::LPDWORD_ lpCollectDataTimeout);
47
48BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI PeekNamedPipe(
49 boost::detail::winapi::HANDLE_ hNamedPipe,
50 boost::detail::winapi::LPVOID_ lpBuffer,
51 boost::detail::winapi::DWORD_ nBufferSize,
52 boost::detail::winapi::LPDWORD_ lpBytesRead,
53 boost::detail::winapi::LPDWORD_ lpTotalBytesAvail,
54 boost::detail::winapi::LPDWORD_ lpBytesLeftThisMessage);
55
56BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI TransactNamedPipe(
57 boost::detail::winapi::HANDLE_ hNamedPipe,
58 boost::detail::winapi::LPVOID_ lpInBuffer,
59 boost::detail::winapi::DWORD_ nInBufferSize,
60 boost::detail::winapi::LPVOID_ lpOutBuffer,
61 boost::detail::winapi::DWORD_ nOutBufferSize,
62 boost::detail::winapi::LPDWORD_ lpBytesRead,
63 _OVERLAPPED* lpOverlapped);
64
65#if !defined( BOOST_NO_ANSI_APIS )
66BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI CreateNamedPipeA(
67 boost::detail::winapi::LPCSTR_ lpName,
68 boost::detail::winapi::DWORD_ dwOpenMode,
69 boost::detail::winapi::DWORD_ dwPipeMode,
70 boost::detail::winapi::DWORD_ nMaxInstances,
71 boost::detail::winapi::DWORD_ nOutBufferSize,
72 boost::detail::winapi::DWORD_ nInBufferSize,
73 boost::detail::winapi::DWORD_ nDefaultTimeOut,
74 _SECURITY_ATTRIBUTES *lpSecurityAttributes);
75
76BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI WaitNamedPipeA(
77 boost::detail::winapi::LPCSTR_ lpNamedPipeName,
78 boost::detail::winapi::DWORD_ nTimeOut);
79#endif // !defined( BOOST_NO_ANSI_APIS )
80
81BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI CreateNamedPipeW(
82 boost::detail::winapi::LPCWSTR_ lpName,
83 boost::detail::winapi::DWORD_ dwOpenMode,
84 boost::detail::winapi::DWORD_ dwPipeMode,
85 boost::detail::winapi::DWORD_ nMaxInstances,
86 boost::detail::winapi::DWORD_ nOutBufferSize,
87 boost::detail::winapi::DWORD_ nInBufferSize,
88 boost::detail::winapi::DWORD_ nDefaultTimeOut,
89 _SECURITY_ATTRIBUTES* lpSecurityAttributes);
90
91BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI WaitNamedPipeW(
92 boost::detail::winapi::LPCWSTR_ lpNamedPipeName,
93 boost::detail::winapi::DWORD_ nTimeOut);
94
95#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
96#if !defined( BOOST_NO_ANSI_APIS )
97BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI GetNamedPipeClientComputerNameA(
98 boost::detail::winapi::HANDLE_ Pipe,
99 boost::detail::winapi::LPSTR_ ClientComputerName,
100 boost::detail::winapi::ULONG_ ClientComputerNameLength);
101#endif // !defined( BOOST_NO_ANSI_APIS )
102
103BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI GetNamedPipeClientComputerNameW(
104 boost::detail::winapi::HANDLE_ Pipe,
105 boost::detail::winapi::LPWSTR_ ClientComputerName,
106 boost::detail::winapi::ULONG_ ClientComputerNameLength);
107#endif
108
109} // extern "C"
110#endif // !defined( BOOST_USE_WINDOWS_H )
111
112namespace boost {
113namespace detail {
114namespace winapi {
115
116#if defined( BOOST_USE_WINDOWS_H )
117
118const DWORD_ PIPE_ACCESS_DUPLEX_ = PIPE_ACCESS_DUPLEX;
119const DWORD_ PIPE_ACCESS_INBOUND_ = PIPE_ACCESS_INBOUND;
120const DWORD_ PIPE_ACCESS_OUTBOUND_ = PIPE_ACCESS_OUTBOUND;
121
122const DWORD_ PIPE_TYPE_BYTE_ = PIPE_TYPE_BYTE;
123const DWORD_ PIPE_TYPE_MESSAGE_ = PIPE_TYPE_MESSAGE;
124
125const DWORD_ PIPE_READMODE_BYTE_ = PIPE_READMODE_BYTE;
126const DWORD_ PIPE_READMODE_MESSAGE_ = PIPE_READMODE_MESSAGE;
127
128const DWORD_ PIPE_WAIT_ = PIPE_WAIT;
129const DWORD_ PIPE_NOWAIT_ = PIPE_NOWAIT;
130
131const DWORD_ PIPE_UNLIMITED_INSTANCES_ = PIPE_UNLIMITED_INSTANCES;
132
133const DWORD_ NMPWAIT_USE_DEFAULT_WAIT_ = NMPWAIT_USE_DEFAULT_WAIT;
134const DWORD_ NMPWAIT_NOWAIT_ = NMPWAIT_NOWAIT;
135const DWORD_ NMPWAIT_WAIT_FOREVER_ = NMPWAIT_WAIT_FOREVER;
136
137#else // defined( BOOST_USE_WINDOWS_H )
138
139const DWORD_ PIPE_ACCESS_DUPLEX_ = 0x00000003;
140const DWORD_ PIPE_ACCESS_INBOUND_ = 0x00000001;
141const DWORD_ PIPE_ACCESS_OUTBOUND_ = 0x00000002;
142
143const DWORD_ PIPE_TYPE_BYTE_ = 0x00000000;
144const DWORD_ PIPE_TYPE_MESSAGE_ = 0x00000004;
145
146const DWORD_ PIPE_READMODE_BYTE_ = 0x00000000;
147const DWORD_ PIPE_READMODE_MESSAGE_ = 0x00000002;
148
149const DWORD_ PIPE_WAIT_ = 0x00000000;
150const DWORD_ PIPE_NOWAIT_ = 0x00000001;
151
152const DWORD_ PIPE_UNLIMITED_INSTANCES_ = 255u;
153
154const DWORD_ NMPWAIT_USE_DEFAULT_WAIT_ = 0x00000000;
155const DWORD_ NMPWAIT_NOWAIT_ = 0x00000001;
156const DWORD_ NMPWAIT_WAIT_FOREVER_ = 0xFFFFFFFF;
157
158#endif // defined( BOOST_USE_WINDOWS_H )
159
160// These constants are not defined in Windows SDK prior to 7.0A
161const DWORD_ PIPE_ACCEPT_REMOTE_CLIENTS_ = 0x00000000;
162const DWORD_ PIPE_REJECT_REMOTE_CLIENTS_ = 0x00000008;
163
164using ::ImpersonateNamedPipeClient;
165using ::DisconnectNamedPipe;
166using ::SetNamedPipeHandleState;
167using ::PeekNamedPipe;
168
169#if !defined( BOOST_NO_ANSI_APIS )
170using ::WaitNamedPipeA;
171#endif
172using ::WaitNamedPipeW;
173
174#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
175#if !defined( BOOST_NO_ANSI_APIS )
176using ::GetNamedPipeClientComputerNameA;
177#endif // !defined( BOOST_NO_ANSI_APIS )
178using ::GetNamedPipeClientComputerNameW;
179#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
180
181BOOST_FORCEINLINE BOOL_ CreatePipe(PHANDLE_ hReadPipe, PHANDLE_ hWritePipe, LPSECURITY_ATTRIBUTES_ lpPipeAttributes, DWORD_ nSize)
182{
183 return ::CreatePipe(hReadPipe, hWritePipe, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpPipeAttributes), nSize);
184}
185
186BOOST_FORCEINLINE BOOL_ ConnectNamedPipe(HANDLE_ hNamedPipe, LPOVERLAPPED_ lpOverlapped)
187{
188 return ::ConnectNamedPipe(hNamedPipe, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
189}
190
191BOOST_FORCEINLINE BOOL_ TransactNamedPipe(HANDLE_ hNamedPipe, LPVOID_ lpInBuffer, DWORD_ nInBufferSize, LPVOID_ lpOutBuffer, DWORD_ nOutBufferSize, LPDWORD_ lpBytesRead, LPOVERLAPPED_ lpOverlapped)
192{
193 return ::TransactNamedPipe(hNamedPipe, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
194}
195
196
197#if !defined( BOOST_NO_ANSI_APIS )
198BOOST_FORCEINLINE HANDLE_ CreateNamedPipeA(
199 LPCSTR_ lpName,
200 DWORD_ dwOpenMode,
201 DWORD_ dwPipeMode,
202 DWORD_ nMaxInstances,
203 DWORD_ nOutBufferSize,
204 DWORD_ nInBufferSize,
205 DWORD_ nDefaultTimeOut,
206 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
207{
208 return ::CreateNamedPipeA(
209 lpName,
210 dwOpenMode,
211 dwPipeMode,
212 nMaxInstances,
213 nOutBufferSize,
214 nInBufferSize,
215 nDefaultTimeOut,
216 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
217}
218
219BOOST_FORCEINLINE HANDLE_ create_named_pipe(
220 LPCSTR_ lpName,
221 DWORD_ dwOpenMode,
222 DWORD_ dwPipeMode,
223 DWORD_ nMaxInstances,
224 DWORD_ nOutBufferSize,
225 DWORD_ nInBufferSize,
226 DWORD_ nDefaultTimeOut,
227 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
228{
229 return ::CreateNamedPipeA(
230 lpName,
231 dwOpenMode,
232 dwPipeMode,
233 nMaxInstances,
234 nOutBufferSize,
235 nInBufferSize,
236 nDefaultTimeOut,
237 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
238}
239#endif // !defined( BOOST_NO_ANSI_APIS )
240
241BOOST_FORCEINLINE HANDLE_ CreateNamedPipeW(
242 LPCWSTR_ lpName,
243 DWORD_ dwOpenMode,
244 DWORD_ dwPipeMode,
245 DWORD_ nMaxInstances,
246 DWORD_ nOutBufferSize,
247 DWORD_ nInBufferSize,
248 DWORD_ nDefaultTimeOut,
249 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
250{
251 return ::CreateNamedPipeW(
252 lpName,
253 dwOpenMode,
254 dwPipeMode,
255 nMaxInstances,
256 nOutBufferSize,
257 nInBufferSize,
258 nDefaultTimeOut,
259 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
260}
261
262BOOST_FORCEINLINE HANDLE_ create_named_pipe(
263 LPCWSTR_ lpName,
264 DWORD_ dwOpenMode,
265 DWORD_ dwPipeMode,
266 DWORD_ nMaxInstances,
267 DWORD_ nOutBufferSize,
268 DWORD_ nInBufferSize,
269 DWORD_ nDefaultTimeOut,
270 LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
271{
272 return ::CreateNamedPipeW(
273 lpName,
274 dwOpenMode,
275 dwPipeMode,
276 nMaxInstances,
277 nOutBufferSize,
278 nInBufferSize,
279 nDefaultTimeOut,
280 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes));
281}
282
283#if !defined( BOOST_NO_ANSI_APIS )
284BOOST_FORCEINLINE BOOL_ wait_named_pipe(LPCSTR_ lpNamedPipeName, DWORD_ nTimeOut)
285{
286 return ::WaitNamedPipeA(lpNamedPipeName, nTimeOut);
287}
288#endif //BOOST_NO_ANSI_APIS
289
290BOOST_FORCEINLINE BOOL_ wait_named_pipe(LPCWSTR_ lpNamedPipeName, DWORD_ nTimeOut)
291{
292 return ::WaitNamedPipeW(lpNamedPipeName, nTimeOut);
293}
294
295#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
296
297#if !defined( BOOST_NO_ANSI_APIS )
298BOOST_FORCEINLINE BOOL_ get_named_pipe_client_computer_name(HANDLE_ Pipe, LPSTR_ ClientComputerName, ULONG_ ClientComputerNameLength)
299{
300 return ::GetNamedPipeClientComputerNameA(Pipe, ClientComputerName, ClientComputerNameLength);
301}
302#endif // !defined( BOOST_NO_ANSI_APIS )
303
304BOOST_FORCEINLINE BOOL_ get_named_pipe_client_computer_name(HANDLE_ Pipe, LPWSTR_ ClientComputerName, ULONG_ ClientComputerNameLength)
305{
306 return ::GetNamedPipeClientComputerNameW(Pipe, ClientComputerName, ClientComputerNameLength);
307}
308
309#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
310
311}
312}
313}
314
315#endif // BOOST_PLAT_WINDOWS_DESKTOP
316
317#endif // BOOST_DETAIL_WINAPI_PIPES_HPP_