Created
November 4, 2014 00:52
-
-
Save thehajime/f1878cdfc0d19bfa1c5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/network/utils/pcap-file-wrapper.cc b/src/network/utils/pcap-file-wrapper.cc | |
--- a/src/network/utils/pcap-file-wrapper.cc | |
+++ b/src/network/utils/pcap-file-wrapper.cc | |
@@ -55,6 +55,18 @@ | |
Close (); | |
} | |
+void | |
+PcapFileWrapper::DoDispose (void) | |
+{ | |
+ NS_LOG_FUNCTION_NOARGS (); | |
+ Close (); | |
+} | |
+void | |
+PcapFileWrapper::NotifyNewAggregate () | |
+{ | |
+ NS_LOG_FUNCTION_NOARGS (); | |
+ Object::NotifyNewAggregate (); | |
+} | |
bool | |
PcapFileWrapper::Fail (void) const | |
diff --git a/src/network/utils/pcap-file-wrapper.h b/src/network/utils/pcap-file-wrapper.h | |
--- a/src/network/utils/pcap-file-wrapper.h | |
+++ b/src/network/utils/pcap-file-wrapper.h | |
@@ -44,6 +44,8 @@ | |
PcapFileWrapper (); | |
~PcapFileWrapper (); | |
+ void DoDispose (void); | |
+ void NotifyNewAggregate (); | |
/** | |
* \return true if the 'fail' bit is set in the underlying iostream, false otherwise. | |
diff --git a/src/point-to-point/helper/point-to-point-helper.cc b/src/point-to-point/helper/point-to-point-helper.cc | |
--- a/src/point-to-point/helper/point-to-point-helper.cc | |
+++ b/src/point-to-point/helper/point-to-point-helper.cc | |
@@ -103,6 +103,13 @@ | |
Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, | |
PcapHelper::DLT_PPP); | |
pcapHelper.HookDefaultSink<PointToPointNetDevice> (device, "PromiscSniffer", file); | |
+ | |
+ Ptr<Node> node = device->GetNode (); | |
+ if (!node->GetObject <PcapFileWrapper>()) | |
+ { | |
+ node->AggregateObject (file); | |
+ } | |
+ | |
} | |
void |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment