A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::FdNetDeviceFdReader Class Reference

This class performs the actual data reading from the sockets. More...

#include "fd-net-device.h"

+ Inheritance diagram for ns3::FdNetDeviceFdReader:
+ Collaboration diagram for ns3::FdNetDeviceFdReader:

Public Member Functions

 FdNetDeviceFdReader ()
 
void SetBufferSize (uint32_t bufferSize)
 Set size of the read buffer.
 
- 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.
 
SimpleRefCountoperator= (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 () override
 The read implementation.
 

Private Attributes

uint32_t m_bufferSize
 size of the read buffer
 

Additional Inherited Members

virtual FdReader::Data DoRead ()=0
 The read implementation.
 
- Protected Attributes inherited from ns3::FdReader
int m_fd
 The file descriptor to read from.
 

Detailed Description

This class performs the actual data reading from the sockets.

Definition at line 53 of file fd-net-device.h.

Constructor & Destructor Documentation

◆ FdNetDeviceFdReader()

ns3::FdNetDeviceFdReader::FdNetDeviceFdReader ( )

Definition at line 47 of file fd-net-device.cc.

Member Function Documentation

◆ DoRead()

FdReader::Data ns3::FdNetDeviceFdReader::DoRead ( )
overrideprivatevirtual

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 60 of file fd-net-device.cc.

References m_bufferSize, ns3::FdReader::m_fd, NS_ABORT_MSG_IF, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ SetBufferSize()

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

Set size of the read buffer.

Parameters
bufferSizethe buffer size

Definition at line 53 of file fd-net-device.cc.

References m_bufferSize, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_bufferSize

uint32_t ns3::FdNetDeviceFdReader::m_bufferSize
private

size of the read buffer

Definition at line 67 of file fd-net-device.h.

Referenced by DoRead(), and SetBufferSize().


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