FreeRDP
include/winpr/pipe.h
1 
20 #ifndef WINPR_PIPE_H
21 #define WINPR_PIPE_H
22 
23 #include <winpr/file.h>
24 #include <winpr/winpr.h>
25 #include <winpr/error.h>
26 #include <winpr/handle.h>
27 #include <winpr/wtypes.h>
28 
29 #ifndef _WIN32
30 
31 #define PIPE_UNLIMITED_INSTANCES 0xFF
32 
33 #define PIPE_ACCESS_INBOUND 0x00000001
34 #define PIPE_ACCESS_OUTBOUND 0x00000002
35 #define PIPE_ACCESS_DUPLEX 0x00000003
36 
37 #define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
38 #define FILE_FLAG_WRITE_THROUGH 0x80000000
39 #define FILE_FLAG_OVERLAPPED 0x40000000
40 
41 #define PIPE_CLIENT_END 0x00000000
42 #define PIPE_SERVER_END 0x00000001
43 
44 #define PIPE_TYPE_BYTE 0x00000000
45 #define PIPE_TYPE_MESSAGE 0x00000004
46 
47 #define PIPE_READMODE_BYTE 0x00000000
48 #define PIPE_READMODE_MESSAGE 0x00000002
49 
50 #define PIPE_WAIT 0x00000000
51 #define PIPE_NOWAIT 0x00000001
52 
53 #define PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000
54 #define PIPE_REJECT_REMOTE_CLIENTS 0x00000008
55 
56 #define NMPWAIT_USE_DEFAULT_WAIT 0x00000000
57 #define NMPWAIT_NOWAIT 0x00000001
58 #define NMPWAIT_WAIT_FOREVER 0xFFFFFFFF
59 
60 #ifdef __cplusplus
61 extern "C"
62 {
63 #endif
64 
69  WINPR_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe,
70  LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
71 
76  WINPR_ATTR_MALLOC(CloseHandle, 1)
77  WINPR_API HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode,
78  DWORD nMaxInstances, DWORD nOutBufferSize,
79  DWORD nInBufferSize, DWORD nDefaultTimeOut,
80  LPSECURITY_ATTRIBUTES lpSecurityAttributes);
81 
82  WINPR_ATTR_MALLOC(CloseHandle, 1)
83  WINPR_API HANDLE CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode,
84  DWORD nMaxInstances, DWORD nOutBufferSize,
85  DWORD nInBufferSize, DWORD nDefaultTimeOut,
86  LPSECURITY_ATTRIBUTES lpSecurityAttributes);
87 
88  WINPR_API BOOL ConnectNamedPipe(HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped);
89 
90  WINPR_API BOOL DisconnectNamedPipe(HANDLE hNamedPipe);
91 
92  WINPR_API BOOL PeekNamedPipe(HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize,
93  LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail,
94  LPDWORD lpBytesLeftThisMessage);
95 
96  WINPR_API BOOL TransactNamedPipe(HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize,
97  LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead,
98  LPOVERLAPPED lpOverlapped);
99 
100  WINPR_API BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut);
101  WINPR_API BOOL WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut);
102 
103  WINPR_API BOOL SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode,
104  LPDWORD lpMaxCollectionCount,
105  LPDWORD lpCollectDataTimeout);
106 
107  WINPR_API BOOL ImpersonateNamedPipeClient(HANDLE hNamedPipe);
108 
109  WINPR_API BOOL GetNamedPipeClientComputerNameA(HANDLE Pipe, LPCSTR ClientComputerName,
110  ULONG ClientComputerNameLength);
111  WINPR_API BOOL GetNamedPipeClientComputerNameW(HANDLE Pipe, LPCWSTR ClientComputerName,
112  ULONG ClientComputerNameLength);
113 
114 #ifdef UNICODE
115 #define CreateNamedPipe CreateNamedPipeW
116 #define WaitNamedPipe WaitNamedPipeW
117 #define GetNamedPipeClientComputerName GetNamedPipeClientComputerNameW
118 #else
119 #define CreateNamedPipe CreateNamedPipeA
120 #define WaitNamedPipe WaitNamedPipeA
121 #define GetNamedPipeClientComputerName GetNamedPipeClientComputerNameA
122 #endif
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif
129 
130 #endif /* WINPR_PIPE_H */