DDS  ver. 3.6
Classes | Namespaces | Macros | Typedefs | Functions
INet.h File Reference
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <algorithm>
#include <iterator>
#include <stdexcept>
#include <unistd.h>
#include "ErrorCode.h"
#include "MiscUtils.h"
#include "def.h"
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>

Go to the source code of this file.

Classes

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

Namespaces

 dds
 Miscellaneous functions and helpers are located here.
 
 dds::misc
 
 dds::misc::INet
 INet declares helpers for Socket and Network operations.
 

Macros

#define INVALID_SOCKET   -1
 this macro indicates an invalid status of the socket More...
 

Typedefs

typedef int dds::misc::INet::Socket_t
 A basic socket type. More...
 
typedef _socket2string< SSocket2String_Trait > dds::misc::INet::socket2string
 Socket to string representation. More...
 
typedef _socket2string< SSocketPeer2String_Trait > dds::misc::INet::peer2string
 Socket-peer to string representation. More...
 

Functions

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

Macro Definition Documentation

◆ INVALID_SOCKET

#define INVALID_SOCKET   -1

this macro indicates an invalid status of the socket