2006-01-11 13:58:32 +00:00
|
|
|
/*
|
|
|
|
* sexpr.h : S-Expression interfaces needed to communicate with the Xen Daemon
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005
|
|
|
|
*
|
|
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. See the file COPYING.LIB in the main directory of this
|
|
|
|
* archive for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LIBVIR_SEXPR_H_
|
2010-03-09 18:22:22 +00:00
|
|
|
# define _LIBVIR_SEXPR_H_
|
2006-01-11 13:58:32 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2007-03-16 15:03:21 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include <sys/types.h>
|
2006-01-11 13:58:32 +00:00
|
|
|
|
|
|
|
enum sexpr_type {
|
|
|
|
SEXPR_NIL,
|
|
|
|
SEXPR_CONS,
|
|
|
|
SEXPR_VALUE,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sexpr {
|
|
|
|
enum sexpr_type kind;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
struct sexpr *car;
|
|
|
|
struct sexpr *cdr;
|
2007-09-29 18:16:26 +00:00
|
|
|
} s;
|
2006-01-11 13:58:32 +00:00
|
|
|
char *value;
|
2007-09-29 18:16:26 +00:00
|
|
|
} u;
|
2006-01-11 13:58:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* conversion to/from strings */
|
Adjust sexpr-related interfaces to be const-correct.
* src/sexpr.c (sexpr_cons, append, sexpr_append, sexpr2string)
(sexpr_lookup_key, sexpr_lookup, sexpr_node, sexpr_fmt_node):
Add "const" attribute where appropriate.
* src/xend_internal.c (sexpr_int, sexpr_float, sexpr_u64)
(sexpr_uuid, sexpr_to_xend_domain_info, sexpr_to_xend_node_info)
(sexpr_to_xend_topology_xml, sexpr_to_domain): Likewise.
* src/sexpr.h: Adjust prototypes.
2008-01-21 14:22:15 +00:00
|
|
|
size_t sexpr2string(const struct sexpr *sexpr, char *buffer, size_t n_buffer);
|
2006-03-15 12:13:25 +00:00
|
|
|
struct sexpr *string2sexpr(const char *buffer);
|
2006-01-11 13:58:32 +00:00
|
|
|
|
|
|
|
/* constructors and destructors */
|
2006-03-15 12:13:25 +00:00
|
|
|
struct sexpr *sexpr_nil(void);
|
|
|
|
struct sexpr *sexpr_string(const char *str, ssize_t len);
|
Adjust sexpr-related interfaces to be const-correct.
* src/sexpr.c (sexpr_cons, append, sexpr_append, sexpr2string)
(sexpr_lookup_key, sexpr_lookup, sexpr_node, sexpr_fmt_node):
Add "const" attribute where appropriate.
* src/xend_internal.c (sexpr_int, sexpr_float, sexpr_u64)
(sexpr_uuid, sexpr_to_xend_domain_info, sexpr_to_xend_node_info)
(sexpr_to_xend_topology_xml, sexpr_to_domain): Likewise.
* src/sexpr.h: Adjust prototypes.
2008-01-21 14:22:15 +00:00
|
|
|
struct sexpr *sexpr_cons(const struct sexpr *car, const struct sexpr *cdr);
|
|
|
|
struct sexpr *sexpr_append(struct sexpr *lst, const struct sexpr *item);
|
2006-03-15 12:13:25 +00:00
|
|
|
void sexpr_free(struct sexpr *sexpr);
|
2006-01-11 13:58:32 +00:00
|
|
|
|
|
|
|
/* lookup in S-Expressions */
|
Adjust sexpr-related interfaces to be const-correct.
* src/sexpr.c (sexpr_cons, append, sexpr_append, sexpr2string)
(sexpr_lookup_key, sexpr_lookup, sexpr_node, sexpr_fmt_node):
Add "const" attribute where appropriate.
* src/xend_internal.c (sexpr_int, sexpr_float, sexpr_u64)
(sexpr_uuid, sexpr_to_xend_domain_info, sexpr_to_xend_node_info)
(sexpr_to_xend_topology_xml, sexpr_to_domain): Likewise.
* src/sexpr.h: Adjust prototypes.
2008-01-21 14:22:15 +00:00
|
|
|
const char *sexpr_node(const struct sexpr *sexpr, const char *node);
|
2008-07-25 10:49:33 +00:00
|
|
|
int sexpr_node_copy(const struct sexpr *sexpr, const char *node, char **dst);
|
Adjust sexpr-related interfaces to be const-correct.
* src/sexpr.c (sexpr_cons, append, sexpr_append, sexpr2string)
(sexpr_lookup_key, sexpr_lookup, sexpr_node, sexpr_fmt_node):
Add "const" attribute where appropriate.
* src/xend_internal.c (sexpr_int, sexpr_float, sexpr_u64)
(sexpr_uuid, sexpr_to_xend_domain_info, sexpr_to_xend_node_info)
(sexpr_to_xend_topology_xml, sexpr_to_domain): Likewise.
* src/sexpr.h: Adjust prototypes.
2008-01-21 14:22:15 +00:00
|
|
|
const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
|
Fix misc Win32 compile warnings
GCC >= 4.4 assumes the 'printf' attribute refers to the native
runtime libraries format specifiers. Thanks to gnulib, libvirt
has GNU format specifiers everywhere. This means we need to
use 'gnu_printf' with GCC >= 4.4 to get correct compiler
checking of printf format specifiers.
* HACKING: Document new rules for ATTRIBUTE_FMT_PRINTF
* autobuild.sh, mingw32-libvirt.spec.in: Disable OpenNebula
driver on mingw32 builds
* qemud/dispatch.h, qemud/qemu.h, src/buf.h src/internal.h,
src/logging.h, src/security.h, src/sexpr.h, src/util.h,
src/virterror_internal.h, src/xend_internal.c: Change
over to ATTRIBUTE_FMT_PRINTF.
* src/virsh.c: Disable 'cd' and 'pwd' commands on Win32
since they don't compile
* src/threads-win32.c: Add missing return value check
2009-07-23 15:07:32 +00:00
|
|
|
ATTRIBUTE_FMT_PRINTF(2,3);
|
Adjust sexpr-related interfaces to be const-correct.
* src/sexpr.c (sexpr_cons, append, sexpr_append, sexpr2string)
(sexpr_lookup_key, sexpr_lookup, sexpr_node, sexpr_fmt_node):
Add "const" attribute where appropriate.
* src/xend_internal.c (sexpr_int, sexpr_float, sexpr_u64)
(sexpr_uuid, sexpr_to_xend_domain_info, sexpr_to_xend_node_info)
(sexpr_to_xend_topology_xml, sexpr_to_domain): Likewise.
* src/sexpr.h: Adjust prototypes.
2008-01-21 14:22:15 +00:00
|
|
|
struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
|
2008-08-01 14:43:12 +00:00
|
|
|
int sexpr_has(const struct sexpr *sexpr, const char *node);
|
2006-01-11 13:58:32 +00:00
|
|
|
#endif
|