Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Plugin used to setup multicast server and client sockets out of the container and passes their file descriptors to process inside the container. More...
#include <MulticastSocketsPlugin.h>
Classes | |
struct | MulticastSocket |
Public Member Functions | |
MulticastSocketPlugin (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 |
Indiciates 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 multicast server and client sockets out of the container and passes their file descriptors to the container in env variables. 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::vector< MulticastSocket > | parseServerSocketsArray (const Json::Value &jsonData) const |
Parses and verifies server socket data from json array. More... | |
std::vector< std::string > | parseClientSocketsArray (const Json::Value &jsonData) const |
Parses and verifies client socket data from json array. More... | |
int | createServerSocket (in_addr_t ip, in_port_t port) |
Creates socket and binds it to multicast ip and port. | |
int | createClientSocket () |
Creates client udp socket. | |
Private Attributes | |
const std::string | mName |
const std::shared_ptr< IDobbyUtils > | mUtilities |
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... | |
Plugin used to setup multicast server and client sockets out of the container and passes their file descriptors to process inside the container.
This plugin creates all necessary sockets when the container is started and closes them when the container is stopped.
|
finalvirtual |
Indiciates which hook points we want and whether to run the asynchronously or synchronously with the other hooks.
For MulticastSocketPlugin everything is done in the PostConstruction phase.
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 |
Parses and verifies client socket data from json array.
The json data is expected (required) to be formatted like the following
"clientSockets": [ { "name": "NAME1" } ]
|
private |
Parses and verifies server socket data from json array.
The json data is expected (required) to be formatted like the following
"serverSockets": [ { "name": "NAME" "ip": "239.255.255.250", "port": 1900 } ]
|
finalvirtual |
Creates multicast server and client sockets out of the container and passes their file descriptors to the container in env variables.
The json data is expected to be formatted like the following:
{ "name": "MulticastSockets", "data": { "serverSockets": [ { "name": "NAME" "ip": "239.255.255.250", "port": 1900 } ], "clientSockets": [ { "name": "NAME1" } ] } }
"serverSockets" and "clientSockets" are optional
Reimplemented from PluginBase.