ia64/xen-unstable

view tools/libxen/include/xen_vif.h @ 14116:fd7f23e44b11

Added VBD. and VIF.qos_supported_algorithms fields, with C bindings, Xend
implementation to follow.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Feb 21 23:03:00 2007 +0000 (2007-02-21)
parents bab07bed5c0a
children cfd23ac1b32a
line source
1 /*
2 * Copyright (c) 2006-2007, 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_VIF_H
20 #define XEN_VIF_H
22 #include "xen_common.h"
23 #include "xen_network_decl.h"
24 #include "xen_string_set.h"
25 #include "xen_string_string_map.h"
26 #include "xen_vif_decl.h"
27 #include "xen_vif_metrics_decl.h"
28 #include "xen_vm_decl.h"
31 /*
32 * The VIF class.
33 *
34 * A virtual network interface.
35 */
38 /**
39 * Free the given xen_vif. The given handle must have been allocated
40 * by this library.
41 */
42 extern void
43 xen_vif_free(xen_vif vif);
46 typedef struct xen_vif_set
47 {
48 size_t size;
49 xen_vif *contents[];
50 } xen_vif_set;
52 /**
53 * Allocate a xen_vif_set of the given size.
54 */
55 extern xen_vif_set *
56 xen_vif_set_alloc(size_t size);
58 /**
59 * Free the given xen_vif_set. The given set must have been allocated
60 * by this library.
61 */
62 extern void
63 xen_vif_set_free(xen_vif_set *set);
66 typedef struct xen_vif_record
67 {
68 xen_vif handle;
69 char *uuid;
70 char *device;
71 struct xen_network_record_opt *network;
72 struct xen_vm_record_opt *vm;
73 char *mac;
74 int64_t mtu;
75 char *qos_algorithm_type;
76 xen_string_string_map *qos_algorithm_params;
77 struct xen_string_set *qos_supported_algorithms;
78 struct xen_vif_metrics_record_opt *metrics;
79 } xen_vif_record;
81 /**
82 * Allocate a xen_vif_record.
83 */
84 extern xen_vif_record *
85 xen_vif_record_alloc(void);
87 /**
88 * Free the given xen_vif_record, and all referenced values. The given
89 * record must have been allocated by this library.
90 */
91 extern void
92 xen_vif_record_free(xen_vif_record *record);
95 typedef struct xen_vif_record_opt
96 {
97 bool is_record;
98 union
99 {
100 xen_vif handle;
101 xen_vif_record *record;
102 } u;
103 } xen_vif_record_opt;
105 /**
106 * Allocate a xen_vif_record_opt.
107 */
108 extern xen_vif_record_opt *
109 xen_vif_record_opt_alloc(void);
111 /**
112 * Free the given xen_vif_record_opt, and all referenced values. The
113 * given record_opt must have been allocated by this library.
114 */
115 extern void
116 xen_vif_record_opt_free(xen_vif_record_opt *record_opt);
119 typedef struct xen_vif_record_set
120 {
121 size_t size;
122 xen_vif_record *contents[];
123 } xen_vif_record_set;
125 /**
126 * Allocate a xen_vif_record_set of the given size.
127 */
128 extern xen_vif_record_set *
129 xen_vif_record_set_alloc(size_t size);
131 /**
132 * Free the given xen_vif_record_set, and all referenced values. The
133 * given set must have been allocated by this library.
134 */
135 extern void
136 xen_vif_record_set_free(xen_vif_record_set *set);
140 typedef struct xen_vif_record_opt_set
141 {
142 size_t size;
143 xen_vif_record_opt *contents[];
144 } xen_vif_record_opt_set;
146 /**
147 * Allocate a xen_vif_record_opt_set of the given size.
148 */
149 extern xen_vif_record_opt_set *
150 xen_vif_record_opt_set_alloc(size_t size);
152 /**
153 * Free the given xen_vif_record_opt_set, and all referenced values.
154 * The given set must have been allocated by this library.
155 */
156 extern void
157 xen_vif_record_opt_set_free(xen_vif_record_opt_set *set);
160 /**
161 * Get a record containing the current state of the given VIF.
162 */
163 extern bool
164 xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif);
167 /**
168 * Get a reference to the VIF instance with the specified UUID.
169 */
170 extern bool
171 xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid);
174 /**
175 * Create a new VIF instance, and return its handle.
176 */
177 extern bool
178 xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record);
181 /**
182 * Destroy the specified VIF instance.
183 */
184 extern bool
185 xen_vif_destroy(xen_session *session, xen_vif vif);
188 /**
189 * Get the uuid field of the given VIF.
190 */
191 extern bool
192 xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
195 /**
196 * Get the device field of the given VIF.
197 */
198 extern bool
199 xen_vif_get_device(xen_session *session, char **result, xen_vif vif);
202 /**
203 * Get the network field of the given VIF.
204 */
205 extern bool
206 xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif);
209 /**
210 * Get the VM field of the given VIF.
211 */
212 extern bool
213 xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif);
216 /**
217 * Get the MAC field of the given VIF.
218 */
219 extern bool
220 xen_vif_get_mac(xen_session *session, char **result, xen_vif vif);
223 /**
224 * Get the MTU field of the given VIF.
225 */
226 extern bool
227 xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif);
230 /**
231 * Get the qos/algorithm_type field of the given VIF.
232 */
233 extern bool
234 xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif);
237 /**
238 * Get the qos/algorithm_params field of the given VIF.
239 */
240 extern bool
241 xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif);
244 /**
245 * Get the qos/supported_algorithms field of the given VIF.
246 */
247 extern bool
248 xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif);
251 /**
252 * Get the metrics field of the given VIF.
253 */
254 extern bool
255 xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif);
258 /**
259 * Set the device field of the given VIF.
260 */
261 extern bool
262 xen_vif_set_device(xen_session *session, xen_vif vif, char *device);
265 /**
266 * Set the MAC field of the given VIF.
267 */
268 extern bool
269 xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac);
272 /**
273 * Set the MTU field of the given VIF.
274 */
275 extern bool
276 xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
279 /**
280 * Set the qos/algorithm_type field of the given VIF.
281 */
282 extern bool
283 xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type);
286 /**
287 * Set the qos/algorithm_params field of the given VIF.
288 */
289 extern bool
290 xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params);
293 /**
294 * Add the given key-value pair to the qos/algorithm_params field of
295 * the given VIF.
296 */
297 extern bool
298 xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value);
301 /**
302 * Remove the given key and its corresponding value from the
303 * qos/algorithm_params field of the given VIF. If the key is not in that
304 * Map, then do nothing.
305 */
306 extern bool
307 xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key);
310 #endif