]> git.proxmox.com Git - ceph.git/blob - 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
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 )
24 extern "C" {
25
26 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI ImpersonateNamedPipeClient(
27 boost::detail::winapi::HANDLE_ hNamedPipe);
28
29 BOOST_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
35 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI ConnectNamedPipe(
36 boost::detail::winapi::HANDLE_ hNamedPipe,
37 _OVERLAPPED* lpOverlapped);
38
39 BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI DisconnectNamedPipe(
40 boost::detail::winapi::HANDLE_ hNamedPipe);
41
42 BOOST_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
48 BOOST_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
56 BOOST_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 )
66 BOOST_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
76 BOOST_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
81 BOOST_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
91 BOOST_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 )
97 BOOST_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
103 BOOST_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
112 namespace boost {
113 namespace detail {
114 namespace winapi {
115
116 #if defined( BOOST_USE_WINDOWS_H )
117
118 const DWORD_ PIPE_ACCESS_DUPLEX_ = PIPE_ACCESS_DUPLEX;
119 const DWORD_ PIPE_ACCESS_INBOUND_ = PIPE_ACCESS_INBOUND;
120 const DWORD_ PIPE_ACCESS_OUTBOUND_ = PIPE_ACCESS_OUTBOUND;
121
122 const DWORD_ PIPE_TYPE_BYTE_ = PIPE_TYPE_BYTE;
123 const DWORD_ PIPE_TYPE_MESSAGE_ = PIPE_TYPE_MESSAGE;
124
125 const DWORD_ PIPE_READMODE_BYTE_ = PIPE_READMODE_BYTE;
126 const DWORD_ PIPE_READMODE_MESSAGE_ = PIPE_READMODE_MESSAGE;
127
128 const DWORD_ PIPE_WAIT_ = PIPE_WAIT;
129 const DWORD_ PIPE_NOWAIT_ = PIPE_NOWAIT;
130
131 const DWORD_ PIPE_UNLIMITED_INSTANCES_ = PIPE_UNLIMITED_INSTANCES;
132
133 const DWORD_ NMPWAIT_USE_DEFAULT_WAIT_ = NMPWAIT_USE_DEFAULT_WAIT;
134 const DWORD_ NMPWAIT_NOWAIT_ = NMPWAIT_NOWAIT;
135 const DWORD_ NMPWAIT_WAIT_FOREVER_ = NMPWAIT_WAIT_FOREVER;
136
137 #else // defined( BOOST_USE_WINDOWS_H )
138
139 const DWORD_ PIPE_ACCESS_DUPLEX_ = 0x00000003;
140 const DWORD_ PIPE_ACCESS_INBOUND_ = 0x00000001;
141 const DWORD_ PIPE_ACCESS_OUTBOUND_ = 0x00000002;
142
143 const DWORD_ PIPE_TYPE_BYTE_ = 0x00000000;
144 const DWORD_ PIPE_TYPE_MESSAGE_ = 0x00000004;
145
146 const DWORD_ PIPE_READMODE_BYTE_ = 0x00000000;
147 const DWORD_ PIPE_READMODE_MESSAGE_ = 0x00000002;
148
149 const DWORD_ PIPE_WAIT_ = 0x00000000;
150 const DWORD_ PIPE_NOWAIT_ = 0x00000001;
151
152 const DWORD_ PIPE_UNLIMITED_INSTANCES_ = 255u;
153
154 const DWORD_ NMPWAIT_USE_DEFAULT_WAIT_ = 0x00000000;
155 const DWORD_ NMPWAIT_NOWAIT_ = 0x00000001;
156 const 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
161 const DWORD_ PIPE_ACCEPT_REMOTE_CLIENTS_ = 0x00000000;
162 const DWORD_ PIPE_REJECT_REMOTE_CLIENTS_ = 0x00000008;
163
164 using ::ImpersonateNamedPipeClient;
165 using ::DisconnectNamedPipe;
166 using ::SetNamedPipeHandleState;
167 using ::PeekNamedPipe;
168
169 #if !defined( BOOST_NO_ANSI_APIS )
170 using ::WaitNamedPipeA;
171 #endif
172 using ::WaitNamedPipeW;
173
174 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
175 #if !defined( BOOST_NO_ANSI_APIS )
176 using ::GetNamedPipeClientComputerNameA;
177 #endif // !defined( BOOST_NO_ANSI_APIS )
178 using ::GetNamedPipeClientComputerNameW;
179 #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
180
181 BOOST_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
186 BOOST_FORCEINLINE BOOL_ ConnectNamedPipe(HANDLE_ hNamedPipe, LPOVERLAPPED_ lpOverlapped)
187 {
188 return ::ConnectNamedPipe(hNamedPipe, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped));
189 }
190
191 BOOST_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 )
198 BOOST_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
219 BOOST_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
241 BOOST_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
262 BOOST_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 )
284 BOOST_FORCEINLINE BOOL_ wait_named_pipe(LPCSTR_ lpNamedPipeName, DWORD_ nTimeOut)
285 {
286 return ::WaitNamedPipeA(lpNamedPipeName, nTimeOut);
287 }
288 #endif //BOOST_NO_ANSI_APIS
289
290 BOOST_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 )
298 BOOST_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
304 BOOST_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_