Anope IRC Services  Version 2.0
Public Member Functions | Protected Member Functions | Protected Attributes
BufferedSocket Class Reference

#include <sockets.h>

Inheritance diagram for BufferedSocket:
Inheritance graph
[legend]
Collaboration diagram for BufferedSocket:
Collaboration graph
[legend]

Public Member Functions

 BufferedSocket ()
 
virtual ~BufferedSocket ()
 
bool ProcessRead () anope_override
 
bool ProcessWrite () anope_override
 
const Anope::string GetLine ()
 
void Write (const char *message,...)
 
void Write (const Anope::string &message)
 
int ReadBufferLen () const
 
int WriteBufferLen () const
 
- 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 Member Functions

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

Protected Attributes

Anope::string read_buffer
 
Anope::string write_buffer
 
int recv_len
 
- 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 269 of file sockets.h.

Constructor & Destructor Documentation

BufferedSocket::BufferedSocket ( )

Definition at line 17 of file socket_transport.cpp.

BufferedSocket::~BufferedSocket ( )
virtual

Definition at line 21 of file socket_transport.cpp.

Member Function Documentation

const Anope::string BufferedSocket::GetLine ( )
bool BufferedSocket::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.

Reimplemented in HTTPProxyConnect, and UplinkSocket.

Definition at line 25 of file socket_transport.cpp.

References Anope::string::append(), SocketEngine::IgnoreErrno(), Socket::io, NET_BUFSIZE, read_buffer, SocketIO::Recv(), and recv_len.

Referenced by UplinkSocket::ProcessRead(), and HTTPProxyConnect::ProcessRead().

bool BufferedSocket::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 ProxyCallbackListener::ProxyCallbackClient.

Definition at line 44 of file socket_transport.cpp.

References SocketEngine::Change(), Anope::string::empty(), SocketEngine::IgnoreErrno(), Socket::io, SocketIO::Send(), SF_WRITABLE, Anope::string::substr(), and write_buffer.

Referenced by ProxyCallbackListener::ProxyCallbackClient::ProcessWrite(), and UplinkSocket::~UplinkSocket().

int BufferedSocket::ReadBufferLen ( ) const

Get the length of the read buffer

Returns
The length of the read buffer

Definition at line 96 of file socket_transport.cpp.

References recv_len.

Referenced by Message::Stats::Run().

void BufferedSocket::Write ( const char *  buffer,
size_t  l 
)
protectedvirtual

Write to the socket

Parameters
messageThe message

Definition at line 70 of file socket_transport.cpp.

References SocketEngine::Change(), SF_WRITABLE, and write_buffer.

Referenced by ProxyCallbackListener::ProxyCallbackClient::OnAccept(), HTTPProxyConnect::OnConnect(), Write(), and UplinkSocket::Message::~Message().

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

Definition at line 76 of file socket_transport.cpp.

References BUFSIZE, and Write().

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

Definition at line 91 of file socket_transport.cpp.

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

int BufferedSocket::WriteBufferLen ( ) const

Get the length of the write buffer

Returns
The length of the write buffer

Definition at line 101 of file socket_transport.cpp.

References Anope::string::length(), and write_buffer.

Referenced by Message::Stats::Run().

Field Documentation

Anope::string BufferedSocket::read_buffer
protected

Definition at line 273 of file sockets.h.

Referenced by GetLine(), and ProcessRead().

int BufferedSocket::recv_len
protected

Definition at line 277 of file sockets.h.

Referenced by ProcessRead(), and ReadBufferLen().

Anope::string BufferedSocket::write_buffer
protected

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