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.

72 lines
2.2 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.hpp
  14. Author: B.Rajeev
  15. Purpose: Provides declarations for the IdMapping class.
  16. --------------------------------------------------*/
  17. #ifndef __ID_MAPPING__
  18. #define __ID_MAPPING__
  19. #include "forward.h"
  20. #include "common.h"
  21. #define ILLEGAL_TRANSPORT_FRAME_ID 0
  22. typedef CMap<TransportFrameId, TransportFrameId &, SessionFrameId, SessionFrameId &> ForwardStore;
  23. typedef CMap<SessionFrameId, SessionFrameId &, TransportFrameId, TransportFrameId &> BackwardStore;
  24. // When a session frame is passed to the transport for transmission, the
  25. // transport assigns a TransportFrameId to the frame.
  26. // The IdMapping class provides a mapping between the SessionFrameIds and
  27. // TransportFrameIds
  28. // NOTE: At any time, several transport frame ids may be associated with a
  29. // session frame id, but the session frame id is only associated with the
  30. // last registered transport frame id. DissociateSessionFrameId is called,
  31. // the session frame id association is lost, however, other transport frame
  32. // ids remain associated with the session frame id
  33. // If this is not desired in the future, a list of associated transport frame
  34. // ids must be maintained for each session frame id
  35. class IdMapping
  36. {
  37. // We need access by both the SessionFrameId and the TransportFrameId.
  38. // To avoid a CMap traversal, two CMaps are used to store the
  39. // FrameIds, indexed by the TransportFrameId and the
  40. // SessionFrameId respectively.
  41. ForwardStore forward_store;
  42. BackwardStore backward_store;
  43. public:
  44. void Associate(IN TransportFrameId transport_frame_id,
  45. IN SessionFrameId session_frame_id);
  46. SessionFrameId DisassociateTransportFrameId(IN TransportFrameId transport_frame_id);
  47. TransportFrameId DisassociateSessionFrameId(IN SessionFrameId session_frame_id);
  48. BOOL CheckIfAssociated(IN SessionFrameId session_frame_id);
  49. ~IdMapping(void);
  50. };
  51. #endif // __ID_MAPPING__