The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ListenSocket Class Reference

This class handles incoming connections on client ports. More...

#include <socket.h>

Inheritance diagram for ListenSocket:

Inheritance graph
[legend]
Collaboration diagram for ListenSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ListenSocket (InspIRCd *Instance, int port, char *addr)
 Create a new listening socket.
void HandleEvent (EventType et, int errornum=0)
 Handle an I/O event.
 ~ListenSocket ()
 Close the socket.
void SetDescription (const std::string &description)
 Set descriptive text.
const std::stringGetDescription ()
 Get description for socket.
int GetPort ()
 Get port number for socket.
std::stringGetIP ()
 Get IP address socket is bound to.

Protected Attributes

InspIRCdServerInstance
 The creator/owner of this object.
std::string desc
 Socket description (shown in stats p).
int family
 Socket address family.
std::string bind_addr
 Address socket is bound to.
int bind_port
 Port socket is bound to.

Static Protected Attributes

static sockaddr * sock_us = NULL
static sockaddr * client = NULL
static sockaddr * raddr = NULL
static unsigned int socketcount = 0

Detailed Description

This class handles incoming connections on client ports.

It will create a new User for every valid connection and assign it a file descriptor.

Definition at line 148 of file socket.h.


Constructor & Destructor Documentation

ListenSocket::ListenSocket InspIRCd Instance,
int  port,
char *  addr
 

Create a new listening socket.

Definition at line 27 of file listensocket.cpp.

References SocketEngine::AddFd(), InspIRCd::BindSocket(), client, DEBUG, family, EventHandler::fd, LogManager::Log(), InspIRCd::Logs, irc::sockets::OpenTCPSocket(), raddr, InspIRCd::SE, ServerInstance, EventHandler::SetFd(), sock_us, and socketcount.

ListenSocket::~ListenSocket  ) 
 

Close the socket.

Definition at line 54 of file listensocket.cpp.

References client, SocketEngine::Close(), DEBUG, SocketEngine::DelFd(), EventHandler::fd, LogManager::Log(), InspIRCd::Logs, raddr, InspIRCd::SE, ServerInstance, SocketEngine::Shutdown(), sock_us, and socketcount.


Member Function Documentation

const std::string& ListenSocket::GetDescription  )  [inline]
 

Get description for socket.

Definition at line 189 of file socket.h.

std::string& ListenSocket::GetIP  )  [inline]
 

Get IP address socket is bound to.

Definition at line 201 of file socket.h.

int ListenSocket::GetPort  )  [inline]
 

Get port number for socket.

Definition at line 195 of file socket.h.

void ListenSocket::HandleEvent EventType  et,
int  errornum = 0
[virtual]
 

Handle an I/O event.

Implements EventHandler.

Definition at line 73 of file listensocket.cpp.

References SocketEngine::Accept(), UserManager::AddUser(), client, SocketEngine::Close(), DEBUG, DEFAULT, EVENT_ERROR, EVENT_READ, EVENT_WRITE, SocketEngine::GetSockName(), LogManager::Log(), InspIRCd::Logs, MAXBUF, SocketEngine::NonBlocking(), raddr, InspIRCd::SE, ServerInstance, SocketEngine::Shutdown(), sock_us, InspIRCd::stats, serverstats::statsAccept, serverstats::statsRefused, and InspIRCd::Users.

void ListenSocket::SetDescription const std::string description  )  [inline]
 

Set descriptive text.

Definition at line 183 of file socket.h.


Member Data Documentation

std::string ListenSocket::bind_addr [protected]
 

Address socket is bound to.

Definition at line 159 of file socket.h.

int ListenSocket::bind_port [protected]
 

Port socket is bound to.

Definition at line 161 of file socket.h.

sockaddr * ListenSocket::client = NULL [static, protected]
 

Definition at line 165 of file socket.h.

Referenced by HandleEvent(), ListenSocket(), and ~ListenSocket().

std::string ListenSocket::desc [protected]
 

Socket description (shown in stats p).

Definition at line 155 of file socket.h.

int ListenSocket::family [protected]
 

Socket address family.

Definition at line 157 of file socket.h.

Referenced by ListenSocket().

sockaddr * ListenSocket::raddr = NULL [static, protected]
 

Definition at line 167 of file socket.h.

Referenced by HandleEvent(), ListenSocket(), and ~ListenSocket().

InspIRCd* ListenSocket::ServerInstance [protected]
 

The creator/owner of this object.

Definition at line 153 of file socket.h.

Referenced by HandleEvent(), ListenSocket(), and ~ListenSocket().

sockaddr * ListenSocket::sock_us = NULL [static, protected]
 

Definition at line 163 of file socket.h.

Referenced by HandleEvent(), ListenSocket(), and ~ListenSocket().

unsigned int ListenSocket::socketcount = 0 [static, protected]
 

Definition at line 169 of file socket.h.

Referenced by ListenSocket(), and ~ListenSocket().


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