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.

96 lines
2.4 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // translate.cpp
  8. //
  9. // SYNOPSIS
  10. //
  11. // Defines the class Translator.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/04/2000 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef TRANSLATE_H
  19. #define TRANSLATE_H
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif
  23. #include <attrdnry.h>
  24. #include <iastlutl.h>
  25. using namespace IASTL;
  26. struct RadiusAttribute;
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //
  29. // CLASS
  30. //
  31. // Translator
  32. //
  33. ///////////////////////////////////////////////////////////////////////////////
  34. class Translator
  35. {
  36. public:
  37. HRESULT FinalConstruct() throw ();
  38. // Converts an IAS attribute to RADIUS format and stores it in dst.
  39. void toRadius(
  40. IASATTRIBUTE& src,
  41. IASAttributeVector& dst
  42. ) const;
  43. // Convert a RADIUS attribute to IAS format and stores it in dst.
  44. void fromRadius(
  45. const RadiusAttribute& src,
  46. DWORD flags,
  47. IASAttributeVector& dst
  48. );
  49. protected:
  50. // Decodes an RADIUS attribute value into dst.
  51. static void decode(
  52. IASTYPE dstType,
  53. const BYTE* src,
  54. ULONG srclen,
  55. IASAttribute& dst
  56. );
  57. // Returns the number of bytes required to encode src.
  58. static ULONG getEncodedSize(
  59. const IASATTRIBUTE& src
  60. );
  61. // Encodes src into dst. dst must be long enough to hold the result.
  62. static void encode(
  63. PBYTE dst,
  64. const IASATTRIBUTE& src
  65. ) throw ();
  66. // Encodes src into dst. Returns the length of the encode data (not counting
  67. // the header).
  68. static ULONG encode(
  69. ULONG headerLength,
  70. const IASATTRIBUTE& src,
  71. IASAttribute& dst
  72. );
  73. // Breaks src into multiple attributes if necessary and stores the result in
  74. // dst.
  75. static void scatter(
  76. ULONG headerLength,
  77. IASATTRIBUTE& src,
  78. IASAttributeVector& dst
  79. );
  80. private:
  81. AttributeDictionary dnary;
  82. };
  83. #endif // TRANSLATE_H