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.

71 lines
1.7 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  2. /*---------------------------------------------------------
  3. Filename: tsent.cpp
  4. Written By: B.Rajeev
  5. ----------------------------------------------------------*/
  6. #include "precomp.h"
  7. #include "common.h"
  8. #include "tsent.h"
  9. void TransportSentStateStore::Register(IN TransportFrameId id,
  10. IN const SnmpErrorReport &error_report)
  11. {
  12. store[id] = new SnmpErrorReport(error_report);
  13. }
  14. void TransportSentStateStore::Modify(IN TransportFrameId id,
  15. IN const SnmpErrorReport &error_report)
  16. {
  17. SnmpErrorReport *old_error_report = NULL ;
  18. store.Lookup(id, old_error_report);
  19. if ( old_error_report )
  20. {
  21. old_error_report->SetError(error_report.GetError());
  22. old_error_report->SetStatus(error_report.GetStatus());
  23. }
  24. }
  25. SnmpErrorReport TransportSentStateStore::Remove(IN TransportFrameId id)
  26. {
  27. SnmpErrorReport *error_report = NULL ;
  28. store.Lookup(id, error_report);
  29. store.RemoveKey(id);
  30. SnmpErrorReport to_return ;
  31. if ( error_report )
  32. {
  33. to_return = (*error_report);
  34. delete error_report;
  35. }
  36. return to_return;
  37. }
  38. TransportSentStateStore::~TransportSentStateStore(void)
  39. {
  40. // get the first position
  41. POSITION current = store.GetStartPosition();
  42. // while the position isn't null
  43. while ( current != NULL )
  44. {
  45. TransportFrameId id;
  46. SnmpErrorReport *error_report = NULL ;
  47. // get the next pair
  48. store.GetNextAssoc(current, id, error_report);
  49. // delete the ptr
  50. delete error_report;
  51. }
  52. // remove all the keys
  53. store.RemoveAll();
  54. }