This class performs the actual data reading from the netmap ring. More...
#include "netmap-net-device.h"
Public Member Functions | |
NetmapNetDeviceFdReader () | |
void | SetBufferSize (uint32_t bufferSize) |
Set size of the read buffer. | |
void | SetNetmapIfp (struct netmap_if *nifp) |
Set netmap interface representation. | |
Public Member Functions inherited from ns3::FdReader | |
FdReader () | |
Constructor. | |
virtual | ~FdReader () |
Destructor. | |
void | Start (int fd, Callback< void, uint8_t *, ssize_t > readCallback) |
Start a new read thread. | |
void | Stop () |
Stop the read thread and reset internal state. | |
Public Member Functions inherited from ns3::SimpleRefCount< FdReader > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Member Functions | |
FdReader::Data | DoRead () |
The read implementation. | |
Private Attributes | |
uint32_t | m_bufferSize |
size of the read buffer | |
struct netmap_if * | m_nifp |
Netmap interface representation. | |
Additional Inherited Members | |
Protected Attributes inherited from ns3::FdReader | |
int | m_fd |
The file descriptor to read from. | |
This class performs the actual data reading from the netmap ring.
Definition at line 95 of file netmap-net-device.h.
ns3::NetmapNetDeviceFdReader::NetmapNetDeviceFdReader | ( | ) |
Definition at line 89 of file netmap-net-device.cc.
|
privatevirtual |
The read implementation.
The value of m_len returned controls further processing. The callback function is only invoked when m_len is positive; any data read is not processed when m_len is negative; reading stops when m_len is zero.
The management of memory associated with m_buf must be compatible with the read callback.
Implements ns3::FdReader.
Definition at line 111 of file netmap-net-device.cc.
References m_bufferSize, ns3::FdReader::m_fd, m_nifp, NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
void ns3::NetmapNetDeviceFdReader::SetBufferSize | ( | uint32_t | bufferSize | ) |
Set size of the read buffer.
bufferSize | the size of the read buffer |
Definition at line 97 of file netmap-net-device.cc.
References m_bufferSize, and NS_LOG_FUNCTION.
void ns3::NetmapNetDeviceFdReader::SetNetmapIfp | ( | struct netmap_if * | nifp | ) |
Set netmap interface representation.
nifp | the netmap interface representation |
Definition at line 104 of file netmap-net-device.cc.
References m_nifp, and NS_LOG_FUNCTION.
|
private |
size of the read buffer
Definition at line 115 of file netmap-net-device.h.
Referenced by DoRead(), and SetBufferSize().
|
private |
Netmap interface representation.
Definition at line 116 of file netmap-net-device.h.
Referenced by DoRead(), and SetNetmapIfp().