Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
NetworkingHelper.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 NETWORKINGHELPER_H
21 #define NETWORKINGHELPER_H
22 
23 #include <netinet/in.h>
24 #include <string>
25 #include "NetworkingPluginCommon.h"
26 
28 {
29 public:
30  NetworkingHelper(bool ipv4Enabled, bool ipv6Enabled);
32 
33 public:
34  bool storeContainerInterface(in_addr_t addr, const std::string &vethName);
35 
36  bool ipv4() const;
37  in_addr_t ipv4Addr() const;
38  std::string ipv4AddrStr() const;
39 
40  bool ipv6() const;
41  struct in6_addr ipv6Addr() const;
42  std::string ipv6AddrStr() const;
43 
44  std::string vethName() const;
45 
46 public:
47  static struct in6_addr in6addrCreate(const in_addr_t inaddr);
48 
49 private:
50  bool mIpv4Enabled;
51  in_addr_t mIpv4Addr;
52  std::string mIpv4AddrStr;
53 
54  bool mIpv6Enabled;
55  struct in6_addr mIpv6Addr;
56  std::string mIpv6AddrStr;
57 
58  std::string mVethName;
59 };
60 
61 #endif // !defined(NETWORKINGHELPER_H)
Definition: NetworkingHelper.h:28
bool storeContainerInterface(in_addr_t addr, const std::string &vethName)
Constructs addresses for the container based on input address. Also stores the veth device used for t...
Definition: NetworkingHelper.cpp:96
static struct in6_addr in6addrCreate(const in_addr_t inaddr)
Constructs an IPv6 address to be used by Dobby.
Definition: NetworkingHelper.cpp:135