ia64/xen-unstable

view tools/libxen/include/xen_network.h @ 14045:7819d9332fba

Split the VBD I/O statistics out into a VBD_metrics class. Document the
VBD.type field, and add it to the C bindings (this was already in Xend).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 21:28:19 2007 +0000 (2007-02-20)
parents 462b945e2f41
children 568433250d84
line source
1 /*
2 * Copyright (c) 2006, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #ifndef XEN_NETWORK_H
20 #define XEN_NETWORK_H
22 #include "xen_common.h"
23 #include "xen_network_decl.h"
24 #include "xen_pif_decl.h"
25 #include "xen_vif_decl.h"
28 /*
29 * The network class.
30 *
31 * A virtual network.
32 */
35 /**
36 * Free the given xen_network. The given handle must have been
37 * allocated by this library.
38 */
39 extern void
40 xen_network_free(xen_network network);
43 typedef struct xen_network_set
44 {
45 size_t size;
46 xen_network *contents[];
47 } xen_network_set;
49 /**
50 * Allocate a xen_network_set of the given size.
51 */
52 extern xen_network_set *
53 xen_network_set_alloc(size_t size);
55 /**
56 * Free the given xen_network_set. The given set must have been
57 * allocated by this library.
58 */
59 extern void
60 xen_network_set_free(xen_network_set *set);
63 typedef struct xen_network_record
64 {
65 xen_network handle;
66 char *uuid;
67 char *name_label;
68 char *name_description;
69 struct xen_vif_record_opt_set *vifs;
70 struct xen_pif_record_opt_set *pifs;
71 char *default_gateway;
72 char *default_netmask;
73 } xen_network_record;
75 /**
76 * Allocate a xen_network_record.
77 */
78 extern xen_network_record *
79 xen_network_record_alloc(void);
81 /**
82 * Free the given xen_network_record, and all referenced values. The
83 * given record must have been allocated by this library.
84 */
85 extern void
86 xen_network_record_free(xen_network_record *record);
89 typedef struct xen_network_record_opt
90 {
91 bool is_record;
92 union
93 {
94 xen_network handle;
95 xen_network_record *record;
96 } u;
97 } xen_network_record_opt;
99 /**
100 * Allocate a xen_network_record_opt.
101 */
102 extern xen_network_record_opt *
103 xen_network_record_opt_alloc(void);
105 /**
106 * Free the given xen_network_record_opt, and all referenced values.
107 * The given record_opt must have been allocated by this library.
108 */
109 extern void
110 xen_network_record_opt_free(xen_network_record_opt *record_opt);
113 typedef struct xen_network_record_set
114 {
115 size_t size;
116 xen_network_record *contents[];
117 } xen_network_record_set;
119 /**
120 * Allocate a xen_network_record_set of the given size.
121 */
122 extern xen_network_record_set *
123 xen_network_record_set_alloc(size_t size);
125 /**
126 * Free the given xen_network_record_set, and all referenced values.
127 * The given set must have been allocated by this library.
128 */
129 extern void
130 xen_network_record_set_free(xen_network_record_set *set);
134 typedef struct xen_network_record_opt_set
135 {
136 size_t size;
137 xen_network_record_opt *contents[];
138 } xen_network_record_opt_set;
140 /**
141 * Allocate a xen_network_record_opt_set of the given size.
142 */
143 extern xen_network_record_opt_set *
144 xen_network_record_opt_set_alloc(size_t size);
146 /**
147 * Free the given xen_network_record_opt_set, and all referenced
148 * values. The given set must have been allocated by this library.
149 */
150 extern void
151 xen_network_record_opt_set_free(xen_network_record_opt_set *set);
154 /**
155 * Get a record containing the current state of the given network.
156 */
157 extern bool
158 xen_network_get_record(xen_session *session, xen_network_record **result, xen_network network);
161 /**
162 * Get a reference to the network instance with the specified UUID.
163 */
164 extern bool
165 xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid);
168 /**
169 * Create a new network instance, and return its handle.
170 */
171 extern bool
172 xen_network_create(xen_session *session, xen_network *result, xen_network_record *record);
175 /**
176 * Destroy the specified network instance.
177 */
178 extern bool
179 xen_network_destroy(xen_session *session, xen_network network);
182 /**
183 * Get all the network instances with the given label.
184 */
185 extern bool
186 xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label);
189 /**
190 * Get the uuid field of the given network.
191 */
192 extern bool
193 xen_network_get_uuid(xen_session *session, char **result, xen_network network);
196 /**
197 * Get the name/label field of the given network.
198 */
199 extern bool
200 xen_network_get_name_label(xen_session *session, char **result, xen_network network);
203 /**
204 * Get the name/description field of the given network.
205 */
206 extern bool
207 xen_network_get_name_description(xen_session *session, char **result, xen_network network);
210 /**
211 * Get the VIFs field of the given network.
212 */
213 extern bool
214 xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, xen_network network);
217 /**
218 * Get the PIFs field of the given network.
219 */
220 extern bool
221 xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_network network);
224 /**
225 * Get the default_gateway field of the given network.
226 */
227 extern bool
228 xen_network_get_default_gateway(xen_session *session, char **result, xen_network network);
231 /**
232 * Get the default_netmask field of the given network.
233 */
234 extern bool
235 xen_network_get_default_netmask(xen_session *session, char **result, xen_network network);
238 /**
239 * Set the name/label field of the given network.
240 */
241 extern bool
242 xen_network_set_name_label(xen_session *session, xen_network network, char *label);
245 /**
246 * Set the name/description field of the given network.
247 */
248 extern bool
249 xen_network_set_name_description(xen_session *session, xen_network network, char *description);
252 /**
253 * Set the default_gateway field of the given network.
254 */
255 extern bool
256 xen_network_set_default_gateway(xen_session *session, xen_network network, char *default_gateway);
259 /**
260 * Set the default_netmask field of the given network.
261 */
262 extern bool
263 xen_network_set_default_netmask(xen_session *session, xen_network network, char *default_netmask);
266 /**
267 * Return a list of all the networks known to the system.
268 */
269 extern bool
270 xen_network_get_all(xen_session *session, struct xen_network_set **result);
273 #endif