Ceylan::Network Namespace Reference

Basic network management, which is an optional Ceylan feature. More...

Classes

class  AnonymousProtocolAwareStreamSocket
 Anonymous connection-based server-side stream socket linked with a protocol server, which manages higher-level message exchanges for that connection. More...
class  AnonymousStreamSocket
 Anonymous connection-based server-side stream socket. More...
class  ClientStreamSocket
 Client-side implementation of connection-based socket. More...
class  IPAddressException
 Exception dedicated to the IP addressing. More...
class  IPAddress
 Handles abstract IP (Internet Protocol) addresses. More...
class  IPAddressvFour
 Handles IPv4 addresses. More...
class  MultiplexedProtocolBasedStreamServer
 Server-side implementation of a server listening socket and its connection-triggered sockets, each one corresponding to a connected client managed by a dedicated protocol server. More...
class  MultiplexedServerStreamSocket
 Server-side implementation of a server listening socket and its connection-triggered sockets, each one corresponding to a connected client. More...
class  NetworkException
 Exception class for network services. More...
class  HostDNSEntry
 Describes the DNS entry corresponding to a specified host. More...
class  SequentialServerStreamSocket
 Server, based on stream sockets, that can serve any number of clients, although not in parallel : clients are taken care of sequentially, one after the other, each one thanks to a dedicated anonymous stream socket. More...
class  ServerStreamSocket
 Server-side implementation of connection-based socket. More...
class  Socket
 Simple general socket I/O class, both for connection-based (stream) sockets and packet-based (datagram) sockets, both for client-side and server-side sockets. More...
class  StreamSocket
 Simple connection-based socket I/O class. More...

Typedefs

typedef int SocketError
 The numerical error code that may be returned by specific network primitives, namely Windows socket ones.
typedef Ceylan::Uint32 Port
 Port number, as specified for sockets.

Enumerations

enum  NetworkAddressType { IPv4, IPv6 }
 

Records the known types of network addresses.

More...

Functions

CEYLAN_DLL const std::string getLocalHostName ()
 Returns local host's name, not including the domain name.
CEYLAN_DLL void setLocalHostName (const std::string &newHostName)
 Sets local host's name.
CEYLAN_DLL const std::string getLocalHostDomainName ()
 Returns local host's domain name.
CEYLAN_DLL void setLocalHostDomainName (const std::string &newHostName)
 Sets local host's domain name.
CEYLAN_DLL const std::string getMostPreciseLocalHostName ()
 Returns most precise available local host name.
CEYLAN_DLL const std::string getFQDNFromIP (const IPAddress &ip)
 Returns the fully qualified domain name (FQDN) of specified host.
CEYLAN_DLL const std::string getFQDNFromIPv4 (const std::string &ipString)
 Returns the fully qualified domain name (FQDN) of specified host.
CEYLAN_DLL const std::string getFQDNFromHostname (const std::string &hostname)
 Returns the fully qualified domain name (FQDN) of specified host.
CEYLAN_DLL const std::string getFQDNFromDNSEntry (const HostDNSEntry &entry)
 Returns the fully qualified domain name (FQDN) from specified DNS entry instance.
CEYLAN_DLL bool isAValidHostName (const std::string &hostnameString)
 Returns whether specified string is a valid host name.
CEYLAN_DLL std::string interpretSocketError (SocketError errorCode)
 Returns a string describing the error associated with the specified error code.
CEYLAN_DLL SocketError getSocketError ()
 Returns the latest socket error.
CEYLAN_DLL std::string explainSocketError ()
 Returns the diagnosis string corresponding to latest socket error.

Detailed Description

Basic network management, which is an optional Ceylan feature.

See also:
Ceylan::URI for Uniform Resource Identifier facilities.
Note:
IPv6 is currently not supported.

Typedef Documentation

Port number, as specified for sockets.

Definition at line 69 of file CeylanSocket.h.

The numerical error code that may be returned by specific network primitives, namely Windows socket ones.

Definition at line 418 of file CeylanNetwork.h.


Enumeration Type Documentation

Records the known types of network addresses.

Enumerator:
IPv4 
IPv6 

Definition at line 77 of file CeylanNetwork.h.


Function Documentation

std::string Ceylan::Network::explainSocketError (  ) 
const string Ceylan::Network::getFQDNFromDNSEntry ( const HostDNSEntry entry  ) 

Returns the fully qualified domain name (FQDN) from specified DNS entry instance.

Parameters:
entry a previously created HostDNSEntry.

Definition at line 1054 of file CeylanNetwork.cc.

References Ceylan::countChars(), dataUtils::e, Ceylan::Network::HostDNSEntry::getAliasList(), Ceylan::Network::HostDNSEntry::getOfficialHostName(), and Ceylan::Network::HostDNSEntry::toString().

Referenced by getFQDNFromHostname(), and getFQDNFromIP().

const string Ceylan::Network::getFQDNFromHostname ( const std::string &  hostname  ) 

Returns the fully qualified domain name (FQDN) of specified host.

Parameters:
hostName the name of host to create a DNS description for. It is a host name (ex: "esperide.com"), not a stringified IP address.

Definition at line 1042 of file CeylanNetwork.cc.

References getFQDNFromDNSEntry().

Referenced by getMostPreciseLocalHostName().

const string Ceylan::Network::getFQDNFromIP ( const IPAddress ip  ) 

Returns the fully qualified domain name (FQDN) of specified host.

Parameters:
ip an IPAddress instance, be it IPv4 or IPv6.
Exceptions:
NetworkException if the search or the conversion failed.

Definition at line 1020 of file CeylanNetwork.cc.

References getFQDNFromDNSEntry().

Referenced by getFQDNFromIPv4().

const string Ceylan::Network::getFQDNFromIPv4 ( const std::string &  ipString  ) 

Returns the fully qualified domain name (FQDN) of specified host.

Parameters:
ipString a string describing the IPv4 address, such as "82.225.152.215".

Definition at line 1031 of file CeylanNetwork.cc.

References getFQDNFromIP().

const string Ceylan::Network::getLocalHostDomainName (  ) 

Returns local host's domain name.

Returns:
a string containing the domain name, or an empty string if no appropriate name is found. For example, on Linux systems, if NIS is not in use, this method reads the content of /proc/sys/kernel/domainname, which might be "(none)" or an empty string: in both of these last cases, an empty string is returned.
Exceptions:
NetworkException if the operation failed.

Definition at line 859 of file CeylanNetwork.cc.

References Ceylan::System::explainError().

Referenced by getMostPreciseLocalHostName().

const string Ceylan::Network::getLocalHostName (  ) 

Returns local host's name, not including the domain name.

Definition at line 776 of file CeylanNetwork.cc.

References Ceylan::System::explainError(), Ceylan::Network::HostDNSEntry::HostNameMaxLength, and Ceylan::toString().

Referenced by getMostPreciseLocalHostName().

const string Ceylan::Network::getMostPreciseLocalHostName (  ) 

Returns most precise available local host name.

Tries to gather most useful information about host name, including FQDN.

If the FQDN does not teach anything (ex: 'localhost.localdomain'), the local host name will be returned, and the domain name, if relevant, will be appended to it, after a dot (hence may return 'rainbow', or 'rainbow.esperide.com' for example).

Note:
Reverse name look-up thanks to IP address could be performed too.

Definition at line 909 of file CeylanNetwork.cc.

References Ceylan::countChars(), dataUtils::e, Ceylan::System::explainError(), generalUtils::false, getFQDNFromHostname(), getLocalHostDomainName(), getLocalHostName(), Ceylan::Exception::toString(), and generalUtils::true.

Referenced by Ceylan::Log::ObjectIdentifier::ObjectIdentifier().

SocketError Ceylan::Network::getSocketError (  ) 
string Ceylan::Network::interpretSocketError ( SocketError  errorCode  ) 

Returns a string describing the error associated with the specified error code.

Parameters:
errorCode the socket error that should be translated.

Definition at line 1129 of file CeylanNetwork.cc.

References Ceylan::toString().

Referenced by explainSocketError().

bool Ceylan::Network::isAValidHostName ( const std::string &  hostnameString  ) 

Returns whether specified string is a valid host name.

Note:
Always returns true if no regular expression feature is available.
See also:
Ceylan::Features::RegularExpressions

Definition at line 1099 of file CeylanNetwork.cc.

References Ceylan::RegExp::matches(), and generalUtils::true.

Referenced by Ceylan::Log::ObjectIdentifier::generateFromChannelName().

void Ceylan::Network::setLocalHostDomainName ( const std::string &  newHostName  ) 

Sets local host's domain name.

Definition at line 888 of file CeylanNetwork.cc.

References Ceylan::System::explainError().

void Ceylan::Network::setLocalHostName ( const std::string &  newHostName  ) 

Sets local host's name.

Note:
The user needs to have special permissions to change the host name.
Exceptions:
NetworkException if the renaming failed, including if the operation is not supported on the running platform.

Definition at line 819 of file CeylanNetwork.cc.

References Ceylan::System::explainError().

Generated on Mon Nov 29 13:41:39 2010 for Ceylan by  doxygen 1.6.3