class SocketAddr

A socket address holder. More...

Full nameTelEngine::SocketAddr
Definition#include <yateclass.h>
InheritsTelEngine::GenObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Protected Methods

Protected Members


Detailed Description

Wrapper class to keep a socket address

inline  SocketAddr ()

SocketAddr

Default constructor of an empty address

inline  SocketAddr (const SocketAddr& value)

SocketAddr

Copy constructor

Parameters:
valueAddress to copy

 SocketAddr (int family)

SocketAddr

Constructor of a null address

Parameters:
familyFamily of the address to create

 SocketAddr (const struct sockaddr* addr, socklen_t len = 0)

SocketAddr

Constructor that stores a copy of an address

Parameters:
addrPointer to the address to store
lenLength of the stored address, zero to use default

 ~SocketAddr ()

~SocketAddr

[virtual]

Destructor that frees and zeroes out everything

inline SocketAddr&  operator= (const SocketAddr& value)

operator=

Assignment operator

Parameters:
valueAddress to copy

bool  operator== (const SocketAddr& other)

operator==

[const]

Equality comparation operator

Parameters:
otherAddress to compare to

Returns: True if the addresses are equal

inline bool  operator!= (const SocketAddr& other)

operator!=

[const]

Inequality comparation operator

Parameters:
otherAddress to compare to

Returns: True if the addresses are different

void  clear ()

clear

Clears up the address, frees the memory

bool  assign (int family)

assign

Assigns an empty address of a specific type

Parameters:
familyFamily of the address to create

Returns: True if the address family is supported

void  assign (const struct sockaddr* addr, socklen_t len = 0)

assign

Assigns a new address

Parameters:
addrPointer to the address to store
lenLength of the stored address, zero to use default

bool  local (const SocketAddr& remote)

local

Attempt to guess a local address that will be used to reach a remote one

Parameters:
remoteRemote address to reach

Returns: True if guessed an address, false if failed

inline bool  valid ()

valid

[const]

Check if a non-null address is held

Returns: True if a valid address is held, false if null

inline bool  null ()

null

[const]

Check if a null address is held

Returns: True if a null address is held

inline int  family ()

family

[const]

Get the family of the stored address

Returns: Address family of the stored address or zero (AF_UNSPEC)

inline const String&  host ()

host

[const]

Get the host of this address

Returns: Host name as String

bool  host (const String& name)

host

[virtual]

Set the hostname of this address

Returns: True if new host set, false if name could not be parsed

int  port ()

port

[const]

Get the port of the stored address (if supported)

Returns: Port number of the socket address or zero

bool  port (int newport)

port

Set the port of the stored address (if supported)

Parameters:
newportPort number to set in the socket address

Returns: True if new port set, false if not supported

inline struct sockaddr*  address ()

address

[const]

Get the contained socket address

Returns: A pointer to the socket address

inline socklen_t  length ()

length

[const]

Get the length of the address

Returns: Length of the stored address

bool  supports (int family)

supports

[static]

Check if an address family is supported by the library

Parameters:
familyFamily of the address to check

Returns: True if the address family is supported

void  stringify ()

stringify

[protected virtual]

Convert the host address to a String stored in m_host

struct sockaddr* m_address

m_address

[protected]

socklen_t m_length

m_length

[protected]

String m_host

m_host

[protected]


Generated by: root on dragoshel on Sat Apr 14 01:50:50 2007, using kdoc 2.0a54.