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.

127 lines
3.5 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // account.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class Accountant.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 08/05/1998 Original version.
  16. // 01/19/1999 Add PKT_ACCESS_CHALLENGE.
  17. // 05/18/1999 Store computerName as UTF-8.
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #ifndef _ACCOUNT_H_
  21. #define _ACCOUNT_H_
  22. #include <lmcons.h>
  23. #include <logfile.h>
  24. #include <logschema.h>
  25. #include <iastl.h>
  26. #include <iastlutl.h>
  27. using namespace IASTL;
  28. #include "resource.h"
  29. class FormattedBuffer;
  30. ///////////////////////////////////////////////////////////////////////////////
  31. //
  32. // CLASS
  33. //
  34. // Accountant
  35. //
  36. ///////////////////////////////////////////////////////////////////////////////
  37. class ATL_NO_VTABLE Accountant :
  38. public IASRequestHandlerSync,
  39. public CComCoClass<Accountant, &__uuidof(Accounting)>
  40. {
  41. public:
  42. IAS_DECLARE_REGISTRY(Accounting, 1, IAS_REGISTRY_AUTO, IASTypeLibrary)
  43. IAS_DECLARE_OBJECT_ID(IAS_PROVIDER_MICROSOFT_ACCOUNTING)
  44. Accountant() throw ();
  45. //////////
  46. // IIasComponent
  47. //////////
  48. STDMETHOD(Initialize)();
  49. STDMETHOD(Shutdown)();
  50. STDMETHOD(PutProperty)(LONG Id, VARIANT* pValue);
  51. protected:
  52. // Main request processing routine.
  53. virtual IASREQUESTSTATUS onSyncRequest(IRequest* pRequest) throw ();
  54. // Packet types.
  55. enum PacketType
  56. {
  57. PKT_UNKNOWN = 0,
  58. PKT_ACCESS_REQUEST = 1,
  59. PKT_ACCESS_ACCEPT = 2,
  60. PKT_ACCESS_REJECT = 3,
  61. PKT_ACCOUNTING_REQUEST = 4,
  62. PKT_ACCESS_CHALLENGE = 11
  63. };
  64. // Append a record to log file.
  65. void appendRecord(
  66. IASRequest& request,
  67. PacketType packetType,
  68. FormattedBuffer& buffer,
  69. const SYSTEMTIME& localTime
  70. ) const throw (_com_error);
  71. // Signature of a record formatter.
  72. typedef void (__stdcall Accountant::*Formatter)(
  73. IASRequest& request,
  74. FormattedBuffer& buffer,
  75. const SYSTEMTIME& localTime,
  76. PATTRIBUTEPOSITION firstPos,
  77. PATTRIBUTEPOSITION lastPos
  78. ) const throw (_com_error);
  79. // Formatter for ODBC records.
  80. void __stdcall formatODBCRecord(
  81. IASRequest& request,
  82. FormattedBuffer& buffer,
  83. const SYSTEMTIME& localTime,
  84. PATTRIBUTEPOSITION firstPos,
  85. PATTRIBUTEPOSITION lastPos
  86. ) const throw (_com_error);
  87. // Formatter for W3C records.
  88. void __stdcall formatW3CRecord(
  89. IASRequest& request,
  90. FormattedBuffer& buffer,
  91. const SYSTEMTIME& localTime,
  92. PATTRIBUTEPOSITION firstPos,
  93. PATTRIBUTEPOSITION lastPos
  94. ) const throw (_com_error);
  95. BOOL logAuth; // Log authentication requests ?
  96. BOOL logAcct; // Log accounting requests ?
  97. BOOL logInterim; // Log interim accounting requests ?
  98. LogFile log; // Log file.
  99. LogSchema schema; // Log schema.
  100. Formatter format; // Pointer to member function being used for formatting.
  101. // Cached computername in UTF-8.
  102. CHAR computerName[MAX_COMPUTERNAME_LENGTH * 3];
  103. DWORD computerNameLen;
  104. };
  105. #endif // _ACCOUNT_H_