A Discrete-Event Network Simulator
API
ns3::NetmapNetDeviceFdReader Class Reference

This class performs the actual data reading from the netmap ring. More...

#include "netmap-net-device.h"

+ Inheritance diagram for ns3::NetmapNetDeviceFdReader:
+ Collaboration diagram for ns3::NetmapNetDeviceFdReader:

Public Member Functions

 NetmapNetDeviceFdReader ()
 
void SetBufferSize (uint32_t bufferSize)
 Set size of the read buffer. More...
 
void SetNetmapIfp (struct netmap_if *nifp)
 Set netmap interface representation. More...
 
- Public Member Functions inherited from ns3::FdReader
 FdReader ()
 Constructor. More...
 
virtual ~FdReader ()
 Destructor. More...
 
void Start (int fd, Callback< void, uint8_t *, ssize_t > readCallback)
 Start a new read thread. More...
 
void Stop (void)
 Stop the read thread and reset internal state. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< FdReader >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Private Member Functions

FdReader::Data DoRead (void)
 The read implementation. More...
 

Private Attributes

uint32_t m_bufferSize
 size of the read buffer More...
 
struct netmap_if * m_nifp
 Netmap interface representation. More...
 

Additional Inherited Members

- Protected Attributes inherited from ns3::FdReader
int m_fd
 The file descriptor to read from. More...
 

Detailed Description

This class performs the actual data reading from the netmap ring.

Definition at line 105 of file netmap-net-device.h.

Constructor & Destructor Documentation

◆ NetmapNetDeviceFdReader()

ns3::NetmapNetDeviceFdReader::NetmapNetDeviceFdReader ( )

Definition at line 96 of file netmap-net-device.cc.

Member Function Documentation

◆ DoRead()

FdReader::Data ns3::NetmapNetDeviceFdReader::DoRead ( void  )
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.

Returns
A structure representing what was read.

Implements ns3::FdReader.

Definition at line 117 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.

◆ SetBufferSize()

void ns3::NetmapNetDeviceFdReader::SetBufferSize ( uint32_t  bufferSize)

Set size of the read buffer.

Parameters
bufferSizethe size of the read buffer

Definition at line 103 of file netmap-net-device.cc.

References m_bufferSize, and NS_LOG_FUNCTION.

◆ SetNetmapIfp()

void ns3::NetmapNetDeviceFdReader::SetNetmapIfp ( struct netmap_if *  nifp)

Set netmap interface representation.

Parameters
nifpthe netmap interface representation

Definition at line 110 of file netmap-net-device.cc.

References m_nifp, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_bufferSize

uint32_t ns3::NetmapNetDeviceFdReader::m_bufferSize
private

size of the read buffer

Definition at line 125 of file netmap-net-device.h.

Referenced by DoRead(), and SetBufferSize().

◆ m_nifp

struct netmap_if* ns3::NetmapNetDeviceFdReader::m_nifp
private

Netmap interface representation.

Definition at line 126 of file netmap-net-device.h.

Referenced by DoRead(), and SetNetmapIfp().


The documentation for this class was generated from the following files: