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.

94 lines
2.3 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // classattr.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class IASClass.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 08/06/1998 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _CLASSATTR_H_
  19. #define _CLASSATTR_H_
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. #include <iaspolcy.h>
  24. #include <iasutil.h>
  25. ///////////////////////////////////////////////////////////////////////////////
  26. //
  27. // CLASS
  28. //
  29. // IASClass
  30. //
  31. // DESCRIPTION
  32. //
  33. // Wrapper around the IAS-specific format for the RADIUS class attribute.
  34. //
  35. ///////////////////////////////////////////////////////////////////////////////
  36. struct IASClass
  37. {
  38. BYTE checksum[4];
  39. BYTE vendorID[4];
  40. BYTE version[2];
  41. BYTE serverAddress[4];
  42. BYTE lastReboot[8];
  43. BYTE serialNumber[8];
  44. //////////
  45. // Miscellaneous accessors.
  46. //////////
  47. DWORD getChecksum() const throw ()
  48. { return IASExtractDWORD(checksum); }
  49. DWORD getVendorID() const throw ()
  50. { return IASExtractDWORD(vendorID); }
  51. WORD getVersion() const throw ()
  52. { return IASExtractWORD(version); }
  53. DWORD getServerAddress() const throw ()
  54. { return IASExtractDWORD(serverAddress); }
  55. FILETIME getLastReboot() const throw ()
  56. {
  57. FILETIME ft;
  58. ft.dwHighDateTime = IASExtractDWORD(lastReboot);
  59. ft.dwLowDateTime = IASExtractDWORD(lastReboot + 4);
  60. return ft;
  61. }
  62. DWORDLONG getSerialNumber() const throw ()
  63. {
  64. ULARGE_INTEGER ul;
  65. ul.HighPart = IASExtractDWORD(serialNumber);
  66. ul.LowPart = IASExtractDWORD(serialNumber + 4);
  67. return ul.QuadPart;
  68. }
  69. const BYTE* getString() const throw ()
  70. { return serialNumber + 8; }
  71. // Returns TRUE if the class attribute is in Microsoft format.
  72. BOOL isMicrosoft(DWORD actualLength) const throw ();
  73. // Must be called before any calls to createAttribute.
  74. static void initialize() throw ();
  75. // Create a new class attribute. The caller is responsible for releasing
  76. // the returned attribute. The tag is optional and may be null.
  77. static PIASATTRIBUTE createAttribute(const IAS_OCTET_STRING* tag) throw ();
  78. };
  79. #endif // _CLASSATTRIB_H_