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
IpcPlugin Class Reference

IPC Plugin. More...

#include <IpcPlugin.h>

Inheritance diagram for IpcPlugin:
Inheritance graph
[legend]
Collaboration diagram for IpcPlugin:
Collaboration graph
[legend]

Public Member Functions

 IpcPlugin (std::shared_ptr< rt_dobby_schema > &containerConfig, const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &rootfsPath)
 Constructor - called when plugin is loaded by PluginLauncher. More...
 
std::string name () const override
 Should return the name of the plugin. More...
 
unsigned hookHints () const override
 Set the bit flags for which hooks we're going to use. More...
 
bool postInstallation () override
 OCI Hook - Run in host namespace.
 
std::vector< std::string > getDependencies () const override
 Should return the names of the plugins this plugin depends on. More...
 
- Public Member Functions inherited from RdkPluginBase
virtual bool preCreation ()
 
virtual bool createRuntime ()
 
virtual bool createContainer ()
 
virtual bool postStart ()
 
virtual bool postHalt ()
 
virtual bool postStop ()
 

Private Member Functions

bool addSocketAndEnv (const std::shared_ptr< DobbyRdkPluginUtils > utils, const std::string &rootfsPath, std::shared_ptr< rt_dobby_schema > containerConfig, std::string busStr, const std::string &socketPath, const std::string &envVar) const
 Adds the bind mount of the socket. More...
 
std::string socketPathFromAddressSimple (const std::string &address) const
 Utility function to extract the socket path from the dbus address string. More...
 

Private Attributes

const std::string mName
 
std::shared_ptr< rt_dobby_schema > mContainerConfig
 
const std::string mRootfsPath
 
const std::shared_ptr< DobbyRdkPluginUtilsmUtils
 
const std::string mDbusRunDir
 
const std::string mDbusSystemSocketPath
 
const std::string mDbusSessionSocketPath
 
const std::string mDbusDebugSocketPath
 
const std::string mDbusSystemEnvVar
 
const std::string mDbusSessionEnvVar
 
const std::string mDbusDebugEnvVar
 

Additional Inherited Members

- Public Types inherited from IDobbyRdkPlugin
enum  HintFlags : unsigned {
  PostInstallationFlag = (1 << 0) , PreCreationFlag = (1 << 1) , CreateRuntimeFlag = (1 << 2) , CreateContainerFlag = (1 << 3) ,
  PostStartFlag = (1 << 5) , PostHaltFlag = (1 << 6) , PostStopFlag = (1 << 7) , Unknown = 0
}
 Bit flags that should be returned by hookHints. More...
 

Detailed Description

IPC Plugin.

Gives access to dbus inside container

Constructor & Destructor Documentation

◆ IpcPlugin()

IpcPlugin::IpcPlugin ( std::shared_ptr< rt_dobby_schema > &  containerConfig,
const std::shared_ptr< DobbyRdkPluginUtils > &  utils,
const std::string &  rootfsPath 
)

Constructor - called when plugin is loaded by PluginLauncher.

Do not change the parameters for this constructor - must match C methods created by REGISTER_RDK_PLUGIN macro

Note plugin name is not case sensitive

Member Function Documentation

◆ addSocketAndEnv()

bool IpcPlugin::addSocketAndEnv ( const std::shared_ptr< DobbyRdkPluginUtils utils,
const std::string &  rootfsPath,
std::shared_ptr< rt_dobby_schema >  containerConfig,
std::string  busStr,
const std::string &  socketPath,
const std::string &  envVar 
) const
private

Adds the bind mount of the socket.

This also creates the mount point and sets the environment variables for the dbus code running inside the container.

◆ getDependencies()

std::vector< std::string > IpcPlugin::getDependencies ( ) const
overridevirtual

Should return the names of the plugins this plugin depends on.

This can be used to determine the order in which the plugins should be processed when running hooks.

Returns
Names of the plugins this plugin depends on.

Reimplemented from RdkPluginBase.

◆ hookHints()

unsigned IpcPlugin::hookHints ( ) const
overridevirtual

Set the bit flags for which hooks we're going to use.

This plugin uses all the hooks so set all the flags

Implements IDobbyRdkPlugin.

◆ name()

std::string IpcPlugin::name ( ) const
inlineoverridevirtual

Should return the name of the plugin.

Returns
string with the name of the hook.

Implements IDobbyRdkPlugin.

◆ socketPathFromAddressSimple()

std::string IpcPlugin::socketPathFromAddressSimple ( const std::string &  address) const
private

Utility function to extract the socket path from the dbus address string.

This uses basic string operations

Parameters
[in]addressThe dbus address trying to parse
Returns
on success the path to the dbus socket, on failure an empty string.

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