Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

  1. #ifndef __iptel_gkutil_gkwsock_h
  2. #define __iptel_gkutil_gkwsock_h
  3. #define ASYNC_ACCEPT_BUFFER_SIZE 0x100
  4. struct ASYNC_ACCEPT;
  5. typedef void (*ASYNC_ACCEPT_FUNC)
  6. (PVOID Context,
  7. SOCKET ClientSocket,
  8. SOCKADDR_IN * LocalAddress,
  9. SOCKADDR_IN * RemoteAddress);
  10. // if ClientSocket != INVALID_SOCKET, then there is an accept pending
  11. // otherwise, no accept is pending.
  12. struct ASYNC_ACCEPT :
  13. public SIMPLE_CRITICAL_SECTION_BASE
  14. {
  15. private:
  16. LONG ReferenceCount;
  17. SOCKET AcceptSocket;
  18. SOCKET ClientSocket;
  19. BYTE ClientInfoBuffer [ASYNC_ACCEPT_BUFFER_SIZE];
  20. DWORD ClientInfoBufferLength;
  21. OVERLAPPED Overlapped;
  22. ASYNC_ACCEPT_FUNC AcceptFunc;
  23. PVOID AcceptFuncContext;
  24. HANDLE StopNotifyEvent;
  25. private:
  26. HRESULT StartIoLocked (
  27. IN SOCKADDR_IN * SocketAddress);
  28. void IoComplete (DWORD, DWORD);
  29. HRESULT IssueAccept (void);
  30. static void IoCompletionCallback (DWORD, DWORD, LPOVERLAPPED);
  31. public:
  32. ASYNC_ACCEPT (void);
  33. ~ASYNC_ACCEPT (void);
  34. HRESULT StartIo (
  35. IN SOCKADDR_IN * SocketAddress,
  36. IN ASYNC_ACCEPT_FUNC AcceptFunc,
  37. IN PVOID Context);
  38. HRESULT GetListenSocketAddress (
  39. OUT SOCKADDR_IN * ReturnSocketAddress);
  40. void StopWait (void);
  41. void AddRef (void);
  42. void Release (void);
  43. };
  44. #endif // __iptel_gkutil_gkwsock_h