$darkmode
vtd::RdbTransceiverShm Class Reference

#include <rdb_transceiver_shm.hpp>

Inheritance diagram for vtd::RdbTransceiverShm:
Collaboration diagram for vtd::RdbTransceiverShm:

Public Member Functions

 RdbTransceiverShm (key_t key, uint32_t release_mask)
 
bool has () const override
 
std::vector< std::shared_ptr< RDB_MSG_t > > receive () override
 
void send (const RDB_MSG_t *, size_t) override
 
void to_json (cloe::Json &j) const override
 

Protected Attributes

uint32_t release_mask_
 VTD uses this mask to notify client when data in buffer is ready.
 
boost::interprocess::mapped_region region_
 Shared memory region.
 
RDB_SHM_HDR_t * rdb_shm_hdr_ {nullptr}
 Pointer to the shared memory management header.
 
RDB_SHM_BUFFER_INFO_t ** buffer_info_ {nullptr}
 Array of pointers to buffer information.
 
RDB_MSG_t ** rdb_msg_ {nullptr}
 Array of pointers to rdb messages.
 
uint64_t num_errors_ {0}
 
uint64_t num_messages_ {0}
 

Friends

void to_json (cloe::Json &j, const RdbTransceiverShm &t)
 

Detailed Description

This class implements an RDB client via shared memory.

WARNING:

This class is primarily a proof-of-concept. Currently, it is not used and there is no guarantee that it actually works as advertised.

Even if it works, under the hood manual memory-management is used, which means that until it is audited, it may leak memory or worse (ironic, I know).

Constructor & Destructor Documentation

◆ RdbTransceiverShm()

vtd::RdbTransceiverShm::RdbTransceiverShm ( key_t  key,
uint32_t  release_mask 
)

Connect to VTD memory to create a new RDB communication.

If a "connection" cannot be achieved, C-strings are thrown.

Parameters
keyto obtain shared memory id
release_maskmask used by VTD to mask a shared memory region as accessible

Member Function Documentation

◆ has()

bool vtd::RdbTransceiverShm::has ( ) const
inlineoverridevirtual

Returns true when the transceiver has a message that can be received.

That is, if true, then a call to receive() will return a vector that is not empty.

Implements vtd::RdbTransceiver.

◆ receive()

std::vector< std::shared_ptr< RDB_MSG_t > > vtd::RdbTransceiverShm::receive ( )
overridevirtual

Non-blocking function to return all received RDB messages.

Implements vtd::RdbTransceiver.

◆ send()

void vtd::RdbTransceiverShm::send ( const RDB_MSG_t *  msg,
size_t  size 
)
inlineoverridevirtual

Sends the RDB message with the given size.

Parameters
msgRDB message
sizenumber of bytes

Implements vtd::RdbTransceiver.


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