| 1 | /* |
| 2 | * Copyright 2009,2010,2011 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * Lukas Kuklinek <[email protected]> |
| 21 | * Peter Vrabec <[email protected]> |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * @file |
| 26 | * General OpenScap functions and types. |
| 27 | * @author Lukas Kuklinek <[email protected]> |
| 28 | * |
| 29 | * @addtogroup COMMON |
| 30 | * @{ |
| 31 | */ |
| 32 | |
| 33 | #ifndef OSCAP_H_ |
| 34 | #define OSCAP_H_cxx . . $ `src/common/public/oscap.h:34:9`! |
| 35 | #include <stdbool.h> |
| 36 | |
| 37 | #include "oscap_text.h"cxx . . $ `<file>/src/common/public/oscap_text.h`/ |
| 38 | #include "oscap_reference.h"cxx . . $ `<file>/src/common/public/oscap_reference.h`/ |
| 39 | #include "oscap_export.h"cxx . . $ `<file>/src/common/public/oscap_export.h`/ |
| 40 | |
| 41 | /** |
| 42 | * This macro will warn, when a deprecated function is used. |
| 43 | */ |
| 44 | #if __GNUC__cxx . . $ `<built-in>:8:9`! > 3 || (__GNUC__cxx . . $ `<built-in>:8:9`! == 3 && __GNUC_MINOR__cxx . . $ `<built-in>:9:9`! >= 1) |
| 45 | # define OSCAP_DEPRECATEDcxx . . $ `src/common/public/oscap.h:45:10`!(func) func __attribute__ ((deprecated)) |
| 46 | #elif defined(_MSC_VER) |
| 47 | # define OSCAP_DEPRECATED(func) __declspec(deprecated) func |
| 48 | #else |
| 49 | # pragma message("WARNING: You need to implement OSCAP_DEPRECATED for this compiler---in order to get deprecation warnings.") |
| 50 | # define OSCAP_DEPRECATED(func) func |
| 51 | #endif |
| 52 | |
| 53 | /** |
| 54 | * Initialize OpenSCAP library. |
| 55 | * |
| 56 | * This is currently needed only in multithreaded applications |
| 57 | * (needs to be called before any child threads are spawned) |
| 58 | * or applications using the XSLT facility w/ EXSLT extensions. |
| 59 | * However, it is a good practice to call this function |
| 60 | * always at the beginning of the program execution. |
| 61 | */ |
| 62 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_initcxx . . $ oscap_init(49f6e7a06ebc5aa8).(void); |
| 63 | |
| 64 | /** |
| 65 | * Release library internal caches. |
| 66 | * |
| 67 | * This function should be called once you finish working with |
| 68 | * any of the libraries included in OpenScap framework. |
| 69 | * It frees internally allocated memory, e.g. cache of the XML parser. |
| 70 | */ |
| 71 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_cleanupcxx . . $ oscap_cleanup(49f6e7a06ebc5aa8).(void); |
| 72 | |
| 73 | /// Get version of the OpenSCAP library |
| 74 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *oscap_get_versioncxx . . $ oscap_get_version(33a1f659e94feb42).(void); |
| 75 | |
| 76 | |
| 77 | /** |
| 78 | * @addtogroup VALID |
| 79 | * @{ |
| 80 | * XML schema based validation of XML representations of SCAP documents. |
| 81 | */ |
| 82 | |
| 83 | /// SCAP document type identifiers |
| 84 | typedef enum oscap_document_typecxx . . $ oscap_document_type# { |
| 85 | OSCAP_DOCUMENT_UNKNOWNcxx . . $ OSCAP_DOCUMENT_UNKNOWN. = 0, ///< The type is unknown |
| 86 | OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS., ///< OVAL Definitions file |
| 87 | OSCAP_DOCUMENT_OVAL_VARIABLEScxx . . $ OSCAP_DOCUMENT_OVAL_VARIABLES., ///< OVAL Variables |
| 88 | OSCAP_DOCUMENT_OVAL_SYSCHARcxx . . $ OSCAP_DOCUMENT_OVAL_SYSCHAR., ///< OVAL system characteristics file |
| 89 | OSCAP_DOCUMENT_OVAL_RESULTScxx . . $ OSCAP_DOCUMENT_OVAL_RESULTS., ///< OVAL results file |
| 90 | OSCAP_DOCUMENT_OVAL_DIRECTIVEScxx . . $ OSCAP_DOCUMENT_OVAL_DIRECTIVES., ///< OVAL directives file |
| 91 | OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF., ///< XCCDF benchmark file |
| 92 | OSCAP_DOCUMENT_CPE_LANGUAGEcxx . . $ OSCAP_DOCUMENT_CPE_LANGUAGE., ///< CPE language file |
| 93 | OSCAP_DOCUMENT_CPE_DICTIONARYcxx . . $ OSCAP_DOCUMENT_CPE_DICTIONARY., ///< CPE dictionary file |
| 94 | OSCAP_DOCUMENT_SCE_RESULTcxx . . $ OSCAP_DOCUMENT_SCE_RESULT., ///< SCE result file |
| 95 | OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS., ///< Source Data Stream file |
| 96 | OSCAP_DOCUMENT_ARFcxx . . $ OSCAP_DOCUMENT_ARF., ///< Result Data Stream file |
| 97 | OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING., ///< XCCDF tailoring file |
| 98 | OSCAP_DOCUMENT_OCILcxx . . $ OSCAP_DOCUMENT_OCIL., ///< OCIL Definitions file |
| 99 | // If you are adding a new enum here, make sure you add support for it |
| 100 | // to utils/oscap-info.c! |
| 101 | } oscap_document_type_tcxx . . $ oscap_document_type_t#; |
| 102 | |
| 103 | /** |
| 104 | * Convert @ref oscap_document_type_t constant to human readable (english) |
| 105 | * representation. |
| 106 | * @param type OpenSCAP Document Type |
| 107 | * @returns English string describing document type. |
| 108 | * @retval Returned value might be pointer to static memory and must not be modified. |
| 109 | * @retval NULL in case of unrecognized document type |
| 110 | */ |
| 111 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *oscap_document_type_to_stringcxx . . $ oscap_document_type_to_string(1cec73a42285d610).(oscap_document_type_tcxx . . $ oscap_document_type_t# type); |
| 112 | |
| 113 | typedef int (*xml_reportercxx . . $ xml_reporter#)(const char *file, int line, const char *msg, void *arg); |
| 114 | |
| 115 | /** |
| 116 | * Apply a XSLT stylesheet to a XML file. |
| 117 | * |
| 118 | * If xsltfile is not an absolute path, the file will be searched relatively to a path specified by the OSCAP_XSLT_PATH environment variable. |
| 119 | * If the variable does not exist a default path is used (usually something like $PREFIX/share/openscap/schemas). |
| 120 | * |
| 121 | * @param xmlfile File to be transformed. |
| 122 | * @param xsltfile XSLT file |
| 123 | * @param outfile Result file shall be written here (NULL for stdout). |
| 124 | * @param params list of key-value pairs to pass to the stylesheet. |
| 125 | * @return the number of bytes written or -1 in case of failure |
| 126 | */ |
| 127 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! int oscap_apply_xsltcxx . . $ oscap_apply_xslt(94a5cfe74efaac1c).(const char *xmlfile, const char *xsltfile, const char *outfile, const char **params); |
| 128 | |
| 129 | /** |
| 130 | * Function returns path used to locate OpenSCAP XML schemas |
| 131 | */ |
| 132 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char * oscap_path_to_schemascxx . . $ oscap_path_to_schemas(33a1f659e94feb42).(void); |
| 133 | |
| 134 | /** |
| 135 | * Function returns path used to locate OpenSCAP Default CPE files |
| 136 | */ |
| 137 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char * oscap_path_to_cpecxx . . $ oscap_path_to_cpe(33a1f659e94feb42).(void); |
| 138 | |
| 139 | /************************************************************/ |
| 140 | /** @} validation group end */ |
| 141 | |
| 142 | /** @} */ |
| 143 | |
| 144 | #endif |