| 1 | /** |
| 2 | * @file elements.h |
| 3 | */ |
| 4 | |
| 5 | /* |
| 6 | * Copyright 2009--2014 Red Hat Inc., Durham, North Carolina. |
| 7 | * All Rights Reserved. |
| 8 | * |
| 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2.1 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public |
| 20 | * License along with this library; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | * |
| 23 | * Authors: |
| 24 | * Maros Barabas <[email protected]> |
| 25 | */ |
| 26 | |
| 27 | #ifndef OSCAP_ELEMENTS_H_ |
| 28 | #define OSCAP_ELEMENTS_H_cxx . . $ `src/common/elements.h:28:9`! |
| 29 | |
| 30 | #include <libxml/xmlreader.h> |
| 31 | #include <libxml/xmlwriter.h> |
| 32 | #include <stdbool.h> |
| 33 | #include <time.h> |
| 34 | #include "public/oscap.h"cxx . . $ `<file>/src/common/public/oscap.h`/ |
| 35 | #include "util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 36 | |
| 37 | #define OSCAP_XMLNS_XSIcxx . . $ `src/common/elements.h:37:9`! BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "http://www.w3.org/2001/XMLSchema-instance" |
| 38 | |
| 39 | /// boolean to string (and vice versa) conversion map |
| 40 | extern const struct oscap_string_mapcxx . . $ oscap_string_map# OSCAP_BOOL_MAPcxx . . $ OSCAP_BOOL_MAP.[]; |
| 41 | |
| 42 | typedef void (*oscap_xml_value_consumercxx . . $ oscap_xml_value_consumer#) (char *, void *); |
| 43 | int oscap_parser_text_valuecxx . . $ oscap_parser_text_value(23cd2d9646b6359b).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, oscap_xml_value_consumercxx . . $ oscap_xml_value_consumer# consumer, void *user); |
| 44 | void oscap_text_consumercxx . . $ oscap_text_consumer(75961c4613ebf8f5).(char *text, void *user); |
| 45 | |
| 46 | /// find starting element at given depth (returns false if none found) |
| 47 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, int depth); |
| 48 | /// get a copy of a string contained by current element |
| 49 | char *oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 50 | /// get a string contained by current element |
| 51 | const char *oscap_element_string_getcxx . . $ oscap_element_string_get(fcb9bb882cfd5f9d).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 52 | /// get depth of current element |
| 53 | int oscap_element_depthcxx . . $ oscap_element_depth(82a242a19623f75).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 54 | /// get xml content of current element as a string |
| 55 | char *oscap_get_xmlcxx . . $ oscap_get_xml(93c99f8009311dd0).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 56 | /// get date from a string |
| 57 | time_tcxx . . $ time_t# oscap_get_datecxx . . $ oscap_get_date(3c95bd14d5d5d286).(const char *date); |
| 58 | /// get datetime from a string |
| 59 | time_tcxx . . $ time_t# oscap_get_datetimecxx . . $ oscap_get_datetime(3c95bd14d5d5d286).(const char *date); |
| 60 | /// convert a piece of XML string to DOM |
| 61 | xmlNodecxx . . $ xmlNode# *oscap_xmlstr_to_domcxx . . $ oscap_xmlstr_to_dom(5514c3fae3f75267).(xmlNodecxx . . $ xmlNode# *parent, const char *elname, const char *content); |
| 62 | |
| 63 | /** |
| 64 | * Save XML Document to the file of the given filename. |
| 65 | * @param filename path to the file |
| 66 | * @param doc the XML document content |
| 67 | * @return 1 on success, -1 on failure (oscap_seterr is set appropriately). |
| 68 | */ |
| 69 | int oscap_xml_save_filenamecxx . . $ oscap_xml_save_filename(4641885591a9fcee).(const char *filename, xmlDocPtrcxx . . $ xmlDocPtr# doc); |
| 70 | |
| 71 | /** |
| 72 | * Save XML Document to the given file descriptor. |
| 73 | * The file descriptor isn't closed by this function. |
| 74 | * @param fd file descriptor |
| 75 | * @param doc the XML document content |
| 76 | * @return 1 on success, -1 on failure (oscap_seterr is set appropriately). |
| 77 | */ |
| 78 | int oscap_xml_save_fdcxx . . $ oscap_xml_save_fd(1ac6e7a5d64265a7).(int fd, xmlDocPtrcxx . . $ xmlDocPtr# doc); |
| 79 | |
| 80 | /** |
| 81 | * Save XML Document to the file of the given filename and dispose the document afterwards. |
| 82 | * @param filename path to the file |
| 83 | * @param doc the XML document content |
| 84 | * @return 1 on success, -1 on failure (oscap_seterr is set appropriatly). |
| 85 | */ |
| 86 | int oscap_xml_save_filename_freecxx . . $ oscap_xml_save_filename_free(4641885591a9fcee).(const char *filename, xmlDocPtrcxx . . $ xmlDocPtr# doc); |
| 87 | |
| 88 | xmlNscxx . . $ xmlNs# *lookup_xsi_nscxx . . $ lookup_xsi_ns(3e517de3a327c4f9).(xmlDoccxx . . $ xmlDoc# *doc); |
| 89 | |
| 90 | #endif |