Leaked source code of windows server 2003
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.

132 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. buffsock.hxx
  5. Abstract:
  6. Simple socket class for buffered I/O.
  7. Author:
  8. Keith Moore (keithmo) 02-Dec-1996
  9. Revision History:
  10. --*/
  11. #ifndef _BUFFSOCK_HXX_
  12. #define _BUFFSOCK_HXX_
  13. class BUFFERED_SOCKET {
  14. public:
  15. //
  16. // Constructor/destructor.
  17. //
  18. BUFFERED_SOCKET();
  19. ~BUFFERED_SOCKET();
  20. //
  21. // Initializers.
  22. //
  23. INT
  24. InitializeClient(
  25. LPSTR HostName,
  26. USHORT Port
  27. );
  28. INT
  29. InitializeClient(
  30. LPSOCKADDR_IN HostAddress
  31. );
  32. INT
  33. InitializeClient(
  34. SOCKET Socket
  35. );
  36. INT
  37. InitializeServer(
  38. USHORT Port
  39. );
  40. //
  41. // Basic I/O.
  42. //
  43. INT
  44. Send(
  45. PVOID Buffer,
  46. LPDWORD BufferLength
  47. );
  48. INT
  49. Recv(
  50. PVOID Buffer,
  51. LPDWORD BufferLength
  52. );
  53. //
  54. // Framed I/O.
  55. //
  56. INT
  57. SendFrame(
  58. PVOID Buffer,
  59. LPDWORD BufferLength
  60. );
  61. INT
  62. RecvFrame(
  63. PVOID Buffer,
  64. LPDWORD BufferLength
  65. );
  66. //
  67. // Blob I/O.
  68. //
  69. INT
  70. SendBlob(
  71. PIIS_CRYPTO_BLOB Blob
  72. );
  73. INT
  74. RecvBlob(
  75. PIIS_CRYPTO_BLOB * ppBlob
  76. );
  77. private:
  78. SOCKET m_Socket;
  79. PVOID m_Buffer;
  80. DWORD m_BufferLength;
  81. DWORD m_BytesAvailable;
  82. DWORD m_Offset;
  83. BOOL m_Initialized;
  84. INT
  85. BufferedRecv(
  86. PVOID Buffer,
  87. DWORD BufferLength
  88. );
  89. INT
  90. CommonInitialize();
  91. static LONG m_InitCount;
  92. }; // BUFFERED_SOCKET
  93. #endif // _BUFFSOCK_HXX_