DDS  ver. 3.5.3.8.g5fe284b
Classes | Typedefs | Functions
MiscCommon::INet Namespace Reference

INet declares helpers for Socket and Network operations. More...

Classes

struct  _socket2string
 A template class, which makes a string representation of the socket. More...
 
class  CSocketClient
 CSocketClient implements a simple socket client. More...
 
class  CSocketServer
 CSocketServer implements a simple socket server. More...
 
class  smart_socket
 A wrapper for a basic Socket. More...
 
struct  SSocket2String_Trait
 A Trait class for _socket2string template. This class operates on a local side of the socket. More...
 
struct  SSocketPeer2String_Trait
 A Trait class for _socket2string template. This class operates a peer of the socket. More...
 

Typedefs

typedef int Socket_t
 A basic socket type. More...
 
typedef _socket2string< SSocket2String_Traitsocket2string
 Socket to string representation. More...
 
typedef _socket2string< SSocketPeer2String_Traitpeer2string
 Socket-peer to string representation. More...
 

Functions

std::string socket_error_string (Socket_t _socket, const char *_strMsg)
 The function returns socket's error string. More...
 
size_t read_from_socket (smart_socket &_Socket, BYTEVector_t *_Buf)
 
template<typename _T >
smart_socketoperator>> (smart_socket &_Socket, _T *_Buf)
 This is a stream operator which helps to receive data from the given socket. More...
 
template<>
smart_socketoperator>> (smart_socket &_Socket, BYTEVector_t *_Buf)
 This is a stream operator which helps to receive data from the given socket. More...
 
int sendall (int s, const unsigned char *const buf, int len, int flags)
 A helper function, which insures that whole buffer was send. More...
 
template<typename _T >
smart_socketoperator<< (smart_socket &_Socket, _T &_Buf)
 This is a stream operator which helps to send data to the given socket. More...
 
template<>
smart_socketoperator<< (smart_socket &_Socket, BYTEVector_t &_Buf)
 This is a stream operator which helps to send data to the given socket. More...
 
void send_string (smart_socket &_Socket, const std::string &_Str2Send)
 A helper function, which sends a string to the given socket. More...
 
void receive_string (smart_socket &_Socket, std::string *_Str2Receive, size_t _BufSize)
 A helper function, which receives a string from the given socket. More...
 
bool is_ip_address (std::string _Addr)
 This function checks whether _Addr is an IP address or not. More...
 
void host2ip (const std::string &_Host, std::string *_IP)
 host2ip converts a given host name to IP address. More...
 
void ip2host (const std::string &_IP, std::string *_Host)
 ip2host converts a given IP address to host name. More...
 
int get_free_port (int _Min, int _Max)
 The function checks and returns a free port from the given range of the ports. More...
 
int get_free_port (int _Port)
 The function checks whether the given port is free or not. More...
 
uint64_t htonll (uint64_t val)
 
uint64_t ntohll (uint64_t val)
 
template<typename T >
normalizeRead (T _value)
 
template<>
uint16_t normalizeRead< uint16_t > (uint16_t _value)
 
template<>
uint32_t normalizeRead< uint32_t > (uint32_t _value)
 
template<>
uint64_t normalizeRead< uint64_t > (uint64_t _value)
 
template<typename T >
normalizeWrite (T _value)
 
template<>
uint16_t normalizeWrite< uint16_t > (uint16_t _value)
 
template<>
uint32_t normalizeWrite< uint32_t > (uint32_t _value)
 
template<>
uint64_t normalizeWrite< uint64_t > (uint64_t _value)
 
void writeall (int _handle, const std::string &_msg)
 A helper function, which insures that whole buffer was written. More...
 

Detailed Description

INet declares helpers for Socket and Network operations.

Typedef Documentation

◆ peer2string

Socket-peer to string representation.

◆ socket2string

Socket to string representation.

◆ Socket_t

A basic socket type.

Function Documentation

◆ get_free_port() [1/2]

int MiscCommon::INet::get_free_port ( int  _Min,
int  _Max 
)
inline

The function checks and returns a free port from the given range of the ports.

◆ get_free_port() [2/2]

int MiscCommon::INet::get_free_port ( int  _Port)
inline

The function checks whether the given port is free or not.

◆ host2ip()

void MiscCommon::INet::host2ip ( const std::string &  _Host,
std::string *  _IP 
)
inline

host2ip converts a given host name to IP address.

◆ htonll()

uint64_t MiscCommon::INet::htonll ( uint64_t  val)
inline

◆ ip2host()

void MiscCommon::INet::ip2host ( const std::string &  _IP,
std::string *  _Host 
)
inline

ip2host converts a given IP address to host name.

◆ is_ip_address()

bool MiscCommon::INet::is_ip_address ( std::string  _Addr)
inline

This function checks whether _Addr is an IP address or not.

◆ normalizeRead()

template<typename T >
T MiscCommon::INet::normalizeRead ( _value)

◆ normalizeRead< uint16_t >()

template<>
uint16_t MiscCommon::INet::normalizeRead< uint16_t > ( uint16_t  _value)
inline

◆ normalizeRead< uint32_t >()

template<>
uint32_t MiscCommon::INet::normalizeRead< uint32_t > ( uint32_t  _value)
inline

◆ normalizeRead< uint64_t >()

template<>
uint64_t MiscCommon::INet::normalizeRead< uint64_t > ( uint64_t  _value)
inline

◆ normalizeWrite()

template<typename T >
T MiscCommon::INet::normalizeWrite ( _value)

◆ normalizeWrite< uint16_t >()

template<>
uint16_t MiscCommon::INet::normalizeWrite< uint16_t > ( uint16_t  _value)
inline

◆ normalizeWrite< uint32_t >()

template<>
uint32_t MiscCommon::INet::normalizeWrite< uint32_t > ( uint32_t  _value)
inline

◆ normalizeWrite< uint64_t >()

template<>
uint64_t MiscCommon::INet::normalizeWrite< uint64_t > ( uint64_t  _value)
inline

◆ ntohll()

uint64_t MiscCommon::INet::ntohll ( uint64_t  val)
inline

◆ operator<<() [1/2]

template<typename _T >
smart_socket& MiscCommon::INet::operator<< ( smart_socket _Socket,
_T _Buf 
)

This is a stream operator which helps to send data to the given socket.

Generic declaration (no implementation).

◆ operator<<() [2/2]

template<>
smart_socket& MiscCommon::INet::operator<< ( smart_socket _Socket,
BYTEVector_t _Buf 
)
inline

This is a stream operator which helps to send data to the given socket.

A template specialization for BYTEVector_t type.

◆ operator>>() [1/2]

template<typename _T >
smart_socket& MiscCommon::INet::operator>> ( smart_socket _Socket,
_T _Buf 
)

This is a stream operator which helps to receive data from the given socket.

Generic declaration (no implementation).

◆ operator>>() [2/2]

template<>
smart_socket& MiscCommon::INet::operator>> ( smart_socket _Socket,
BYTEVector_t _Buf 
)
inline

This is a stream operator which helps to receive data from the given socket.

A template specialization for BYTEVector_t type.

◆ read_from_socket()

size_t MiscCommon::INet::read_from_socket ( smart_socket _Socket,
BYTEVector_t _Buf 
)
inline

◆ receive_string()

void MiscCommon::INet::receive_string ( smart_socket _Socket,
std::string *  _Str2Receive,
size_t  _BufSize 
)
inline

A helper function, which receives a string from the given socket.

◆ send_string()

void MiscCommon::INet::send_string ( smart_socket _Socket,
const std::string &  _Str2Send 
)
inline

A helper function, which sends a string to the given socket.

◆ sendall()

int MiscCommon::INet::sendall ( int  s,
const unsigned char *const  buf,
int  len,
int  flags 
)
inline

A helper function, which insures that whole buffer was send.

◆ socket_error_string()

std::string MiscCommon::INet::socket_error_string ( Socket_t  _socket,
const char *  _strMsg 
)
inline

The function returns socket's error string.

◆ writeall()

void MiscCommon::INet::writeall ( int  _handle,
const std::string &  _msg 
)
inline

A helper function, which insures that whole buffer was written.