2
* lxc: linux Container library
4
* (C) Copyright IBM Corp. 2007, 2008
7
* Daniel Lezcano <dlezcano at fr.ibm.com>
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 2.1 of the License, or (at your option) any later version.
14
* This library is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#include <netinet/in.h>
27
#include <sys/param.h>
31
#include <lxc/start.h> /* for lxc_handler */
43
* Defines the structure to configure an ipv4 address
44
* @address : ipv4 address
45
* @broadcast : ipv4 broadcast address
46
* @mask : network mask
59
* Defines the structure to configure an ipv6 address
60
* @flags : set the address up
61
* @address : ipv6 address
62
* @broadcast : ipv6 broadcast address
63
* @mask : network mask
67
struct in6_addr mcast;
68
struct in6_addr acast;
77
char *pair; /* pair name */
88
int mode; /* private, vepa, bridge */
92
struct ifla_veth veth_attr;
93
struct ifla_vlan vlan_attr;
94
struct ifla_macvlan macvlan_attr;
98
* Defines a structure to configure a network device
99
* @link : lxc.network.link, name of bridge or host iface to attach if any
100
* @name : lxc.network.name, name of iface on the container side
101
* @flags : flag of the network device (IFF_UP, ... )
102
* @ipv4 : a list of ipv4 addresses to be set on the network device
103
* @ipv6 : a list of ipv6 addresses to be set on the network device
104
* @upscript : a script filename to be executed during interface configuration
115
struct lxc_list ipv4;
116
struct lxc_list ipv6;
121
* Defines a generic struct to configure the control group.
122
* It is up to the programmer to specify the right subsystem.
123
* @subsystem : the targetted subsystem
124
* @value : the value to set
132
* Defines a structure containing a pty information for
134
* @name : the path name of the slave pty side
135
* @master : the file descriptor of the master
136
* @slave : the file descriptor of the slave
138
struct lxc_pty_info {
139
char name[MAXPATHLEN];
146
* Defines the number of tty configured and contains the
148
* @nbtty = number of configured ttys
150
struct lxc_tty_info {
152
struct lxc_pty_info *pty_info;
156
* Defines the structure to store the console information
157
* @peer : the file descriptor put/get console traffic
158
* @name : the file name of the slave pty
165
char name[MAXPATHLEN];
166
struct termios *tios;
170
* Defines a structure to store the rootfs location, the
171
* optionals pivot_root, rootfs mount paths
172
* @rootfs : a path to the rootfs
173
* @pivot_root : a path to a pivot_root location to be used
182
* Defines the global container configuration
183
* @rootfs : root directory to run the container
184
* @pivotdir : pivotdir path, if not set default will be used
185
* @mount : list of mount points
186
* @tty : numbers of tty
187
* @pts : new pts instance
188
* @mount_list : list of mount point (alternative to fstab file)
189
* @network : network configuration
190
* @utsname : container utsname
191
* @fstab : path to a fstab file format
192
* @caps : list of the capabilities
193
* @tty_info : tty data
194
* @console : console data
202
struct utsname *utsname;
203
struct lxc_list cgroup;
204
struct lxc_list network;
205
struct lxc_list mount_list;
206
struct lxc_list caps;
207
struct lxc_tty_info tty_info;
208
struct lxc_console console;
209
struct lxc_rootfs rootfs;
213
* Initialize the lxc configuration structure
215
extern struct lxc_conf *lxc_conf_init(void);
217
extern int lxc_create_network(struct lxc_handler *handler);
218
extern void lxc_delete_network(struct lxc_list *networks);
219
extern int lxc_assign_network(struct lxc_list *networks, pid_t pid);
221
extern int lxc_create_tty(const char *name, struct lxc_conf *conf);
222
extern void lxc_delete_tty(struct lxc_tty_info *tty_info);
225
* Configure the container from inside
228
extern int lxc_setup(const char *name, struct lxc_conf *lxc_conf);