ia64/xen-unstable

view tools/libxen/include/xen_common.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 01b1cbe3fedc
children af07c7b01893
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_COMMON_H
20 #define XEN_COMMON_H
23 #include <stdbool.h>
24 #include <stddef.h>
25 #include <stdint.h>
26 #include <time.h>
28 #include "xen_host_decl.h"
31 typedef bool (*xen_result_func)(const void *data, size_t len,
32 void *result_handle);
35 /**
36 * len does not include a terminating \0.
37 */
38 typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
39 void *result_handle,
40 xen_result_func result_func);
43 typedef struct
44 {
45 xen_call_func call_func;
46 void *handle;
47 const char *session_id;
48 bool ok;
49 char **error_description;
50 int error_description_count;
51 } xen_session;
54 struct xen_task_;
55 typedef struct xen_task_ * xen_task_id;
58 typedef struct
59 {
60 int progress;
61 long eta;
62 /* !!! RESULT */
63 } xen_task_status;
66 typedef struct
67 {
68 int major;
69 int minor;
70 int patch;
71 char *extraversion;
72 } xen_version;
75 /**
76 * Free the given xen_version, and all referenced values.
77 */
78 extern void xen_version_free(xen_version *version);
81 /**
82 * Return the version of this client-side library. This will be the major,
83 * minor, and extraversion of the Xen release with which it was released,
84 * plus the library's own version as the patch.
85 */
86 extern xen_version *xen_get_client_side_version();
89 extern bool
90 xen_uuid_string_to_bytes(char *uuid, char **bytes);
93 extern bool
94 xen_uuid_bytes_to_string(char *bytes, char **uuid);
97 extern void
98 xen_uuid_free(char *uuid);
101 extern void
102 xen_uuid_bytes_free(char *bytes);
105 /**
106 * Initialise this library. Call this before starting to use this library.
107 * Note that since this library depends upon libxml2, you should also call
108 * xmlInitParser as appropriate for your program.
109 */
110 extern
111 void xen_init(void);
114 /**
115 * Clear up this library. Call when you have finished using this library.
116 * Note that since this library depends upon libxml2, you should also call
117 * xmlCleanupParser as appropriate for your program.
118 */
119 extern
120 void xen_fini(void);
123 /**
124 * Log in at the server, and allocate a xen_session to represent this session.
125 */
126 extern xen_session *
127 xen_session_login_with_password(xen_call_func call_func, void *handle,
128 const char *uname, const char *pwd);
131 /**
132 * Log out at the server, and free the xen_session.
133 */
134 extern void
135 xen_session_logout(xen_session *session);
138 /**
139 * Set *result to be a handle to the host to which this session is connected.
140 */
141 extern int
142 xen_session_get_this_host(xen_session *session, xen_host *result);
145 #endif