Anope IRC Services  Version 2.0
Public Member Functions
SocketIO Class Reference

#include <sockets.h>

Inheritance diagram for SocketIO:
Inheritance graph
[legend]

Public Member Functions

virtual ~SocketIO ()
 
virtual int Recv (Socket *s, char *buf, size_t sz)
 
virtual int Send (Socket *s, const char *buf, size_t sz)
 
int Send (Socket *s, const Anope::string &buf)
 
virtual ClientSocketAccept (ListenSocket *s)
 
virtual SocketFlag FinishAccept (ClientSocket *cs)
 
virtual void Bind (Socket *s, const Anope::string &ip, int port=0)
 
virtual void Connect (ConnectionSocket *s, const Anope::string &target, int port)
 
virtual SocketFlag FinishConnect (ConnectionSocket *s)
 
virtual void Destroy ()
 

Detailed Description

Definition at line 136 of file sockets.h.

Constructor & Destructor Documentation

virtual SocketIO::~SocketIO ( )
inlinevirtual

Definition at line 139 of file sockets.h.

Member Function Documentation

ClientSocket * SocketIO::Accept ( ListenSocket s)
virtual

Accept a connection from a socket

Parameters
sThe socket
Returns
The new socket

Reimplemented in SSLSocketIO, and SSLSocketIO.

Definition at line 371 of file sockets.cpp.

References accept, Socket::flags, Socket::GetFD(), Anope::LastError(), ListenSocket::OnAccept(), ClientSocket::OnAccept(), sockaddrs::sa, and SF_ACCEPTED.

void SocketIO::Bind ( Socket s,
const Anope::string ip,
int  port = 0 
)
virtual

Bind a socket

Parameters
sThe socket
ipThe IP to bind to
portThe optional port to bind to

Definition at line 394 of file sockets.cpp.

References Socket::bindaddr, Socket::GetFD(), Socket::IsIPv6(), Anope::LastError(), sockaddrs::pton(), sockaddrs::sa, and sockaddrs::size().

void SocketIO::Connect ( ConnectionSocket s,
const Anope::string target,
int  port 
)
virtual
virtual void SocketIO::Destroy ( )
inlinevirtual

Called when the socket is destructing

Reimplemented in SSLSocketIO, and SSLSocketIO.

Definition at line 191 of file sockets.h.

Referenced by Pipe::Pipe().

SocketFlag SocketIO::FinishAccept ( ClientSocket cs)
virtual

Finished accepting a connection from a socket

Parameters
sThe socket
Returns
SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error

Reimplemented in SSLSocketIO, and SSLSocketIO.

Definition at line 389 of file sockets.cpp.

References SF_ACCEPTED.

Referenced by ClientSocket::Process().

SocketFlag SocketIO::FinishConnect ( ConnectionSocket s)
virtual

Called to potentially finish a pending connection

Parameters
sThe socket
Returns
SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error.

Reimplemented in SSLSocketIO, and SSLSocketIO.

Definition at line 423 of file sockets.cpp.

References Socket::flags, Socket::GetFD(), Anope::LastError(), ConnectionSocket::OnConnect(), ConnectionSocket::OnError(), SF_CONNECTED, SF_CONNECTING, and SF_DEAD.

Referenced by ConnectionSocket::Process().

int SocketIO::Recv ( Socket s,
char *  buf,
size_t  sz 
)
virtual

Receive something from the buffer

Parameters
sThe socket
bufThe buf to read to
szHow much to read
Returns
Number of bytes received

Reimplemented in SSLSocketIO, and SSLSocketIO.

Definition at line 350 of file sockets.cpp.

References Socket::GetFD(), and TotalRead.

Referenced by BufferedSocket::ProcessRead(), and BinarySocket::ProcessRead().

int SocketIO::Send ( Socket s,
const char *  buf,
size_t  sz 
)
virtual

Write something to the socket

Parameters
sThe socket
bufThe data to write
sizeThe length of the data

Reimplemented in SSLSocketIO, and SSLSocketIO.

Definition at line 358 of file sockets.cpp.

References Socket::GetFD(), and TotalWritten.

Referenced by BufferedSocket::ProcessWrite(), and BinarySocket::ProcessWrite().

int SocketIO::Send ( Socket s,
const Anope::string buf 
)

Definition at line 366 of file sockets.cpp.

References Anope::string::c_str(), Anope::string::length(), and Mail::Send().


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