A Device for an Emu Network Link. More...
#include <emu-net-device.h>
Public Types | |
enum | EncapsulationMode { ILLEGAL, DIX, LLC } |
Enumeration of the types of packets supported in the class. More... | |
Public Types inherited from ns3::NetDevice | |
enum | PacketType { PACKET_HOST = 1, NS3_PACKET_HOST = PACKET_HOST, PACKET_BROADCAST, NS3_PACKET_BROADCAST = PACKET_BROADCAST, PACKET_MULTICAST, NS3_PACKET_MULTICAST = PACKET_MULTICAST, PACKET_OTHERHOST, NS3_PACKET_OTHERHOST = PACKET_OTHERHOST } |
Packet types are used as they are in Linux. More... | |
typedef Callback< bool, Ptr < NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, enum PacketType > | PromiscReceiveCallback |
typedef Callback< bool, Ptr < NetDevice >, Ptr< const Packet >, uint16_t, const Address & > | ReceiveCallback |
Public Member Functions | |
EmuNetDevice () | |
Construct a EmuNetDevice. More... | |
virtual | ~EmuNetDevice () |
Destroy a EmuNetDevice. More... | |
virtual void | AddLinkChangeCallback (Callback< void > callback) |
virtual Address | GetAddress (void) const |
virtual Address | GetBroadcast (void) const |
virtual Ptr< Channel > | GetChannel (void) const |
EmuNetDevice::EncapsulationMode | GetEncapsulationMode (void) const |
Get the encapsulation mode of this device. More... | |
virtual uint32_t | GetIfIndex (void) const |
virtual uint16_t | GetMtu (void) const |
virtual Address | GetMulticast (Ipv4Address multicastGroup) const |
Make and return a MAC multicast address using the provided multicast group. More... | |
virtual Address | GetMulticast (Ipv6Address addr) const |
Get the MAC multicast address corresponding to the IPv6 address provided. More... | |
virtual Ptr< Node > | GetNode (void) const |
Ptr< Queue > | GetQueue (void) const |
Get a copy of the attached Queue. More... | |
virtual bool | IsBridge (void) const |
Is this a bridge? More... | |
virtual bool | IsBroadcast (void) const |
virtual bool | IsLinkUp (void) const |
virtual bool | IsMulticast (void) const |
virtual bool | IsPointToPoint (void) const |
Is this a point to point link? More... | |
virtual bool | NeedsArp (void) const |
virtual bool | Send (Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) |
virtual bool | SendFrom (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) |
virtual void | SetAddress (Address address) |
Set the address of this interface. More... | |
void | SetDataRate (DataRate bps) |
Set the Data Rate used for transmission of packets. More... | |
void | SetEncapsulationMode (EmuNetDevice::EncapsulationMode mode) |
Set the encapsulation mode of this device. More... | |
virtual void | SetIfIndex (const uint32_t index) |
virtual bool | SetMtu (const uint16_t mtu) |
virtual void | SetNode (Ptr< Node > node) |
virtual void | SetPromiscReceiveCallback (PromiscReceiveCallback cb) |
void | SetQueue (Ptr< Queue > queue) |
Attach a queue to the EmuNetDevice. More... | |
virtual void | SetReceiveCallback (NetDevice::ReceiveCallback cb) |
void | Start (Time tStart) |
Set a start time for the device. More... | |
void | Stop (Time tStop) |
Set a stop time for the device. More... | |
virtual bool | SupportsSendFrom (void) const |
Public Member Functions inherited from ns3::NetDevice | |
virtual | ~NetDevice () |
Public Member Functions inherited from ns3::Object | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::NetDevice | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
EmuNetDevice (const EmuNetDevice &) | |
void | AddHeader (Ptr< Packet > p, uint16_t protocolNumber) |
Adds the necessary headers and trailers to a packet of data in order to respect the protocol implemented by the agent. More... | |
void | CreateSocket (void) |
Call out to a separate process running as suid root in order to get a raw socket. More... | |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
std::string | FindCreator (std::string creatorName) |
Figure out where the raw socket creation process lives on the system. More... | |
void | ForwardUp (uint8_t *buf, uint32_t len) |
Method to handle received packets. More... | |
void | NotifyLinkUp (void) |
EmuNetDevice & | operator= (const EmuNetDevice &) |
bool | ProcessHeader (Ptr< Packet > p, uint16_t ¶m) |
Removes, from a packet of data, all headers and trailers that relate to the protocol implemented by the agent. More... | |
void | ReadThread (void) |
Loop to read and process packets. More... | |
void | StartDevice (void) |
Spin up the device. More... | |
void | StopDevice (void) |
Tear down the device. More... | |
bool | TransmitStart (Ptr< Packet > p) |
Start Sending a Packet Down the Wire. More... | |
Private Attributes | |
Mac48Address | m_address |
The MAC address which has been assigned to this device. More... | |
std::string | m_deviceName |
The unix/linux name of the underlying device (e.g., eth0) More... | |
EncapsulationMode | m_encapMode |
The type of packet that should be created by the AddHeader function and that should be processed by the ProcessHeader function. More... | |
uint32_t | m_ifIndex |
The ns-3 interface index (in the sense of net device index) that has been assigned to this network device. More... | |
bool | m_isBroadcast |
Flag indicating whether or not the underlying net device supports broadcast. More... | |
bool | m_isMulticast |
Flag indicating whether or not the underlying net device supports multicast. More... | |
TracedCallback | m_linkChangeCallbacks |
Callbacks to fire if the link changes state (up or down). More... | |
bool | m_linkUp |
Flag indicating whether or not the link is up. More... | |
TracedCallback< Ptr< const Packet > > | m_macPromiscRxTrace |
The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition). More... | |
TracedCallback< Ptr< const Packet > > | m_macRxDropTrace |
The trace source fired for packets successfully received by the device but which are dropped before being forwarded up to higher layers (at the L2/L3 transition). More... | |
TracedCallback< Ptr< const Packet > > | m_macRxTrace |
The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition). More... | |
TracedCallback< Ptr< const Packet > > | m_macTxDropTrace |
The trace source fired when packets coming into the "top" of the device at the L3/L2 transition are dropped before being queued for transmission. More... | |
TracedCallback< Ptr< const Packet > > | m_macTxTrace |
The trace source fired when packets come into the "top" of the device at the L3/L2 transition, before being queued for transmission. More... | |
uint32_t | m_maxPendingReads |
Ptr< Node > | m_node |
The Node to which this device is attached. More... | |
uint32_t | m_nodeId |
uint8_t * | m_packetBuffer |
A 64K buffer to hold packet data while it is being sent. More... | |
uint32_t | m_pendingReadCount |
SystemMutex | m_pendingReadMutex |
TracedCallback< Ptr< const Packet > > | m_phyRxBeginTrace |
The trace source fired when a packet begins the reception process from the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyRxDropTrace |
The trace source fired when the phy layer drops a packet it has received. More... | |
TracedCallback< Ptr< const Packet > > | m_phyRxEndTrace |
The trace source fired when a packet begins the reception process from the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyRxTrace |
The trace source fired when a packet ends the reception process from the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyTxBeginTrace |
The trace source fired when a packet begins the transmission process on the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyTxDropTrace |
The trace source fired when the phy layer drops a packet as it tries to transmit it. More... | |
TracedCallback< Ptr< const Packet > > | m_phyTxEndTrace |
The trace source fired when a packet ends the transmission process on the medium. More... | |
NetDevice::PromiscReceiveCallback | m_promiscRxCallback |
The callback used to notify higher layers that a packet has been received in promiscuous mode. More... | |
TracedCallback< Ptr< const Packet > > | m_promiscSnifferTrace |
A trace source that emulates a promiscuous mode protocol sniffer connected to the device. More... | |
Ptr< Queue > | m_queue |
The Queue which this EmuNetDevice uses as a packet source. More... | |
Ptr< SystemThread > | m_readThread |
NetDevice::ReceiveCallback | m_rxCallback |
The callback used to notify higher layers that a packet has been received. More... | |
int32_t | m_sll_ifindex |
The Unix interface index that we got from the system and which corresponds to the interface (e.g., "eth1") we are using to talk to the network. More... | |
TracedCallback< Ptr< const Packet > > | m_snifferTrace |
A trace source that emulates a non-promiscuous protocol sniffer connected to the device. More... | |
int32_t | m_sock |
EventId | m_startEvent |
EventId | m_stopEvent |
Time | m_tStart |
Time to start spinning up the device. More... | |
Time | m_tStop |
Time to start tearing down the device. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
A Device for an Emu Network Link.
ns3::EmuNetDevice is accessible through the following paths with Config::Set and Config::Connect:
Definition at line 52 of file emu-net-device.h.
Enumeration of the types of packets supported in the class.
Enumerator | |
---|---|
ILLEGAL |
Encapsulation mode not set. |
DIX |
DIX II / Ethernet II packet. |
LLC |
802.2 LLC/SNAP Packet |
Definition at line 60 of file emu-net-device.h.
ns3::EmuNetDevice::EmuNetDevice | ( | ) |
Construct a EmuNetDevice.
This is the constructor for the EmuNetDevice. It takes as a
Definition at line 189 of file emu-net-device.cc.
References m_packetBuffer, m_tStart, NS_LOG_FUNCTION, and Start().
|
virtual |
Destroy a EmuNetDevice.
This is the destructor for the EmuNetDevice.
Definition at line 206 of file emu-net-device.cc.
References m_packetBuffer.
|
private |
Adds the necessary headers and trailers to a packet of data in order to respect the protocol implemented by the agent.
p | packet |
protocolNumber | protocol number |
|
virtual |
callback | the callback to invoke |
Add a callback invoked whenever the link status changes to UP. This callback is typically used by the IP/ARP layer to flush the ARP cache and by IPv6 stack to flush NDISC cache whenever the link goes up.
Implements ns3::NetDevice.
Definition at line 1016 of file emu-net-device.cc.
References ns3::TracedCallback< T1, T2, T3, T4, T5, T6, T7, T8 >::ConnectWithoutContext(), and m_linkChangeCallbacks.
|
private |
Call out to a separate process running as suid root in order to get a raw socket.
We do this to avoid having the entire simulation running as root. If this method returns, we'll have a raw socket waiting for us in m_sock.
Definition at line 381 of file emu-net-device.cc.
References EMU_MAGIC, ns3::EmuBufferToString(), m_sock, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, and NS_LOG_INFO.
Referenced by StartDevice().
|
privatevirtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
Definition at line 213 of file emu-net-device.cc.
References ns3::Object::DoDispose(), m_node, m_readThread, NS_LOG_FUNCTION_NOARGS, and StopDevice().
|
private |
Figure out where the raw socket creation process lives on the system.
|
private |
Method to handle received packets.
Synchronized with simulator via ScheduleNow from ReadThread.
Definition at line 614 of file emu-net-device.cc.
References ns3::Packet::Copy(), DIX, ns3::EthernetHeader::GetDestination(), ns3::EthernetHeader::GetLengthType(), ns3::LlcSnapHeader::GetSerializedSize(), ns3::EthernetHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::EthernetHeader::GetSource(), ns3::LlcSnapHeader::GetType(), ns3::Mac48Address::IsBroadcast(), ns3::Mac48Address::IsGroup(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), LLC, m_address, m_encapMode, m_macPromiscRxTrace, m_macRxTrace, m_pendingReadCount, m_pendingReadMutex, m_phyRxDropTrace, m_promiscRxCallback, m_promiscSnifferTrace, m_rxCallback, m_snifferTrace, ns3::NetDevice::NS3_PACKET_BROADCAST, ns3::NetDevice::NS3_PACKET_HOST, ns3::NetDevice::NS3_PACKET_MULTICAST, ns3::NetDevice::NS3_PACKET_OTHERHOST, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Packet::RemoveHeader().
Referenced by ReadThread().
|
virtual |
Implements ns3::NetDevice.
Definition at line 975 of file emu-net-device.cc.
References m_address, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
Calling this method is invalid if IsBroadcast returns not true.
Implements ns3::NetDevice.
Definition at line 1028 of file emu-net-device.cc.
Implements ns3::NetDevice.
Definition at line 961 of file emu-net-device.cc.
References NS_FATAL_ERROR.
EmuNetDevice::EncapsulationMode ns3::EmuNetDevice::GetEncapsulationMode | ( | void | ) | const |
Get the encapsulation mode of this device.
Definition at line 233 of file emu-net-device.cc.
References m_encapMode, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
Implements ns3::NetDevice.
Definition at line 955 of file emu-net-device.cc.
References m_ifIndex.
|
virtual |
This value is typically used by the IP layer to perform IP fragmentation when needed.
Implements ns3::NetDevice.
Definition at line 989 of file emu-net-device.cc.
References m_deviceName, and NS_FATAL_ERROR.
Referenced by GetTypeId().
|
virtual |
Make and return a MAC multicast address using the provided multicast group.
RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet multicast address by placing the low-order 23-bits of the IP address into the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex).
This method performs the multicast address creation function appropriate to an EUI-48-based CSMA device. This MAC address is encapsulated in an abstract Address to avoid dependencies on the exact address format.
multicastGroup | The IP address for the multicast group destination of the packet. |
Implements ns3::NetDevice.
Definition at line 1040 of file emu-net-device.cc.
References ns3::Mac48Address::GetMulticast(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
virtual |
Get the MAC multicast address corresponding to the IPv6 address provided.
addr | IPv6 address |
Implements ns3::NetDevice.
Definition at line 1057 of file emu-net-device.cc.
References ns3::Mac48Address::GetMulticast(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
When a subclass needs to get access to the underlying node base class to print the nodeid for example, it can invoke this method.
Implements ns3::NetDevice.
Definition at line 1094 of file emu-net-device.cc.
References m_node.
Referenced by StartDevice().
Get a copy of the attached Queue.
Definition at line 935 of file emu-net-device.cc.
References m_queue, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::EmuHelper::EnableAsciiInternal().
|
static |
Definition at line 64 of file emu-net-device.cc.
References DIX, GetMtu(), LLC, m_address, m_deviceName, m_macPromiscRxTrace, m_macRxDropTrace, m_macRxTrace, m_macTxDropTrace, m_macTxTrace, m_maxPendingReads, m_phyRxBeginTrace, m_phyRxDropTrace, m_phyRxEndTrace, m_phyTxBeginTrace, m_phyTxDropTrace, m_phyTxEndTrace, m_promiscSnifferTrace, m_queue, m_snifferTrace, m_tStart, m_tStop, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), SetEncapsulationMode(), and ns3::TypeId::SetParent().
|
virtual |
Is this a bridge?
Implements ns3::NetDevice.
Definition at line 1074 of file emu-net-device.cc.
|
virtual |
Implements ns3::NetDevice.
Definition at line 1022 of file emu-net-device.cc.
References m_isBroadcast.
|
virtual |
Implements ns3::NetDevice.
Definition at line 1010 of file emu-net-device.cc.
References m_linkUp.
Referenced by SendFrom().
|
virtual |
Implements ns3::NetDevice.
Definition at line 1034 of file emu-net-device.cc.
References m_isMulticast.
|
virtual |
Is this a point to point link?
Implements ns3::NetDevice.
Definition at line 1068 of file emu-net-device.cc.
|
virtual |
Called by higher-layers to check if this NetDevice requires ARP to be used.
Implements ns3::NetDevice.
Definition at line 1106 of file emu-net-device.cc.
|
private |
Definition at line 942 of file emu-net-device.cc.
References m_linkChangeCallbacks, and m_linkUp.
Referenced by StartDevice().
|
private |
Removes, from a packet of data, all headers and trailers that relate to the protocol implemented by the agent.
p | Packet whose headers need to be processed |
param | An integer parameter that can be set by the function |
|
private |
Loop to read and process packets.
Definition at line 744 of file emu-net-device.cc.
References ForwardUp(), m_maxPendingReads, m_nodeId, m_pendingReadCount, m_pendingReadMutex, m_sock, ns3::MakeEvent(), NS_FATAL_ERROR, NS_LOG_FUNCTION_NOARGS, NS_LOG_INFO, NS_LOG_LOGIC, and ns3::Simulator::ScheduleWithContext().
Referenced by StartDevice().
|
virtual |
packet | packet sent from above down to Network Device |
dest | mac address of the destination (already resolved) |
protocolNumber | identifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received. |
Called from higher layer to send packet into Network Device to the specified destination Address
Implements ns3::NetDevice.
Definition at line 814 of file emu-net-device.cc.
References m_address, NS_LOG_FUNCTION, and SendFrom().
|
virtual |
packet | packet sent from above down to Network Device |
source | source mac address (so called "MAC spoofing") |
dest | mac address of the destination (already resolved) |
protocolNumber | identifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received. |
Called from higher layer to send packet into Network Device with the specified source and destination Addresses.
Implements ns3::NetDevice.
Definition at line 840 of file emu-net-device.cc.
References ns3::Packet::AddHeader(), ns3::Mac48Address::ConvertFrom(), ns3::Packet::CopyData(), DIX, ns3::Packet::GetSize(), ns3::Packet::GetUid(), IsLinkUp(), LLC, m_encapMode, m_macTxDropTrace, m_macTxTrace, m_packetBuffer, m_promiscSnifferTrace, m_queue, m_sll_ifindex, m_snifferTrace, m_sock, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::EthernetHeader::SetDestination(), ns3::EthernetHeader::SetLengthType(), ns3::EthernetHeader::SetSource(), and ns3::LlcSnapHeader::SetType().
Referenced by Send().
|
virtual |
Set the address of this interface.
address | address to set |
Implements ns3::NetDevice.
Definition at line 968 of file emu-net-device.cc.
References ns3::Mac48Address::ConvertFrom(), m_address, and NS_LOG_FUNCTION.
void ns3::EmuNetDevice::SetDataRate | ( | DataRate | bps | ) |
Set the Data Rate used for transmission of packets.
bps | the data rate at which this object operates |
Definition at line 921 of file emu-net-device.cc.
References NS_FATAL_ERROR, and NS_LOG_FUNCTION.
void ns3::EmuNetDevice::SetEncapsulationMode | ( | EmuNetDevice::EncapsulationMode | mode | ) |
Set the encapsulation mode of this device.
mode | The encapsulation mode of this device. |
Definition at line 225 of file emu-net-device.cc.
References m_encapMode, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by GetTypeId().
|
virtual |
index | ifIndex of the device |
Implements ns3::NetDevice.
Definition at line 949 of file emu-net-device.cc.
References m_ifIndex.
|
virtual |
mtu | MTU value, in bytes, to set for the device |
Override for default MTU defined on a per-type basis.
Implements ns3::NetDevice.
Definition at line 982 of file emu-net-device.cc.
References NS_FATAL_ERROR.
node | the node associated to this netdevice. |
This method is called from ns3::Node::AddDevice.
Implements ns3::NetDevice.
Definition at line 1100 of file emu-net-device.cc.
References m_node.
|
virtual |
cb | callback to invoke whenever a packet has been received in promiscuous mode and must be forwarded to the higher layers. |
Enables netdevice promiscuous mode and sets the callback that will handle promiscuous mode packets. Note, promiscuous mode packets means all packets, including those packets that can be sensed by the netdevice but which are intended to be received by other hosts.
Implements ns3::NetDevice.
Definition at line 1080 of file emu-net-device.cc.
References m_promiscRxCallback.
Attach a queue to the EmuNetDevice.
The EmuNetDevice "owns" a queue that implements a queueing method such as DropTail or RED.
queue | Ptr to the new queue. |
Definition at line 928 of file emu-net-device.cc.
References m_queue, and NS_LOG_FUNCTION.
Referenced by main().
|
virtual |
cb | callback to invoke whenever a packet has been received and must be forwarded to the higher layers. |
Implements ns3::NetDevice.
Definition at line 1112 of file emu-net-device.cc.
References m_rxCallback.
void ns3::EmuNetDevice::Start | ( | Time | tStart | ) |
Set a start time for the device.
tStart | the start time |
Definition at line 240 of file emu-net-device.cc.
References ns3::Simulator::Cancel(), m_startEvent, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and StartDevice().
Referenced by EmuNetDevice().
|
private |
Spin up the device.
Definition at line 263 of file emu-net-device.cc.
References CreateSocket(), ns3::Node::GetId(), GetNode(), m_deviceName, m_isBroadcast, m_isMulticast, m_nodeId, m_readThread, m_sll_ifindex, m_sock, ns3::MakeCallback(), NotifyLinkUp(), NS_FATAL_ERROR, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, and ReadThread().
Referenced by Start().
void ns3::EmuNetDevice::Stop | ( | Time | tStop | ) |
Set a stop time for the device.
tStop | the stop time |
Definition at line 252 of file emu-net-device.cc.
References ns3::Simulator::Cancel(), m_startEvent, m_stopEvent, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and StopDevice().
|
private |
Tear down the device.
Definition at line 599 of file emu-net-device.cc.
References m_readThread, m_sock, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by DoDispose(), and Stop().
|
virtual |
Implements ns3::NetDevice.
Definition at line 1086 of file emu-net-device.cc.
References NS_LOG_FUNCTION_NOARGS.
Start Sending a Packet Down the Wire.
p | packet to send |
|
private |
The MAC address which has been assigned to this device.
Definition at line 457 of file emu-net-device.h.
Referenced by ForwardUp(), GetAddress(), GetTypeId(), Send(), and SetAddress().
|
private |
The unix/linux name of the underlying device (e.g., eth0)
Definition at line 513 of file emu-net-device.h.
Referenced by GetMtu(), GetTypeId(), and StartDevice().
|
private |
The type of packet that should be created by the AddHeader function and that should be processed by the ProcessHeader function.
Definition at line 485 of file emu-net-device.h.
Referenced by ForwardUp(), GetEncapsulationMode(), SendFrom(), and SetEncapsulationMode().
|
private |
The ns-3 interface index (in the sense of net device index) that has been assigned to this network device.
Definition at line 472 of file emu-net-device.h.
Referenced by GetIfIndex(), and SetIfIndex().
|
private |
Flag indicating whether or not the underlying net device supports broadcast.
Definition at line 497 of file emu-net-device.h.
Referenced by IsBroadcast(), and StartDevice().
|
private |
Flag indicating whether or not the underlying net device supports multicast.
Definition at line 503 of file emu-net-device.h.
Referenced by IsMulticast(), and StartDevice().
|
private |
Callbacks to fire if the link changes state (up or down).
Definition at line 508 of file emu-net-device.h.
Referenced by AddLinkChangeCallback(), and NotifyLinkUp().
|
private |
Flag indicating whether or not the link is up.
In this case, whether or not the device is connected to a channel.
Definition at line 491 of file emu-net-device.h.
Referenced by IsLinkUp(), and NotifyLinkUp().
|
private |
The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition).
This is a promiscuous trace.
Definition at line 317 of file emu-net-device.h.
Referenced by ForwardUp(), and GetTypeId().
|
private |
The trace source fired for packets successfully received by the device but which are dropped before being forwarded up to higher layers (at the L2/L3 transition).
Definition at line 335 of file emu-net-device.h.
Referenced by GetTypeId().
|
private |
The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition).
This is a non-promiscuous trace.
Definition at line 326 of file emu-net-device.h.
Referenced by ForwardUp(), and GetTypeId().
|
private |
The trace source fired when packets coming into the "top" of the device at the L3/L2 transition are dropped before being queued for transmission.
Definition at line 308 of file emu-net-device.h.
Referenced by GetTypeId(), and SendFrom().
|
private |
The trace source fired when packets come into the "top" of the device at the L3/L2 transition, before being queued for transmission.
Definition at line 300 of file emu-net-device.h.
Referenced by GetTypeId(), and SendFrom().
|
private |
Definition at line 527 of file emu-net-device.h.
Referenced by GetTypeId(), and ReadThread().
The Node to which this device is attached.
Definition at line 452 of file emu-net-device.h.
Referenced by DoDispose(), GetNode(), and SetNode().
|
private |
Definition at line 525 of file emu-net-device.h.
Referenced by ReadThread(), and StartDevice().
|
private |
A 64K buffer to hold packet data while it is being sent.
Definition at line 518 of file emu-net-device.h.
Referenced by EmuNetDevice(), SendFrom(), and ~EmuNetDevice().
|
private |
Definition at line 528 of file emu-net-device.h.
Referenced by ForwardUp(), and ReadThread().
|
private |
Definition at line 529 of file emu-net-device.h.
Referenced by ForwardUp(), and ReadThread().
|
private |
The trace source fired when a packet begins the reception process from the medium.
Definition at line 375 of file emu-net-device.h.
Referenced by GetTypeId().
|
private |
The trace source fired when the phy layer drops a packet it has received.
Definition at line 390 of file emu-net-device.h.
Referenced by ForwardUp(), and GetTypeId().
|
private |
The trace source fired when a packet begins the reception process from the medium.
Definition at line 383 of file emu-net-device.h.
Referenced by GetTypeId().
|
private |
The trace source fired when a packet ends the reception process from the medium.
Definition at line 367 of file emu-net-device.h.
|
private |
The trace source fired when a packet begins the transmission process on the medium.
Definition at line 343 of file emu-net-device.h.
Referenced by GetTypeId().
|
private |
The trace source fired when the phy layer drops a packet as it tries to transmit it.
Definition at line 359 of file emu-net-device.h.
Referenced by GetTypeId().
|
private |
The trace source fired when a packet ends the transmission process on the medium.
Definition at line 351 of file emu-net-device.h.
Referenced by GetTypeId().
|
private |
The callback used to notify higher layers that a packet has been received in promiscuous mode.
Definition at line 467 of file emu-net-device.h.
Referenced by ForwardUp(), and SetPromiscReceiveCallback().
|
private |
A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
This trace source fire on packets destined for any host just like your average everyday packet sniffer.
On the transmit size, this trace hook will fire after a packet is dequeued from the device queue for transmission. In Linux, for example, this would correspond to the point just before a device hard_start_xmit where dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET ETH_P_ALL handlers.
On the receive side, this trace hook will fire when a packet is received, just before the receive callback is executed. In Linux, for example, this would correspond to the point at which the packet is dispatched to packet sniffers in netif_receive_skb.
Definition at line 430 of file emu-net-device.h.
Referenced by ForwardUp(), GetTypeId(), and SendFrom().
The Queue which this EmuNetDevice uses as a packet source.
Management of this Queue has been delegated to the EmuNetDevice and it has the responsibility for deletion.
Definition at line 292 of file emu-net-device.h.
Referenced by GetQueue(), GetTypeId(), SendFrom(), and SetQueue().
|
private |
Definition at line 447 of file emu-net-device.h.
Referenced by DoDispose(), StartDevice(), and StopDevice().
|
private |
The callback used to notify higher layers that a packet has been received.
Definition at line 462 of file emu-net-device.h.
Referenced by ForwardUp(), and SetReceiveCallback().
|
private |
The Unix interface index that we got from the system and which corresponds to the interface (e.g., "eth1") we are using to talk to the network.
Valid when m_sock is valid.
Definition at line 478 of file emu-net-device.h.
Referenced by SendFrom(), and StartDevice().
|
private |
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
Unlike your average everyday sniffer, this trace source will not fire on PACKET_OTHERHOST events.
On the transmit size, this trace hook will fire after a packet is dequeued from the device queue for transmission. In Linux, for example, this would correspond to the point just before a device hard_start_xmit where dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET ETH_P_ALL handlers.
On the receive side, this trace hook will fire when a packet is received, just before the receive callback is executed. In Linux, for example, this would correspond to the point at which the packet is dispatched to packet sniffers in netif_receive_skb.
Definition at line 410 of file emu-net-device.h.
Referenced by ForwardUp(), GetTypeId(), and SendFrom().
|
private |
Definition at line 445 of file emu-net-device.h.
Referenced by CreateSocket(), ReadThread(), SendFrom(), StartDevice(), and StopDevice().
|
private |
Definition at line 442 of file emu-net-device.h.
|
private |
Definition at line 443 of file emu-net-device.h.
Referenced by Stop().
|
private |
Time to start spinning up the device.
Definition at line 435 of file emu-net-device.h.
Referenced by EmuNetDevice(), and GetTypeId().
|
private |
Time to start tearing down the device.
Definition at line 440 of file emu-net-device.h.
Referenced by GetTypeId().