manager can query and list IKE_SA status (no layout yet)
[strongswan.git] / src / manager / lib / xml.h
1 /**
2 * @file xml.h
3 *
4 * @brief Interface of xml_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef XML_H_
24 #define XML_H_
25
26 #include <enumerator.h>
27
28 typedef struct xml_t xml_t;
29
30 /**
31 * @brief Simple enumerator based XML parser.
32 *
33 * An xml_t is a single node of the XML tree, but also serves as root node
34 * and therefore the document.
35 * This object has no destructor, the tree gets destroyed when all enumerator
36 * instances get destroyed.
37 */
38 struct xml_t {
39
40 /**
41 * @brief Create an enumerator over all children.
42 *
43 * Enumerated values must not be manipulated or freed.
44 *
45 * @return enumerator over (xml_t* child, char *name, char *value)
46 */
47 enumerator_t* (*children)(xml_t *this);
48
49 /**
50 * @brief Get an attribute value by its name.
51 *
52 * @param name name of the attribute
53 * @return attribute value, NULL if not found
54 */
55 char *(*get_attribute)(xml_t *this, char *name);
56 };
57
58 /**
59 * @brief Create a xml instance.
60 */
61 xml_t *xml_create(char *xml);
62
63 #endif /* XML_H_ */