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.

88 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: frame.hpp
  14. Author: B.Rajeev
  15. Purpose: Provides declarations for the FrameRegistry class.
  16. --------------------------------------------------*/
  17. #ifndef __FRAME_REGISTRY__
  18. #define __FRAME_REGISTRY__
  19. #define ILLEGAL_SESSION_FRAME_ID 0
  20. #include "forward.h"
  21. #include "common.h"
  22. #include "message.h"
  23. typedef CMap<SessionFrameId, SessionFrameId, WaitingMessage *, WaitingMessage *> FrameMapping;
  24. /*--------------------------------------------------
  25. Overview:
  26. ---------
  27. FrameRegistry: Provides access to WaitingMessages in a store
  28. through their SessionFrameId.
  29. This enables cancellation of SendFrame request. The frame id
  30. is supplied by the calling SnmpOperation to the session.
  31. When the operation tries to cancel a SendFrame request,
  32. SnmpImpSession calls the CancelFrameNotification. This method
  33. informs the flow control mechanism of the event (which may
  34. Deregister the waiting message erasing the
  35. <SessionFrameId, WaitingMessage>association).
  36. --------------------------------------------------*/
  37. class FrameRegistry
  38. {
  39. // it stores the waiting messages in the context of this session
  40. SnmpImpSession *session;
  41. // used to generate session frame ids
  42. SessionFrameId next_session_frame_id;
  43. // stores pairs of the form <SessionFrameId, WaitingMessage *>
  44. FrameMapping mapping;
  45. public:
  46. FrameRegistry(IN SnmpImpSession &session)
  47. {
  48. FrameRegistry::session = &session;
  49. next_session_frame_id = ILLEGAL_SESSION_FRAME_ID+1;
  50. }
  51. SessionFrameId GenerateSessionFrameId(void);
  52. void RegisterFrame(IN const SessionFrameId session_frame_id, IN WaitingMessage &waiting_message);
  53. void DeregisterFrame(IN const SessionFrameId session_frame_id);
  54. // returns NULL if no such waiting message
  55. WaitingMessage *GetWaitingMessage(IN const SessionFrameId session_frame_id);
  56. void CancelFrameNotification(IN const SessionFrameId session_frame_id);
  57. ~FrameRegistry(void);
  58. };
  59. #endif // __FRAME_REGISTRY__