InspIRCd
3.0
|
#include <inspsocket.h>
Classes | |
class | SendQueue |
Public Types | |
enum | Type { SS_UNKNOWN, SS_USER } |
Public Member Functions | |
StreamSocket (Type sstype=SS_UNKNOWN) | |
IOHook * | GetIOHook () const |
void | AddIOHook (IOHook *hook) |
void | DelIOHook () |
void | DoWrite () |
void | OnEventHandlerRead () CXX11_OVERRIDE |
void | OnEventHandlerWrite () CXX11_OVERRIDE |
void | OnEventHandlerError (int errcode) CXX11_OVERRIDE |
void | SetError (const std::string &err) |
const std::string & | getError () const |
virtual void | OnDataReady ()=0 |
virtual void | OnError (BufferedSocketError e)=0 |
virtual bool | OnSetEndPoint (const irc::sockets::sockaddrs &local, const irc::sockets::sockaddrs &remote) |
void | WriteData (const std::string &data) |
bool | GetNextLine (std::string &line, char delim='\n') |
size_t | getSendQSize () const |
SendQueue & | GetSendQ () |
virtual void | Close () |
void | Close (bool writeblock) |
CullResult | cull () CXX11_OVERRIDE |
IOHook * | GetModHook (Module *mod) const |
IOHook * | GetLastHook () const |
![]() | |
int | GetFd () const |
bool | HasFd () const |
int | GetEventMask () const |
void | SetFd (int FD) |
EventHandler () | |
virtual | ~EventHandler () |
Public Attributes | |
const Type | type |
Protected Member Functions | |
void | SwapInternals (StreamSocket &other) |
![]() | |
void | SwapInternals (EventHandler &other) |
Protected Attributes | |
std::string | recvq |
![]() | |
int | fd |
StreamSocket is a class that wraps a TCP socket and handles send and receive queues, including passing them to IO hooks
enum StreamSocket::Type |
The type of socket this IOHook represents.
|
virtual |
Close the socket, remove from socket engine, etc
void StreamSocket::Close | ( | bool | writeblock | ) |
If writeblock is true then only close the socket if all data has been sent. Otherwise, close immediately.
|
virtual |
This ensures that close is called prior to destructor
Reimplemented from classbase.
void StreamSocket::DoWrite | ( | ) |
Flush the send queue
|
inline |
Gets the error message for this socket.
IOHook * StreamSocket::GetLastHook | ( | ) | const |
bool StreamSocket::GetNextLine | ( | std::string & | line, |
char | delim = '\n' |
||
) |
Convenience function: read a line from the socket
line | The line read |
delim | The line delimiter |
size_t StreamSocket::getSendQSize | ( | ) | const |
Useful for implementing sendq exceeded
|
pure virtual |
Called when new data is present in recvq
Implemented in BufferedSocket, and UserIOHandler.
|
pure virtual |
Called when the socket gets an error from socket engine or IO hook
Implemented in UserIOHandler.
|
virtual |
|
virtual |
Called by the socket engine on a read event
Implements EventHandler.
|
virtual |
Called by the socket engine on a write event
Reimplemented from EventHandler.
Reimplemented in BufferedSocket.
|
virtual |
Called when the endpoint addresses are changed.
local | The new local endpoint. |
remote | The new remote endpoint. |
Reimplemented in UserIOHandler.
|
inline |
Sets the error message for this socket. Once set, the socket is dead.
|
protected |
Swaps the internals of this StreamSocket with another one.
other | A StreamSocket to swap internals with. |
void StreamSocket::WriteData | ( | const std::string & | data | ) |
Send the given data out the socket, either now or when writes unblock
|
protected |
The data which has been received from the socket.