Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
IpcPlugin.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2020 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: IpcPlugin.h
21 *
22 */
23#ifndef IPCPLUGIN_H
24#define IPCPLUGIN_H
25
26#include <RdkPluginBase.h>
27
28#include <sys/types.h>
29#include <netinet/in.h>
30
31#include <unistd.h>
32#include <string>
33#include <memory>
34
42{
43public:
44 IpcPlugin(std::shared_ptr<rt_dobby_schema>& containerConfig,
45 const std::shared_ptr<DobbyRdkPluginUtils> &utils,
46 const std::string &rootfsPath);
47
48public:
49 inline std::string name() const override
50 {
51 return mName;
52 };
53
54 // Override to return the appropriate hints for what we implement
55 unsigned hookHints() const override;
56
57public:
58 bool postInstallation() override;
59
60public:
61 std::vector<std::string> getDependencies() const override;
62
63private:
64 bool addSocketAndEnv(const std::shared_ptr<DobbyRdkPluginUtils> utils,
65 const std::string& rootfsPath,
66 std::shared_ptr<rt_dobby_schema> containerConfig,
67 std::string busStr,
68 const std::string &socketPath,
69 const std::string &envVar) const;
70
71 std::string socketPathFromAddressSimple(const std::string& address) const;
72
73private:
74 const std::string mName;
75 std::shared_ptr<rt_dobby_schema> mContainerConfig;
76 const std::string mRootfsPath;
77 const std::shared_ptr<DobbyRdkPluginUtils> mUtils;
78
79 const std::string mDbusRunDir;
80
81 const std::string mDbusSystemSocketPath;
82 const std::string mDbusSessionSocketPath;
83 const std::string mDbusDebugSocketPath;
84
85 const std::string mDbusSystemEnvVar;
86 const std::string mDbusSessionEnvVar;
87 const std::string mDbusDebugEnvVar;
88
89
90};
91
92#endif // !defined(IPCPLUGIN_H)
IPC Plugin.
Definition IpcPlugin.h:42
std::string socketPathFromAddressSimple(const std::string &address) const
Utility function to extract the socket path from the dbus address string.
Definition IpcPlugin.cpp:300
std::string name() const override
Should return the name of the plugin.
Definition IpcPlugin.h:49
bool addSocketAndEnv(const std::shared_ptr< DobbyRdkPluginUtils > utils, const std::string &rootfsPath, std::shared_ptr< rt_dobby_schema > containerConfig, std::string busStr, const std::string &socketPath, const std::string &envVar) const
Adds the bind mount of the socket.
Definition IpcPlugin.cpp:200
std::vector< std::string > getDependencies() const override
Should return the names of the plugins this plugin depends on.
Definition IpcPlugin.cpp:176
bool postInstallation() override
OCI Hook - Run in host namespace.
Definition IpcPlugin.cpp:81
unsigned hookHints() const override
Set the bit flags for which hooks we're going to use.
Definition IpcPlugin.cpp:70
Basic object that provides the default overrides for a plugin.
Definition RdkPluginBase.h:34