46   : m_fd (-1), m_readCallback (0), m_readThread (0), m_stop (false),
 
   80   if (fcntl (
m_evpipe[0], F_SETFL, tmp | O_NONBLOCK) == -1)
 
  128       ssize_t len = write (
m_evpipe[1], &zero, 
sizeof (zero));
 
  129       if (len != 
sizeof (zero))
 
  130         NS_LOG_WARN (
"incomplete write(): " << std::strerror (errno));
 
  170   FD_SET (
m_fd, &rfds);
 
  176       fd_set readfds = rfds;
 
  178       r = select (nfds, &readfds, NULL, NULL, NULL);
 
  179       if (r == -1 && errno != EINTR)
 
  184       if (FD_ISSET (
m_evpipe[0], &readfds))
 
  190               ssize_t len = read (
m_evpipe[0], buf, 
sizeof (buf));
 
  197                   if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)
 
  215       if (FD_ISSET (
m_fd, &readfds))
 
  225           else if (data.
m_len > 0)
 
NS_FATAL_x macro definitions. 
 
void Start(int fd, Callback< void, uint8_t *, ssize_t > readCallback)
Start a new read thread. 
 
void DestroyEvent(void)
Event handler scheduled for destroy time to halt the thread. 
 
A structure representing data read. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
virtual ~FdReader()
Destructor. 
 
System-independent thread class ns3::SystemThread declaration. 
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
bool IsRunning(void) const 
This method is syntactic sugar for !IsExpired(). 
 
ns3::Simulator declaration. 
 
Callback< void, uint8_t *, ssize_t > m_readCallback
The main thread callback function to invoke when we have data. 
 
bool m_stop
Signal the read thread to stop. 
 
void Run(void)
The asynchronous function which performs the read. 
 
void Stop(void)
Stop the read thread and reset internal state. 
 
ns3::FdReader declaration. 
 
Ptr< SystemThread > m_readThread
The thread doing the read, created and launched by Start(). 
 
int m_fd
The file descriptor to read from. 
 
void Unref(void) const
Decrement the reference count. 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
uint8_t * m_buf
The read data buffer. 
 
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
EventId m_destroyEvent
The event scheduled for destroy time which will invoke DestroyEvent and halt the thread. 
 
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN. 
 
void Ref(void) const
Increment the reference count. 
 
void Nullify(void)
Discard the implementation, set it to null. 
 
virtual FdReader::Data DoRead(void)=0
The read implementation. 
 
static EventId ScheduleDestroy(MEM mem_ptr, OBJ obj)
Schedule an event to expire when Simulator::Destroy is called. 
 
int m_evpipe[2]
Pipe used to signal events between threads. 
 
ssize_t m_len
The size of the read data buffer, in bytes. 
 
Reference counting for smart pointers.