ia64/xen-unstable

view tools/libxen/include/xen_vif.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 0a422c8c3144
children 0aa6755159d5
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_VIF_H
20 #define XEN_VIF_H
22 #include "xen_common.h"
23 #include "xen_network_decl.h"
24 #include "xen_vif_decl.h"
25 #include "xen_vm_decl.h"
28 /*
29 * The VIF class.
30 *
31 * A virtual network interface.
32 */
35 /**
36 * Free the given xen_vif. The given handle must have been allocated
37 * by this library.
38 */
39 extern void
40 xen_vif_free(xen_vif vif);
43 typedef struct xen_vif_set
44 {
45 size_t size;
46 xen_vif *contents[];
47 } xen_vif_set;
49 /**
50 * Allocate a xen_vif_set of the given size.
51 */
52 extern xen_vif_set *
53 xen_vif_set_alloc(size_t size);
55 /**
56 * Free the given xen_vif_set. The given set must have been allocated
57 * by this library.
58 */
59 extern void
60 xen_vif_set_free(xen_vif_set *set);
63 typedef struct xen_vif_record
64 {
65 xen_vif handle;
66 char *uuid;
67 char *device;
68 struct xen_network_record_opt *network;
69 struct xen_vm_record_opt *vm;
70 char *mac;
71 int64_t mtu;
72 double io_read_kbs;
73 double io_write_kbs;
74 } xen_vif_record;
76 /**
77 * Allocate a xen_vif_record.
78 */
79 extern xen_vif_record *
80 xen_vif_record_alloc(void);
82 /**
83 * Free the given xen_vif_record, and all referenced values. The given
84 * record must have been allocated by this library.
85 */
86 extern void
87 xen_vif_record_free(xen_vif_record *record);
90 typedef struct xen_vif_record_opt
91 {
92 bool is_record;
93 union
94 {
95 xen_vif handle;
96 xen_vif_record *record;
97 } u;
98 } xen_vif_record_opt;
100 /**
101 * Allocate a xen_vif_record_opt.
102 */
103 extern xen_vif_record_opt *
104 xen_vif_record_opt_alloc(void);
106 /**
107 * Free the given xen_vif_record_opt, and all referenced values. The
108 * given record_opt must have been allocated by this library.
109 */
110 extern void
111 xen_vif_record_opt_free(xen_vif_record_opt *record_opt);
114 typedef struct xen_vif_record_set
115 {
116 size_t size;
117 xen_vif_record *contents[];
118 } xen_vif_record_set;
120 /**
121 * Allocate a xen_vif_record_set of the given size.
122 */
123 extern xen_vif_record_set *
124 xen_vif_record_set_alloc(size_t size);
126 /**
127 * Free the given xen_vif_record_set, and all referenced values. The
128 * given set must have been allocated by this library.
129 */
130 extern void
131 xen_vif_record_set_free(xen_vif_record_set *set);
135 typedef struct xen_vif_record_opt_set
136 {
137 size_t size;
138 xen_vif_record_opt *contents[];
139 } xen_vif_record_opt_set;
141 /**
142 * Allocate a xen_vif_record_opt_set of the given size.
143 */
144 extern xen_vif_record_opt_set *
145 xen_vif_record_opt_set_alloc(size_t size);
147 /**
148 * Free the given xen_vif_record_opt_set, and all referenced values.
149 * The given set must have been allocated by this library.
150 */
151 extern void
152 xen_vif_record_opt_set_free(xen_vif_record_opt_set *set);
155 /**
156 * Get a record containing the current state of the given VIF.
157 */
158 extern bool
159 xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif);
162 /**
163 * Get a reference to the VIF instance with the specified UUID.
164 */
165 extern bool
166 xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid);
169 /**
170 * Create a new VIF instance, and return its handle.
171 */
172 extern bool
173 xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record);
176 /**
177 * Destroy the specified VIF instance.
178 */
179 extern bool
180 xen_vif_destroy(xen_session *session, xen_vif vif);
183 /**
184 * Get the uuid field of the given VIF.
185 */
186 extern bool
187 xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
190 /**
191 * Get the device field of the given VIF.
192 */
193 extern bool
194 xen_vif_get_device(xen_session *session, char **result, xen_vif vif);
197 /**
198 * Get the network field of the given VIF.
199 */
200 extern bool
201 xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif);
204 /**
205 * Get the VM field of the given VIF.
206 */
207 extern bool
208 xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif);
211 /**
212 * Get the MAC field of the given VIF.
213 */
214 extern bool
215 xen_vif_get_mac(xen_session *session, char **result, xen_vif vif);
218 /**
219 * Get the MTU field of the given VIF.
220 */
221 extern bool
222 xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif);
225 /**
226 * Get the io/read_kbs field of the given VIF.
227 */
228 extern bool
229 xen_vif_get_io_read_kbs(xen_session *session, double *result, xen_vif vif);
232 /**
233 * Get the io/write_kbs field of the given VIF.
234 */
235 extern bool
236 xen_vif_get_io_write_kbs(xen_session *session, double *result, xen_vif vif);
239 /**
240 * Set the device field of the given VIF.
241 */
242 extern bool
243 xen_vif_set_device(xen_session *session, xen_vif vif, char *device);
246 /**
247 * Set the MAC field of the given VIF.
248 */
249 extern bool
250 xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac);
253 /**
254 * Set the MTU field of the given VIF.
255 */
256 extern bool
257 xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
260 #endif