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

#include <sockets.h>

Inheritance diagram for Pipe:
Inheritance graph
Collaboration diagram for Pipe:
Collaboration graph

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

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()

Pipe::~Pipe ( )

Definition at line 43 of file pipeengine.cpp.

References anope_close, and write_pipe.

Member Function Documentation

◆ Notify()

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

◆ OnNotify()

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().

◆ ProcessRead()

bool Pipe::ProcessRead ( )

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.

◆ Read()

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

Read data from this pipe

dataA buffer to read data into
szThe size of the buffer
The amount of data read

Definition at line 63 of file pipeengine.cpp.

References Socket::GetFD(), and read.

◆ SetWriteBlocking()

bool Pipe::SetWriteBlocking ( bool  state)

Mark the write end of this pipe (non)blocking

statetrue to enable blocking, false to disable blocking
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.

◆ Write() [1/2]

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

Write data to this pipe

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().

◆ Write() [2/2]

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

Definition at line 474 of file sockets.h.

References CoreExport, NormalSocketIO, TotalRead, TotalWritten, and Write().

Referenced by Write().

Field Documentation

◆ write_pipe

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: