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.

90 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: ssent.cpp
  14. Written By: B.Rajeev
  15. ----------------------------------------------------------*/
  16. #include "precomp.h"
  17. #include "common.h"
  18. #include "ssent.h"
  19. void SessionSentStateStore::Register(IN SessionFrameId id,
  20. IN SnmpOperation &operation,
  21. IN const SnmpErrorReport &error_report)
  22. {
  23. store[id] = new ErrorInfo(operation, error_report);
  24. }
  25. SnmpErrorReport SessionSentStateStore::Remove(IN SessionFrameId id, OUT SnmpOperation *&operation)
  26. {
  27. ErrorInfo *error_info;
  28. BOOL found = store.Lookup(id, error_info);
  29. if ( !found )
  30. {
  31. operation = NULL;
  32. return SnmpErrorReport(Snmp_Error, Snmp_Local_Error);
  33. }
  34. store.RemoveKey(id);
  35. SnmpErrorReport to_return(error_info->GetErrorReport());
  36. operation = error_info->GetOperation();
  37. delete error_info;
  38. return to_return;
  39. }
  40. void SessionSentStateStore::Remove(IN SessionFrameId id)
  41. {
  42. SnmpOperation *operation;
  43. Remove(id, operation);
  44. }
  45. SessionSentStateStore::~SessionSentStateStore(void)
  46. {
  47. // get the first position
  48. POSITION current = store.GetStartPosition();
  49. // while the position isn't null
  50. while ( current != NULL )
  51. {
  52. SessionFrameId id;
  53. ErrorInfo *error_info;
  54. // get the next pair
  55. store.GetNextAssoc(current, id, error_info);
  56. // delete the ptr
  57. delete error_info;
  58. }
  59. // remove all the keys
  60. store.RemoveAll();
  61. }