]>
Commit | Line | Data |
---|---|---|
620eff3c | 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 | ||
28 | enum { | |
5f58350a | 29 | EMPTY, |
620eff3c | 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 | */ | |
42 | struct lxc_inetdev { | |
43 | struct in_addr addr; | |
44 | struct in_addr bcast; | |
45 | int prefix; | |
46 | }; | |
47 | ||
48 | struct 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 | */ | |
59 | struct lxc_inet6dev { | |
60 | struct in6_addr addr; | |
61 | struct in6_addr bcast; | |
62 | struct in6_addr acast; | |
63 | int prefix; | |
64 | }; | |
65 | ||
66 | struct 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 | */ | |
76 | struct 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 | */ | |
94 | struct 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 | */ | |
102 | struct lxc_cgroup { | |
103 | ; | |
104 | }; | |
105 | ||
106 | /* | |
107 | * Defines the global container configuration | |
108 | * @chroot : the root directory to run the container | |
109 | * @mount : the list of mount points | |
110 | * @network : the network configuration | |
111 | * @utsname : the container utsname | |
112 | */ | |
113 | struct lxc_conf { | |
114 | char *chroot; | |
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 | */ | |
124 | extern int lxc_configure(const char *name, struct lxc_conf *conf); | |
125 | ||
126 | /* | |
127 | * Remove the resources created by the configuration | |
128 | */ | |
129 | extern int lxc_unconfigure(const char *name); | |
130 | ||
131 | extern int conf_create_network(const char *name, pid_t pid); | |
132 | ||
133 | extern int conf_destroy_network(const char *name); | |
134 | ||
135 | /* | |
136 | * Configure the container from inside | |
137 | */ | |
138 | extern int lxc_setup(const char *name); | |
139 | ||
140 | extern int conf_has(const char *name, const char *info); | |
141 | ||
142 | #define conf_has_fstab(__name) conf_has(__name, "fstab") | |
143 | #define conf_has_chroot(__name) conf_has(__name, "chroot") | |
144 | #define conf_has_utsname(__name) conf_has(__name, "utsname") | |
145 | #define conf_has_network(__name) conf_has(__name, "network") | |
146 | ||
147 | #endif |