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
Collaboration diagram for BufferedSocket:
Collaboration graph

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

Detailed Description

Definition at line 269 of file sockets.h.

Constructor & Destructor Documentation

◆ BufferedSocket()

BufferedSocket::BufferedSocket ( )

Definition at line 17 of file socket_transport.cpp.

◆ ~BufferedSocket()

BufferedSocket::~BufferedSocket ( )

Definition at line 21 of file socket_transport.cpp.

Member Function Documentation

◆ GetLine()

const Anope::string BufferedSocket::GetLine ( )

◆ ProcessRead()

bool BufferedSocket::ProcessRead ( )

Called when there is something to be received for this socket

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

◆ ProcessWrite()

bool BufferedSocket::ProcessWrite ( )

Called when the socket is ready to be written to

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

◆ ReadBufferLen()

int BufferedSocket::ReadBufferLen ( ) const

Get the length of the read buffer

The length of the read buffer

Definition at line 96 of file socket_transport.cpp.

References recv_len.

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

◆ Write() [1/3]

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

Write to the socket

messageThe message

Definition at line 70 of file socket_transport.cpp.

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

Referenced by Write(), BinarySocket::Write(), and UplinkSocket::Message::~Message().

◆ Write() [2/3]

void BufferedSocket::Write ( const char *  message,

Definition at line 76 of file socket_transport.cpp.

References BUFSIZE, and Write().

◆ Write() [3/3]

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

◆ WriteBufferLen()

int BufferedSocket::WriteBufferLen ( ) const

Get the length of the write buffer

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

◆ read_buffer

Anope::string BufferedSocket::read_buffer

Definition at line 273 of file sockets.h.

Referenced by GetLine(), and ProcessRead().

◆ recv_len

int BufferedSocket::recv_len

Definition at line 277 of file sockets.h.

Referenced by ProcessRead(), and ReadBufferLen().

◆ write_buffer

Anope::string BufferedSocket::write_buffer

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