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.

114 lines
2.3 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. /*---------------------------------------------------------
  13. Filename: fs_reg.cpp
  14. Written By: B.Rajeev
  15. ----------------------------------------------------------*/
  16. #include "precomp.h"
  17. #include "common.h"
  18. #include "fs_reg.h"
  19. #include "sec.h"
  20. FrameState::FrameState(IN SessionFrameId session_frame_id, IN VBList &vblist)
  21. : session_frame_id(session_frame_id),
  22. vblist(&vblist)
  23. {}
  24. FrameState::~FrameState(void)
  25. {
  26. delete vblist;
  27. }
  28. FrameStateRegistry::~FrameStateRegistry()
  29. {
  30. DestroySecurity();
  31. }
  32. FrameState *FrameStateRegistry::Get(IN SessionFrameId session_frame_id)
  33. {
  34. FrameState *frame_state;
  35. BOOL found = mapping.Lookup(session_frame_id, frame_state);
  36. if ( found )
  37. return frame_state;
  38. else
  39. return NULL;
  40. }
  41. FrameState *FrameStateRegistry::Remove(IN SessionFrameId session_frame_id)
  42. {
  43. FrameState *frame_state = Get(session_frame_id);
  44. if ( frame_state != NULL )
  45. mapping.RemoveKey(session_frame_id);
  46. return frame_state;
  47. }
  48. FrameState *FrameStateRegistry::GetNext(OUT SessionFrameId *session_frame_id)
  49. {
  50. if ( current_pointer == NULL )
  51. return NULL;
  52. SessionFrameId local_session_frame_id;
  53. FrameState *frame_state;
  54. mapping.GetNextAssoc(current_pointer, local_session_frame_id, frame_state);
  55. if ( session_frame_id != NULL )
  56. *session_frame_id = local_session_frame_id;
  57. return frame_state;
  58. }
  59. void FrameStateRegistry::RegisterSecurity(IN SnmpSecurity *snmp_security)
  60. {
  61. if ( snmp_security != NULL )
  62. {
  63. security = snmp_security->Copy();
  64. if ( !(*security)() )
  65. throw GeneralException(Snmp_Error, Snmp_Local_Error,__FILE__,__LINE__);
  66. }
  67. else
  68. security = NULL;
  69. }
  70. SnmpSecurity *FrameStateRegistry::GetSecurity() const
  71. {
  72. return security;
  73. }
  74. void FrameStateRegistry::DestroySecurity()
  75. {
  76. if ( security != NULL )
  77. {
  78. delete security;
  79. security = NULL;
  80. }
  81. }