]> git.proxmox.com Git - mirror_lxc.git/blob - src/liblxc/conf.h
Initial revision
[mirror_lxc.git] / src / liblxc / conf.h
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 enum {
27 VETH,
28 MACVLAN,
29 PHYS,
30 MAXCONFTYPE,
31 };
32
33 /*
34 * Defines the structure to configure an ipv4 address
35 * @address : ipv4 address
36 * @broadcast : ipv4 broadcast address
37 * @mask : network mask
38 */
39 struct inetdev {
40 struct in_addr addr;
41 struct in_addr bcast;
42 int prefix;
43 };
44
45 struct route {
46 struct in_addr addr;
47 };
48
49 /*
50 * Defines the structure to configure an ipv6 address
51 * @flags : set the address up
52 * @address : ipv6 address
53 * @broadcast : ipv6 broadcast address
54 * @mask : network mask
55 */
56 struct inet6dev {
57 struct in6_addr addr;
58 struct in6_addr bcast;
59 struct in6_addr acast;
60 int prefix;
61 };
62
63 struct route6 {
64 struct in6_addr addr;
65 };
66 /*
67 * Defines a structure to configure a network device
68 * @ifname : network device name
69 * @flags : flag of the network device (IFF_UP, ... )
70 * @ipv4 : a list of ipv4 addresses to be set on the network device
71 * @ipv6 : a list of ipv6 addresses to be set on the network device
72 */
73 struct netdev {
74 int flags;
75 char *ifname;
76 char *newname;
77 char *hwaddr;
78 struct list ipv4;
79 struct list ipv6;
80 struct list route4;
81 struct list route6;
82 };
83
84 /*
85 * Defines the kind of the network to use
86 * @type : the type of the network virtualization
87 * @phys : phys configuration type
88 * @veth : veth configuration type
89 * @macvlan : macvlan configuration type
90 */
91 struct network {
92 int type;
93 struct list netdev;
94 };
95
96 /*
97 * Defines a structure to configure the control data and path
98 */
99 struct cgroup {
100 ;
101 };
102
103 /*
104 * Defines the global container configuration
105 * @chroot : the root directory to run the container
106 * @mount : the list of mount points
107 * @network : the network configuration
108 * @utsname : the container utsname
109 */
110 struct lxc_conf {
111 char *chroot;
112 char *fstab;
113 struct utsname *utsname;
114 struct cgroup *cgroup;
115 struct list networks;
116 };
117
118 /*
119 * Configure the external resources for the container
120 */
121 extern int lxc_configure(const char *name, struct lxc_conf *conf);
122
123 /*
124 * Remove the resources created by the configuration
125 */
126 extern int lxc_unconfigure(const char *name);
127
128 extern int conf_create_network(const char *name, pid_t pid);
129
130 extern int conf_destroy_network(const char *name);
131
132 /*
133 * Configure the container from inside
134 */
135 extern int lxc_setup(const char *name);
136
137 extern int conf_has(const char *name, const char *info);
138
139 #define conf_has_fstab(__name) conf_has(__name, "fstab")
140 #define conf_has_utsname(__name) conf_has(__name, "utsname")
141 #define conf_has_network(__name) conf_has(__name, "network")
142
143
144 #endif