ia64/xen-unstable

view tools/libxen/include/xen_pif.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 7261e0d4b7df
children 42dd9055ee1f
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_PIF_H
20 #define XEN_PIF_H
22 #include "xen_common.h"
23 #include "xen_host_decl.h"
24 #include "xen_network_decl.h"
25 #include "xen_pif_decl.h"
26 #include "xen_pif_metrics_decl.h"
29 /*
30 * The PIF class.
31 *
32 * A physical network interface (note separate VLANs are represented as
33 * several PIFs).
34 */
37 /**
38 * Free the given xen_pif. The given handle must have been allocated
39 * by this library.
40 */
41 extern void
42 xen_pif_free(xen_pif pif);
45 typedef struct xen_pif_set
46 {
47 size_t size;
48 xen_pif *contents[];
49 } xen_pif_set;
51 /**
52 * Allocate a xen_pif_set of the given size.
53 */
54 extern xen_pif_set *
55 xen_pif_set_alloc(size_t size);
57 /**
58 * Free the given xen_pif_set. The given set must have been allocated
59 * by this library.
60 */
61 extern void
62 xen_pif_set_free(xen_pif_set *set);
65 typedef struct xen_pif_record
66 {
67 xen_pif handle;
68 char *uuid;
69 char *device;
70 struct xen_network_record_opt *network;
71 struct xen_host_record_opt *host;
72 char *mac;
73 int64_t mtu;
74 int64_t vlan;
75 struct xen_pif_metrics_record_opt *metrics;
76 } xen_pif_record;
78 /**
79 * Allocate a xen_pif_record.
80 */
81 extern xen_pif_record *
82 xen_pif_record_alloc(void);
84 /**
85 * Free the given xen_pif_record, and all referenced values. The given
86 * record must have been allocated by this library.
87 */
88 extern void
89 xen_pif_record_free(xen_pif_record *record);
92 typedef struct xen_pif_record_opt
93 {
94 bool is_record;
95 union
96 {
97 xen_pif handle;
98 xen_pif_record *record;
99 } u;
100 } xen_pif_record_opt;
102 /**
103 * Allocate a xen_pif_record_opt.
104 */
105 extern xen_pif_record_opt *
106 xen_pif_record_opt_alloc(void);
108 /**
109 * Free the given xen_pif_record_opt, and all referenced values. The
110 * given record_opt must have been allocated by this library.
111 */
112 extern void
113 xen_pif_record_opt_free(xen_pif_record_opt *record_opt);
116 typedef struct xen_pif_record_set
117 {
118 size_t size;
119 xen_pif_record *contents[];
120 } xen_pif_record_set;
122 /**
123 * Allocate a xen_pif_record_set of the given size.
124 */
125 extern xen_pif_record_set *
126 xen_pif_record_set_alloc(size_t size);
128 /**
129 * Free the given xen_pif_record_set, and all referenced values. The
130 * given set must have been allocated by this library.
131 */
132 extern void
133 xen_pif_record_set_free(xen_pif_record_set *set);
137 typedef struct xen_pif_record_opt_set
138 {
139 size_t size;
140 xen_pif_record_opt *contents[];
141 } xen_pif_record_opt_set;
143 /**
144 * Allocate a xen_pif_record_opt_set of the given size.
145 */
146 extern xen_pif_record_opt_set *
147 xen_pif_record_opt_set_alloc(size_t size);
149 /**
150 * Free the given xen_pif_record_opt_set, and all referenced values.
151 * The given set must have been allocated by this library.
152 */
153 extern void
154 xen_pif_record_opt_set_free(xen_pif_record_opt_set *set);
157 /**
158 * Get a record containing the current state of the given PIF.
159 */
160 extern bool
161 xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif);
164 /**
165 * Get a reference to the PIF instance with the specified UUID.
166 */
167 extern bool
168 xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid);
171 /**
172 * Get the uuid field of the given PIF.
173 */
174 extern bool
175 xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif);
178 /**
179 * Get the device field of the given PIF.
180 */
181 extern bool
182 xen_pif_get_device(xen_session *session, char **result, xen_pif pif);
185 /**
186 * Get the network field of the given PIF.
187 */
188 extern bool
189 xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif);
192 /**
193 * Get the host field of the given PIF.
194 */
195 extern bool
196 xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif);
199 /**
200 * Get the MAC field of the given PIF.
201 */
202 extern bool
203 xen_pif_get_mac(xen_session *session, char **result, xen_pif pif);
206 /**
207 * Get the MTU field of the given PIF.
208 */
209 extern bool
210 xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif);
213 /**
214 * Get the VLAN field of the given PIF.
215 */
216 extern bool
217 xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif);
220 /**
221 * Get the metrics field of the given PIF.
222 */
223 extern bool
224 xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif);
227 /**
228 * Set the device field of the given PIF.
229 */
230 extern bool
231 xen_pif_set_device(xen_session *session, xen_pif pif, char *device);
234 /**
235 * Set the MAC field of the given PIF.
236 */
237 extern bool
238 xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac);
241 /**
242 * Set the MTU field of the given PIF.
243 */
244 extern bool
245 xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu);
248 /**
249 * Set the VLAN field of the given PIF.
250 */
251 extern bool
252 xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan);
255 /**
256 * Create a VLAN interface from an existing physical interface
257 */
258 extern bool
259 xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan);
262 /**
263 * Destroy the interface (provided it is a synthetic interface like a
264 * VLAN; fail if it is a physical interface)
265 */
266 extern bool
267 xen_pif_destroy(xen_session *session, xen_pif self);
270 #endif