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.

238 lines
7.4 KiB

  1. /***********************************************************************
  2. * INTEL Corporation Proprietary Information *
  3. * *
  4. * This listing is supplied under the terms of a license agreement *
  5. * with INTEL Corporation and may not be copied nor disclosed except *
  6. * in accordance with the terms of that agreement. *
  7. * *
  8. * Copyright (c) 1996 Intel Corporation. All rights reserved. *
  9. ***********************************************************************/
  10. #ifndef __CPLS_H
  11. #define __CPLS_H
  12. #include <limits.h>
  13. #ifdef WIN32
  14. #include <windows.h>
  15. #include <windowsx.h>
  16. #include "port32.h"
  17. #endif
  18. #ifdef _WINDOWS
  19. #ifndef _MSWINDOWS_
  20. #define _MSWINDOWS_
  21. #endif
  22. #endif
  23. typedef int HLOG;
  24. #ifndef FALSE
  25. #define FALSE 0
  26. #endif
  27. #ifndef TRUE
  28. #define TRUE 1
  29. #endif
  30. #ifdef WIN32
  31. #ifdef BUILDING_CPLS_DLL
  32. #define CPLS_FAREXPORT __declspec(dllexport)
  33. #define CPLS_EXPORT __declspec(dllexport)
  34. #else
  35. #define CPLS_FAREXPORT __declspec(dllimport)
  36. #define CPLS_EXPORT __declspec(dllimport)
  37. #endif
  38. #ifndef EXPORT
  39. #define EXPORT
  40. #endif // EXPORT
  41. #elif _MSWINDOWS_
  42. #ifndef CALLBACK
  43. #define CALLBACK _far _pascal
  44. #endif
  45. #ifdef BUILDING_CPLS_DLL
  46. #define CPLS_FAREXPORT _far _export _pascal
  47. #define CPLS_EXPORT _export
  48. #else
  49. #define CPLS_FAREXPORT _far _pascal
  50. #define CPLS_EXPORT
  51. #endif
  52. #ifndef EXPORT
  53. #define EXPORT _export
  54. #endif // EXPORT
  55. #ifndef FAR
  56. #define FAR _far
  57. #endif
  58. #else
  59. #ifndef CALLBACK
  60. #define CALLBACK
  61. #endif
  62. #define CPLS_FAREXPORT
  63. #ifndef EXPORT
  64. #define EXPORT
  65. #endif
  66. #ifndef FAR
  67. #define FAR
  68. #endif
  69. #endif // _MSWINDOWS_
  70. typedef int BOOL;
  71. typedef unsigned char BYTE;
  72. typedef unsigned short WORD;
  73. typedef const char FAR* CPLProtocol;
  74. typedef int CPLProtocolID;
  75. #define CONFIG_FILENAME "CPLS.INI" // internal use only
  76. // Pre-defined event and event category constants.
  77. //
  78. #define String_Event USHRT_MAX
  79. #define Binary_Event USHRT_MAX-1
  80. #define String_Category USHRT_MAX
  81. #define Binary_Category USHRT_MAX-1
  82. #ifdef __cplusplus
  83. class CProtocolLog;
  84. class CProtocolEvent;
  85. typedef CProtocolEvent FAR* (CALLBACK *CPLEventGenesisProc)(
  86. BYTE FAR* pObject, // in
  87. CProtocolLog FAR* pSourceLog, // in
  88. BOOL bCopyObject ); // in
  89. extern "C"{
  90. // This first one is only for C++ clients...
  91. void CPLS_FAREXPORT CPLRegisterEventGenesisProc( CPLProtocolID ProtocolID, CPLEventGenesisProc pfnGenesisProc );
  92. #endif // __cplusplus
  93. // Possible file mode values for CPLOpen().
  94. //
  95. #define CPLS_CREATE 0 // Will overwrite an existing file.
  96. #define CPLS_APPEND 1 // Will append to an existing file, or create a new one.
  97. /////////////////////////////////////////////////////////////////////////////
  98. // PROTOCOL LOGGING FUNCTIONS
  99. //
  100. // Here is the sequence of functions to call for use of a protocol logger:
  101. // 1) CPLInitialize() or CPLINTInitialize()
  102. // 2) CPLOpen()
  103. // 3) CPLOutput*() or CPLINTOutput*() -- repeat as necessary
  104. // 4) CPLClose()
  105. // 5) CPLUninitialize()
  106. //
  107. // CPLInitialize() - Creates a protocol logger.
  108. // CPLINTInitialize() - The version of CPLInitialize() which must be called
  109. // by clients which will be calling the CPLINTOuptut*() functions within
  110. // interrupt context. CPLINTInitialize may not be called within
  111. // interrupt context.
  112. // CPLUninitialize() - Releases a protocol logger. This must be called for
  113. // every initialized logger before shutdown in order to free associated
  114. // memory.
  115. // CPLOpen() - Associates a protocol logger with a file (output stream).
  116. // CPLClose() - Releases a logger's usage of a stream. This function does
  117. // not block. A "close" event is placed on the event queue of the
  118. // stream. Release of the stream occurs when this "close" event is
  119. // serviced.
  120. // CPLOutputDebug() -
  121. // CPLINTOutputDebug() - The version of CPLOutputDebug() safely callable
  122. // within interrupt context.
  123. // CPLOutputAscii() -
  124. // CPLINTOutputAscii() - The version of CPLOutputAscii() safely callable
  125. // within interrupt context.
  126. // CPLOutput() -
  127. // CPLINTOutput() - The version of CPLOutput() safely callable
  128. // within interrupt context.
  129. // CPLFlush() - Flushes all events to the stream of the specified logger.
  130. // Blocks until the flush is complete.
  131. // CPLINTFlush() - The version of CPLFlush() safely callable within
  132. // interrupt context. This version does not block. A "flush" message
  133. // is sent to CPLS. The flush occurs when this flush message is
  134. // serviced.
  135. // CPLFlushAndClose() -
  136. // CPLEnable() - Enables or disables protocol logging at runtime.
  137. // CPLEnableAsync() - Sets synchronous or asynchronous logging output mode.
  138. // CURRENTLY NOT SUPPORTED.
  139. // CPLLogAscii() -
  140. // CPLINTLogAscii() - The version of CPLLogAscii() safely callable
  141. // within interrupt context.
  142. //
  143. // Only these functions may be called from within interrupt context:
  144. // CPLINTOutputDebug()
  145. // CPLINTOutputAscii()
  146. // CPLINTOutput()
  147. // CPLINTFlush()
  148. // CPLEnable()
  149. // CPLINTLogAscii()
  150. /////////////////////////////////////////////////////////////////////////////
  151. CPLProtocolID CPLS_FAREXPORT WINAPI CPLInitialize( CPLProtocol Protocol );
  152. CPLProtocolID CPLS_FAREXPORT CPLINTInitialize( CPLProtocol Protocol );
  153. int CPLS_FAREXPORT WINAPI CPLUninitialize( HLOG hlog );
  154. HLOG CPLS_FAREXPORT WINAPI CPLOpen( CPLProtocolID ProtocolID,
  155. const char FAR* szName,
  156. int FileMode );
  157. HLOG CPLS_FAREXPORT CPLINTOpen( CPLProtocolID ProtocolID,
  158. const char FAR* szName,
  159. int FileMode );
  160. int CPLS_FAREXPORT WINAPI CPLClose( HLOG hLog );
  161. int CPLS_FAREXPORT CPLOutputDebug( HLOG hLog,
  162. const char FAR* szString );
  163. int CPLS_FAREXPORT CPLINTOutputDebug( HLOG hLog,
  164. const char FAR* szString );
  165. int CPLS_FAREXPORT CPLOutputAscii( HLOG hLog,
  166. WORD EventID,
  167. const char FAR* szEvent,
  168. BYTE FAR* pData,
  169. int nDataBytes,
  170. WORD EventCategory,
  171. unsigned long UserData );
  172. int CPLS_FAREXPORT CPLINTOutputAscii( HLOG hLog,
  173. WORD EventID,
  174. const char FAR* szEvent,
  175. BYTE FAR* pData,
  176. int nDataBytes,
  177. WORD EventCategory,
  178. unsigned long UserData );
  179. int CPLS_FAREXPORT WINAPI CPLOutput( HLOG hLog,
  180. BYTE FAR* pData,
  181. int nDataBytes,
  182. unsigned long UserData );
  183. int CPLS_FAREXPORT CPLINTOutput( HLOG hLog,
  184. BYTE FAR* pData,
  185. int nDataBytes,
  186. unsigned long UserData );
  187. int CPLS_FAREXPORT CPLFlush( HLOG hLog );
  188. int CPLS_FAREXPORT CPLINTFlush( HLOG hLog );
  189. int CPLS_FAREXPORT CPLFlushAndClose( HLOG hLog );
  190. void CPLS_FAREXPORT CPLEnable( BOOL bEnable );
  191. //void CPLS_FAREXPORT CPLEnableAsync( BOOL bEnable );
  192. #ifdef __cplusplus
  193. }; // extern "C"
  194. #endif // __cplusplus
  195. #define CPLLogAscii( hLog, \
  196. EventID, \
  197. pData, \
  198. nDataBytes, \
  199. EventCategory, \
  200. UserData ) \
  201. CPLOutputAscii( hLog, EventID, #EventID, pData, nDataBytes, EventCategory, UserData )
  202. #define CPLINTLogAscii( hLog, \
  203. EventID, \
  204. pData, \
  205. nDataBytes, \
  206. EventCategory, \
  207. UserData ) \
  208. CPLINTOutputAscii( hLog, EventID, #EventID, pData, nDataBytes, EventCategory, UserData )
  209. #endif // __CPLS_H