]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/lxc_conf.h
Freeze/unfreeze when checkpointing, stop the container when specified with '-s' option
[mirror_lxc.git] / src / lxc / lxc_conf.h
CommitLineData
0ad19a3f 1/*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
7 * Daniel Lezcano <dlezcano at fr.ibm.com>
8 *
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.
13 *
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.
18 *
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
22 */
23#ifndef _conf_h
24#define _conf_h
25
26#include <netinet/in.h>
27
28enum {
29 EMPTY,
30 VETH,
31 MACVLAN,
32 PHYS,
33 MAXCONFTYPE,
34};
35
36/*
37 * Defines the structure to configure an ipv4 address
38 * @address : ipv4 address
39 * @broadcast : ipv4 broadcast address
40 * @mask : network mask
41 */
42struct lxc_inetdev {
43 struct in_addr addr;
44 struct in_addr bcast;
45 int prefix;
46};
47
48struct lxc_route {
49 struct in_addr addr;
50};
51
52/*
53 * Defines the structure to configure an ipv6 address
54 * @flags : set the address up
55 * @address : ipv6 address
56 * @broadcast : ipv6 broadcast address
57 * @mask : network mask
58 */
59struct lxc_inet6dev {
60 struct in6_addr addr;
61 struct in6_addr bcast;
62 struct in6_addr acast;
63 int prefix;
64};
65
66struct lxc_route6 {
67 struct in6_addr addr;
68};
69/*
70 * Defines a structure to configure a network device
71 * @ifname : network device name
72 * @flags : flag of the network device (IFF_UP, ... )
73 * @ipv4 : a list of ipv4 addresses to be set on the network device
74 * @ipv6 : a list of ipv6 addresses to be set on the network device
75 */
76struct lxc_netdev {
77 int flags;
78 char *ifname;
79 char *newname;
80 char *hwaddr;
81 struct lxc_list ipv4;
82 struct lxc_list ipv6;
83 struct lxc_list route4;
84 struct lxc_list route6;
85};
86
87/*
88 * Defines the kind of the network to use
89 * @type : the type of the network virtualization
90 * @phys : phys configuration type
91 * @veth : veth configuration type
92 * @macvlan : macvlan configuration type
93 */
94struct lxc_network {
95 int type;
96 struct lxc_list netdev;
97};
98
99/*
100 * Defines a structure to configure the control data and path
101 */
102struct lxc_cgroup {
103 ;
104};
105
106/*
107 * Defines the global container configuration
eae6543d 108 * @rootfs : the root directory to run the container
0ad19a3f 109 * @mount : the list of mount points
110 * @network : the network configuration
111 * @utsname : the container utsname
112 */
113struct lxc_conf {
eae6543d 114 char *rootfs;
0ad19a3f 115 char *fstab;
116 struct utsname *utsname;
117 struct lxc_cgroup *cgroup;
118 struct lxc_list networks;
119};
120
121/*
122 * Configure the external resources for the container
123 */
124extern int lxc_configure(const char *name, struct lxc_conf *conf);
125
126/*
127 * Remove the resources created by the configuration
128 */
129extern int lxc_unconfigure(const char *name);
130
131extern int conf_create_network(const char *name, pid_t pid);
132
133extern int conf_destroy_network(const char *name);
134
135/*
136 * Configure the container from inside
137 */
138extern int lxc_setup(const char *name);
139
140extern int conf_has(const char *name, const char *info);
141
142#define conf_has_fstab(__name) conf_has(__name, "fstab")
eae6543d 143#define conf_has_rootfs(__name) conf_has(__name, "rootfs")
0ad19a3f 144#define conf_has_utsname(__name) conf_has(__name, "utsname")
145#define conf_has_network(__name) conf_has(__name, "network")
146
147#endif