26 #include "IDobbyUtils.h"
27 #include "ContainerId.h"
28 #include <IDobbyIPCUtils.h>
29 #include <IDobbySettings.h>
33 # include <json/json.h>
35 # include <jsoncpp/json.h>
38 #define PLUGINLAUNCHER_PATH "/usr/bin/DobbyPluginLauncher"
40 #include "rt_dobby_schema.h"
48 #include <sys/types.h>
49 #include <sys/mount.h>
52 #define RDK_NETWORK_PLUGIN_NAME "networking"
53 #define RDK_LOGGING_PLUGIN_NAME "logging"
54 #define RDK_IPC_PLUGIN_NAME "ipc"
55 #define RDK_STORAGE_PLUGIN_NAME "storage"
56 #define RDK_GPU_PLUGIN_NAME "gpu"
57 #define RDK_RTSCHEDULING_PLUGIN_NAME "rtscheduling"
80 std::string fsImagePath;
81 std::string fsImageType;
82 std::string destination;
83 std::list<std::string> mountOptions;
84 unsigned long mountFlags;
94 virtual uid_t userId()
const = 0;
95 virtual gid_t groupId()
const = 0;
99 virtual bool consoleDisabled()
const = 0;
100 virtual ssize_t consoleLimit()
const = 0;
101 virtual const std::string& consolePath()
const = 0;
102 virtual bool restartOnCrash()
const = 0;
103 virtual const std::string& rootfsPath()
const = 0;
104 virtual std::shared_ptr<rt_dobby_schema> config()
const = 0;
105 virtual const std::map<std::string, Json::Value>& rdkPlugins()
const = 0;
107 #if defined(LEGACY_COMPONENTS)
108 virtual const std::map<std::string, Json::Value>& legacyPlugins()
const = 0;
113 virtual const std::string spec()
const
114 {
return std::string(); }
120 bool addMount(
const std::string& source,
121 const std::string& target,
122 const std::string& fsType,
123 unsigned long mountFlags,
124 const std::list<std::string>& mountOptions);
139 bool writeConfigJsonImpl(
const std::string& filePath)
const;
141 std::shared_ptr<rt_dobby_schema> cfg,
142 const std::string& bundlePath);
144 std::shared_ptr<rt_dobby_schema> cfg,
145 const std::string& bundlePath);
147 std::shared_ptr<rt_dobby_schema> cfg,
148 const std::string& bundlePath);
159 static std::list<DevNode>
scanDevNodes(
const std::list<std::string> &devNodes);
161 mutable std::mutex mLock;
165 void setPluginHookEntry(rt_defs_hook* entry,
const std::string& name,
const std::string& configPath);
A wrapper around a std::string, used to add some type definition to to an id and also to sanity check...
Definition: ContainerId.h:41
Interface that configuration file parser classes have to implement.
Definition: DobbyConfig.h:66
void printCommand() const
Definition: DobbyConfig.cpp:320
bool addEnvironmentVar(const std::string &envVar)
Public api to allow for adding additional env variables.
Definition: DobbyConfig.cpp:234
bool updateBundleConfig(const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath)
Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLa...
Definition: DobbyConfig.cpp:726
bool changeProcessArgs(const std::string &command)
Definition: DobbyConfig.cpp:276
bool addWesterosMount(const std::string &socketPath)
Definition: DobbyConfig.cpp:408
void setApparmorProfile(const std::string &profileName)
Set apparmor profile in config.
Definition: DobbyConfig.cpp:819
virtual bool isValid() const =0
Getters used for plugins.
static std::list< DevNode > scanDevNodes(const std::list< std::string > &devNodes)
Takes a list of glob patterns corresponding to dev node paths and returns a list of structs with thei...
Definition: DobbyConfig.cpp:47
bool setHostnameToContainerId(const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath)
Sets the container hostname to the container ID.
Definition: DobbyConfig.cpp:697
void addPluginLauncherHooks(std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath)
Adds OCI hooks to the config.
Definition: DobbyConfig.cpp:641
void setPidsLimit(int limit)
Set cgroup pids limit.
Definition: DobbyConfig.cpp:858
bool findPluginLauncherHookEntry(rt_defs_hook **hook, int len)
Checks a hook for Dobby plugin launcher entries.
Definition: DobbyConfig.cpp:564
bool enableSTrace(const std::string &logsDir)
Enables strace for the container.
Definition: DobbyConfig.cpp:347
bool convertToCompliant(const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath)
Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLa...
Definition: DobbyConfig.cpp:889
const std::string configJson() const
Get OCI bundle config json as string.
Definition: DobbyConfig.cpp:452
struct DobbyConfig::_LoopMount LoopMount
Loopmount struct used for Storage plugin.
bool writeConfigJson(const std::string &filePath) const
Writes bundle config string to a file.
Definition: DobbyConfig.cpp:491
void setPluginHookEntry(rt_defs_hook *entry, const std::string &name, const std::string &configPath)
Populates a hook entry structure with DobbyPluginLauncher data.
Definition: DobbyConfig.cpp:591
bool addMount(const std::string &source, const std::string &target, const std::string &fsType, unsigned long mountFlags, const std::list< std::string > &mountOptions)
Public api to allow for adding additional mounts.
Definition: DobbyConfig.cpp:129
bool isApparmorProfileLoaded(const char *profile) const
Check if apparmor profile is loaded.
Definition: DobbyConfig.cpp:782
NetworkType
Network type used for Network plugin.
Definition: DobbyConfig.h:73
BusType
The type of dbus to call methods on / emit signals.
Definition: IDobbyIPCUtils.h:60
Definition: DobbyConfig.h:152
Loopmount struct used for Storage plugin.
Definition: DobbyConfig.h:79