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

Dobby Gamepad plugin. More...

#include <GamepadPlugin.h>

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

Public Member Functions

 GamepadPlugin (std::shared_ptr< rt_dobby_schema > &containerConfig, const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &rootfsPath)
 
std::string name () const override
 Should return the name of the plugin. More...
 
unsigned hookHints () const override
 Should return a bitfield of the hook points implemented by the plugin. More...
 
bool postInstallation () override
 Dobby Hook - run in host namespace once when container bundle is downloaded.
 
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

void addDevices (int64_t major, int64_t minor, int numDevices, const std::string &type, const std::string &mode) const
 Adds devices to containe_config->linux->resources->devices. More...
 
void addGidMapping (gid_t host_id, gid_t container_id) const
 Adds gid mapping to container_config->linux->gid_mappings. More...
 
void addAdditionalGid (gid_t gid) const
 Adds additionalGid to container_config->process->user->additional_gids. More...
 
gid_t getInputGroupId () const
 Finds input group id in /etc/group file. More...
 

Private Attributes

const std::string mName
 
std::shared_ptr< rt_dobby_schema > mContainerConfig
 
const std::shared_ptr< DobbyRdkPluginUtilsmUtils
 

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

Dobby Gamepad plugin.

Member Function Documentation

◆ addAdditionalGid()

void GamepadPlugin::addAdditionalGid ( gid_t  gid) const
private

Adds additionalGid to container_config->process->user->additional_gids.

Parameters
[in]gidgroup id to be added

◆ addDevices()

void GamepadPlugin::addDevices ( int64_t  major,
int64_t  minor,
int  numDevices,
const std::string &  type,
const std::string &  mode 
) const
private

Adds devices to containe_config->linux->resources->devices.

Multiple devices can be added. All devices will have major number equal to major param. Minor numbers are in range [minor .. minor + numDevices - 1].

Parameters
[in]majormajor number of the devices that will be added
[in]minorstarting minor number of the devices
[in]numDevicesnumber of devices that will be added
[in]typecharacter ("c") of block ("b")
[in]modeaccess mode

◆ addGidMapping()

void GamepadPlugin::addGidMapping ( gid_t  host_id,
gid_t  container_id 
) const
private

Adds gid mapping to container_config->linux->gid_mappings.

Parameters
[in]host_idhost group id to be added to the mapping
[in]container_idcontainer group id to be added to the mapping

◆ getDependencies()

std::vector< std::string > GamepadPlugin::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.

◆ getInputGroupId()

gid_t GamepadPlugin::getInputGroupId ( ) const
private

Finds input group id in /etc/group file.

Each line in /etc/group contains "group_name:password:group_id:group_list". Finds the line starting with 'input', then finds the group_id in that line.

Returns
input groups group id or -1 if group id is not found

◆ hookHints()

unsigned GamepadPlugin::hookHints ( ) const
overridevirtual

Should return a bitfield of the hook points implemented by the plugin.

Only bits that are set will be called as hooks. This is to optimise the implementation of the hook code to ensure we don't waste time trying to run hooks that don't do anything

The value returned should be constant for the lifetime of the class

Returns
bitmask of the HintFlags bits.

Implements IDobbyRdkPlugin.

◆ name()

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

Should return the name of the plugin.

Returns
string with the name of the hook.

Implements IDobbyRdkPlugin.


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