Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
NetworkingPlugin.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#ifndef NETWORKINGPLUGIN_H
21#define NETWORKINGPLUGIN_H
22
23#include <RdkPluginBase.h>
24#include "Netfilter.h"
25#include "NetworkingHelper.h"
26
27#include <sys/types.h>
28#include <netinet/in.h>
29#include <unistd.h>
30#include <string>
31
36{
37public:
38 NetworkingPlugin(std::shared_ptr<rt_dobby_schema> &cfg,
39 const std::shared_ptr<DobbyRdkPluginUtils> &utils,
40 const std::string &rootfsPath);
42
43public:
44 inline std::string name() const override
45 {
46 return mName;
47 };
48
49 unsigned hookHints() const override;
50
51public:
52 bool postInstallation() override;
53 bool createRuntime() override;
54 bool postHalt() override;
55 bool postStop() override;
56
57public:
58 std::vector<std::string> getDependencies() const override;
59
60private:
61 std::vector<std::string> GetExternalInterfacesFromSettings() const;
62 std::vector<std::string> GetAvailableExternalInterfaces() const;
63
64private:
65 bool mValid;
66 const std::string mName;
67 NetworkType mNetworkType;
68
69 std::shared_ptr<rt_dobby_schema> mContainerConfig;
70 const std::shared_ptr<DobbyRdkPluginUtils> mUtils;
71
72 const std::string mRootfsPath;
73 const rt_defs_plugins_networking_data *mPluginData;
74
75 std::shared_ptr<NetworkingHelper> mHelper;
76 std::shared_ptr<Netfilter> mNetfilter;
77};
78
79#endif // !defined(NETWORKINGPLUGIN_H)
Definition NetworkingPlugin.h:36
bool postHalt() override
Dobby Hook - Run in host namespace when container terminates.
Definition NetworkingPlugin.cpp:289
bool postStop() override
OCI Hook - Run in host namespace.
Definition NetworkingPlugin.cpp:264
bool postInstallation() override
Dobby Hook - run in host namespace once when container bundle is downloaded.
Definition NetworkingPlugin.cpp:111
unsigned hookHints() const override
Set the bit flags for which hooks we're going to use.
Definition NetworkingPlugin.cpp:96
std::vector< std::string > GetAvailableExternalInterfaces() const
Gets the external interfaces that are actually available. Looks in the settings for the interfaces Do...
Definition NetworkingPlugin.cpp:443
std::vector< std::string > getDependencies() const override
Should return the names of the plugins this plugin depends on.
Definition NetworkingPlugin.cpp:419
std::string name() const override
Should return the name of the plugin.
Definition NetworkingPlugin.h:44
std::vector< std::string > GetExternalInterfacesFromSettings() const
Gets the external interfaces defined in the dobby settings file, regardless of whether they actually ...
Definition NetworkingPlugin.cpp:503
bool createRuntime() override
OCI Hook - Run in host namespace.
Definition NetworkingPlugin.cpp:143
Basic object that provides the default overrides for a plugin.
Definition RdkPluginBase.h:34