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.

99 lines
2.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // VSASink.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file declares the class VSASink.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 03/07/1998 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _VSASINK_H_
  19. #define _VSASINK_H_
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. #include <iaspolcy.h>
  24. #include <nocopy.h>
  25. ///////////////////////////////////////////////////////////////////////////////
  26. //
  27. // CLASS
  28. //
  29. // SubVSA
  30. //
  31. // DESCRIPTION
  32. //
  33. // Encapsulates the information for converting an IAS Attribute into a
  34. // RADIUS vendor specific attribute.
  35. //
  36. ///////////////////////////////////////////////////////////////////////////////
  37. class SubVSA
  38. {
  39. public:
  40. DWORD vendorID; // The Vendor-ID in host order.
  41. BYTE vendorType; // The Vendor-Type code.
  42. PIASATTRIBUTE attr; // Protocol-independent representation.
  43. // When sorting, we want to group by vendor ID and flags. We don't care
  44. // about type.
  45. bool operator<(const SubVSA& s) const throw ()
  46. {
  47. return vendorID == s.vendorID ? attr->dwFlags < s.attr->dwFlags
  48. : vendorID < s.vendorID;
  49. }
  50. };
  51. ///////////////////////////////////////////////////////////////////////////////
  52. //
  53. // CLASS
  54. //
  55. // VSASink
  56. //
  57. // DESCRIPTION
  58. //
  59. // This class converts a Request object into a sink for SubVSA's. Sub-VSA's
  60. // inserted into the sink are converted into IASAttributes's and inserted
  61. // into the request object.
  62. //
  63. ///////////////////////////////////////////////////////////////////////////////
  64. class VSASink
  65. : NonCopyable
  66. {
  67. public:
  68. // Construct a sink from a request.
  69. explicit VSASink(IAttributesRaw* request) throw ();
  70. // Insert a SubVSA into the sink.
  71. VSASink& operator<<(const SubVSA& vsa);
  72. // Flush the sink. This should be called after all SubVSA's have been
  73. // inserted to ensure that everything has been inserted into the request.
  74. void flush();
  75. protected:
  76. enum
  77. {
  78. NO_VENDOR = 0, // Indicates a 'blank' vendor ID.
  79. MAX_SUBVSA_LENGTH = 249, // Maximum length of a sub-VSA.
  80. MAX_VSA_LENGTH = 253 // Maximum length of a consolidated VSA.
  81. };
  82. CComPtr<IAttributesRaw> raw; // The request object being wrapped.
  83. BYTE buffer[MAX_VSA_LENGTH]; // Buffer used for building VSA's.
  84. size_t bufferLength; // Number of bytes in the buffer.
  85. DWORD currentVendor; // Vendor being processed.
  86. DWORD currentFlags; // Flags for current VSA.
  87. };
  88. #endif // _VSASINK_H_