2
* sexpr.h : S-Expression interfaces needed to communicate with the Xen Daemon
6
* Anthony Liguori <aliguori@us.ibm.com>
8
* This file is subject to the terms and conditions of the GNU Lesser General
9
* Public License. See the file COPYING.LIB in the main directory of this
10
* archive for more details.
13
#ifndef _LIBVIR_SEXPR_H_
14
# define _LIBVIR_SEXPR_H_
16
# include "internal.h"
19
# include <sys/types.h>
39
/* conversion to/from strings */
40
int sexpr2string(const struct sexpr *sexpr, virBufferPtr buffer);
41
struct sexpr *string2sexpr(const char *buffer);
43
/* constructors and destructors */
44
struct sexpr *sexpr_nil(void);
45
struct sexpr *sexpr_string(const char *str, ssize_t len);
46
struct sexpr *sexpr_cons(const struct sexpr *car, const struct sexpr *cdr);
47
struct sexpr *sexpr_append(struct sexpr *lst, const struct sexpr *item);
48
void sexpr_free(struct sexpr *sexpr);
50
/* lookup in S-Expressions */
51
const char *sexpr_node(const struct sexpr *sexpr, const char *node);
52
int sexpr_node_copy(const struct sexpr *sexpr, const char *node, char **dst);
53
const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
54
ATTRIBUTE_FMT_PRINTF(2,3);
55
struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
56
int sexpr_has(const struct sexpr *sexpr, const char *node);
58
int sexpr_int(const struct sexpr *sexpr, const char *name);
59
double sexpr_float(const struct sexpr *sexpr, const char *name);
60
uint64_t sexpr_u64(const struct sexpr *sexpr, const char *name);