Public Member Functions

SocketIO Class Reference

#include <sockets.h>

Inherited by SSLSocketIO.

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 131 of file sockets.h.


Constructor & Destructor Documentation

virtual SocketIO::~SocketIO (  )  [inline, virtual]

Definition at line 134 of file sockets.h.


Member Function Documentation

ClientSocket * SocketIO::Accept ( ListenSocket s  )  [virtual]

Accept a connection from a socket

Parameters:
s The socket
Returns:
The new socket

Reimplemented in SSLSocketIO.

Definition at line 340 of file sockets.cpp.

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

Referenced by ListenSocket::ProcessRead().

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

Bind a socket

Parameters:
s The socket
ip The IP to bind to
port The optional port to bind to

Definition at line 363 of file sockets.cpp.

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

Referenced by Socket::Bind(), and ListenSocket::ListenSocket().

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

Called when the socket is destructing

Reimplemented in SSLSocketIO.

Definition at line 186 of file sockets.h.

Referenced by Pipe::Pipe(), and Socket::~Socket().

SocketFlag SocketIO::FinishAccept ( ClientSocket cs  )  [virtual]

Finished accepting a connection from a socket

Parameters:
s The socket
Returns:
SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error

Reimplemented in SSLSocketIO.

Definition at line 358 of file sockets.cpp.

Referenced by ClientSocket::Process().

SocketFlag SocketIO::FinishConnect ( ConnectionSocket s  )  [virtual]

Called to potentially finish a pending connection

Parameters:
s The socket
Returns:
SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error.

Reimplemented in SSLSocketIO.

Definition at line 392 of file sockets.cpp.

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

Referenced by ConnectionSocket::Process().

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

Receive something from the buffer

Parameters:
s The socket
buf The buf to read to
sz How much to read
Returns:
Number of bytes received

Reimplemented in SSLSocketIO.

Definition at line 321 of file sockets.cpp.

References Socket::GetFD(), and TotalRead.

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

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

Definition at line 335 of file sockets.cpp.

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

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

Write something to the socket

Parameters:
s The socket
buf The data to write
size The length of the data

Reimplemented in SSLSocketIO.

Definition at line 328 of file sockets.cpp.

References Socket::GetFD(), and TotalWritten.

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


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