|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #ifndef NETMAP_NET_DEVICE_H
22 #define NETMAP_NET_DEVICE_H
24 #include "ns3/net-device-queue-interface.h"
27 #include <net/netmap_user.h>
60 virtual void Start (
void);
66 virtual void Stop (
void);
73 virtual void Wake (
void);
193 virtual ssize_t
Write (uint8_t *buffer,
size_t length);
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
void SetBufferSize(uint32_t bufferSize)
Set size of the read buffer.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< NetDeviceQueue > m_queue
NetDevice queue.
This class performs the actual data reading from the netmap ring.
std::mutex m_mutex
Mutex to serialize the operations performed on the queue.
uint32_t m_totalQueuedBytes
Total queued bytes.
a NetDevice to read/write network traffic from/into a netmap file descriptor.
void SetNetDeviceQueue(Ptr< NetDeviceQueue > queue)
Set the NetDeviceQueue.
uint32_t m_nRxRings
Number of receiver rings.
void DoFinishStoppingDevice(void)
Complete additional actions, if any, to tear down the device.
virtual void SyncAndNotifyQueue()
This function syncs netmap ring and notifies netdevice queue.
uint32_t m_bufferSize
size of the read buffer
virtual void Start(void)
Called by the device to start this device transmission queue.
NetmapNetDeviceFdReader()
FdReader::Data DoRead(void)
The read implementation.
static TypeId GetTypeId(void)
Get the type ID.
Smart pointer class similar to boost::intrusive_ptr.
virtual ~NetmapNetDevice()
uint32_t m_nRxRingsSlots
Number of slots in the receiver rings.
void DoFinishStartingDevice(void)
Complete additional actions, if any, to spin up down the device.
int GetSpaceInNetmapTxRing() const
Get the number of slots currently available in the netmap transmission ring.
Network device transmission queue.
virtual bool IsStopped(void) const
Get the status of the device transmission queue.
virtual ssize_t Write(uint8_t *buffer, size_t length)
The function Writes a packet into the netmap transmission ring.
struct netmap_if * m_nifp
Netmap interface representation.
virtual ~NetDeviceQueueLock()
std::atomic< bool > m_syncAndNotifyQueueThreadRun
Running flag of the flow control thread.
uint32_t m_nTxRingsSlots
Number of slots in the transmission rings.
void SetTxRingsInfo(uint32_t nTxRings, uint32_t nTxRingsSlots)
Set the netmap transmission rings info.
a NetDevice to read/write network traffic from/into a file descriptor.
uint32_t m_nTxRings
Number of transmission rings.
virtual void Wake(void)
Called by the device to wake the queue disc associated with this device transmission queue.
A class that asynchronously reads from a file descriptor.
void SetRxRingsInfo(uint32_t nRxRings, uint32_t nRxRingsSlots)
Set the netmap receiver rings info.
void SetNetmapInterfaceRepresentation(struct netmap_if *nifp)
Set the netmap interface representation.
uint8_t m_syncAndNotifyQueuePeriod
The period of time in us after which the device syncs the netmap ring and notifies queue status.
Network device transmission queue with lock.
Ptr< FdReader > DoCreateFdReader(void)
Create the FdReader object.
virtual void Stop(void)
Called by the device to stop this device transmission queue.
uint32_t GetBytesInNetmapTxRing()
Get the number of bytes currently in the netmap transmission ring.
virtual void NotifyTransmittedBytes(uint32_t bytes)
Called by the netdevice to report the number of bytes it is going to transmit.
struct netmap_if * m_nifp
Netmap interface representation.
void SetNetmapIfp(struct netmap_if *nifp)
Set netmap interface representation.
A structure representing data read.
Ptr< SystemThread > m_syncAndNotifyQueueThread
Thread used to perform the flow control.
virtual void NotifyQueuedBytes(uint32_t bytes)
Called by the netdevice to report the number of bytes queued to the device queue.