a NetDevice to read/write network traffic from/into a netmap file descriptor. More...
#include "netmap-net-device.h"
 Inheritance diagram for ns3::NetmapNetDevice:
 Inheritance diagram for ns3::NetmapNetDevice: Collaboration diagram for ns3::NetmapNetDevice:
 Collaboration diagram for ns3::NetmapNetDevice:| Public Member Functions | |
| NetmapNetDevice () | |
| virtual | ~NetmapNetDevice () | 
| uint32_t | GetBytesInNetmapTxRing () | 
| Get the number of bytes currently in the netmap transmission ring.  More... | |
| int | GetSpaceInNetmapTxRing () const | 
| Get the number of slots currently available in the netmap transmission ring.  More... | |
| void | SetNetDeviceQueue (Ptr< NetDeviceQueue > queue) | 
| Set the NetDeviceQueue.  More... | |
| void | SetNetmapInterfaceRepresentation (struct netmap_if *nifp) | 
| Set the netmap interface representation.  More... | |
| void | SetRxRingsInfo (uint32_t nRxRings, uint32_t nRxRingsSlots) | 
| Set the netmap receiver rings info.  More... | |
| void | SetTxRingsInfo (uint32_t nTxRings, uint32_t nTxRingsSlots) | 
| Set the netmap transmission rings info.  More... | |
| virtual ssize_t | Write (uint8_t *buffer, size_t length) | 
| The function Writes a packet into the netmap transmission ring.  More... | |
|  Public Member Functions inherited from ns3::FdNetDevice | |
| FdNetDevice () | |
| Constructor for the FdNetDevice.  More... | |
| virtual | ~FdNetDevice () | 
| Destructor for the FdNetDevice.  More... | |
| virtual void | AddLinkChangeCallback (Callback< void > callback) | 
| virtual Address | GetAddress (void) const | 
| virtual Address | GetBroadcast (void) const | 
| virtual Ptr< Channel > | GetChannel (void) const | 
| FdNetDevice::EncapsulationMode | GetEncapsulationMode (void) const | 
| Get the link layer 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 | 
| virtual bool | IsBridge (void) const | 
| Return true if the net device is acting as a bridge.  More... | |
| virtual bool | IsBroadcast (void) const | 
| virtual bool | IsLinkUp (void) const | 
| virtual bool | IsMulticast (void) const | 
| virtual bool | IsPointToPoint (void) const | 
| Return true if the net device is on 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 | SetEncapsulationMode (FdNetDevice::EncapsulationMode mode) | 
| Set the link layer encapsulation mode of this device.  More... | |
| void | SetFileDescriptor (int fd) | 
| Set the associated file descriptor.  More... | |
| virtual void | SetIfIndex (const uint32_t index) | 
| virtual void | SetIsBroadcast (bool broadcast) | 
| Set if the NetDevice is able to send Broadcast messages.  More... | |
| virtual void | SetIsMulticast (bool multicast) | 
| Set if the NetDevice is able to send Multicast messages.  More... | |
| virtual bool | SetMtu (const uint16_t mtu) | 
| virtual void | SetNode (Ptr< Node > node) | 
| virtual void | SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) | 
| 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 () const | 
|  Public Member Functions inherited from ns3::NetDevice | |
| virtual | ~NetDevice () | 
|  Public Member Functions inherited from ns3::Object | |
| Object () | |
| Constructor.  More... | |
| virtual | ~Object () | 
| Destructor.  More... | |
| void | AggregateObject (Ptr< Object > other) | 
| Aggregate two Objects together.  More... | |
| void | Dispose (void) | 
| Dispose of this Object.  More... | |
| AggregateIterator | GetAggregateIterator (void) const | 
| Get an iterator to the Objects aggregated to this one.  More... | |
| virtual TypeId | GetInstanceTypeId (void) const | 
| Get the most derived TypeId for this Object.  More... | |
| template<typename T > | |
| Ptr< T > | GetObject (void) const | 
| Get a pointer to the requested aggregated Object.  More... | |
| template<typename T > | |
| Ptr< T > | GetObject (TypeId tid) const | 
| Get a pointer to the requested aggregated Object by TypeId.  More... | |
| template<> | |
| Ptr< Object > | GetObject () const | 
| Specialization of ()  for objects of type ns3::Object.  More... | |
| template<> | |
| Ptr< Object > | GetObject (TypeId tid) const | 
| Specialization of (TypeId tid)  for objects of type ns3::Object.  More... | |
| void | Initialize (void) | 
| Invoke DoInitialize on all Objects aggregated to this one.  More... | |
| bool | IsInitialized (void) const | 
| Check if the object has been initialized.  More... | |
|  Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| SimpleRefCount () | |
| Default 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 operator.  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 | 
| Get the value of an attribute, raising fatal errors if unsuccessful.  More... | |
| bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const | 
| Get the value of an attribute without raising erros.  More... | |
| void | SetAttribute (std::string name, const AttributeValue &value) | 
| Set a single attribute, raising fatal errors if unsuccessful.  More... | |
| bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) | 
| Set a single attribute without raising errors.  More... | |
| bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) | 
| Connect a TraceSource to a Callback with a context.  More... | |
| bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) | 
| Connect a TraceSource to a Callback without a context.  More... | |
| bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) | 
| Disconnect from a TraceSource a Callback previously connected with a context.  More... | |
| bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) | 
| Disconnect from a TraceSource a Callback previously connected without a context.  More... | |
| Static Public Member Functions | |
| static TypeId | GetTypeId (void) | 
| Get the type ID.  More... | |
|  Static Public Member Functions inherited from ns3::FdNetDevice | |
| static TypeId | GetTypeId (void) | 
| Get the type ID.  More... | |
|  Static Public Member Functions inherited from ns3::NetDevice | |
| static TypeId | GetTypeId (void) | 
| Get the type ID.  More... | |
|  Static Public Member Functions inherited from ns3::Object | |
| static TypeId | GetTypeId (void) | 
| Register this type.  More... | |
|  Static Public Member Functions inherited from ns3::ObjectBase | |
| static TypeId | GetTypeId (void) | 
| Get the type ID.  More... | |
| Private Member Functions | |
| Ptr< FdReader > | DoCreateFdReader (void) | 
| Create the FdReader object.  More... | |
| void | DoFinishStartingDevice (void) | 
| Complete additional actions, if any, to spin up down the device.  More... | |
| void | DoFinishStoppingDevice (void) | 
| Complete additional actions, if any, to tear down the device.  More... | |
| virtual void | SyncAndNotifyQueue () | 
| This function syncs netmap ring and notifies netdevice queue.  More... | |
| Private Attributes | |
| struct netmap_if * | m_nifp | 
| Netmap interface representation.  More... | |
| uint32_t | m_nRxRings | 
| Number of receiver rings.  More... | |
| uint32_t | m_nRxRingsSlots | 
| Number of slots in the receiver rings.  More... | |
| uint32_t | m_nTxRings | 
| Number of transmission rings.  More... | |
| uint32_t | m_nTxRingsSlots | 
| Number of slots in the transmission rings.  More... | |
| Ptr< NetDeviceQueue > | m_queue | 
| NetDevice queue.  More... | |
| uint8_t | m_syncAndNotifyQueuePeriod | 
| The period of time in us after which the device syncs the netmap ring and notifies queue status.  More... | |
| Ptr< SystemThread > | m_syncAndNotifyQueueThread | 
| Thread used to perform the flow control.  More... | |
| std::atomic< bool > | m_syncAndNotifyQueueThreadRun | 
| Running flag of the flow control thread.  More... | |
| uint32_t | m_totalQueuedBytes | 
| Total queued bytes.  More... | |
| Additional Inherited Members | |
|  Public Types inherited from ns3::FdNetDevice | |
| enum | EncapsulationMode { DIX, LLC, DIXPI } | 
| Enumeration of the types of frames supported in the class.  More... | |
|  Public Types inherited from ns3::NetDevice | |
| typedef void(* | LinkChangeTracedCallback) (void) | 
| TracedCallback signature for link changed event.  More... | |
| 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 | 
|  Protected Member Functions inherited from ns3::FdNetDevice | |
| virtual uint8_t * | AllocateBuffer (size_t len) | 
| Allocate packet buffer.  More... | |
| virtual void | DoDispose (void) | 
| Destructor implementation.  More... | |
| virtual void | DoInitialize (void) | 
| Method Initialization for start and stop attributes.  More... | |
| virtual void | FreeBuffer (uint8_t *buf) | 
| Free the given packet buffer.  More... | |
| int | GetFileDescriptor (void) const | 
| Get the associated file descriptor.  More... | |
| void | ReceiveCallback (uint8_t *buf, ssize_t len) | 
| Callback to invoke when a new frame is received.  More... | |
|  Protected Member Functions inherited from ns3::Object | |
| Object (const Object &o) | |
| Copy an Object.  More... | |
| virtual void | NotifyNewAggregate (void) | 
| Notify all Objects aggregated to this one of a new Object being aggregated.  More... | |
|  Protected Member Functions inherited from ns3::ObjectBase | |
| void | ConstructSelf (const AttributeConstructionList &attributes) | 
| Complete construction of ObjectBase; invoked by derived classes.  More... | |
| virtual void | NotifyConstructionCompleted (void) | 
| Notifier called once the ObjectBase is fully constructed.  More... | |
|  Protected Attributes inherited from ns3::FdNetDevice | |
| std::queue< std::pair< uint8_t *, ssize_t > > | m_pendingQueue | 
| Number of packets that were received and scheduled for read but not yet read.  More... | |
| SystemMutex | m_pendingReadMutex | 
| Mutex to increase pending read counter.  More... | |
|  Related Functions inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid (void) | 
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly.  More... | |
a NetDevice to read/write network traffic from/into a netmap file descriptor.
A NetmapNetDevice object will read and write packets from/to a netmap file descriptor.
Definition at line 137 of file netmap-net-device.h.
| ns3::NetmapNetDevice::NetmapNetDevice | ( | ) | 
Definition at line 184 of file netmap-net-device.cc.
References m_nifp, m_nRxRings, m_nRxRingsSlots, m_nTxRings, m_nTxRingsSlots, m_queue, m_syncAndNotifyQueueThread, m_syncAndNotifyQueueThreadRun, m_totalQueuedBytes, and NS_LOG_FUNCTION.
| 
 | virtual | 
Definition at line 198 of file netmap-net-device.cc.
References m_nifp, m_queue, and NS_LOG_FUNCTION.
Create the FdReader object.
Reimplemented from ns3::FdNetDevice.
Definition at line 206 of file netmap-net-device.cc.
References ns3::FdNetDevice::GetMtu(), m_nifp, and NS_LOG_FUNCTION.
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | privatevirtual | 
Complete additional actions, if any, to spin up down the device.
Reimplemented from ns3::FdNetDevice.
Definition at line 218 of file netmap-net-device.cc.
References m_syncAndNotifyQueueThread, m_syncAndNotifyQueueThreadRun, ns3::MakeCallback(), NS_LOG_FUNCTION, and SyncAndNotifyQueue().
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | privatevirtual | 
Complete additional actions, if any, to tear down the device.
Reimplemented from ns3::FdNetDevice.
Definition at line 229 of file netmap-net-device.cc.
References m_queue, m_syncAndNotifyQueueThread, m_syncAndNotifyQueueThreadRun, and NS_LOG_FUNCTION.
| uint32_t ns3::NetmapNetDevice::GetBytesInNetmapTxRing | ( | ) | 
Get the number of bytes currently in the netmap transmission ring.
Definition at line 241 of file netmap-net-device.cc.
References m_nifp, m_nTxRingsSlots, and NS_LOG_FUNCTION.
Referenced by SyncAndNotifyQueue().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| int ns3::NetmapNetDevice::GetSpaceInNetmapTxRing | ( | ) | const | 
Get the number of slots currently available in the netmap transmission ring.
Definition at line 300 of file netmap-net-device.cc.
References m_nifp, and NS_LOG_FUNCTION.
Referenced by SyncAndNotifyQueue().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Get the type ID.
Definition at line 170 of file netmap-net-device.cc.
References m_syncAndNotifyQueuePeriod, ns3::MakeUintegerAccessor(), and ns3::TypeId::SetParent().
 Here is the call graph for this function:
 Here is the call graph for this function:| void ns3::NetmapNetDevice::SetNetDeviceQueue | ( | Ptr< NetDeviceQueue > | queue | ) | 
Set the NetDeviceQueue.
| queue | the NetDeviceQueue | 
Definition at line 266 of file netmap-net-device.cc.
References m_queue, and NS_LOG_FUNCTION.
| void ns3::NetmapNetDevice::SetNetmapInterfaceRepresentation | ( | struct netmap_if * | nifp | ) | 
Set the netmap interface representation.
| nifp | the pointer to netmap interface representation | 
Definition at line 274 of file netmap-net-device.cc.
References m_nifp, and NS_LOG_FUNCTION.
| void ns3::NetmapNetDevice::SetRxRingsInfo | ( | uint32_t | nRxRings, | 
| uint32_t | nRxRingsSlots | ||
| ) | 
Set the netmap receiver rings info.
| nTxRings | the number of receiver rings | 
| nTxRingsSlots | the number of slots for each receiver ring | 
Definition at line 291 of file netmap-net-device.cc.
References m_nRxRings, m_nRxRingsSlots, and NS_LOG_FUNCTION.
| void ns3::NetmapNetDevice::SetTxRingsInfo | ( | uint32_t | nTxRings, | 
| uint32_t | nTxRingsSlots | ||
| ) | 
Set the netmap transmission rings info.
| nTxRings | the number of transmission rings | 
| nTxRingsSlots | the number of slots for each transmission ring | 
Definition at line 282 of file netmap-net-device.cc.
References m_nTxRings, m_nTxRingsSlots, and NS_LOG_FUNCTION.
| 
 | privatevirtual | 
This function syncs netmap ring and notifies netdevice queue.
This function runs in a separate thread.
Definition at line 312 of file netmap-net-device.cc.
References GetBytesInNetmapTxRing(), ns3::FdNetDevice::GetFileDescriptor(), GetSpaceInNetmapTxRing(), m_nifp, m_queue, m_syncAndNotifyQueuePeriod, m_syncAndNotifyQueueThreadRun, m_totalQueuedBytes, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by DoFinishStartingDevice().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | virtual | 
The function Writes a packet into the netmap transmission ring.
| buffer | the pointer to packet | 
| lenght | the packet lenght | 
Reimplemented from ns3::FdNetDevice.
Definition at line 354 of file netmap-net-device.cc.
References m_nifp, m_queue, m_totalQueuedBytes, and NS_LOG_FUNCTION.
| 
 | private | 
Netmap interface representation.
Definition at line 206 of file netmap-net-device.h.
Referenced by DoCreateFdReader(), GetBytesInNetmapTxRing(), GetSpaceInNetmapTxRing(), NetmapNetDevice(), SetNetmapInterfaceRepresentation(), SyncAndNotifyQueue(), Write(), and ~NetmapNetDevice().
| 
 | private | 
Number of receiver rings.
Definition at line 209 of file netmap-net-device.h.
Referenced by NetmapNetDevice(), and SetRxRingsInfo().
| 
 | private | 
Number of slots in the receiver rings.
Definition at line 210 of file netmap-net-device.h.
Referenced by NetmapNetDevice(), and SetRxRingsInfo().
| 
 | private | 
Number of transmission rings.
Definition at line 207 of file netmap-net-device.h.
Referenced by NetmapNetDevice(), and SetTxRingsInfo().
| 
 | private | 
Number of slots in the transmission rings.
Definition at line 208 of file netmap-net-device.h.
Referenced by GetBytesInNetmapTxRing(), NetmapNetDevice(), and SetTxRingsInfo().
| 
 | private | 
NetDevice queue.
Definition at line 211 of file netmap-net-device.h.
Referenced by DoFinishStoppingDevice(), NetmapNetDevice(), SetNetDeviceQueue(), SyncAndNotifyQueue(), Write(), and ~NetmapNetDevice().
| 
 | private | 
The period of time in us after which the device syncs the netmap ring and notifies queue status.
Definition at line 215 of file netmap-net-device.h.
Referenced by GetTypeId(), and SyncAndNotifyQueue().
| 
 | private | 
Thread used to perform the flow control.
Definition at line 213 of file netmap-net-device.h.
Referenced by DoFinishStartingDevice(), DoFinishStoppingDevice(), and NetmapNetDevice().
| 
 | private | 
Running flag of the flow control thread.
Definition at line 214 of file netmap-net-device.h.
Referenced by DoFinishStartingDevice(), DoFinishStoppingDevice(), NetmapNetDevice(), and SyncAndNotifyQueue().
| 
 | private | 
Total queued bytes.
Definition at line 212 of file netmap-net-device.h.
Referenced by NetmapNetDevice(), SyncAndNotifyQueue(), and Write().