pipe.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * WinPR: Windows Portable Runtime
  3. * Pipe Functions
  4. *
  5. * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #ifndef WINPR_PIPE_PRIVATE_H
  20. #define WINPR_PIPE_PRIVATE_H
  21. #ifndef _WIN32
  22. #include <winpr/pipe.h>
  23. #include <winpr/collections.h>
  24. #include "../handle/handle.h"
  25. struct winpr_pipe
  26. {
  27. WINPR_HANDLE_DEF();
  28. int fd;
  29. };
  30. typedef struct winpr_pipe WINPR_PIPE;
  31. typedef struct winpr_named_pipe WINPR_NAMED_PIPE;
  32. typedef void (*fnUnrefNamedPipe)(WINPR_NAMED_PIPE* pNamedPipe);
  33. struct winpr_named_pipe
  34. {
  35. WINPR_HANDLE_DEF();
  36. int clientfd;
  37. int serverfd;
  38. char* name;
  39. char* lpFileName;
  40. char* lpFilePath;
  41. BOOL ServerMode;
  42. DWORD dwOpenMode;
  43. DWORD dwPipeMode;
  44. DWORD nMaxInstances;
  45. DWORD nOutBufferSize;
  46. DWORD nInBufferSize;
  47. DWORD nDefaultTimeOut;
  48. DWORD dwFlagsAndAttributes;
  49. LPOVERLAPPED lpOverlapped;
  50. fnUnrefNamedPipe pfnUnrefNamedPipe;
  51. };
  52. BOOL winpr_destroy_named_pipe(WINPR_NAMED_PIPE* pNamedPipe);
  53. BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
  54. LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
  55. BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
  56. LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
  57. #endif
  58. #endif /* WINPR_PIPE_PRIVATE_H */