Open SCAP Library
|
00001 /* 00002 * Copyright 2009 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * Lukas Kuklinek <lkuklinek@redhat.com> 00021 */ 00022 00023 #ifndef XCCDF_ELEMENTS_H_ 00024 #define XCCDF_ELEMENTS_H_ 00025 #include <libxml/xmlreader.h> 00026 #include <stdbool.h> 00027 #include <time.h> 00028 #include "../common/util.h" 00029 #include "../common/elements.h" 00030 00031 OSCAP_HIDDEN_START; 00032 00033 typedef enum { 00034 XCCDFE_ERROR = -1, 00035 XCCDFE_UNMATCHED = 0, 00036 XCCDFE_BENCHMARK, 00037 XCCDFE_GROUP, 00038 XCCDFE_RULE, 00039 XCCDFE_VALUE, 00040 XCCDFE_PROFILE, 00041 XCCDFE_TESTRESULT, 00042 XCCDFE_RESULT_BENCHMARK, 00043 XCCDFE_CHECK, 00044 XCCDFE_CHECK_IMPORT, 00045 XCCDFE_CHECK_EXPORT, 00046 XCCDFE_CHECK_CONTENT, 00047 XCCDFE_CHECK_CONTENT_REF, 00048 XCCDFE_CHOICES, 00049 XCCDFE_CHOICE, 00050 XCCDFE_COMPLEX_CHECK, 00051 XCCDFE_CONFLICTS, 00052 XCCDFE_CPE_LIST, 00053 XCCDFE_DEFAULT, 00054 XCCDFE_DESCRIPTION, 00055 XCCDFE_FACT, 00056 XCCDFE_FIX, 00057 XCCDFE_FIXTEXT, 00058 XCCDFE_FRONT_MATTER, 00059 XCCDFE_IDENT, 00060 XCCDFE_IDENTITY, 00061 XCCDFE_IMPACT_METRIC, 00062 XCCDFE_INSTANCE, 00063 XCCDFE_LOWER_BOUND, 00064 XCCDFE_MATCH, 00065 XCCDFE_MESSAGE, 00066 XCCDFE_METADATA, 00067 XCCDFE_MODEL, 00068 XCCDFE_NEW_RESULT, 00069 XCCDFE_NOTICE, 00070 XCCDFE_OLD_RESULT, 00071 XCCDFE_ORGANIZATION, 00072 XCCDFE_OVERRIDE, 00073 XCCDFE_PARAM, 00074 XCCDFE_PLAIN_TEXT, 00075 XCCDFE_PLATFORM, 00076 XCCDFE_CPE2_PLATFORMSPEC, 00077 XCCDFE_RESULT_PROFILE, 00078 XCCDFE_PROFILE_NOTE, 00079 XCCDFE_QUESTION, 00080 XCCDFE_RATIONALE, 00081 XCCDFE_REAR_MATTER, 00082 XCCDFE_REFERENCE, 00083 XCCDFE_REFINE_RULE, 00084 XCCDFE_REFINE_VALUE, 00085 XCCDFE_REMARK, 00086 XCCDFE_REQUIRES, 00087 XCCDFE_RESULT, 00088 XCCDFE_RULE_RESULT, 00089 XCCDFE_SCORE, 00090 XCCDFE_SELECT, 00091 XCCDFE_SET_VALUE, 00092 XCCDFE_SIGNATURE, 00093 XCCDFE_SOURCE, 00094 XCCDFE_STATUS, 00095 XCCDFE_SUB, 00096 XCCDFE_TARGET, 00097 XCCDFE_TARGET_ADDRESS, 00098 XCCDFE_TARGET_FACTS, 00099 XCCDFE_TITLE, 00100 XCCDFE_UPPER_BOUND, 00101 XCCDFE_VALUE_VAL, 00102 XCCDFE_VERSION, 00103 XCCDFE_WARNING, 00104 XCCDFE_END_ 00105 } xccdf_element_t; 00106 00107 #define XCCDF_XMLNS "http://checklists.nist.gov/xccdf/1.1" 00108 00109 xccdf_element_t xccdf_element_get(xmlTextReaderPtr reader); 00110 00111 #define XCCDF_ASSERT_ELEMENT(reader, element) do { if (xccdf_element_get(reader) != element) return false; } while(false) 00112 00113 typedef enum { 00114 XCCDFA_NONE, 00115 XCCDFA_ABSTRACT, 00116 XCCDFA_AUTHENTICATED, 00117 XCCDFA_AUTHORITY, 00118 XCCDFA_CATEGORY, 00119 XCCDFA_CLUSTER_ID, 00120 XCCDFA_COMPLEXITY, 00121 XCCDFA_CONTEXT, 00122 XCCDFA_DATE, 00123 XCCDFA_DISRUPTION, 00124 XCCDFA_END_TIME, 00125 XCCDFA_EXPORT_NAME, 00126 XCCDFA_EXTENDS, 00127 XCCDFA_FIXREF, 00128 XCCDFA_HIDDEN, 00129 XCCDFA_HREF, 00130 XCCDFA_ID, 00131 XCCDFA_IDREF, 00132 XCCDFA_IID, 00133 XCCDFA_IMPORT_NAME, 00134 XCCDFA_INTERACTIVE, 00135 XCCDFA_INTERFACEHINT, 00136 XCCDFA_MAXIMUM, 00137 XCCDFA_MULTIPLE, 00138 XCCDFA_MUSTMATCH, 00139 XCCDFA_NAME, 00140 XCCDFA_NEGATE, 00141 XCCDFA_NOTE_TAG, 00142 XCCDFA_OPERATOR, 00143 XCCDFA_OVERRIDE, 00144 XCCDFA_PARENTCONTEXT, 00145 XCCDFA_PLATFORM, 00146 XCCDFA_PRIVILEDGED, 00147 XCCDFA_PROHIBITCHANGES, 00148 XCCDFA_REBOOT, 00149 XCCDFA_RESOLVED, 00150 XCCDFA_ROLE, 00151 XCCDFA_SELECTED, 00152 XCCDFA_SELECTOR, 00153 XCCDFA_SEVERITY, 00154 XCCDFA_START_TIME, 00155 XCCDFA_STRATEGY, 00156 XCCDFA_STYLE, 00157 XCCDFA_STYLE_HREF, 00158 XCCDFA_SYSTEM, 00159 XCCDFA_TAG, 00160 XCCDFA_TEST_SYSTEM, 00161 XCCDFA_TIME, 00162 XCCDFA_TYPE, 00163 XCCDFA_UPDATE, 00164 XCCDFA_URI, 00165 XCCDFA_VALUE_ID, 00166 XCCDFA_VERSION, 00167 XCCDFA_WEIGHT, 00168 XCCDFA_END_ 00169 } xccdf_attribute_t; 00170 00171 bool xccdf_attribute_has(xmlTextReaderPtr reader, xccdf_attribute_t attr); 00172 const char *xccdf_attribute_get(xmlTextReaderPtr reader, xccdf_attribute_t attr); 00173 char *xccdf_attribute_copy(xmlTextReaderPtr reader, xccdf_attribute_t attr); 00174 bool xccdf_attribute_get_bool(xmlTextReaderPtr reader, xccdf_attribute_t attr); 00175 int xccdf_attribute_get_int(xmlTextReaderPtr reader, xccdf_attribute_t attr); 00176 float xccdf_attribute_get_float(xmlTextReaderPtr reader, xccdf_attribute_t attr); 00177 //void xccdf_read_flag(xmlTextReaderPtr reader, xccdf_attribute_t attr, xccdf_flags* flags, xccdf_flag_t flag); 00178 00179 extern const struct oscap_string_map XCCDF_BOOL_MAP[]; 00180 00181 void xccdf_print_depth(int depth); 00182 void xccdf_print_max(const char *str, int max, const char *ellipsis); 00183 void xccdf_print_max_text(const struct oscap_text *txt, int max, const char *ellipsis); 00184 void xccdf_print_textlist(struct oscap_text_iterator *txt, int depth, int max, const char *ellipsis); 00185 00186 OSCAP_HIDDEN_END; 00187 00188 #endif