Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DobbyLogRelay Class Reference
Inheritance diagram for DobbyLogRelay:
Inheritance graph
[legend]
Collaboration diagram for DobbyLogRelay:
Collaboration graph
[legend]

Public Member Functions

 DobbyLogRelay (const std::string &sourceSocketPath, const std::string &destinationSocketPath)
 Create relay between two UNIX datagram sockets. More...
 
void process (const std::shared_ptr< AICommon::IPollLoop > &pollLoop, epoll_event event) override
 Called on the poll loop. Forwards the data from the source to the destination socket. More...
 
void addToPollLoop (const std::shared_ptr< AICommon::IPollLoop > &pollLoop)
 Adds the log relay to a given poll loop so that the process() method is called when the source socket receives data. More...
 
void removeFromPollLoop (const std::shared_ptr< AICommon::IPollLoop > &pollLoop)
 Removes the log relay to a given poll loop. More...
 

Private Member Functions

int createDgramSocket (const std::string &path)
 Create a SOCK_DGRAM AF_UNIX socket at the given path. Removes the socket at the given path if it exists. More...
 

Private Attributes

const std::string mSourceSocketPath
 
const std::string mDestinationSocketPath
 
int mSourceSocketFd
 
int mDestinationSocketFd
 
sockaddr_un mDestinationSocketAddress
 
char mBuf [BUFFER_SIZE]
 
std::mutex mLock
 

Constructor & Destructor Documentation

◆ DobbyLogRelay()

DobbyLogRelay::DobbyLogRelay ( const std::string &  sourceSocketPath,
const std::string &  destinationSocketPath 
)

Create relay between two UNIX datagram sockets.

All messages sent to the source socket are forwarded to the destination socket. Used to relay messages to the host syslog/journald and ensure the messages are tagged with the dobby daemon PID for the RDK log collection scripts

Member Function Documentation

◆ addToPollLoop()

void DobbyLogRelay::addToPollLoop ( const std::shared_ptr< AICommon::IPollLoop > &  pollLoop)

Adds the log relay to a given poll loop so that the process() method is called when the source socket receives data.

Parameters
[in]pollLoopThe poll loop to add ourselves to

◆ createDgramSocket()

int DobbyLogRelay::createDgramSocket ( const std::string &  path)
private

Create a SOCK_DGRAM AF_UNIX socket at the given path. Removes the socket at the given path if it exists.

Parameters
[in]pathThe path the socket should be created at

◆ process()

void DobbyLogRelay::process ( const std::shared_ptr< AICommon::IPollLoop > &  pollLoop,
epoll_event  event 
)
overridevirtual

Called on the poll loop. Forwards the data from the source to the destination socket.

Parameters
[in]pollLoopThe pollLoop instance that the process method was called from
[in]eventsThe epoll event that occured

Implements AICommon::IPollSource.

◆ removeFromPollLoop()

void DobbyLogRelay::removeFromPollLoop ( const std::shared_ptr< AICommon::IPollLoop > &  pollLoop)

Removes the log relay to a given poll loop.

Parameters
[in]pollLoopThe poll loop to add ourselves to

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