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
[legend]
Collaboration diagram for BinarySocket:
Collaboration graph
[legend]

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
 
SocketIOio
 

Detailed Description

Definition at line 317 of file sockets.h.

Constructor & Destructor Documentation

BinarySocket::BinarySocket ( )

Definition at line 119 of file socket_transport.cpp.

BinarySocket::~BinarySocket ( )
virtual

Definition at line 123 of file socket_transport.cpp.

Member Function Documentation

bool BinarySocket::ProcessRead ( )
virtual

Called when there is something to be received for this socket

Returns
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, Read(), and SocketIO::Recv().

Referenced by MyRedisService::BlockAndProcess().

bool BinarySocket::ProcessWrite ( )
virtual

Called when the socket is ready to be written to

Returns
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(), Socket::io, BinarySocket::DataBlock::len, SocketIO::Send(), SF_WRITABLE, and write_buffer.

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

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

Called with data from the socket

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

Reimplemented in SOCKS5ProxyConnect, MyHTTPClient, and RedisSocket.

Definition at line 196 of file socket_transport.cpp.

Referenced by ProcessRead().

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

Write data to the socket

Parameters
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(), SF_WRITABLE, and write_buffer.

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

void BinarySocket::Write ( const char *  message,
  ... 
)

Definition at line 176 of file socket_transport.cpp.

References BUFSIZE, and Write().

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

Definition at line 191 of file socket_transport.cpp.

References Anope::string::c_str(), Anope::string::length(), and Write().

Field Documentation

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

Definition at line 331 of file sockets.h.

Referenced by MyHTTPClient::ProcessWrite(), ProcessWrite(), and Write().


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