Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
netcreate.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License version 2.1 as published by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  */
17 
24 #ifndef LXCPP_COMMAND_NETCREATE_HPP
25 #define LXCPP_COMMAND_NETCREATE_HPP
26 
28 #include "lxcpp/network-config.hpp"
29 #include "lxcpp/container.hpp"
30 
31 #include <sys/types.h>
32 
33 namespace lxcpp {
34 
35 class NetCreateAll final: Command {
36 public:
40  NetCreateAll(const NetworkConfig& network, pid_t pid) :
41  mNetwork(network),
42  mPid(pid)
43  {
44  }
45 
46  void execute();
47 
48 private:
50  pid_t mPid;
51 };
52 
53 class NetConfigureAll final: Command {
54 public:
58  NetConfigureAll(const NetworkConfig& network) :
59  mNetwork(network)
60  {
61  }
62 
63  void execute();
64 
65 private:
67 };
68 
69 class NetInteraceCreate final: Command {
70 public:
71  NetInteraceCreate(const std::string& zoneif,
72  const std::string& hostif,
73  InterfaceType type,
75  mZoneIf(zoneif),
76  mHostIf(hostif),
77  mType(type),
78  mMode(mode)
79  {
80  }
81 
82  void execute();
83 
84 private:
85  const std::string& mZoneIf;
86  const std::string& mHostIf;
89 };
90 
92 public:
93  NetInterfaceSetAttrs(const std::string& ifname,
94  const Attrs& attrs) :
95  mIfname(ifname),
96  mAttrs(attrs)
97  {
98  }
99 
100  void execute();
101 
102 private:
103  const std::string& mIfname;
104  const Attrs& mAttrs;
105 };
106 
108 public:
109  NetInterfaceAddInetAddr(const std::string& ifname,
110  const std::vector<InetAddr>& addrList) :
111  mIfname(ifname),
112  mAddrList(addrList)
113  {
114  }
115 
116  void execute();
117 
118 private:
119  const std::string& mIfname;
120  const std::vector<InetAddr>& mAddrList;
121 };
122 
123 } // namespace lxcpp
124 
125 #endif // LXCPP_COMMAND_NETCREATE_HPP
Definition: netcreate.hpp:53
const NetworkConfig & mNetwork
Definition: netcreate.hpp:49
NetInterfaceSetAttrs(const std::string &ifname, const Attrs &attrs)
Definition: netcreate.hpp:93
void execute()
Definition: netcreate.cpp:63
Definition: netcreate.hpp:35
MacVLanMode mMode
Definition: netcreate.hpp:88
const std::string & mHostIf
Definition: netcreate.hpp:86
const std::string & mIfname
Definition: netcreate.hpp:119
const std::vector< InetAddr > & mAddrList
Definition: netcreate.hpp:120
const std::string & mZoneIf
Definition: netcreate.hpp:85
NetInteraceCreate(const std::string &zoneif, const std::string &hostif, InterfaceType type, MacVLanMode mode=MacVLanMode::PRIVATE)
Definition: netcreate.hpp:71
InterfaceType mType
Definition: netcreate.hpp:87
void execute()
Definition: netcreate.cpp:79
Network configuration classes.
const Attrs & mAttrs
Definition: netcreate.hpp:104
Command interface definition.
std::vector< Attr > Attrs
Definition: network.hpp:174
const NetworkConfig & mNetwork
Definition: netcreate.hpp:66
NetConfigureAll(const NetworkConfig &network)
Configures network interfaces (exec in container process context)
Definition: netcreate.hpp:58
Definition: netcreate.hpp:69
const std::string & mIfname
Definition: netcreate.hpp:103
Container interface.
Definition: netcreate.hpp:107
Definition: command.hpp:29
MacVLanMode
Suported MacVLan modes.
Definition: network.hpp:188
void execute()
Definition: netcreate.cpp:132
Network interface configuration.
Definition: network-config.hpp:119
NetInterfaceAddInetAddr(const std::string &ifname, const std::vector< InetAddr > &addrList)
Definition: netcreate.hpp:109
void execute()
Definition: netcreate.cpp:144
pid_t mPid
Definition: netcreate.hpp:50
InterfaceType
Created interface type.
Definition: network.hpp:179
NetCreateAll(const NetworkConfig &network, pid_t pid)
Creates network interfaces for use in container (exec in host context)
Definition: netcreate.hpp:40
void execute()
Definition: netcreate.cpp:138
Definition: netcreate.hpp:91