join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicNetlinkEndpoint< Protocol > Class Template Reference

basic netlink endpoint class. More...

#include <endpoint.hpp>

Inheritance diagram for join::BasicNetlinkEndpoint< Protocol >:
Collaboration diagram for join::BasicNetlinkEndpoint< Protocol >:

Public Member Functions

constexpr BasicNetlinkEndpoint () noexcept
 default constructor.
 
 BasicNetlinkEndpoint (const struct sockaddr *addr, socklen_t len) noexcept
 create instance using socket address.
 
 BasicNetlinkEndpoint (const Protocol &protocol, uint32_t pid, uint32_t groups) noexcept
 create instance using netlink groups.
 
 BasicNetlinkEndpoint (uint32_t pid, uint32_t groups) noexcept
 create instance using netlink groups.
 
 BasicNetlinkEndpoint (const Protocol &protocol, uint32_t groups) noexcept
 create instance using netlink groups.
 
 BasicNetlinkEndpoint (uint32_t groups) noexcept
 create instance using netlink groups.
 
Protocol protocol () const noexcept
 get endpoint protocol.
 
constexpr socklen_t length () const noexcept
 get socket address length.
 
void pid (uint32_t pid) noexcept
 set process id.
 
uint32_t pid () const noexcept
 get process id.
 
void groups (uint32_t groups) noexcept
 set netlink groups.
 
uint32_t groups () const noexcept
 get netlink groups.
 
std::string device () const
 get device name (not applicable for netlink).
 
- Public Member Functions inherited from join::BasicEndpoint< Protocol >
constexpr BasicEndpoint () noexcept
 default constructor.
 
 BasicEndpoint (const struct sockaddr *addr, socklen_t len) noexcept
 create instance using socket address.
 
 BasicEndpoint (Side side, const std::string &name, uint64_t elementSize=1472, uint64_t capacity=144)
 create instance.
 
 BasicEndpoint (const BasicEndpoint &other)=delete
 copy constructor.
 
struct sockaddr * addr () noexcept
 get socket address.
 
const struct sockaddr * addr () const noexcept
 get socket address.
 
BasicEndpointoperator= (const BasicEndpoint &other)=delete
 copy assignment operator.
 
 ~BasicEndpoint ()
 destroy the instance.
 
int open ()
 open the channel endpoint.
 
void close ()
 close the channel endpoint.
 
bool opened () const
 check if the endpoint is open.
 
int trySend (const void *element)
 try to send a message to the peer (non blocking).
 
int send (const void *element)
 send a message to the peer (blocking).
 
int timedSend (const void *element, std::chrono::duration< Rep, Period > timeout)
 send a message to the peer with timeout (blocking).
 
int tryReceive (void *element)
 try to receive a message from the peer (non blocking).
 
int receive (void *element)
 receive a message from the peer (blocking).
 
int timedReceive (void *element, std::chrono::duration< Rep, Period > timeout)
 receive a message from the peer with timeout (blocking).
 
uint64_t available () const
 get number of available slots for sending.
 
bool full () const
 check if outbound queue is full.
 
uint64_t pending () const
 get number of pending messages.
 
bool empty () const
 check if inbound queue is empty.
 
Side side () const
 get the side this endpoint represents.
 
const std::string & name () const
 get the channel name.
 
uint64_t elementSize () const
 get the element size.
 
uint64_t capacity () const
 get the buffer capacity.
 

Protected Attributes

int _protocol
 netlink protocol type.
 
- Protected Attributes inherited from join::BasicEndpoint< Protocol >
struct sockaddr_storage _addr
 socket address storage.
 

Additional Inherited Members

- Public Types inherited from join::BasicEndpoint< Protocol >
enum  Side
 endpoint side identifier. More...
 
using Outbound
 
using Inbound
 

Detailed Description

template<class Protocol>
class join::BasicNetlinkEndpoint< Protocol >

basic netlink endpoint class.

Constructor & Destructor Documentation

◆ BasicNetlinkEndpoint() [1/6]

template<class Protocol >
join::BasicNetlinkEndpoint< Protocol >::BasicNetlinkEndpoint ( )
inlineconstexprnoexcept

default constructor.

◆ BasicNetlinkEndpoint() [2/6]

template<class Protocol >
join::BasicNetlinkEndpoint< Protocol >::BasicNetlinkEndpoint ( const struct sockaddr * addr,
socklen_t len )
inlinenoexcept

create instance using socket address.

Parameters
addrsocket address.
lensocket address length.

◆ BasicNetlinkEndpoint() [3/6]

template<class Protocol >
join::BasicNetlinkEndpoint< Protocol >::BasicNetlinkEndpoint ( const Protocol & protocol,
uint32_t pid,
uint32_t groups )
inlinenoexcept

create instance using netlink groups.

Parameters
protocolnetlink protocol.
pidprocess id.
groupsnetlink groups to set.

◆ BasicNetlinkEndpoint() [4/6]

template<class Protocol >
join::BasicNetlinkEndpoint< Protocol >::BasicNetlinkEndpoint ( uint32_t pid,
uint32_t groups )
inlinenoexcept

create instance using netlink groups.

Parameters
pidprocess id.
groupsnetlink groups to set.

◆ BasicNetlinkEndpoint() [5/6]

template<class Protocol >
join::BasicNetlinkEndpoint< Protocol >::BasicNetlinkEndpoint ( const Protocol & protocol,
uint32_t groups )
inlinenoexcept

create instance using netlink groups.

Parameters
protocolnetlink protocol.
groupsnetlink groups to set.

◆ BasicNetlinkEndpoint() [6/6]

template<class Protocol >
join::BasicNetlinkEndpoint< Protocol >::BasicNetlinkEndpoint ( uint32_t groups)
inlinenoexcept

create instance using netlink groups.

Parameters
groupsnetlink groups to set.

Member Function Documentation

◆ device()

template<class Protocol >
std::string join::BasicNetlinkEndpoint< Protocol >::device ( ) const
inline

get device name (not applicable for netlink).

Returns
empty string.

◆ groups() [1/2]

template<class Protocol >
uint32_t join::BasicNetlinkEndpoint< Protocol >::groups ( ) const
inlinenoexcept

get netlink groups.

Returns
netlink groups bitmask.

◆ groups() [2/2]

template<class Protocol >
void join::BasicNetlinkEndpoint< Protocol >::groups ( uint32_t groups)
inlinenoexcept

set netlink groups.

Parameters
groupsnetlink groups bitmask.

◆ length()

template<class Protocol >
socklen_t join::BasicNetlinkEndpoint< Protocol >::length ( ) const
inlineconstexprnoexcept

get socket address length.

Returns
socket address length.

◆ pid() [1/2]

template<class Protocol >
uint32_t join::BasicNetlinkEndpoint< Protocol >::pid ( ) const
inlinenoexcept

get process id.

Returns
process id.

◆ pid() [2/2]

template<class Protocol >
void join::BasicNetlinkEndpoint< Protocol >::pid ( uint32_t pid)
inlinenoexcept

set process id.

Parameters
pidprocess id.

◆ protocol()

template<class Protocol >
Protocol join::BasicNetlinkEndpoint< Protocol >::protocol ( ) const
inlinenoexcept

get endpoint protocol.

Returns
endpoint protocol.

Member Data Documentation

◆ _protocol

template<class Protocol >
int join::BasicNetlinkEndpoint< Protocol >::_protocol
protected

netlink protocol type.


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