Public Member Functions | Private Member Functions | Private Attributes | List of all members
rcdiscover::Socket< Derived > Class Template Reference

CRTP class for platform specific socket implementation. More...

#include <socket.h>

Public Member Functions

void bind (const sockaddr_in &addr)
 Binds the socket to an interface. More...
 
void enableBroadcast ()
 Enables broadcast for this socket. More...
 
void enableNonBlocking ()
 Enables non-blocking operation for this socket. More...
 
template<typename T >
const T & getHandle () const
 Returns the native socket handle. More...
 
const std::string & getIfaceName () const
 Returns the interface name. More...
 
Socketoperator= (const Socket &)=delete
 
Socketoperator= (Socket &&)=default
 
void send (const std::vector< uint8_t > &sendbuf)
 Sends data. More...
 
 Socket (std::string iface_name)
 
 Socket (const Socket &)=delete
 
 Socket (Socket &&)=default
 

Private Member Functions

Derived & getDerived ()
 
const Derived & getDerived () const
 

Private Attributes

std::string iface_name_
 

Detailed Description

template<typename Derived>
class rcdiscover::Socket< Derived >

CRTP class for platform specific socket implementation.

Definition at line 52 of file socket.h.

Constructor & Destructor Documentation

template<typename Derived>
rcdiscover::Socket< Derived >::Socket ( std::string  iface_name)
inlineexplicit

Definition at line 66 of file socket.h.

template<typename Derived>
rcdiscover::Socket< Derived >::Socket ( const Socket< Derived > &  )
delete
template<typename Derived>
rcdiscover::Socket< Derived >::Socket ( Socket< Derived > &&  )
default

Member Function Documentation

template<typename Derived>
void rcdiscover::Socket< Derived >::bind ( const sockaddr_in &  addr)
inline

Binds the socket to an interface.

Parameters
addrsockaddr_in specifying the interface

Definition at line 89 of file socket.h.

template<typename Derived>
void rcdiscover::Socket< Derived >::enableBroadcast ( )
inline

Enables broadcast for this socket.

Definition at line 106 of file socket.h.

template<typename Derived>
void rcdiscover::Socket< Derived >::enableNonBlocking ( )
inline

Enables non-blocking operation for this socket.

Definition at line 114 of file socket.h.

template<typename Derived>
Derived& rcdiscover::Socket< Derived >::getDerived ( )
inlineprivate

Definition at line 55 of file socket.h.

template<typename Derived>
const Derived& rcdiscover::Socket< Derived >::getDerived ( ) const
inlineprivate

Definition at line 60 of file socket.h.

template<typename Derived>
template<typename T >
const T& rcdiscover::Socket< Derived >::getHandle ( ) const
inline

Returns the native socket handle.

Returns
native socket handle

Definition at line 80 of file socket.h.

template<typename Derived>
const std::string& rcdiscover::Socket< Derived >::getIfaceName ( ) const
inline

Returns the interface name.

Definition at line 122 of file socket.h.

template<typename Derived>
Socket& rcdiscover::Socket< Derived >::operator= ( const Socket< Derived > &  )
delete
template<typename Derived>
Socket& rcdiscover::Socket< Derived >::operator= ( Socket< Derived > &&  )
default
template<typename Derived>
void rcdiscover::Socket< Derived >::send ( const std::vector< uint8_t > &  sendbuf)
inline

Sends data.

Parameters
sendbufdata to send

Definition at line 98 of file socket.h.

Member Data Documentation

template<typename Derived>
std::string rcdiscover::Socket< Derived >::iface_name_
private

Definition at line 128 of file socket.h.


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


rcdiscover
Author(s): Heiko Hirschmueller , Raphael Schaller
autogenerated on Sun Apr 18 2021 02:16:32