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>
41 * Defines the structure to configure an ipv4 address
42 * @address : ipv4 address
43 * @broadcast : ipv4 broadcast address
44 * @mask : network mask
57 * Defines the structure to configure an ipv6 address
58 * @flags : set the address up
59 * @address : ipv6 address
60 * @broadcast : ipv6 broadcast address
61 * @mask : network mask
65 struct in6_addr bcast
;
66 struct in6_addr acast
;
75 char *pair
; /* pair name */
86 int mode
; /* private, vepa, bridge */
90 struct ifla_veth veth_attr
;
91 struct ifla_vlan vlan_attr
;
92 struct ifla_macvlan macvlan_attr
;
96 * Defines a structure to configure a network device
97 * @link : lxc.network.link, name of bridge or host iface to attach if any
98 * @name : lxc.network.name, name of iface on the container side
99 * @flags : flag of the network device (IFF_UP, ... )
100 * @ipv4 : a list of ipv4 addresses to be set on the network device
101 * @ipv6 : a list of ipv6 addresses to be set on the network device
112 struct lxc_list ipv4
;
113 struct lxc_list ipv6
;
117 * Defines a generic struct to configure the control group.
118 * It is up to the programmer to specify the right subsystem.
119 * @subsystem : the targetted subsystem
120 * @value : the value to set
128 * Defines a structure containing a pty information for
130 * @name : the path name of the slave pty side
131 * @master : the file descriptor of the master
132 * @slave : the file descriptor of the slave
134 struct lxc_pty_info
{
135 char name
[MAXPATHLEN
];
142 * Defines the number of tty configured and contains the
144 * @nbtty = number of configured ttys
146 struct lxc_tty_info
{
148 struct lxc_pty_info
*pty_info
;
152 * Defines the structure to store the console information
153 * @peer : the file descriptor put/get console traffic
154 * @name : the file name of the slave pty
160 char name
[MAXPATHLEN
];
161 struct termios
*tios
;
165 * Defines the global container configuration
166 * @rootfs : root directory to run the container
167 * @pivotdir : pivotdir path, if not set default will be used
168 * @mount : list of mount points
169 * @tty : numbers of tty
170 * @pts : new pts instance
171 * @mount_list : list of mount point (alternative to fstab file)
172 * @network : network configuration
173 * @utsname : container utsname
174 * @fstab : path to a fstab file format
175 * @caps : list of the capabilities
176 * @tty_info : tty data
177 * @console : console data
185 struct utsname
*utsname
;
186 struct lxc_list cgroup
;
187 struct lxc_list network
;
188 struct lxc_list mount_list
;
189 struct lxc_list caps
;
190 struct lxc_tty_info tty_info
;
191 struct lxc_console console
;
195 * Initialize the lxc configuration structure
197 extern struct lxc_conf
*lxc_conf_init(void);
199 extern int lxc_create_network(struct lxc_list
*networks
);
200 extern void lxc_delete_network(struct lxc_list
*networks
);
201 extern int lxc_assign_network(struct lxc_list
*networks
, pid_t pid
);
203 extern int lxc_create_tty(const char *name
, struct lxc_conf
*conf
);
204 extern void lxc_delete_tty(struct lxc_tty_info
*tty_info
);
207 * Configure the container from inside
212 extern int lxc_setup(const char *name
, struct lxc_conf
*lxc_conf
);