mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-02 11:21:12 +00:00
64b3019d69
* 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.
55 lines
1.5 KiB
C
55 lines
1.5 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 "internal.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;
|
|
} s;
|
|
char *value;
|
|
} u;
|
|
};
|
|
|
|
/* conversion to/from strings */
|
|
size_t sexpr2string(const 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(const struct sexpr *car, const struct sexpr *cdr);
|
|
struct sexpr *sexpr_append(struct sexpr *lst, const struct sexpr *item);
|
|
void sexpr_free(struct sexpr *sexpr);
|
|
|
|
/* lookup in S-Expressions */
|
|
const char *sexpr_node(const struct sexpr *sexpr, const char *node);
|
|
const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
|
|
ATTRIBUTE_FORMAT(printf,2,3);
|
|
struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
|
|
int sexpr_has(struct sexpr *sexpr, const char *node);
|
|
#endif
|