#include <yateclass.h>
Inheritance diagram for SocketAddr:
Public Member Functions | |
SocketAddr () | |
SocketAddr (const SocketAddr &value) | |
SocketAddr (int family) | |
SocketAddr (const struct sockaddr *addr, socklen_t len=0) | |
virtual | ~SocketAddr () |
SocketAddr & | operator= (const SocketAddr &value) |
bool | operator== (const SocketAddr &other) const |
bool | operator!= (const SocketAddr &other) const |
void | clear () |
bool | assign (int family) |
void | assign (const struct sockaddr *addr, socklen_t len=0) |
bool | local (const SocketAddr &remote) |
bool | valid () const |
bool | null () const |
int | family () const |
const String & | host () const |
virtual bool | host (const String &name) |
int | port () const |
bool | port (int newport) |
sockaddr * | address () const |
socklen_t | length () const |
Static Public Member Functions | |
static bool | supports (int family) |
Protected Member Functions | |
virtual void | stringify () |
Protected Attributes | |
sockaddr * | m_address |
socklen_t | m_length |
String | m_host |
Wrapper class to keep a socket address
SocketAddr | ( | ) | [inline] |
Default constructor of an empty address
SocketAddr | ( | const SocketAddr & | value | ) | [inline] |
Copy constructor
value | Address to copy |
SocketAddr | ( | int | family | ) |
Constructor of a null address
family | Family of the address to create |
SocketAddr | ( | const struct sockaddr * | addr, | |
socklen_t | len = 0 | |||
) |
Constructor that stores a copy of an address
addr | Pointer to the address to store | |
len | Length of the stored address, zero to use default |
virtual ~SocketAddr | ( | ) | [virtual] |
Destructor that frees and zeroes out everything
SocketAddr& operator= | ( | const SocketAddr & | value | ) | [inline] |
Assignment operator
value | Address to copy |
bool operator== | ( | const SocketAddr & | other | ) | const |
Equality comparation operator
other | Address to compare to |
bool operator!= | ( | const SocketAddr & | other | ) | const [inline] |
Inequality comparation operator
other | Address to compare to |
void clear | ( | ) |
Clears up the address, frees the memory
bool assign | ( | int | family | ) |
Assigns an empty address of a specific type
family | Family of the address to create |
void assign | ( | const struct sockaddr * | addr, | |
socklen_t | len = 0 | |||
) |
Assigns a new address
addr | Pointer to the address to store | |
len | Length of the stored address, zero to use default |
bool local | ( | const SocketAddr & | remote | ) |
Attempt to guess a local address that will be used to reach a remote one
remote | Remote address to reach |
bool valid | ( | ) | const [inline] |
Check if a non-null address is held
bool null | ( | ) | const [inline] |
Check if a null address is held
int family | ( | ) | const [inline] |
Get the family of the stored address
virtual bool host | ( | const String & | name | ) | [virtual] |
Set the hostname of this address
int port | ( | ) | const |
Get the port of the stored address (if supported)
bool port | ( | int | newport | ) |
Set the port of the stored address (if supported)
newport | Port number to set in the socket address |
struct sockaddr* address | ( | ) | const [inline, read] |
Get the contained socket address
socklen_t length | ( | ) | const [inline] |
Get the length of the address
static bool supports | ( | int | family | ) | [static] |
Check if an address family is supported by the library
family | Family of the address to check |
virtual void stringify | ( | ) | [protected, virtual] |
Convert the host address to a String stored in m_host