scim 1.4.18
scim::SocketAddress Class Reference

The class to hold a socket address. More...

#include <scim_socket.h>

Public Member Functions

 SocketAddress (const String &addr=String())
 Constructor.
 
 SocketAddress (const SocketAddress &addr)
 Copy constructor.
 
 ~SocketAddress ()
 Destructor.
 
const SocketAddressoperator= (const SocketAddress &addr)
 Copy operator.
 
bool valid () const
 Check if this address is valid.
 
SocketFamily get_family () const
 Get the family of this socket address.
 
bool set_address (const String &addr)
 Set a new address.
 
String get_address () const
 Get the address string.
 
const voidget_data () const
 Get the internal data of this socket address, used by class Socket.
 
int get_data_length () const
 Get the size of the internall data.
 

Detailed Description

The class to hold a socket address.

Class SocketAddress encapsulates the details of socket address, like socketaddr_un and socketaddr_in.

A SocketAddress object can be constructed from an address string, which must start with one of the following prefixes:

  • inet: or tcp: A internet address (ipv4). This kind of address must include two parts, separated by a colon. The first part is the ip address, the second part is the port. For example: inet:127.0.0.1:12345
  • local: or unix: or file: A unix or local socket address. It's a full path of a socket file. For example: local:/tmp/scim-socket-frontend

Constructor & Destructor Documentation

◆ SocketAddress() [1/2]

scim::SocketAddress::SocketAddress ( const String & addr = String())

Constructor.

Parameters
addrthe address string.

◆ SocketAddress() [2/2]

scim::SocketAddress::SocketAddress ( const SocketAddress & addr)

Copy constructor.

◆ ~SocketAddress()

scim::SocketAddress::~SocketAddress ( )

Destructor.

Member Function Documentation

◆ operator=()

const SocketAddress & scim::SocketAddress::operator= ( const SocketAddress & addr)

Copy operator.

◆ valid()

bool scim::SocketAddress::valid ( ) const

Check if this address is valid.

Returns
true if this address is valid.

◆ get_family()

SocketFamily scim::SocketAddress::get_family ( ) const

Get the family of this socket address.

Returns
the family enum value of this address.
See also
SocketFamily

◆ set_address()

bool scim::SocketAddress::set_address ( const String & addr)

Set a new address.

Parameters
addrthe new address string.

◆ get_address()

String scim::SocketAddress::get_address ( ) const

Get the address string.

Returns
the address string.

◆ get_data()

const void * scim::SocketAddress::get_data ( ) const

Get the internal data of this socket address, used by class Socket.

Returns
the pointer to the data, usually a sockaddr struct.

◆ get_data_length()

int scim::SocketAddress::get_data_length ( ) const

Get the size of the internall data.

Returns
the size of the internall data returned by get_data ();

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