ia64/xen-unstable

view tools/libxen/include/xen_vtpm.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 37fd1cf9019d
children
line source
1 /*
2 * Copyright (c) 2006, XenSource Inc.
3 * Copyright (c) 2006, IBM Corp.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
20 #ifndef XEN_VTPM_H
21 #define XEN_VTPM_H
23 #include "xen_common.h"
24 #include "xen_vm_decl.h"
25 #include "xen_vtpm_decl.h"
28 /*
29 * The VTPM class.
30 *
31 * A virtual TPM device.
32 */
35 /**
36 * Free the given xen_vtpm. The given handle must have been allocated
37 * by this library.
38 */
39 extern void
40 xen_vtpm_free(xen_vtpm vtpm);
43 typedef struct xen_vtpm_set
44 {
45 size_t size;
46 xen_vtpm *contents[];
47 } xen_vtpm_set;
49 /**
50 * Allocate a xen_vtpm_set of the given size.
51 */
52 extern xen_vtpm_set *
53 xen_vtpm_set_alloc(size_t size);
55 /**
56 * Free the given xen_vtpm_set. The given set must have been allocated
57 * by this library.
58 */
59 extern void
60 xen_vtpm_set_free(xen_vtpm_set *set);
63 typedef struct xen_vtpm_record
64 {
65 xen_vtpm handle;
66 char *uuid;
67 struct xen_vm_record_opt *vm;
68 struct xen_vm_record_opt *backend;
69 } xen_vtpm_record;
71 /**
72 * Allocate a xen_vtpm_record.
73 */
74 extern xen_vtpm_record *
75 xen_vtpm_record_alloc(void);
77 /**
78 * Free the given xen_vtpm_record, and all referenced values. The
79 * given record must have been allocated by this library.
80 */
81 extern void
82 xen_vtpm_record_free(xen_vtpm_record *record);
85 typedef struct xen_vtpm_record_opt
86 {
87 bool is_record;
88 union
89 {
90 xen_vtpm handle;
91 xen_vtpm_record *record;
92 } u;
93 } xen_vtpm_record_opt;
95 /**
96 * Allocate a xen_vtpm_record_opt.
97 */
98 extern xen_vtpm_record_opt *
99 xen_vtpm_record_opt_alloc(void);
101 /**
102 * Free the given xen_vtpm_record_opt, and all referenced values. The
103 * given record_opt must have been allocated by this library.
104 */
105 extern void
106 xen_vtpm_record_opt_free(xen_vtpm_record_opt *record_opt);
109 typedef struct xen_vtpm_record_set
110 {
111 size_t size;
112 xen_vtpm_record *contents[];
113 } xen_vtpm_record_set;
115 /**
116 * Allocate a xen_vtpm_record_set of the given size.
117 */
118 extern xen_vtpm_record_set *
119 xen_vtpm_record_set_alloc(size_t size);
121 /**
122 * Free the given xen_vtpm_record_set, and all referenced values. The
123 * given set must have been allocated by this library.
124 */
125 extern void
126 xen_vtpm_record_set_free(xen_vtpm_record_set *set);
130 typedef struct xen_vtpm_record_opt_set
131 {
132 size_t size;
133 xen_vtpm_record_opt *contents[];
134 } xen_vtpm_record_opt_set;
136 /**
137 * Allocate a xen_vtpm_record_opt_set of the given size.
138 */
139 extern xen_vtpm_record_opt_set *
140 xen_vtpm_record_opt_set_alloc(size_t size);
142 /**
143 * Free the given xen_vtpm_record_opt_set, and all referenced values.
144 * The given set must have been allocated by this library.
145 */
146 extern void
147 xen_vtpm_record_opt_set_free(xen_vtpm_record_opt_set *set);
150 /**
151 * Get a record containing the current state of the given VTPM.
152 */
153 extern bool
154 xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm);
157 /**
158 * Get a reference to the VTPM instance with the specified UUID.
159 */
160 extern bool
161 xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid);
164 /**
165 * Create a new VTPM instance, and return its handle.
166 */
167 extern bool
168 xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record);
171 /**
172 * Destroy the specified VTPM instance.
173 */
174 extern bool
175 xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
178 /**
179 * Get the uuid field of the given VTPM.
180 */
181 extern bool
182 xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm);
185 /**
186 * Get the VM field of the given VTPM.
187 */
188 extern bool
189 xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm);
192 /**
193 * Get the backend field of the given VTPM.
194 */
195 extern bool
196 xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
198 #endif