bug 1005: GetSocket() methods for OnOffApplication and PacketSink
authorTom Henderson <tomh@tomh.org>
Fri, 15 Oct 2010 12:53:05 -0700
changeset 6624 616d42c69f05
parent 6623 ee39e2c196c3
child 6625 a071889af159
bug 1005: GetSocket() methods for OnOffApplication and PacketSink
src/applications/onoff/onoff-application.cc
src/applications/onoff/onoff-application.h
src/applications/packet-sink/packet-sink.cc
src/applications/packet-sink/packet-sink.h
--- a/src/applications/onoff/onoff-application.cc	Fri Oct 15 12:51:18 2010 -0700
+++ b/src/applications/onoff/onoff-application.cc	Fri Oct 15 12:53:05 2010 -0700
@@ -111,6 +111,12 @@
   m_maxBytes = maxBytes;
 }
 
+Ptr<Socket>
+OnOffApplication::GetSocket (void) const
+{
+  NS_LOG_FUNCTION (this);
+  return m_socket;
+}
 
 void
 OnOffApplication::DoDispose (void)
--- a/src/applications/onoff/onoff-application.h	Fri Oct 15 12:51:18 2010 -0700
+++ b/src/applications/onoff/onoff-application.h	Fri Oct 15 12:53:05 2010 -0700
@@ -102,6 +102,11 @@
    */
   void SetMaxBytes (uint32_t maxBytes);
 
+  /**
+   * \return pointer to associated socket
+   */
+  Ptr<Socket> GetSocket (void) const;
+
 protected:
   virtual void DoDispose (void);
 private:
--- a/src/applications/packet-sink/packet-sink.cc	Fri Oct 15 12:51:18 2010 -0700
+++ b/src/applications/packet-sink/packet-sink.cc	Fri Oct 15 12:53:05 2010 -0700
@@ -75,6 +75,20 @@
   return m_totalRx;
 }
   
+Ptr<Socket>
+PacketSink::GetListeningSocket (void) const
+{
+  NS_LOG_FUNCTION (this);
+  return m_socket;
+}
+
+std::list<Ptr<Socket> >
+PacketSink::GetAcceptedSockets (void) const
+{
+  NS_LOG_FUNCTION (this);
+  return m_socketList;
+}
+
 void PacketSink::DoDispose (void)
 {
   NS_LOG_FUNCTION (this);
--- a/src/applications/packet-sink/packet-sink.h	Fri Oct 15 12:51:18 2010 -0700
+++ b/src/applications/packet-sink/packet-sink.h	Fri Oct 15 12:53:05 2010 -0700
@@ -77,7 +77,17 @@
    * \return the total bytes received in this sink app
    */
   uint32_t GetTotalRx () const;
-  
+
+  /**
+   * \return pointer to listening socket
+   */
+  Ptr<Socket> GetListeningSocket (void) const;
+
+  /**
+   * \return list of pointers to accepted sockets
+   */
+  std::list<Ptr<Socket> > GetAcceptedSockets (void) const;
+ 
 protected:
   virtual void DoDispose (void);
 private: