| 1 | /* |
| 2 | * Copyright 2013 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 | * Šimon Lukašík |
| 21 | */ |
| 22 | |
| 23 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 24 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 25 | #endif |
| 26 | |
| 27 | #include "oval_definitions_impl.h"cxx . . $ `<file>/src/OVAL/oval_definitions_impl.h`/ |
| 28 | |
| 29 | static void _oval_definition_fill_vardefcxx . . $ _oval_definition_fill_vardef(25ef73fe1b205d47).(struct oval_definitioncxx . . $ oval_definition# *definition, struct oval_string_mapcxx . . $ oval_string_map# *vardef); |
| 30 | static void _oval_criteria_fill_vardefcxx . . $ _oval_criteria_fill_vardef(bc05313e5abb0428).(struct oval_criteria_nodecxx . . $ oval_criteria_node# *cnode, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id); |
| 31 | static void _oval_test_fill_vardefcxx . . $ _oval_test_fill_vardef(1d4c09c8088465a).(struct oval_testcxx . . $ oval_test# *test, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id); |
| 32 | static void _oval_object_fill_vardefcxx . . $ _oval_object_fill_vardef(428d1517d841fe25).(struct oval_objectcxx . . $ oval_object# *object, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id); |
| 33 | static void _oval_setobject_fill_vardefcxx . . $ _oval_setobject_fill_vardef(734bf22dc8a1bc91).(struct oval_setobjectcxx . . $ oval_setobject# *set, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id); |
| 34 | static void _oval_state_fill_vardefcxx . . $ _oval_state_fill_vardef(cc4e9d83a2dfb2c6).(struct oval_statecxx . . $ oval_state# *state, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id); |
| 35 | static void _oval_entity_fill_vardefcxx . . $ _oval_entity_fill_vardef(25415726d9476896).(struct oval_entitycxx . . $ oval_entity# *entity, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id); |
| 36 | static void _vardef_insertcxx . . $ _vardef_insert(9c717b37723dda1b).(struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id, const char *variable_id); |
| 37 | |
| 38 | struct oval_string_mapcxx . . $ oval_string_map# *oval_definition_model_build_vardef_mappingcxx . . $ oval_definition_model_build_vardef_mapping(a6b442aa12b5a8ea).(struct oval_definition_modelcxx . . $ oval_definition_model# *model) |
| 39 | { |
| 40 | struct oval_string_mapcxx . . $ oval_string_map# *vardef = oval_string_map_newcxx . . $ oval_string_map_new(c786b134e882bd29).(); |
| 41 | struct oval_definition_iteratorcxx . . $ oval_definition_iterator# *def_it = oval_definition_model_get_definitionscxx . . $ oval_definition_model_get_definitions(b47d05023b659a14).(model); |
| 42 | while (oval_definition_iterator_has_morecxx . . $ oval_definition_iterator_has_more(97a46799ea94a148).(def_it)) { |
| 43 | struct oval_definitioncxx . . $ oval_definition# *definition = oval_definition_iterator_nextcxx . . $ oval_definition_iterator_next(cba20bfe98f05efc).(def_it); |
| 44 | _oval_definition_fill_vardefcxx . . $ _oval_definition_fill_vardef(25ef73fe1b205d47).(definition, vardef); |
| 45 | } |
| 46 | oval_definition_iterator_freecxx . . $ oval_definition_iterator_free(b4c4f061b8f4c70).(def_it); |
| 47 | return vardef; |
| 48 | } |
| 49 | |
| 50 | void _oval_definition_fill_vardefcxx . . $ _oval_definition_fill_vardef(25ef73fe1b205d47).(struct oval_definitioncxx . . $ oval_definition# *definition, struct oval_string_mapcxx . . $ oval_string_map# *vardef) |
| 51 | { |
| 52 | struct oval_criteria_nodecxx . . $ oval_criteria_node# *cnode = oval_definition_get_criteriacxx . . $ oval_definition_get_criteria(65398e133db0196).(definition); |
| 53 | if (cnode != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 54 | _oval_criteria_fill_vardefcxx . . $ _oval_criteria_fill_vardef(bc05313e5abb0428).(cnode, vardef, oval_definition_get_idcxx . . $ oval_definition_get_id(293cc7080a5789e2).(definition)); |
| 55 | } |
| 56 | |
| 57 | void _oval_criteria_fill_vardefcxx . . $ _oval_criteria_fill_vardef(bc05313e5abb0428).(struct oval_criteria_nodecxx . . $ oval_criteria_node# *cnode, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id) |
| 58 | { |
| 59 | switch (oval_criteria_node_get_typecxx . . $ oval_criteria_node_get_type(ef81df196a9c20f6).(cnode)) { |
| 60 | case OVAL_NODETYPE_CRITERIONcxx . . $ OVAL_NODETYPE_CRITERION.:{ |
| 61 | struct oval_testcxx . . $ oval_test# *test = oval_criteria_node_get_testcxx . . $ oval_criteria_node_get_test(a0ab3911a55a3308).(cnode); |
| 62 | if (test != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 63 | _oval_test_fill_vardefcxx . . $ _oval_test_fill_vardef(1d4c09c8088465a).(test, vardef, definition_id); |
| 64 | } break; |
| 65 | case OVAL_NODETYPE_CRITERIAcxx . . $ OVAL_NODETYPE_CRITERIA.:{ |
| 66 | struct oval_criteria_node_iteratorcxx . . $ oval_criteria_node_iterator# *cnode_it = oval_criteria_node_get_subnodescxx . . $ oval_criteria_node_get_subnodes(664e31975832357a).(cnode); |
| 67 | if (cnode_it != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) { |
| 68 | while (oval_criteria_node_iterator_has_morecxx . . $ oval_criteria_node_iterator_has_more(1d7c354b15b37d35).(cnode_it)) { |
| 69 | struct oval_criteria_nodecxx . . $ oval_criteria_node# *node = oval_criteria_node_iterator_nextcxx . . $ oval_criteria_node_iterator_next(6cad1f2abc1761f6).(cnode_it); |
| 70 | if (node != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 71 | _oval_criteria_fill_vardefcxx . . $ _oval_criteria_fill_vardef(bc05313e5abb0428).(node, vardef, definition_id); |
| 72 | } |
| 73 | oval_criteria_node_iterator_freecxx . . $ oval_criteria_node_iterator_free(dc39dde275a510d9).(cnode_it); |
| 74 | } |
| 75 | } break; |
| 76 | case OVAL_NODETYPE_EXTENDDEFcxx . . $ OVAL_NODETYPE_EXTENDDEF.:{ |
| 77 | struct oval_definitioncxx . . $ oval_definition# *definition = oval_criteria_node_get_definitioncxx . . $ oval_criteria_node_get_definition(c20eec0d71e88e87).(cnode); |
| 78 | if (definition != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) { |
| 79 | struct oval_criteria_nodecxx . . $ oval_criteria_node# *node = oval_definition_get_criteriacxx . . $ oval_definition_get_criteria(65398e133db0196).(definition); |
| 80 | if (node != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 81 | _oval_criteria_fill_vardefcxx . . $ _oval_criteria_fill_vardef(bc05313e5abb0428).(node, vardef, definition_id); |
| 82 | } |
| 83 | } break; |
| 84 | case OVAL_NODETYPE_UNKNOWNcxx . . $ OVAL_NODETYPE_UNKNOWN.: |
| 85 | default: |
| 86 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 87 | break; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | void _oval_test_fill_vardefcxx . . $ _oval_test_fill_vardef(1d4c09c8088465a).(struct oval_testcxx . . $ oval_test# *test, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id) |
| 92 | { |
| 93 | struct oval_objectcxx . . $ oval_object# *object = oval_test_get_objectcxx . . $ oval_test_get_object(7733aadd35446dd9).(test); |
| 94 | if (object != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 95 | _oval_object_fill_vardefcxx . . $ _oval_object_fill_vardef(428d1517d841fe25).(object, vardef, definition_id); |
| 96 | struct oval_state_iteratorcxx . . $ oval_state_iterator# *ste_it = oval_test_get_statescxx . . $ oval_test_get_states(b738fee4834aaaa6).(test); |
| 97 | while (oval_state_iterator_has_morecxx . . $ oval_state_iterator_has_more(bbfacbd9c1bc3d63).(ste_it)) { |
| 98 | struct oval_statecxx . . $ oval_state# *state = oval_state_iterator_nextcxx . . $ oval_state_iterator_next(f0883bc3981b419).(ste_it); |
| 99 | if (state != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 100 | _oval_state_fill_vardefcxx . . $ _oval_state_fill_vardef(cc4e9d83a2dfb2c6).(state, vardef, definition_id); |
| 101 | } |
| 102 | oval_state_iterator_freecxx . . $ oval_state_iterator_free(37c8c23faa65426a).(ste_it); |
| 103 | } |
| 104 | |
| 105 | void _oval_object_fill_vardefcxx . . $ _oval_object_fill_vardef(428d1517d841fe25).(struct oval_objectcxx . . $ oval_object# *object, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id) |
| 106 | { |
| 107 | struct oval_object_content_iteratorcxx . . $ oval_object_content_iterator# *content_it = oval_object_get_object_contentscxx . . $ oval_object_get_object_contents(1183628165c9500f).(object); |
| 108 | while (oval_object_content_iterator_has_morecxx . . $ oval_object_content_iterator_has_more(94988246e4c8fa99).(content_it)) { |
| 109 | struct oval_object_contentcxx . . $ oval_object_content# *content = oval_object_content_iterator_nextcxx . . $ oval_object_content_iterator_next(eb16ce6ae0e4b7fc).(content_it); |
| 110 | switch (oval_object_content_get_typecxx . . $ oval_object_content_get_type(7a653648ed12be92).(content)) { |
| 111 | case OVAL_OBJECTCONTENT_ENTITYcxx . . $ OVAL_OBJECTCONTENT_ENTITY.:{ |
| 112 | struct oval_entitycxx . . $ oval_entity# *entity = oval_object_content_get_entitycxx . . $ oval_object_content_get_entity(ecfb176ae958982e).(content); |
| 113 | _oval_entity_fill_vardefcxx . . $ _oval_entity_fill_vardef(25415726d9476896).(entity, vardef, definition_id); |
| 114 | } break; |
| 115 | case OVAL_OBJECTCONTENT_SETcxx . . $ OVAL_OBJECTCONTENT_SET.:{ |
| 116 | struct oval_setobjectcxx . . $ oval_setobject# *set = oval_object_content_get_setobjectcxx . . $ oval_object_content_get_setobject(25929015085a5f4).(content); |
| 117 | _oval_setobject_fill_vardefcxx . . $ _oval_setobject_fill_vardef(734bf22dc8a1bc91).(set, vardef, definition_id); |
| 118 | } break; |
| 119 | default: |
| 120 | break; |
| 121 | } |
| 122 | } |
| 123 | oval_object_content_iterator_freecxx . . $ oval_object_content_iterator_free(de918ccd59b4e784).(content_it); |
| 124 | } |
| 125 | |
| 126 | void _oval_setobject_fill_vardefcxx . . $ _oval_setobject_fill_vardef(734bf22dc8a1bc91).(struct oval_setobjectcxx . . $ oval_setobject# *set, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id) |
| 127 | { |
| 128 | switch (oval_setobject_get_typecxx . . $ oval_setobject_get_type(d5fdd55de288db3f).(set)) { |
| 129 | case OVAL_SET_AGGREGATEcxx . . $ OVAL_SET_AGGREGATE.:{ |
| 130 | struct oval_setobject_iteratorcxx . . $ oval_setobject_iterator# *subset_it = oval_setobject_get_subsetscxx . . $ oval_setobject_get_subsets(13e8a59127c47b3f).(set); |
| 131 | while (oval_setobject_iterator_has_morecxx . . $ oval_setobject_iterator_has_more(ecf6a7229e0ada85).(subset_it)) { |
| 132 | struct oval_setobjectcxx . . $ oval_setobject# *subset = oval_setobject_iterator_nextcxx . . $ oval_setobject_iterator_next(8019d249221a9c9c).(subset_it); |
| 133 | _oval_setobject_fill_vardefcxx . . $ _oval_setobject_fill_vardef(734bf22dc8a1bc91).(subset, vardef, definition_id); |
| 134 | } |
| 135 | oval_setobject_iterator_freecxx . . $ oval_setobject_iterator_free(9cd4ba6b9ae808f7).(subset_it); |
| 136 | } break; |
| 137 | case OVAL_SET_COLLECTIVEcxx . . $ OVAL_SET_COLLECTIVE.:{ |
| 138 | struct oval_object_iteratorcxx . . $ oval_object_iterator# *object_it = oval_setobject_get_objectscxx . . $ oval_setobject_get_objects(2806f397737704ff).(set); |
| 139 | while (oval_object_iterator_has_morecxx . . $ oval_object_iterator_has_more(9147d04dca65c7).(object_it)) { |
| 140 | struct oval_objectcxx . . $ oval_object# *object = oval_object_iterator_nextcxx . . $ oval_object_iterator_next(85e8e8a3fd76bfb).(object_it); |
| 141 | _oval_object_fill_vardefcxx . . $ _oval_object_fill_vardef(428d1517d841fe25).(object, vardef, definition_id); |
| 142 | } |
| 143 | oval_object_iterator_freecxx . . $ oval_object_iterator_free(bcb47d61bf2b3914).(object_it); |
| 144 | |
| 145 | struct oval_filter_iteratorcxx . . $ oval_filter_iterator# *filter_it = oval_setobject_get_filterscxx . . $ oval_setobject_get_filters(a3a77d5b16cc3321).(set); |
| 146 | while (oval_filter_iterator_has_morecxx . . $ oval_filter_iterator_has_more(1c196fda7090525b).(filter_it)) { |
| 147 | struct oval_filtercxx . . $ oval_filter# *filter = oval_filter_iterator_nextcxx . . $ oval_filter_iterator_next(54517aa6f88ff9ef).(filter_it); |
| 148 | struct oval_statecxx . . $ oval_state# *state = oval_filter_get_statecxx . . $ oval_filter_get_state(4b60831d8443711d).(filter); |
| 149 | _oval_state_fill_vardefcxx . . $ _oval_state_fill_vardef(cc4e9d83a2dfb2c6).(state, vardef, definition_id); |
| 150 | } |
| 151 | oval_filter_iterator_freecxx . . $ oval_filter_iterator_free(af72975b992300c1).(filter_it); |
| 152 | } break; |
| 153 | default: |
| 154 | break; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | void _oval_state_fill_vardefcxx . . $ _oval_state_fill_vardef(cc4e9d83a2dfb2c6).(struct oval_statecxx . . $ oval_state# *state, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id) |
| 159 | { |
| 160 | struct oval_state_content_iteratorcxx . . $ oval_state_content_iterator# *content_it = oval_state_get_contentscxx . . $ oval_state_get_contents(e38d902cdc6b5c2d).(state); |
| 161 | while (oval_state_content_iterator_has_morecxx . . $ oval_state_content_iterator_has_more(344811bbb4806d19).(content_it)) { |
| 162 | struct oval_state_contentcxx . . $ oval_state_content# *content = oval_state_content_iterator_nextcxx . . $ oval_state_content_iterator_next(43c3368aa9ccef0c).(content_it); |
| 163 | struct oval_entitycxx . . $ oval_entity# *entity = oval_state_content_get_entitycxx . . $ oval_state_content_get_entity(20470541c08ba23c).(content); |
| 164 | if (entity != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 165 | _oval_entity_fill_vardefcxx . . $ _oval_entity_fill_vardef(25415726d9476896).(entity, vardef, definition_id); |
| 166 | } |
| 167 | oval_state_content_iterator_freecxx . . $ oval_state_content_iterator_free(526a40962d3af9e1).(content_it); |
| 168 | } |
| 169 | |
| 170 | void _oval_entity_fill_vardefcxx . . $ _oval_entity_fill_vardef(25415726d9476896).(struct oval_entitycxx . . $ oval_entity# *entity, struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id) |
| 171 | { |
| 172 | if (oval_entity_get_varref_typecxx . . $ oval_entity_get_varref_type(ad657afef3bd7ab6).(entity) == OVAL_ENTITY_VARREF_ATTRIBUTEcxx . . $ OVAL_ENTITY_VARREF_ATTRIBUTE. || |
| 173 | oval_entity_get_varref_typecxx . . $ oval_entity_get_varref_type(ad657afef3bd7ab6).(entity) == OVAL_ENTITY_VARREF_ELEMENTcxx . . $ OVAL_ENTITY_VARREF_ELEMENT.) { |
| 174 | struct oval_variablecxx . . $ oval_variable# *variable = oval_entity_get_variablecxx . . $ oval_entity_get_variable(fe3169ea470c913).(entity); |
| 175 | if (variable != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) |
| 176 | _vardef_insertcxx . . $ _vardef_insert(9c717b37723dda1b).(vardef, definition_id, oval_variable_get_idcxx . . $ oval_variable_get_id(341a3c7e6ea3818b).(variable)); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void _vardef_insertcxx . . $ _vardef_insert(9c717b37723dda1b).(struct oval_string_mapcxx . . $ oval_string_map# *vardef, const char *definition_id, const char *variable_id) |
| 181 | { |
| 182 | struct oval_string_mapcxx . . $ oval_string_map# *def_list = (struct oval_string_mapcxx . . $ oval_string_map# *) oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(vardef, variable_id); |
| 183 | if (def_list == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) { |
| 184 | def_list = oval_string_map_newcxx . . $ oval_string_map_new(c786b134e882bd29).(); |
| 185 | oval_string_map_putcxx . . $ oval_string_map_put(95b46de789826acc).(vardef, variable_id, def_list); |
| 186 | } |
| 187 | oval_string_map_putcxx . . $ oval_string_map_put(95b46de789826acc).(def_list, definition_id, (void *) ""); |
| 188 | } |