| 1 | /* |
| 2 | * Copyright 2010 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 | * Maros Barabas <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | #ifndef OSCAP_TOOL_H_ |
| 25 | #define OSCAP_TOOL_H_cxx . . $ `utils/oscap-tool.h:25:9`! |
| 26 | |
| 27 | /* Standard header files */ |
| 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | #ifdef HAVE_GETOPT_Hcxx . . $ `build/config.h:79:9`! |
| 32 | #include <getopt.h> |
| 33 | #endif |
| 34 | |
| 35 | /* openscap common */ |
| 36 | #include <oscap.h>cxx . . $ `<file>/src/common/public/oscap.h`/ |
| 37 | #include <oscap_error.h>cxx . . $ `<file>/src/common/public/oscap_error.h`/ |
| 38 | #include <oscap_text.h>cxx . . $ `<file>/src/common/public/oscap_text.h`/ |
| 39 | |
| 40 | #include <oval_definitions.h>cxx . . $ `<file>/src/OVAL/public/oval_definitions.h`/ |
| 41 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 42 | # include <oval_probe.h>cxx . . $ `<file>/src/OVAL/public/oval_probe.h`/ |
| 43 | #endif |
| 44 | #include <xccdf_benchmark.h>cxx . . $ `<file>/src/XCCDF/public/xccdf_benchmark.h`/ |
| 45 | #include <xccdf_session.h>cxx . . $ `<file>/src/XCCDF/public/xccdf_session.h`/ |
| 46 | #include <cpe_dict.h>cxx . . $ `<file>/src/CPE/public/cpe_dict.h`/ |
| 47 | #include <cpe_name.h>cxx . . $ `<file>/src/CPE/public/cpe_name.h`/ |
| 48 | |
| 49 | #define OSCAP_PRODUCTNAMEcxx . . $ `utils/oscap-tool.h:49:9`! "cpe:/a:open-scap:oscap" |
| 50 | #define OSCAP_ERR_MSGcxx . . $ `utils/oscap-tool.h:50:9`! "OpenSCAP Error:" |
| 51 | |
| 52 | struct oscap_actioncxx . . $ oscap_action#; |
| 53 | struct oscap_modulecxx . . $ oscap_module#; |
| 54 | |
| 55 | typedef int(*oscap_tool_funccxx . . $ oscap_tool_func#)(const struct oscap_actioncxx . . $ oscap_action#* action); |
| 56 | typedef boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!(*oscap_option_funccxx . . $ oscap_option_func#)(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action#* action); |
| 57 | |
| 58 | struct oscap_modulecxx . . $ oscap_module# { |
| 59 | const char *namecxx . . $ oscap_module#name.; |
| 60 | const char *usagecxx . . $ oscap_module#usage.; |
| 61 | const char *usage_extracxx . . $ oscap_module#usage_extra.; |
| 62 | const char *summarycxx . . $ oscap_module#summary.; |
| 63 | const char *helpcxx . . $ oscap_module#help.; |
| 64 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! hiddencxx . . $ oscap_module#hidden.; |
| 65 | struct oscap_modulecxx . . $ oscap_module# *parentcxx . . $ oscap_module#parent.; |
| 66 | struct oscap_modulecxx . . $ oscap_module# **submodulescxx . . $ oscap_module#submodules.; |
| 67 | oscap_tool_funccxx . . $ oscap_tool_func# funccxx . . $ oscap_module#func.; |
| 68 | oscap_option_funccxx . . $ oscap_option_func# opt_parsercxx . . $ oscap_module#opt_parser.; |
| 69 | void *usercxx . . $ oscap_module#user.; |
| 70 | }; |
| 71 | |
| 72 | // standard oscap CLI exit statuses |
| 73 | enum oscap_exitcodecxx . . $ oscap_exitcode# { |
| 74 | OSCAP_OKcxx . . $ OSCAP_OK. = 0, // successful exit |
| 75 | OSCAP_ERRORcxx . . $ OSCAP_ERROR. = 1, // an error occurred |
| 76 | OSCAP_FAILcxx . . $ OSCAP_FAIL. = 2, // a process (e.g. scan or validation) failed |
| 77 | OSCAP_ERR_FETCHcxx . . $ OSCAP_ERR_FETCH. = 1, // cold not fetch input file (same as error for now) |
| 78 | OSCAP_BADARGScxx . . $ OSCAP_BADARGS. = 100, // bad commandline arguments |
| 79 | OSCAP_BADMODULEcxx . . $ OSCAP_BADMODULE. = 101, // unrecognized module |
| 80 | OSCAP_UNIMPL_MODcxx . . $ OSCAP_UNIMPL_MOD. = 110, // module functionality not implemented |
| 81 | OSCAP_UNIMPLcxx . . $ OSCAP_UNIMPL. = 111, // functionality not implemented |
| 82 | // end of list |
| 83 | OSCAP_EXITCODES_END_cxx . . $ OSCAP_EXITCODES_END_. = 120 // any code returned shall not be higher than this |
| 84 | }; |
| 85 | |
| 86 | struct ds_actioncxx . . $ ds_action# { |
| 87 | char* filecxx . . $ ds_action#file.; |
| 88 | char* targetcxx . . $ ds_action#target.; |
| 89 | char* xccdf_resultcxx . . $ ds_action#xccdf_result.; |
| 90 | char** oval_resultscxx . . $ ds_action#oval_results.; |
| 91 | size_tcxx . . $ size_t# oval_result_countcxx . . $ ds_action#oval_result_count.; |
| 92 | }; |
| 93 | |
| 94 | struct cpe_actioncxx . . $ cpe_action# { |
| 95 | char * namecxx . . $ cpe_action#name.; |
| 96 | char * dictcxx . . $ cpe_action#dict.; |
| 97 | }; |
| 98 | |
| 99 | struct cve_actioncxx . . $ cve_action# { |
| 100 | char * filecxx . . $ cve_action#file.; |
| 101 | char * cvecxx . . $ cve_action#cve.; |
| 102 | }; |
| 103 | |
| 104 | struct oscap_actioncxx . . $ oscap_action# { |
| 105 | struct oscap_modulecxx . . $ oscap_module# *modulecxx . . $ oscap_action#module.; |
| 106 | /* files */ |
| 107 | char *f_xccdfcxx . . $ oscap_action#f_xccdf.; |
| 108 | char *f_datastream_idcxx . . $ oscap_action#f_datastream_id.; |
| 109 | char *f_xccdf_idcxx . . $ oscap_action#f_xccdf_id.; |
| 110 | char *f_oval_idcxx . . $ oscap_action#f_oval_id.; |
| 111 | char *f_benchmark_idcxx . . $ oscap_action#f_benchmark_id.; |
| 112 | char *f_report_idcxx . . $ oscap_action#f_report_id.; |
| 113 | char *f_ovalcxx . . $ oscap_action#f_oval.; |
| 114 | char **f_ovalscxx . . $ oscap_action#f_ovals.; |
| 115 | char *f_syscharcxx . . $ oscap_action#f_syschar.; |
| 116 | char *f_directivescxx . . $ oscap_action#f_directives.; |
| 117 | char *f_resultscxx . . $ oscap_action#f_results.; |
| 118 | char *f_results_stigcxx . . $ oscap_action#f_results_stig.; |
| 119 | char *f_results_arfcxx . . $ oscap_action#f_results_arf.; |
| 120 | char *f_reportcxx . . $ oscap_action#f_report.; |
| 121 | char *f_variablescxx . . $ oscap_action#f_variables.; |
| 122 | char *f_verbose_logcxx . . $ oscap_action#f_verbose_log.; |
| 123 | /* others */ |
| 124 | char *profilecxx . . $ oscap_action#profile.; |
| 125 | struct oscap_stringlistcxx . . $ oscap_stringlist# *rulescxx . . $ oscap_action#rules.; |
| 126 | struct oscap_stringlistcxx . . $ oscap_stringlist# *skip_rulescxx . . $ oscap_action#skip_rules.; |
| 127 | char *formatcxx . . $ oscap_action#format.; |
| 128 | char *idcxx . . $ oscap_action#id.; |
| 129 | int hide_profile_infocxx . . $ oscap_action#hide_profile_info.; |
| 130 | char *stylesheetcxx . . $ oscap_action#stylesheet.; |
| 131 | char *tailoring_filecxx . . $ oscap_action#tailoring_file.; |
| 132 | char *tailoring_idcxx . . $ oscap_action#tailoring_id.; |
| 133 | char *cpecxx . . $ oscap_action#cpe.; |
| 134 | |
| 135 | struct ds_actioncxx . . $ ds_action#* ds_actioncxx . . $ oscap_action#ds_action.; |
| 136 | struct cpe_actioncxx . . $ cpe_action# * cpe_actioncxx . . $ oscap_action#cpe_action.; |
| 137 | struct cve_actioncxx . . $ cve_action# * cve_actioncxx . . $ oscap_action#cve_action.; |
| 138 | struct cvrf_actioncxx . . $ cvrf_action# * cvrf_actioncxx . . $ oscap_action#cvrf_action.; |
| 139 | char *filecxx . . $ oscap_action#file.; |
| 140 | |
| 141 | int verbositycxx . . $ oscap_action#verbosity.; |
| 142 | int show_profiles_onlycxx . . $ oscap_action#show_profiles_only.; |
| 143 | int provide_machine_readable_outputcxx . . $ oscap_action#provide_machine_readable_output.; |
| 144 | int doctypecxx . . $ oscap_action#doctype.; |
| 145 | int forcecxx . . $ oscap_action#force.; |
| 146 | int validatecxx . . $ oscap_action#validate.; |
| 147 | int validate_signaturecxx . . $ oscap_action#validate_signature.; |
| 148 | int enforce_signaturecxx . . $ oscap_action#enforce_signature.; |
| 149 | int schematroncxx . . $ oscap_action#schematron.; |
| 150 | int remote_resourcescxx . . $ oscap_action#remote_resources.; |
| 151 | int progresscxx . . $ oscap_action#progress.; |
| 152 | int oval_resultscxx . . $ oscap_action#oval_results.; |
| 153 | int without_sys_charscxx . . $ oscap_action#without_sys_chars.; |
| 154 | int thin_resultscxx . . $ oscap_action#thin_results.; |
| 155 | int remediatecxx . . $ oscap_action#remediate.; |
| 156 | int check_engine_resultscxx . . $ oscap_action#check_engine_results.; |
| 157 | int export_variablescxx . . $ oscap_action#export_variables.; |
| 158 | int list_dynamiccxx . . $ oscap_action#list_dynamic.; |
| 159 | char *verbosity_levelcxx . . $ oscap_action#verbosity_level.; |
| 160 | char *fix_typecxx . . $ oscap_action#fix_type.; |
| 161 | char *local_filescxx . . $ oscap_action#local_files.; |
| 162 | char *referencecxx . . $ oscap_action#reference.; |
| 163 | int referencescxx . . $ oscap_action#references.; |
| 164 | int rawcxx . . $ oscap_action#raw.; |
| 165 | int show_rule_detailscxx . . $ oscap_action#show_rule_details.; |
| 166 | int list_rulescxx . . $ oscap_action#list_rules.; |
| 167 | int list_varscxx . . $ oscap_action#list_vars.; |
| 168 | }; |
| 169 | |
| 170 | int app_xsltcxx . . $ app_xslt(94a5cfe74efaac1c).(const char *infile, const char *xsltfile, const char *outfile, const char **params); |
| 171 | int reportercxx . . $ reporter(710d628f83af7da6).(const char *file, int line, const char *msg, void *arg); |
| 172 | |
| 173 | int oscap_module_processcxx . . $ oscap_module_process(844605f188a3c36c).(struct oscap_modulecxx . . $ oscap_module# *module, int argc, char **argv); |
| 174 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(struct oscap_modulecxx . . $ oscap_module# *module, FILEcxx . . $ FILE# *out, const char *err, ...); |
| 175 | int oscap_module_callcxx . . $ oscap_module_call(862350c5cd0b6b18).(struct oscap_actioncxx . . $ oscap_action# *action); |
| 176 | |
| 177 | void oscap_print_errorcxx . . $ oscap_print_error(49f6e7a06ebc5aa8).(void); |
| 178 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! check_verbose_optionscxx . . $ check_verbose_options(47ff121b0a12a6e).(struct oscap_actioncxx . . $ oscap_action# *action); |
| 179 | void download_reporting_callbackcxx . . $ download_reporting_callback(3ca54e6407cd3d15).(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! warning, const char *format, ...); |
| 180 | |
| 181 | void report_missing_profilecxx . . $ report_missing_profile(2fa786934fe80e24).(const char *profile_suffix, const char *source_file); |
| 182 | void report_multiple_profile_matchescxx . . $ report_multiple_profile_matches(2fa786934fe80e24).(const char *profile_suffix, const char *source_file); |
| 183 | |
| 184 | int xccdf_set_profile_or_report_bad_idcxx . . $ xccdf_set_profile_or_report_bad_id(958fe49146dd32a6).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *profile_id, const char *source_file); |
| 185 | int evaluate_suffix_match_result_with_custom_reportscxx . . $ evaluate_suffix_match_result_with_custom_reports(900988ad5affe787).(int suffix_match_result, const char *profile_suffix, const char *source_file, void (* report_missing)(const char *, const char *), void (* report_multiple)(const char *, const char *)); |
| 186 | int evaluate_suffix_match_resultcxx . . $ evaluate_suffix_match_result(9ee5302023219b2d).(int suffix_match_result, const char *profile_suffix, const char *source_file); |
| 187 | |
| 188 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_ROOT_MODULEcxx . . $ OSCAP_ROOT_MODULE.; |
| 189 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_DS_MODULEcxx . . $ OSCAP_DS_MODULE.; |
| 190 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_XCCDF_MODULEcxx . . $ OSCAP_XCCDF_MODULE.; |
| 191 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE.; |
| 192 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_CVE_MODULEcxx . . $ OSCAP_CVE_MODULE.; |
| 193 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_CPE_MODULEcxx . . $ OSCAP_CPE_MODULE.; |
| 194 | extern struct oscap_modulecxx . . $ oscap_module# OSCAP_INFO_MODULEcxx . . $ OSCAP_INFO_MODULE.; |
| 195 | |
| 196 | #ifndef HAVE_GETOPT_Hcxx . . $ `build/config.h:79:9`! |
| 197 | |
| 198 | #define __getopt_argv_const const |
| 199 | #define no_argument 0 |
| 200 | #define required_argument 1 |
| 201 | #define optional_argument 2 |
| 202 | |
| 203 | extern char *optarg; |
| 204 | extern int optind; |
| 205 | extern int opterr; |
| 206 | extern int optopt; |
| 207 | |
| 208 | struct option |
| 209 | { |
| 210 | const char *name; |
| 211 | int has_arg; |
| 212 | int *flag; |
| 213 | int val; |
| 214 | }; |
| 215 | |
| 216 | getopt_long(int ___argc, char *__getopt_argv_const *___argv, |
| 217 | const char *__shortopts, |
| 218 | const struct option *__longopts, int *__longind); |
| 219 | |
| 220 | #endif |
| 221 | |
| 222 | #endif //OSCAP_TOOL_H_ |