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.

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