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.

76 lines
1.9 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: idmap.cpp
  14. Written By: B.Rajeev
  15. ----------------------------------------------------------*/
  16. #include "precomp.h"
  17. #include "common.h"
  18. #include "idmap.h"
  19. #include "frame.h"
  20. void IdMapping::Associate(IN TransportFrameId transport_frame_id,
  21. IN SessionFrameId session_frame_id)
  22. {
  23. forward_store[transport_frame_id] = session_frame_id;
  24. backward_store[session_frame_id] = transport_frame_id;
  25. }
  26. SessionFrameId IdMapping::DisassociateTransportFrameId(IN TransportFrameId transport_frame_id)
  27. {
  28. SessionFrameId session_frame_id;
  29. if ( !forward_store.Lookup(transport_frame_id, session_frame_id) )
  30. return ILLEGAL_SESSION_FRAME_ID;
  31. forward_store.RemoveKey(transport_frame_id);
  32. backward_store.RemoveKey(session_frame_id);
  33. return session_frame_id;
  34. }
  35. TransportFrameId IdMapping::DisassociateSessionFrameId(IN SessionFrameId session_frame_id)
  36. {
  37. TransportFrameId transport_frame_id;
  38. if ( !backward_store.Lookup(session_frame_id, transport_frame_id) )
  39. return ILLEGAL_TRANSPORT_FRAME_ID;
  40. backward_store.RemoveKey(session_frame_id);
  41. forward_store.RemoveKey(transport_frame_id);
  42. return transport_frame_id;
  43. }
  44. BOOL IdMapping::CheckIfAssociated(IN SessionFrameId session_frame_id)
  45. {
  46. TransportFrameId transport_frame_id;
  47. return backward_store.Lookup(session_frame_id, transport_frame_id);
  48. }
  49. IdMapping::~IdMapping(void)
  50. {
  51. forward_store.RemoveAll();
  52. backward_store.RemoveAll();
  53. }