ia64/xen-unstable

view tools/libxen/include/xen_console.h @ 14044:988b90c6b4f3

Added Console.other_config to the docs (Xend already has this).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 19:38:24 2007 +0000 (2007-02-20)
parents be35eed950da
children 42dd9055ee1f
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_CONSOLE_H
20 #define XEN_CONSOLE_H
22 #include "xen_common.h"
23 #include "xen_console_decl.h"
24 #include "xen_console_protocol.h"
25 #include "xen_string_string_map.h"
26 #include "xen_vm_decl.h"
29 /*
30 * The console class.
31 *
32 * A console.
33 */
36 /**
37 * Free the given xen_console. The given handle must have been
38 * allocated by this library.
39 */
40 extern void
41 xen_console_free(xen_console console);
44 typedef struct xen_console_set
45 {
46 size_t size;
47 xen_console *contents[];
48 } xen_console_set;
50 /**
51 * Allocate a xen_console_set of the given size.
52 */
53 extern xen_console_set *
54 xen_console_set_alloc(size_t size);
56 /**
57 * Free the given xen_console_set. The given set must have been
58 * allocated by this library.
59 */
60 extern void
61 xen_console_set_free(xen_console_set *set);
64 typedef struct xen_console_record
65 {
66 xen_console handle;
67 char *uuid;
68 enum xen_console_protocol protocol;
69 char *location;
70 struct xen_vm_record_opt *vm;
71 xen_string_string_map *other_config;
72 } xen_console_record;
74 /**
75 * Allocate a xen_console_record.
76 */
77 extern xen_console_record *
78 xen_console_record_alloc(void);
80 /**
81 * Free the given xen_console_record, and all referenced values. The
82 * given record must have been allocated by this library.
83 */
84 extern void
85 xen_console_record_free(xen_console_record *record);
88 typedef struct xen_console_record_opt
89 {
90 bool is_record;
91 union
92 {
93 xen_console handle;
94 xen_console_record *record;
95 } u;
96 } xen_console_record_opt;
98 /**
99 * Allocate a xen_console_record_opt.
100 */
101 extern xen_console_record_opt *
102 xen_console_record_opt_alloc(void);
104 /**
105 * Free the given xen_console_record_opt, and all referenced values.
106 * The given record_opt must have been allocated by this library.
107 */
108 extern void
109 xen_console_record_opt_free(xen_console_record_opt *record_opt);
112 typedef struct xen_console_record_set
113 {
114 size_t size;
115 xen_console_record *contents[];
116 } xen_console_record_set;
118 /**
119 * Allocate a xen_console_record_set of the given size.
120 */
121 extern xen_console_record_set *
122 xen_console_record_set_alloc(size_t size);
124 /**
125 * Free the given xen_console_record_set, and all referenced values.
126 * The given set must have been allocated by this library.
127 */
128 extern void
129 xen_console_record_set_free(xen_console_record_set *set);
133 typedef struct xen_console_record_opt_set
134 {
135 size_t size;
136 xen_console_record_opt *contents[];
137 } xen_console_record_opt_set;
139 /**
140 * Allocate a xen_console_record_opt_set of the given size.
141 */
142 extern xen_console_record_opt_set *
143 xen_console_record_opt_set_alloc(size_t size);
145 /**
146 * Free the given xen_console_record_opt_set, and all referenced
147 * values. The given set must have been allocated by this library.
148 */
149 extern void
150 xen_console_record_opt_set_free(xen_console_record_opt_set *set);
153 /**
154 * Get a record containing the current state of the given console.
155 */
156 extern bool
157 xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console);
160 /**
161 * Get a reference to the console instance with the specified UUID.
162 */
163 extern bool
164 xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid);
167 /**
168 * Create a new console instance, and return its handle.
169 */
170 extern bool
171 xen_console_create(xen_session *session, xen_console *result, xen_console_record *record);
174 /**
175 * Destroy the specified console instance.
176 */
177 extern bool
178 xen_console_destroy(xen_session *session, xen_console console);
181 /**
182 * Get the uuid field of the given console.
183 */
184 extern bool
185 xen_console_get_uuid(xen_session *session, char **result, xen_console console);
188 /**
189 * Get the protocol field of the given console.
190 */
191 extern bool
192 xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console);
195 /**
196 * Get the location field of the given console.
197 */
198 extern bool
199 xen_console_get_location(xen_session *session, char **result, xen_console console);
202 /**
203 * Get the VM field of the given console.
204 */
205 extern bool
206 xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console);
209 /**
210 * Get the other_config field of the given console.
211 */
212 extern bool
213 xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console);
216 /**
217 * Set the other_config field of the given console.
218 */
219 extern bool
220 xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config);
223 /**
224 * Add the given key-value pair to the other_config field of the given
225 * console.
226 */
227 extern bool
228 xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value);
231 /**
232 * Remove the given key and its corresponding value from the
233 * other_config field of the given console. If the key is not in that Map,
234 * then do nothing.
235 */
236 extern bool
237 xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key);
240 #endif