libvirt/src/sexpr.h
Daniel Veillard 247cf7a3b2 * src/hash.c src/hash.h src/internal.h src/libvirt.c src/sexpr.c
src/sexpr.h src/virsh.c src/virterror.c src/xen_internal.c
  src/xen_internal.h src/xend_internal.c src/xend_internal.h
  src/xml.c src/xml.h: applied cb/indent to homogenize the source
  style, as a first pass.
Daniel
2006-03-15 12:13:25 +00:00

50 lines
1.3 KiB
C

/*
* 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_
#define _LIBVIR_SEXPR_H_
#include <sys/types.h>
enum sexpr_type {
SEXPR_NIL,
SEXPR_CONS,
SEXPR_VALUE,
};
struct sexpr {
enum sexpr_type kind;
union {
struct {
struct sexpr *car;
struct sexpr *cdr;
};
char *value;
};
};
/* conversion to/from strings */
size_t sexpr2string(struct sexpr *sexpr, char *buffer, size_t n_buffer);
struct sexpr *string2sexpr(const char *buffer);
/* constructors and destructors */
struct sexpr *sexpr_nil(void);
struct sexpr *sexpr_string(const char *str, ssize_t len);
struct sexpr *sexpr_cons(struct sexpr *car, struct sexpr *cdr);
struct sexpr *sexpr_append(struct sexpr *lst, struct sexpr *item);
void sexpr_free(struct sexpr *sexpr);
/* lookup in S-Expressions */
const char *sexpr_node(struct sexpr *sexpr, const char *node);
struct sexpr *sexpr_lookup(struct sexpr *sexpr, const char *node);
#endif