debuggers.hg

view tools/libxen/include/xen/api/xen_vtpm.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 /*
2 * Copyright (c) 2006-2007, 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/api/xen_common.h>
24 #include <xen/api/xen_vm_decl.h>
25 #include <xen/api/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_string_string_map *other_config;
70 } xen_vtpm_record;
72 /**
73 * Allocate a xen_vtpm_record.
74 */
75 extern xen_vtpm_record *
76 xen_vtpm_record_alloc(void);
78 /**
79 * Free the given xen_vtpm_record, and all referenced values. The
80 * given record must have been allocated by this library.
81 */
82 extern void
83 xen_vtpm_record_free(xen_vtpm_record *record);
86 typedef struct xen_vtpm_record_opt
87 {
88 bool is_record;
89 union
90 {
91 xen_vtpm handle;
92 xen_vtpm_record *record;
93 } u;
94 } xen_vtpm_record_opt;
96 /**
97 * Allocate a xen_vtpm_record_opt.
98 */
99 extern xen_vtpm_record_opt *
100 xen_vtpm_record_opt_alloc(void);
102 /**
103 * Free the given xen_vtpm_record_opt, and all referenced values. The
104 * given record_opt must have been allocated by this library.
105 */
106 extern void
107 xen_vtpm_record_opt_free(xen_vtpm_record_opt *record_opt);
110 typedef struct xen_vtpm_record_set
111 {
112 size_t size;
113 xen_vtpm_record *contents[];
114 } xen_vtpm_record_set;
116 /**
117 * Allocate a xen_vtpm_record_set of the given size.
118 */
119 extern xen_vtpm_record_set *
120 xen_vtpm_record_set_alloc(size_t size);
122 /**
123 * Free the given xen_vtpm_record_set, and all referenced values. The
124 * given set must have been allocated by this library.
125 */
126 extern void
127 xen_vtpm_record_set_free(xen_vtpm_record_set *set);
131 typedef struct xen_vtpm_record_opt_set
132 {
133 size_t size;
134 xen_vtpm_record_opt *contents[];
135 } xen_vtpm_record_opt_set;
137 /**
138 * Allocate a xen_vtpm_record_opt_set of the given size.
139 */
140 extern xen_vtpm_record_opt_set *
141 xen_vtpm_record_opt_set_alloc(size_t size);
143 /**
144 * Free the given xen_vtpm_record_opt_set, and all referenced values.
145 * The given set must have been allocated by this library.
146 */
147 extern void
148 xen_vtpm_record_opt_set_free(xen_vtpm_record_opt_set *set);
151 /**
152 * Get a record containing the current state of the given VTPM.
153 */
154 extern bool
155 xen_vtpm_get_record(xen_session *session, xen_vtpm_record **result, xen_vtpm vtpm);
158 /**
159 * Get a reference to the VTPM instance with the specified UUID.
160 */
161 extern bool
162 xen_vtpm_get_by_uuid(xen_session *session, xen_vtpm *result, char *uuid);
165 /**
166 * Create a new VTPM instance, and return its handle.
167 */
168 extern bool
169 xen_vtpm_create(xen_session *session, xen_vtpm *result, xen_vtpm_record *record);
172 /**
173 * Destroy the specified VTPM instance.
174 */
175 extern bool
176 xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
179 /**
180 * Get the uuid field of the given VTPM.
181 */
182 extern bool
183 xen_vtpm_get_uuid(xen_session *session, char **result, xen_vtpm vtpm);
186 /**
187 * Get the VM field of the given VTPM.
188 */
189 extern bool
190 xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm);
193 /**
194 * Get the backend field of the given VTPM.
195 */
196 extern bool
197 xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
200 /**
201 * Get the other_config field of the given VTPM.
202 */
203 extern bool
204 xen_vtpm_get_other_config(xen_session *session,
205 xen_string_string_map **result,
206 xen_vtpm vtpm);
209 /**
210 * Set the other_config field of the given VTPM.
211 */
212 extern bool
213 xen_vtpm_set_other_config(xen_session *session,
214 xen_vtpm vtpm,
215 xen_string_string_map *other_config);
218 #endif