Public Member Functions | Data Fields

Pipe Class Reference

#include <sockets.h>

Inherits Socket.

Inherited by DBFlatFile, DBMySQL, DBSQL, ModePipe, ModuleLDAP, ModuleSQL, and Thread.

Collaboration diagram for Pipe:
Collaboration graph
[legend]

Public Member Functions

 Pipe ()
 ~Pipe ()
bool ProcessRead () anope_override
void Write (const char *data, size_t sz)
void Write (const Anope::string &data)
int Read (char *data, size_t sz)
bool SetWriteBlocking (bool state)
void Notify ()
virtual void OnNotify ()=0

Data Fields

int write_pipe

Detailed Description

Definition at line 453 of file sockets.h.


Constructor & Destructor Documentation

Pipe::Pipe (  ) 
Pipe::~Pipe (  ) 

Definition at line 43 of file pipeengine.cpp.

References anope_close, and write_pipe.


Member Function Documentation

void Pipe::Notify (  ) 

Called when this pipe needs to be woken up Is the same as Write("\0", 1)

Definition at line 77 of file pipeengine.cpp.

References Write().

Referenced by DBFlatFile::OnSaveDatabase(), LDAPService::Run(), Thread::SetExitState(), and ModeManager::StackerAdd().

virtual void Pipe::OnNotify (  )  [pure virtual]

Called after ProcessRead comes back from Notify(), overload to do something useful

Implemented in DBFlatFile, DBSQL, DBMySQL, ModuleLDAP, ModuleSQL, and ModePipe.

Referenced by ProcessRead().

bool Pipe::ProcessRead (  )  [virtual]

Called when data is to be read, reads the data then calls OnNotify

Reimplemented from Socket.

Definition at line 49 of file pipeengine.cpp.

References Socket::GetFD(), OnNotify(), and read.

int Pipe::Read ( char *  data,
size_t  sz 
)

Read data from this pipe

Parameters:
data A buffer to read data into
sz The size of the buffer
Returns:
The amount of data read

Definition at line 63 of file pipeengine.cpp.

References Socket::GetFD(), and read.

Referenced by DBFlatFile::OnNotify().

bool Pipe::SetWriteBlocking ( bool  state  ) 

Mark the write end of this pipe (non)blocking

Parameters:
state true to enable blocking, false to disable blocking
Returns:
true if the socket is now blocking

Definition at line 68 of file pipeengine.cpp.

References F_GETFL, F_SETFL, fcntl(), O_NONBLOCK, and write_pipe.

void Pipe::Write ( const Anope::string data  )  [inline]

Definition at line 473 of file sockets.h.

References Write().

Referenced by Write().

void Pipe::Write ( const char *  data,
size_t  sz 
)

Write data to this pipe

Parameters:
data The data to write
sz The amount of data to wirite

Definition at line 58 of file pipeengine.cpp.

References write, and write_pipe.

Referenced by Notify(), and DBFlatFile::OnSaveDatabase().


Field Documentation

The FD of the write pipe this->sock is the readfd

Definition at line 459 of file sockets.h.

Referenced by Pipe(), SetWriteBlocking(), Write(), and ~Pipe().


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