Anope IRC Services  Version 2.0
Public Member Functions | Data Fields
Pipe Class Referenceabstract

#include <sockets.h>

Inheritance diagram for Pipe:
Inheritance graph
[legend]
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
 
- Public Member Functions inherited from Socket
 Socket ()
 
 Socket (int sock, bool ipv6=false, int type=SOCK_STREAM)
 
virtual ~Socket ()
 
int GetFD () const
 
bool IsIPv6 () const
 
bool SetBlocking (bool state)
 
void Bind (const Anope::string &ip, int port=0)
 
virtual bool Process ()
 
virtual bool ProcessWrite ()
 
virtual void ProcessError ()
 

Data Fields

int write_pipe
 
- Data Fields inherited from Socket
std::bitset< SF_SIZEflags
 
sockaddrs bindaddr
 
SocketIOio
 

Additional Inherited Members

- Protected Attributes inherited from Socket
int sock
 
bool ipv6
 

Detailed Description

Definition at line 454 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(), DispatcherThread::Run(), LDAPService::Run(), Thread::SetExitState(), ModeManager::StackerAdd(), and LDAPService::Timeout().

virtual void Pipe::OnNotify ( )
pure virtual

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

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

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
dataA buffer to read data into
szThe 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
statetrue 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 char *  data,
size_t  sz 
)

Write data to this pipe

Parameters
dataThe data to write
szThe amount of data to wirite

Definition at line 58 of file pipeengine.cpp.

References write, and write_pipe.

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

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

Definition at line 474 of file sockets.h.

References Write().

Referenced by Write().

Field Documentation

int Pipe::write_pipe

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

Definition at line 460 of file sockets.h.

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


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