s/PKCS/PKI
[pwmd.git] / src / xml.h
blobb07eb372e7157519303cefd03b92fb01d8806259
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef XML_H
21 #define XML_H
23 #include <libxml/tree.h>
24 #include <libxml/parser.h>
25 #include <libxml/xpath.h>
27 #include "util-string.h"
29 struct element_list_s
31 struct slist_s *list;
32 char **elements;
33 char *prefix;
34 int resolving;
35 int recurse;
36 int verbose;
37 int with_target;
38 char **req;
41 gpg_error_t new_root_element (xmlDocPtr doc, char *name);
42 xmlDocPtr new_document (void);
43 gpg_error_t list_root_elements (xmlDocPtr doc, struct string_s **, int, int);
44 int valid_xml_element (xmlChar * element);
45 xmlNodePtr find_elements (xmlDocPtr doc, xmlNodePtr node,
46 char **req, gpg_error_t * error, int *target,
47 xmlNodePtr (*found_fn) (xmlNodePtr, char **,
48 gpg_error_t *, char **,
49 void *),
50 xmlNodePtr (*not_found_fn) (xmlNodePtr, char **,
51 gpg_error_t *, void *),
52 int is_list_command, int recursion_depth,
53 void *data, int stop);
54 xmlNodePtr find_root_element (xmlDocPtr doc, char ***req, gpg_error_t * error,
55 int *target, int recursion_depth, int stop);
56 xmlNodePtr create_elements_cb (xmlNodePtr node, char **elements,
57 gpg_error_t * error, void *data);
58 xmlNodePtr create_target_elements_cb (xmlNodePtr node, char **elements,
59 gpg_error_t * error, void *data);
60 int is_literal_element (char **element);
61 int valid_element_path (char **path, int content);
62 xmlNodePtr find_text_node (xmlNodePtr node);
63 gpg_error_t create_path_list (xmlDocPtr doc, struct element_list_s *elements,
64 char *path);
65 gpg_error_t recurse_xpath_nodeset (xmlDocPtr doc, xmlNodeSetPtr nodes,
66 xmlChar * value, xmlBufferPtr * result,
67 int, const xmlChar *);
68 gpg_error_t add_attribute (xmlNodePtr node, const char *name,
69 const char *value);
70 xmlChar *node_has_attribute (xmlNodePtr n, xmlChar * attr);
71 gpg_error_t delete_attribute (xmlNodePtr n, const xmlChar * name);
72 gpg_error_t convert_pre_212_elements (xmlDocPtr doc);
73 gpg_error_t validate_import (xmlNodePtr);
74 xmlNodePtr find_element (xmlNodePtr node, char *element, xmlNodePtr stop);
75 gpg_error_t update_element_mtime (xmlNodePtr n);
76 gpg_error_t unlink_node (xmlNodePtr n);
77 xmlDocPtr parse_doc (const char *xml, size_t len);
78 gpg_error_t attr_ctime (xmlNodePtr n);
79 gpg_error_t build_realpath (xmlDocPtr doc, char *line,
80 struct string_s **result);
81 gpg_error_t validate_target_attribute (xmlDocPtr doc, const char *src,
82 xmlNodePtr dst);
84 #endif