2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
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/>.
23 #include <libxml/tree.h>
24 #include <libxml/parser.h>
25 #include <libxml/xpath.h>
27 #include "util-misc.h"
29 #include "util-string.h"
44 gpg_error_t
new_root_element (struct client_s
*, xmlDocPtr doc
, char *name
);
45 xmlDocPtr
new_document (void);
46 gpg_error_t
list_root_elements (struct client_s
*, xmlDocPtr doc
,
47 struct string_s
**, int, int);
48 int valid_xml_element (xmlChar
* element
);
49 xmlNodePtr
find_elements (struct client_s
*, xmlDocPtr doc
, xmlNodePtr node
,
50 char **req
, gpg_error_t
* error
, int *target
,
51 xmlNodePtr (*found_fn
) (struct client_s
*,
53 gpg_error_t
*, char **,
55 xmlNodePtr (*not_found_fn
) (struct client_s
*, int,
57 gpg_error_t
*, void *),
58 int is_list_command
, int recursion_depth
,
59 void *data
, int stop
);
60 xmlNodePtr
find_root_element (struct client_s
*, xmlDocPtr doc
, char ***req
,
61 gpg_error_t
* error
, int *target
,
62 int recursion_depth
, int stop
);
63 xmlNodePtr
create_elements_cb (struct client_s
*, int verify
, xmlNodePtr node
,
64 char **elements
, gpg_error_t
* error
,
66 xmlNodePtr
create_target_elements_cb (struct client_s
*, int verify
,
67 xmlNodePtr node
, char **elements
,
68 gpg_error_t
* error
, void *data
);
69 int is_literal_element (char **element
);
70 int valid_element_path (char **path
, int content
);
71 xmlNodePtr
find_text_node (xmlNodePtr node
);
72 gpg_error_t
create_path_list (struct client_s
*, xmlDocPtr doc
,
73 struct element_list_s
*elements
, char *path
);
74 gpg_error_t
recurse_xpath_nodeset (struct client_s
*, xmlDocPtr doc
,
75 xmlNodeSetPtr nodes
, xmlChar
* value
,
76 xmlBufferPtr
* result
, int, const xmlChar
*);
77 gpg_error_t
add_attribute (struct client_s
*, xmlNodePtr node
,
78 const char *name
, const char *value
);
79 xmlChar
*node_has_attribute (xmlNodePtr n
, xmlChar
* attr
);
80 gpg_error_t
delete_attribute (struct client_s
*, xmlNodePtr n
,
81 const xmlChar
* name
);
82 gpg_error_t
convert_pre_212_elements (xmlDocPtr doc
);
83 gpg_error_t
validate_import (struct client_s
*, xmlNodePtr
);
84 xmlNodePtr
find_element (struct client_s
*, xmlNodePtr node
, char *element
,
85 xmlNodePtr stop
, gpg_error_t
*);
86 gpg_error_t
update_element_mtime (struct client_s
*, xmlNodePtr n
);
87 gpg_error_t
unlink_node (struct client_s
*, xmlNodePtr n
);
88 gpg_error_t
parse_doc (const char *xml
, size_t len
, xmlDocPtr
*doc
);
89 gpg_error_t
attr_ctime (struct client_s
*, xmlNodePtr n
);
90 gpg_error_t
build_realpath (struct client_s
*, xmlDocPtr doc
, char *line
,
91 struct string_s
**result
);
92 gpg_error_t
validate_target_attribute (struct client_s
*, xmlDocPtr doc
,
93 const char *src
, xmlNodePtr dst
);
94 int valid_xml_attribute (const char *str
);
95 gpg_error_t
is_element_owner (struct client_s
*, xmlNodePtr
);