20 #include "simple-channel.h"
21 #include "simple-net-device.h"
22 #include "ns3/simulator.h"
23 #include "ns3/packet.h"
31 NS_OBJECT_ENSURE_REGISTERED (SimpleChannel);
34 SimpleChannel::GetTypeId (
void)
36 static TypeId tid = TypeId (
"ns3::SimpleChannel")
37 .SetParent<Channel> ()
38 .AddConstructor<SimpleChannel> ()
43 SimpleChannel::SimpleChannel ()
49 SimpleChannel::Send (Ptr<Packet> p, uint16_t protocol,
50 Mac48Address to, Mac48Address from,
51 Ptr<SimpleNetDevice> sender)
54 for (std::vector<Ptr<SimpleNetDevice> >::const_iterator i = m_devices.begin (); i != m_devices.end (); ++i)
56 Ptr<SimpleNetDevice> tmp = *i;
62 &SimpleNetDevice::Receive, tmp, p->Copy (), protocol, to, from);
67 SimpleChannel::Add (Ptr<SimpleNetDevice> device)
70 m_devices.push_back (device);
77 return m_devices.size ();
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
#define NS_LOG_COMPONENT_DEFINE(name)
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
static void ScheduleWithContext(uint32_t context, Time const &time, MEM mem_ptr, OBJ obj)
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
virtual uint32_t GetNDevices(void) const