Sockets

Sockets currently wrap System Sockets.

Interface Classes

Interface Server

class SecSocket_Server

Subclassed by Zostera::LinSecSocket_Server

Public Functions

virtual int send(std::string&, int) = 0

Send the given information over the TCP connection with the given socket number.

Parameters
  • message: std::string Message

  • socket: int socket number

virtual int send(std::tuple<char *, size_t>, int) = 0

Send the given information over the TCP connection with the given socket number.

Parameters
  • message: std::tuple<char*, size_t> Message

  • socket: int socket number

virtual int send(std::shared_ptr<char>, size_t, int) = 0

Send the given bytes to the Sever depending if there is and cryptosys placed also encrypted.

Parameters
  • message: std::tuple<std::shared_ptr<char>, size_T> smart char pointer and the length of the message.

virtual std::string receiveString(int) = 0

Receives Information from the TCP connection.

Parameters
  • socket: int socket number

virtual std::tuple<char *, size_t> receiveRawByte(int) = 0

Receives Information from the TCP connection.

Parameters
  • socket: int socket number

virtual std::tuple<std::shared_ptr<char>, size_t> receiveByte(int) = 0

Receives Information from the TCP connection.

Parameters
  • socket: int socket number

virtual std::tuple<int, int, std::string> listen_and_accept() = 0

Will listen for incoming connections.

virtual int bind(std::string&, unsigned short) = 0

Will try to bind this socket to the given host and port.

Parameters
  • host: std::string

  • port: unsigned short

virtual void placeEncryptionSys(std::shared_ptr<Zostera::CCryptoSys>) = 0

Places the CCryptoSys which will be used for encryption and decryption of incoming data.

Parameters
  • ptr: CCryptoSys* pointer to an already configured CryptoSys

virtual void close(int socket) = 0

Closes given socket.

Parameters
  • socket: Socket that should be closed.

virtual bool checkValidity(int socket) = 0

Checks for validity of connection.

Parameters
  • socket: Given socket that should bechecked

Interface Client

class SocketClientInterface

Subclassed by Zostera::LinSecSocket_Client

Public Functions

virtual int send(std::string&) = 0

Send the given String to the Server depending if there is and cryptosys placed also encrypted.

Parameters
  • message: std::string the given string that should be send.

virtual int send(std::tuple<char *, size_t>) = 0

Send the given bytes to the Sever depending if there is and cryptosys placed also encrypted.

Parameters
  • message: std::tuple<char*, size_T> char pointer and the length of the message.

virtual int send(std::shared_ptr<char>, size_t) = 0

Send the given bytes to the Sever depending if there is and cryptosys placed also encrypted.

Parameters
  • message: std::tuple<std::shared_ptr<char>, size_T> smart char pointer and the length of the message.

virtual std::string receiveString() = 0

Receives Information.

virtual std::tuple<char *, size_t> receiveRawByte() = 0

Receives Information.

virtual std::tuple<std::shared_ptr<char>, size_t> receiveByte() = 0

Receives Information.

virtual int connect(std::string&, unsigned short) = 0

Will try to connect to a other listening socket.

Parameters
  • host: std::string

  • port: unsigned short

virtual void placeEncryptionSys(std::shared_ptr<Zostera::CCryptoSys>) = 0

Places the CCryptoSys which will be used for encryption and decryption of incoming data.

Parameters
  • ptr: CCryptoSys* pointer to an already configured CryptoSys

virtual void close() = 0

Closes Connection.

virtual bool checkValidity() = 0

Checks for validity of connection.

Inherited Classes

Linux Server

class LinSecSocket_Server : private Zostera::SecSocket_Server

Linux Client

class LinSecSocket_Client : private Zostera::SocketClientInterface