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.

230 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. emsapi.h
  5. Abstract:
  6. This module provides the C++ foundation classes for implementing
  7. SAC channels.
  8. Author:
  9. Brian Guarraci (briangu), 2001
  10. Revision History:
  11. --*/
  12. #ifndef _EMS_API_H
  13. #define _EMS_API_H
  14. extern "C" {
  15. #include <sacapi.h>
  16. }
  17. ///////////////////////////////////////////////////////////
  18. //
  19. // This class defines the base channel object. It is primarily
  20. // a base interface class with a handle to the channel. Children
  21. // of this are generally variations of the interface.
  22. //
  23. ///////////////////////////////////////////////////////////
  24. class EMSChannel {
  25. protected:
  26. //
  27. // Don't let users instantiate directly
  28. //
  29. EMSChannel();
  30. //
  31. // Status determining if we have a valid channel handle
  32. //
  33. BOOL myHaveValidHandle;
  34. inline BOOL
  35. HaveValidHandle(
  36. VOID
  37. )
  38. {
  39. return myHaveValidHandle;
  40. }
  41. //
  42. // The channel handle the instace refers to
  43. //
  44. SAC_CHANNEL_HANDLE myEMSChannelHandle;
  45. //
  46. // opens the channel during construction
  47. //
  48. BOOL
  49. virtual Open(
  50. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  51. );
  52. //
  53. // closes the channel during destruction
  54. //
  55. BOOL
  56. virtual Close(
  57. VOID
  58. );
  59. public:
  60. virtual ~EMSChannel();
  61. static EMSChannel*
  62. Construct(
  63. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  64. );
  65. //
  66. // Get the channel handle
  67. //
  68. inline SAC_CHANNEL_HANDLE
  69. GetEMSChannelHandle(
  70. VOID
  71. )
  72. {
  73. return myEMSChannelHandle;
  74. }
  75. //
  76. // Determine if the channel has new data to read
  77. //
  78. BOOL
  79. HasNewData(
  80. OUT PBOOL InputWaiting
  81. );
  82. };
  83. ///////////////////////////////////////////////////////////
  84. //
  85. ///////////////////////////////////////////////////////////
  86. class EMSRawChannel : public EMSChannel {
  87. protected:
  88. //
  89. // Don't let users instantiate the channel directly
  90. //
  91. EMSRawChannel();
  92. public:
  93. static EMSRawChannel*
  94. Construct(
  95. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  96. );
  97. virtual ~EMSRawChannel();
  98. //
  99. // Manual I/O functions
  100. //
  101. BOOL
  102. Write(
  103. IN PCBYTE Buffer,
  104. IN ULONG BufferSize
  105. );
  106. BOOL
  107. Read(
  108. OUT PBYTE Buffer,
  109. IN ULONG BufferSize,
  110. OUT PULONG ByteCount
  111. );
  112. };
  113. ///////////////////////////////////////////////////////////
  114. //
  115. ///////////////////////////////////////////////////////////
  116. class EMSVTUTF8Channel : public EMSChannel {
  117. private:
  118. //
  119. // Don't let users instantiate the channel directly
  120. //
  121. EMSVTUTF8Channel();
  122. public:
  123. virtual ~EMSVTUTF8Channel();
  124. static EMSVTUTF8Channel*
  125. Construct(
  126. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  127. );
  128. BOOL
  129. Write(
  130. IN PCWCHAR Buffer,
  131. IN ULONG BufferSize
  132. );
  133. BOOL
  134. Write(
  135. IN PCWSTR Buffer
  136. );
  137. BOOL
  138. Read(
  139. OUT PWSTR Buffer,
  140. IN ULONG BufferSize,
  141. OUT PULONG ByteCount
  142. );
  143. };
  144. ///////////////////////////////////////////////////////////
  145. //
  146. ///////////////////////////////////////////////////////////
  147. class EMSCmdChannel : public EMSChannel {
  148. protected:
  149. //
  150. // Don't let users instantiate the channel directly
  151. //
  152. EMSCmdChannel();
  153. public:
  154. static EMSCmdChannel*
  155. Construct(
  156. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  157. );
  158. virtual ~EMSCmdChannel();
  159. BOOL
  160. Write(
  161. IN PCBYTE Buffer,
  162. IN ULONG BufferSize
  163. );
  164. BOOL
  165. Read(
  166. OUT PBYTE Buffer,
  167. IN ULONG BufferSize,
  168. OUT PULONG ByteCount
  169. );
  170. };
  171. #endif