#include <sockets.h>
Inherited by BinarySocket [virtual], BufferedSocket [virtual], ClientSocket [virtual], ConnectionSocket [virtual], DNS::ReplySocket [virtual], ListenSocket [virtual], and Pipe.

Public Member Functions | |
| 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 bool | ProcessRead () |
| virtual bool | ProcessWrite () |
| virtual void | ProcessError () |
Data Fields | |
| std::bitset< SF_SIZE > | flags |
| sockaddrs | bindaddr |
| SocketIO * | io |
Protected Attributes | |
| int | sock |
| bool | ipv6 |
Definition at line 189 of file sockets.h.
| Socket::Socket | ( | ) |
Empty constructor, should not be called.
Definition at line 416 of file sockets.cpp.
| Socket::Socket | ( | int | sock, | |
| bool | ipv6 = false, |
|||
| int | type = SOCK_STREAM | |||
| ) |
Constructor, possibly creates the socket and adds it to the engine
| sock | The socket to use, -1 if we need to create our own | |
| ipv6 | true if using ipv6 | |
| type | The socket type, defaults to SOCK_STREAM |
Definition at line 421 of file sockets.cpp.
References SocketEngine::Change(), io, ipv6, SetBlocking(), SF_READABLE, sock, and SocketEngine::Sockets.
| Socket::~Socket | ( | ) | [virtual] |
Destructor, closes the socket and removes it from the engine
Definition at line 434 of file sockets.cpp.
References anope_close, SocketEngine::Change(), SocketIO::Destroy(), io, SF_READABLE, SF_WRITABLE, sock, and SocketEngine::Sockets.
| void Socket::Bind | ( | const Anope::string & | ip, | |
| int | port = 0 | |||
| ) |
Bind the socket to an ip and port
| ip | The ip | |
| port | The port |
Definition at line 462 of file sockets.cpp.
References SocketIO::Bind(), and io.
Referenced by Uplink::Connect().
| int Socket::GetFD | ( | ) | const |
Get the socket FD for this socket
Definition at line 443 of file sockets.cpp.
References sock.
Referenced by SocketIO::Accept(), SSLSocketIO::Accept(), SocketIO::Bind(), SocketEngine::Change(), SocketIO::Connect(), SSLSocketIO::Connect(), SocketIO::FinishConnect(), SSLSocketIO::FinishConnect(), ListenSocket::ListenSocket(), ClientSocket::ProcessError(), ConnectionSocket::ProcessError(), Pipe::ProcessRead(), Pipe::Read(), SocketIO::Recv(), SocketIO::Send(), MyHTTPClient::Serve(), SetBlocking(), and MyHTTPClient::~MyHTTPClient().
| bool Socket::IsIPv6 | ( | ) | const |
Check if this socket is IPv6
Definition at line 448 of file sockets.cpp.
References ipv6.
Referenced by SocketIO::Bind(), SocketIO::Connect(), and SSLSocketIO::Connect().
| bool Socket::Process | ( | ) | [virtual] |
Called when there either is a read or write event.
Reimplemented in ConnectionSocket, and ClientSocket.
Definition at line 467 of file sockets.cpp.
Referenced by SocketEngine::Process().
| void Socket::ProcessError | ( | ) | [virtual] |
Called when there is an error for this socket
Reimplemented in ConnectionSocket, and ClientSocket.
Definition at line 482 of file sockets.cpp.
Referenced by SocketEngine::Process().
| bool Socket::ProcessRead | ( | ) | [virtual] |
Called when there is something to be received for this socket
Reimplemented in BufferedSocket, BinarySocket, ListenSocket, Pipe, UplinkSocket, TCPSocket::Client, UDPSocket, and HTTPProxyConnect.
Definition at line 472 of file sockets.cpp.
Referenced by SocketEngine::Process().
| bool Socket::ProcessWrite | ( | ) | [virtual] |
Called when the socket is ready to be written to
Reimplemented in BufferedSocket, BinarySocket, TCPSocket::Client, UDPSocket, and ProxyCallbackListener::ProxyCallbackClient.
Definition at line 477 of file sockets.cpp.
Referenced by SocketEngine::Process().
| bool Socket::SetBlocking | ( | bool | state | ) |
Mark a socket as (non)blocking
| state | true to enable blocking, false to disable blocking |
Definition at line 453 of file sockets.cpp.
References F_GETFL, F_SETFL, fcntl(), GetFD(), and O_NONBLOCK.
Referenced by ListenSocket::ListenSocket(), and Socket().
Definition at line 201 of file sockets.h.
Referenced by SocketIO::Bind(), and ListenSocket::ListenSocket().
| std::bitset<SF_SIZE> Socket::flags |
Definition at line 198 of file sockets.h.
Referenced by SocketIO::Accept(), SSLSocketIO::Accept(), SocketEngine::Change(), SocketIO::Connect(), SSLSocketIO::Connect(), SSLSocketIO::FinishAccept(), SocketIO::FinishConnect(), SSLSocketIO::FinishConnect(), Thread::OnNotify(), SocketEngine::Process(), ClientSocket::Process(), ConnectionSocket::Process(), Thread::Start(), and ModuleProxyScan::ConnectionTimeout::Tick().
Definition at line 204 of file sockets.h.
Referenced by SSLSocketIO::Accept(), Bind(), ConnectionSocket::Connect(), SSLSocketIO::Connect(), SSLSocketIO::FinishAccept(), SSLSocketIO::FinishConnect(), MySSLService::Init(), ListenSocket::ListenSocket(), Pipe::Pipe(), ClientSocket::Process(), ConnectionSocket::Process(), ListenSocket::ProcessRead(), BinarySocket::ProcessRead(), BufferedSocket::ProcessRead(), BinarySocket::ProcessWrite(), BufferedSocket::ProcessWrite(), Socket(), ~Socket(), and SSLModule::~SSLModule().
bool Socket::ipv6 [protected] |
int Socket::sock [protected] |
Definition at line 193 of file sockets.h.
Referenced by GetFD(), ListenSocket::ListenSocket(), Pipe::Pipe(), Socket(), and ~Socket().
1.7.1