Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ircd_connector Class Reference

Each connection has one or more of these each represents ONE outbound connection to another ircd so each inbound has multiple outbounds. More...

#include <connection.h>

Inheritance diagram for ircd_connector:

Inheritance graph
[legend]
Collaboration diagram for ircd_connector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

bool MakeOutboundConnection (char *host, int port)
 Create an outbound connection to a listening socket.

std::string GetServerName ()
 Return the servername on this established connection.

void SetServerName (std::string serv)
 Set the server name of this connection.

int GetDescriptor ()
 Get the file descriptor associated with this connection.

void SetDescriptor (int fd)
 Set the file descriptor for this connection.

int GetState ()
 Get the state flags for this connection.

void SetState (int state)
 Set the state flags for this connection.

char * GetServerIP ()
 Get the ip address (not servername) associated with this connection.

std::string GetDescription ()
 Get the server description of this connection.

void SetDescription (std::string desc)
 Set the server description of this connection.

int GetServerPort ()
 Get the port number being used for this connection If the connection is outbound this will be the remote port otherwise it will be the local port, so it can always be gautanteed as open at the address given in GetServerIP().

void SetServerPort (int p)
 Set the port used by this connection.

bool SetHostAndPort (char *host, int port)
 Set both the host and the port in one operation for this connection.

void CloseConnection ()
 Close the connection by calling close() on its file descriptor This function call updates no other data.


Public Attributes

char host [MAXBUF]
 When MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference.

int port
 When MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference.

std::vector< std::string > routes
 Server names of servers that this server is linked to So for A->B->C, if this was the record for B it would contain A and C whilever both servers are connected to B.


Private Member Functions

bool SetHostAddress (char *host, int port)
 PRIVATE function to set the host address and port to connect to.


Private Attributes

sockaddr_in addr
 Sockaddr of the outbound ip and port.

int fd
 File descriptor of the connection.

std::string servername
 Server name.

std::string description
 Server 'GECOS'.

int state
 State.


Detailed Description

Each connection has one or more of these each represents ONE outbound connection to another ircd so each inbound has multiple outbounds.

A listening socket that accepts server type connections is represented by one class serverrec. Class serverrec will instantiate several objects of type ircd_connector to represent each established connection, inbound or outbound. So, to determine all linked servers you must walk through all the serverrecs that the core defines, and in each one iterate through until you find connection(s) relating to the server you want information on. The core and module API provide functions for this.

Definition at line 41 of file connection.h.


Member Function Documentation

void ircd_connector::CloseConnection  
 

Close the connection by calling close() on its file descriptor This function call updates no other data.

std::string ircd_connector::GetDescription  
 

Get the server description of this connection.

int ircd_connector::GetDescriptor  
 

Get the file descriptor associated with this connection.

char* ircd_connector::GetServerIP  
 

Get the ip address (not servername) associated with this connection.

std::string ircd_connector::GetServerName  
 

Return the servername on this established connection.

int ircd_connector::GetServerPort  
 

Get the port number being used for this connection If the connection is outbound this will be the remote port otherwise it will be the local port, so it can always be gautanteed as open at the address given in GetServerIP().

int ircd_connector::GetState  
 

Get the state flags for this connection.

bool ircd_connector::MakeOutboundConnection char *    host,
int    port
 

Create an outbound connection to a listening socket.

void ircd_connector::SetDescription std::string    desc
 

Set the server description of this connection.

void ircd_connector::SetDescriptor int    fd
 

Set the file descriptor for this connection.

bool ircd_connector::SetHostAddress char *    host,
int    port
[private]
 

PRIVATE function to set the host address and port to connect to.

bool ircd_connector::SetHostAndPort char *    host,
int    port
 

Set both the host and the port in one operation for this connection.

void ircd_connector::SetServerName std::string    serv
 

Set the server name of this connection.

void ircd_connector::SetServerPort int    p
 

Set the port used by this connection.

void ircd_connector::SetState int    state
 

Set the state flags for this connection.


Member Data Documentation

sockaddr_in ircd_connector::addr [private]
 

Sockaddr of the outbound ip and port.

Definition at line 46 of file connection.h.

std::string ircd_connector::description [private]
 

Server 'GECOS'.

Definition at line 58 of file connection.h.

int ircd_connector::fd [private]
 

File descriptor of the connection.

Definition at line 50 of file connection.h.

char ircd_connector::host[MAXBUF]
 

When MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference.

Definition at line 75 of file connection.h.

int ircd_connector::port
 

When MakeOutboundConnection is called, these public members are filled with the details passed to the function, for future reference.

Definition at line 81 of file connection.h.

std::vector<std::string> ircd_connector::routes
 

Server names of servers that this server is linked to So for A->B->C, if this was the record for B it would contain A and C whilever both servers are connected to B.

Definition at line 87 of file connection.h.

std::string ircd_connector::servername [private]
 

Server name.

Definition at line 54 of file connection.h.

int ircd_connector::state [private]
 

State.

STATE_NOAUTH_INBOUND, STATE_NOAUTH_OUTBOUND STATE_SYNC, STATE_DISCONNECTED, STATE_CONNECTED

Definition at line 63 of file connection.h.


The documentation for this class was generated from the following file:
Generated on Thu Apr 29 16:22:07 2004 for InspIRCd by doxygen1.3-rc3