23 #ifndef IDOBBYPLUGIN_H
24 #define IDOBBYPLUGIN_H
26 #include "ContainerId.h"
27 #include "IDobbyEnv.h"
28 #include "IDobbyUtils.h"
29 #include "IDobbyStartState.h"
32 # include <json/json.h>
34 # include <jsoncpp/json.h>
37 #include <sys/types.h>
66 virtual std::string
name()
const = 0;
78 PostConstructionSync = (1 << 0),
79 PreStartSync = (1 << 1),
80 PostStartSync = (1 << 2),
81 PostStopSync = (1 << 3),
82 PreDestructionSync = (1 << 4),
84 PostConstructionAsync = (1 << 16),
85 PreStartAsync = (1 << 17),
86 PostStartAsync = (1 << 18),
87 PostStopAsync = (1 << 19),
88 PreDestructionAsync = (1 << 20)
135 const std::shared_ptr<IDobbyStartState>& startupState,
136 const std::string& rootfsPath,
137 const Json::Value& jsonData) = 0;
159 const std::string& rootfsPath,
160 const Json::Value& jsonData) = 0;
180 const std::string& rootfsPath,
181 const Json::Value& jsonData) = 0;
197 const std::string& rootfsPath,
198 const Json::Value& jsonData) = 0;
217 const std::string& rootfsPath,
218 const Json::Value& jsonData) = 0;
233 # define PUBLIC_FN __attribute__ ((visibility ("default")))
247 #define REGISTER_DOBBY_PLUGIN(_class, _args...) \
248 int PUBLIC_FN __attribute__((weak)) __ai_debug_log_level = 0; \
249 void PUBLIC_FN __attribute__((weak)) \
250 __ai_debug_log_printf(int level, const char *file, const char *func, \
251 int line, const char *fmt, ...) \
253 void PUBLIC_FN __attribute__((weak)) \
254 __ai_debug_log_sys_printf(int err, int level, const char *file, \
255 const char *func, int line, const char *fmt, ...) \
258 extern "C" PUBLIC_FN IDobbyPlugin* createIDobbyPlugin(const std::shared_ptr<IDobbyEnv>& env, \
259 const std::shared_ptr<IDobbyUtils>& utils); \
260 extern "C" PUBLIC_FN IDobbyPlugin* createIDobbyPlugin(const std::shared_ptr<IDobbyEnv>& env, \
261 const std::shared_ptr<IDobbyUtils>& utils) \
263 return new _class(std::dynamic_pointer_cast<IDobbyEnv>(env), \
264 std::dynamic_pointer_cast<IDobbyUtils>(utils), \
267 extern "C" PUBLIC_FN void destroyIDobbyPlugin(_class const* _plugin); \
268 extern "C" PUBLIC_FN void destroyIDobbyPlugin(_class const* _plugin) \
270 return delete _plugin; \
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 plugin libraries have to implement.
Definition: IDobbyPlugin.h:51
virtual bool preStart(const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData)=0
Hook function called after the container is setup, but before the init process is executed.
virtual bool postStart(const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData)=0
Hook function called after the container is started and the init process is now running.
virtual bool preDestruction(const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData)=0
Hook function called just before the rootfs is deleted, this is called even if there was an error sta...
virtual bool postConstruction(const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData)=0
Hook function called after the rootfs has been created, but before the container is launched.
HintFlags
Bit flags that should be returned by hookHints.
Definition: IDobbyPlugin.h:77
virtual bool postStop(const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData)=0
Hook function called after the container has stopped.
virtual unsigned hookHints() const =0
Should return a bitfield of the hook points implemented by the plugin.
virtual std::string name() const =0
Should return the name of the plugin, this is used to match against the json spec file used to create...