Skip to content

Instantly share code, notes, and snippets.

@lalithsuresh
Last active May 12, 2016 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lalithsuresh/5186251 to your computer and use it in GitHub Desktop.
Save lalithsuresh/5186251 to your computer and use it in GitHub Desktop.
diff -r b3e6d121f1c7 scratch/testapp-sim.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scratch/testapp-sim.cc Mon Mar 18 11:26:57 2013 +0100
@@ -0,0 +1,27 @@
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/applications-module.h"
+
+using namespace ns3;
+
+NS_LOG_COMPONENT_DEFINE ("TestExample");
+
+int
+main (int argc, char *argv[])
+{
+ NodeContainer nodes;
+ nodes.Create (1);
+
+ /*
+ * XXX:
+ * Add TestApplication to the above created
+ * node. Then schedule TestApplication to be
+ * started and stopped at the 1st and 2nd
+ * second of simulation time respectively.
+ *
+ * */
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+ return 0;
+}
diff -r b3e6d121f1c7 src/applications/model/testapp.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/applications/model/testapp.cc Mon Mar 18 11:26:57 2013 +0100
@@ -0,0 +1,35 @@
+#include "ns3/log.h"
+#include "testapp.h"
+
+NS_LOG_COMPONENT_DEFINE ("TestApplication");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (TestApplication);
+
+TypeId
+TestApplication::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::TestApplication")
+ .SetParent<Application> ()
+ .AddConstructor<TestApplication> ();
+ return tid;
+}
+
+TestApplication::TestApplication ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+TestApplication::~TestApplication ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+/*
+ *
+ * XXX: IMPLEMENT TWO METHODS HERE
+ *
+ * */
+
+} // namespace ns3
diff -r b3e6d121f1c7 src/applications/model/testapp.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/applications/model/testapp.h Mon Mar 18 11:26:57 2013 +0100
@@ -0,0 +1,27 @@
+#ifndef TEST_APPLICATION_H
+#define TEST_APPLICATION_H
+
+#include "ns3/application.h"
+
+namespace ns3 {
+
+class TestApplication : public Application
+{
+
+public:
+ static TypeId GetTypeId (void);
+
+ TestApplication ();
+ virtual ~TestApplication ();
+
+private:
+/*
+ * XXX: ADD TWO METHODS HERE
+ *
+ *
+ */
+};
+
+}
+
+#endif //TEST_APPLICATION_H
diff -r 5970605ca894 src/applications/wscript
--- a/src/applications/wscript Sat Mar 08 17:50:26 2014 +0100
+++ b/src/applications/wscript Tue Mar 18 15:51:36 2014 +0100
@@ -19,6 +19,7 @@
'model/udp-echo-server.cc',
'model/v4ping.cc',
'model/application-packet-probe.cc',
+ 'model/testapp.cc',
'helper/bulk-send-helper.cc',
'helper/on-off-helper.cc',
'helper/packet-sink-helper.cc',
@@ -53,6 +54,7 @@
'model/udp-echo-server.h',
'model/v4ping.h',
'model/application-packet-probe.h',
+ 'model/testapp.h',
'helper/bulk-send-helper.h',
'helper/on-off-helper.h',
'helper/packet-sink-helper.h',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment