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.

66 lines
1.4 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // dictionary.cpp
  8. //
  9. // SYNOPSIS
  10. //
  11. // Defines the class CDictionary.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 04/19/1999 Complete rewrite.
  16. // 02/16/2000 User ID instead of RADIUS_ID.
  17. // 04/17/2000 Port to new dictionary API.
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #include <radcommon.h>
  21. #include <dictionary.h>
  22. #include <iastlb.h>
  23. #include <iastlutl.h>
  24. BOOL CDictionary::Init() throw ()
  25. {
  26. HRESULT hr;
  27. // When in doubt, assume OctetString.
  28. for (ULONG i = 0; i < 256; ++i)
  29. {
  30. type[i] = IASTYPE_OCTET_STRING;
  31. }
  32. try
  33. {
  34. // Names of various columns in the dictionary.
  35. const PCWSTR COLUMNS[] =
  36. {
  37. L"ID",
  38. L"Syntax",
  39. NULL
  40. };
  41. // Open the attributes table.
  42. IASTL::IASDictionary dnary(COLUMNS);
  43. // Store the RADIUS attributes in the type array.
  44. while (dnary.next())
  45. {
  46. LONG id = dnary.getLong(0);
  47. if (id >= 0 && id < 256)
  48. {
  49. type[id] = (IASTYPE)dnary.getLong(1);
  50. }
  51. }
  52. }
  53. catch (const _com_error& ce)
  54. {
  55. return FALSE;
  56. }
  57. return TRUE;
  58. }