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.

81 lines
2.1 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: reg.hpp
  14. Author: B.Rajeev
  15. Purpose: Provides declarations for the MessageRegistry class
  16. --------------------------------------------------*/
  17. #ifndef __REG__
  18. #define __REG__
  19. #include "common.h"
  20. #include "encdec.h"
  21. #include "message.h"
  22. /*--------------------------------------------------
  23. Overview:
  24. --------
  25. MessageRegistry: It maintains a mapping
  26. <request_id, waiting_message *>. Before transmission, a waiting
  27. message registers itself with the registry.
  28. When the session notifies the registry of a message
  29. arrival event, the registry notifies the waiting message of the event
  30. --------------------------------------------------*/
  31. typedef CMap< RequestId, RequestId, WaitingMessage *, WaitingMessage * > RequestMap;
  32. class MessageRegistry
  33. {
  34. // the v1 session: for obtaining session information,
  35. // event handler
  36. SnmpImpSession *session;
  37. // map for (event_id, waiting_message) association and
  38. // unique request_id generation
  39. static RequestId next_request_id;
  40. RequestMap mapping;
  41. public:
  42. MessageRegistry(IN SnmpImpSession &session)
  43. {
  44. MessageRegistry::session = &session;
  45. }
  46. // generates and returns a new request id. It also
  47. // associates the waiting message with the request id
  48. RequestId GenerateRequestId(IN WaitingMessage &waiting_message);
  49. // used by the session to notify the message registry
  50. // of a message receipt (when it is received from the Transport)
  51. // it must notify the concerned waiting message of the event
  52. void MessageArrivalNotification(IN SnmpPdu &snmp_pdu);
  53. // delete (request_id, waiting_message) pair
  54. void RemoveMessage(IN RequestId request_id);
  55. ~MessageRegistry(void);
  56. };
  57. #endif // __REG__