src/devices/point-to-point/point-to-point-channel.cc
changeset 2983 e3a416fe9dd5
parent 2834 1aab57845b07
child 2989 b7eb3929096c
equal deleted inserted replaced
2982:a7e3e54c7e94 2983:e3a416fe9dd5
    54 PointToPointChannel::PointToPointChannel()
    54 PointToPointChannel::PointToPointChannel()
    55 : 
    55 : 
    56   Channel ("PointToPoint Channel"), 
    56   Channel ("PointToPoint Channel"), 
    57   m_nDevices(0)
    57   m_nDevices(0)
    58 {
    58 {
    59   NS_LOG_FUNCTION;
    59   NS_LOG_FUNCTION_NOARGS ();
    60 }
    60 }
    61 
    61 
    62 void
    62 void
    63 PointToPointChannel::Attach(Ptr<PointToPointNetDevice> device)
    63 PointToPointChannel::Attach(Ptr<PointToPointNetDevice> device)
    64 {
    64 {
    65   NS_LOG_FUNCTION;
    65   NS_LOG_FUNCTION (this << device);
    66   NS_LOG_PARAMS (this << device);
       
    67   NS_ASSERT(m_nDevices < N_DEVICES && "Only two devices permitted");
    66   NS_ASSERT(m_nDevices < N_DEVICES && "Only two devices permitted");
    68   NS_ASSERT(device != 0);
    67   NS_ASSERT(device != 0);
    69 
    68 
    70   m_link[m_nDevices++].m_src = device;
    69   m_link[m_nDevices++].m_src = device;
    71 //
    70 //
    84 bool
    83 bool
    85 PointToPointChannel::TransmitStart(Ptr<Packet> p,
    84 PointToPointChannel::TransmitStart(Ptr<Packet> p,
    86                                    Ptr<PointToPointNetDevice> src,
    85                                    Ptr<PointToPointNetDevice> src,
    87                                    const Time& txTime)
    86                                    const Time& txTime)
    88 {
    87 {
    89   NS_LOG_FUNCTION;
    88   NS_LOG_FUNCTION (this << p << src);
    90   NS_LOG_PARAMS (this << p << src);
       
    91   NS_LOG_LOGIC ("UID is " << p->GetUid () << ")");
    89   NS_LOG_LOGIC ("UID is " << p->GetUid () << ")");
    92 
    90 
    93   NS_ASSERT(m_link[0].m_state != INITIALIZING);
    91   NS_ASSERT(m_link[0].m_state != INITIALIZING);
    94   NS_ASSERT(m_link[1].m_state != INITIALIZING);
    92   NS_ASSERT(m_link[1].m_state != INITIALIZING);
    95 
    93 
   105 }
   103 }
   106 
   104 
   107 uint32_t 
   105 uint32_t 
   108 PointToPointChannel::GetNDevices (void) const
   106 PointToPointChannel::GetNDevices (void) const
   109 {
   107 {
   110   NS_LOG_FUNCTION;
   108   NS_LOG_FUNCTION_NOARGS ();
   111   return m_nDevices;
   109   return m_nDevices;
   112 }
   110 }
   113 
   111 
   114 Ptr<PointToPointNetDevice>
   112 Ptr<PointToPointNetDevice>
   115 PointToPointChannel::GetPointToPointDevice (uint32_t i) const
   113 PointToPointChannel::GetPointToPointDevice (uint32_t i) const
   116 {
   114 {
   117   NS_LOG_FUNCTION;
   115   NS_LOG_FUNCTION_NOARGS ();
   118   NS_ASSERT(i < 2);
   116   NS_ASSERT(i < 2);
   119   return m_link[i].m_src;
   117   return m_link[i].m_src;
   120 }
   118 }
   121 
   119 
   122 const DataRate&
   120 const DataRate&
   123 PointToPointChannel::GetDataRate (void)
   121 PointToPointChannel::GetDataRate (void)
   124 {
   122 {
   125   NS_LOG_FUNCTION;
   123   NS_LOG_FUNCTION_NOARGS ();
   126   return m_bps;
   124   return m_bps;
   127 }
   125 }
   128 
   126 
   129 const Time&
   127 const Time&
   130 PointToPointChannel::GetDelay (void)
   128 PointToPointChannel::GetDelay (void)
   131 {
   129 {
   132   NS_LOG_FUNCTION;
   130   NS_LOG_FUNCTION_NOARGS ();
   133   return m_delay;
   131   return m_delay;
   134 }
   132 }
   135 
   133 
   136 Ptr<NetDevice>
   134 Ptr<NetDevice>
   137 PointToPointChannel::GetDevice (uint32_t i) const
   135 PointToPointChannel::GetDevice (uint32_t i) const
   138 {
   136 {
   139   NS_LOG_FUNCTION;
   137   NS_LOG_FUNCTION_NOARGS ();
   140   return GetPointToPointDevice (i);
   138   return GetPointToPointDevice (i);
   141 }
   139 }
   142 
   140 
   143 
   141 
   144 } // namespace ns3
   142 } // namespace ns3