Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Dobby plugin for creating the necessary OCDM buffers. More...
#include <OpenCDMPlugin.h>
Public Member Functions | |
OpenCDMPlugin (const std::shared_ptr< IDobbyEnv > &env, const std::shared_ptr< IDobbyUtils > &utils) | |
std::string | name () const final |
Boilerplate that just returns the name of the hook. More... | |
unsigned | hookHints () const final |
Indicates which hook points we want and whether to run the asynchronously or synchronously with the other hooks. More... | |
bool | postConstruction (const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData) final |
Creates the required temp files for WPE browser to launch and decrypt content. The files are created in the host filesystem and then mounted into the container. More... | |
Public Member Functions inherited from PluginBase | |
virtual bool | preStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container is setup, but before the init process is executed. More... | |
virtual bool | postStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container is started and the init process is now running. More... | |
virtual bool | postStop (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container has stopped. More... | |
virtual bool | preDestruction (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container. More... | |
Private Member Functions | |
std::string | ocdmBufferPath (unsigned bufferNum) const |
Returns the file path of the OCDMBuffer corresponding to the specified buffer number. More... | |
std::string | ocdmBufferAdminPath (unsigned bufferNum) const |
Returns the file path of the OCDM admin Buffer corresponding to the specified buffer number. More... | |
bool | writeFileIfNotExists (const std::string &filePath) const |
Checks if the specified file exists then creates a blank file with permissions 0760 it if it doesn't exist. More... | |
bool | enableTmpOCDMDir (const std::shared_ptr< IDobbyStartState > &startupState) const |
Ensures the /tmp/OCDM directory exists and has permissions so accessible by apps but not (directory) writeable. More... | |
Private Attributes | |
const std::string | mName |
const std::shared_ptr< IDobbyUtils > | mUtilities |
const gid_t | mAppsGroupId |
Additional Inherited Members | |
Public Types inherited from IDobbyPlugin | |
enum | HintFlags : unsigned { PostConstructionSync = (1 << 0) , PreStartSync = (1 << 1) , PostStartSync = (1 << 2) , PostStopSync = (1 << 3) , PreDestructionSync = (1 << 4) , PostConstructionAsync = (1 << 16) , PreStartAsync = (1 << 17) , PostStartAsync = (1 << 18) , PostStopAsync = (1 << 19) , PreDestructionAsync = (1 << 20) } |
Bit flags that should be returned by hookHints. More... | |
Dobby plugin for creating the necessary OCDM buffers.
To launch the WPE runtime, various OpenCDM temporary files and sockets are needed inside the /tmp directory to allow decryption of DRM content to take place using the OCDMi plugin.
RunC cannot mount files that don't exist, so we need to create the files before we can launch the container
|
private |
Ensures the /tmp/OCDM directory exists and has permissions so accessible by apps but not (directory) writeable.
This is added because on newer OCDM builds they've switched the directories around.
|
finalvirtual |
Indicates which hook points we want and whether to run the asynchronously or synchronously with the other hooks.
For Netflix, the mounts should be created preStart
Implements IDobbyPlugin.
|
finalvirtual |
Boilerplate that just returns the name of the hook.
This string needs to match the name specified in the container spec json.
Implements IDobbyPlugin.
|
private |
Returns the file path of the OCDM admin Buffer corresponding to the specified buffer number.
[in] | bufferNum | Number of buffer to create |
|
private |
Returns the file path of the OCDMBuffer corresponding to the specified buffer number.
[in] | bufferNum | Number of buffer to create |
|
finalvirtual |
Creates the required temp files for WPE browser to launch and decrypt content. The files are created in the host filesystem and then mounted into the container.
For now, the files to create are hard coded, but could be passed in via JSON in the future - FIXME
The JSON for the plugin should be formatted like so:
{ "name": "OpenCDM", }
[in] | id | The id of the container. |
[in] | startupState | The mutable start-up state of the container. |
[in] | rootfsPath | The absolute path to the rootfs of the container. |
[in] | jsonData | The parsed json data from the container spec file. |
Reimplemented from PluginBase.
|
private |
Checks if the specified file exists then creates a blank file with permissions 0760 it if it doesn't exist.
[in] | filePath | The file to create |