Anope IRC Services  Version 2.0
Data Structures | Public Member Functions | Protected Attributes
BinarySocket Class Reference

#include <sockets.h>

Inheritance diagram for BinarySocket:
Inheritance graph
Collaboration diagram for BinarySocket:
Collaboration graph

Data Structures

struct  DataBlock

Public Member Functions

 BinarySocket ()
virtual ~BinarySocket ()
bool ProcessRead () anope_override
bool ProcessWrite () anope_override
virtual void Write (const char *buffer, size_t l)
void Write (const char *message,...)
void Write (const Anope::string &message)
virtual bool Read (const char *buffer, size_t l)
- 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 void ProcessError ()

Protected Attributes

std::deque< DataBlock * > write_buffer
- Protected Attributes inherited from Socket
int sock
bool ipv6

Additional Inherited Members

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

Detailed Description

Definition at line 317 of file sockets.h.

Constructor & Destructor Documentation

◆ BinarySocket()

BinarySocket::BinarySocket ( )

Definition at line 119 of file socket_transport.cpp.

◆ ~BinarySocket()

BinarySocket::~BinarySocket ( )

Definition at line 123 of file socket_transport.cpp.

Member Function Documentation

◆ ProcessRead()

bool BinarySocket::ProcessRead ( )

Called when there is something to be received for this socket

true on success, false to drop this socket

Reimplemented from Socket.

Definition at line 127 of file socket_transport.cpp.

References Socket::io, NET_BUFSIZE, and SocketIO::Recv().

Referenced by MyRedisService::BlockAndProcess().

◆ ProcessWrite()

bool BinarySocket::ProcessWrite ( )

Called when the socket is ready to be written to

true on success, false to drop this socket

Reimplemented from Socket.

Reimplemented in MyHTTPClient.

Definition at line 138 of file socket_transport.cpp.

References BinarySocket::DataBlock::buf, SocketEngine::Change(), Anope::string::empty(), Socket::io, BinarySocket::DataBlock::len, SocketIO::Send(), SF_WRITABLE, and BufferedSocket::write_buffer.

Referenced by MyRedisService::BlockAndProcess(), and MyHTTPClient::ProcessWrite().

◆ Read()

bool BinarySocket::Read ( const char *  buffer,
size_t  l 

Called with data from the socket

bufferThe data
lThe length of buffer
true to continue reading, false to drop the socket

Reimplemented in SOCKS5ProxyConnect, MyHTTPClient, and RedisSocket.

Definition at line 196 of file socket_transport.cpp.

◆ Write() [1/3]

void BinarySocket::Write ( const char *  buffer,
size_t  l 

Write data to the socket

bufferThe data to write
lThe length of the data; if 0 then this function returns without doing anything

Definition at line 168 of file socket_transport.cpp.

References SocketEngine::Change(), Anope::string::push_back(), SF_WRITABLE, and BufferedSocket::write_buffer.

Referenced by MyRedisService::Send(), MyHTTPClient::SendReply(), and HTTPClient::WriteClient().

◆ Write() [2/3]

void BinarySocket::Write ( const char *  message,

Definition at line 176 of file socket_transport.cpp.

References BUFSIZE, and BufferedSocket::Write().

◆ Write() [3/3]

void BinarySocket::Write ( const Anope::string message)

Field Documentation

◆ write_buffer

std::deque<DataBlock *> BinarySocket::write_buffer

Definition at line 331 of file sockets.h.

Referenced by MyHTTPClient::ProcessWrite().

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