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 (const Socket &)=delete
 
 Socket (Socket &&)=default
 
 Socket (std::string iface_name)
 

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

◆ Socket() [1/3]

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

Definition at line 66 of file socket.h.

◆ Socket() [2/3]

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

◆ Socket() [3/3]

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

Member Function Documentation

◆ bind()

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.

◆ enableBroadcast()

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

Enables broadcast for this socket.

Definition at line 106 of file socket.h.

◆ enableNonBlocking()

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

Enables non-blocking operation for this socket.

Definition at line 114 of file socket.h.

◆ getDerived() [1/2]

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

Definition at line 55 of file socket.h.

◆ getDerived() [2/2]

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

Definition at line 60 of file socket.h.

◆ getHandle()

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.

◆ getIfaceName()

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

Returns the interface name.

Definition at line 122 of file socket.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

template<typename Derived >
Socket& rcdiscover::Socket< Derived >::operator= ( Socket< Derived > &&  )
default

◆ send()

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

◆ iface_name_

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 Thu Aug 1 2024 02:55:56