Debian Codegraph @

src/OVAL/oval_behavior.c

raw symbols SCIP
1 /**
2 * @file oval_behavior.c
3 * \brief Open Vulnerability and Assessment Language
4 *
5 * See more details at http://oval.mitre.org/
6 */
7
8 /*
9 * Copyright 2009--2013 Red Hat Inc., Durham, North Carolina.
10 * All Rights Reserved.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 * Authors:
27 * "David Niemoller" <[email protected]>
28 */
29
30 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
31 #include <config.h>cxx . . $ `<file>/build/config.h`/
32 #endif
33
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <string.h>
37
38 #include "oval_definitions_impl.h"cxx . . $ `<file>/src/OVAL/oval_definitions_impl.h`/
39 #include "adt/oval_collection_impl.h"cxx . . $ `<file>/src/OVAL/adt/oval_collection_impl.h`/
40 #include "adt/oval_string_map_impl.h"cxx . . $ `<file>/src/OVAL/adt/oval_string_map_impl.h`/
41
42 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
43 #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/
44 #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/
45
46 /***************************************************************************/
47 /* Variable definitions
48 * */
49
50 typedef struct oval_behaviorcxx . . $ oval_behavior# {
51 struct oval_definition_modelcxx . . $ oval_definition_model# *modelcxx . . $ oval_behavior#model.;
52 char *valuecxx . . $ oval_behavior#value.;
53 char *keycxx . . $ oval_behavior#key.;
54 } oval_behavior_tcxx . . $ oval_behavior_t#;
55
56 /* End of variable definitions
57 * */
58 /***************************************************************************/
59
60 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_behavior_iterator_has_morecxx . . $ oval_behavior_iterator_has_more(3d3ff23bd26ad9ab).(struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator# *oc_behavior)
61 {
62 return oval_collection_iterator_has_morecxx . . $ oval_collection_iterator_has_more(de0650ab9b639739).((struct oval_iteratorcxx . . $ oval_iterator# *)
63 oc_behavior);
64 }
65
66 struct oval_behaviorcxx . . $ oval_behavior# *oval_behavior_iterator_nextcxx . . $ oval_behavior_iterator_next(13cbfab487b431e4).(struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator#
67 *oc_behavior)
68 {
69 return (struct oval_behaviorcxx . . $ oval_behavior# *)
70 oval_collection_iterator_nextcxx . . $ oval_collection_iterator_next(344074693c9690a9).((struct oval_iteratorcxx . . $ oval_iterator# *)oc_behavior);
71 }
72
73 void oval_behavior_iterator_freecxx . . $ oval_behavior_iterator_free(3c04ebb55bfb1ccb).(struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator#
74 *oc_behavior)
75 {
76 oval_collection_iterator_freecxx . . $ oval_collection_iterator_free(ee496816570b41f7).((struct oval_iteratorcxx . . $ oval_iterator# *)oc_behavior);
77 }
78
79 char *oval_behavior_get_valuecxx . . $ oval_behavior_get_value(11d4889a96551e31).(struct oval_behaviorcxx . . $ oval_behavior# *behavior)
80 {
81 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(behavior);
82
83 return behavior->valuecxx . . $ oval_behavior#value.;
84 }
85
86 char *oval_behavior_get_keycxx . . $ oval_behavior_get_key(11d4889a96551e31).(struct oval_behaviorcxx . . $ oval_behavior# *behavior)
87 {
88 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(behavior);
89
90 return behavior->keycxx . . $ oval_behavior#key.;
91 }
92
93 struct oval_behaviorcxx . . $ oval_behavior# *oval_behavior_newcxx . . $ oval_behavior_new(7fd9ca49075560ad).(struct oval_definition_modelcxx . . $ oval_definition_model# *model)
94 {
95 oval_behavior_tcxx . . $ oval_behavior_t# *behavior = (oval_behavior_tcxx . . $ oval_behavior_t# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(oval_behavior_tcxx . . $ oval_behavior_t#));
96 if (behavior == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
97 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
98
99 behavior->modelcxx . . $ oval_behavior#model. = model;
100 behavior->valuecxx . . $ oval_behavior#value. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
101 behavior->keycxx . . $ oval_behavior#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
102 return behavior;
103 }
104
105 struct oval_behaviorcxx . . $ oval_behavior# *oval_behavior_clonecxx . . $ oval_behavior_clone(398e385dc1412c01).(struct oval_definition_modelcxx . . $ oval_definition_model# *new_model, struct oval_behaviorcxx . . $ oval_behavior# *old_behavior)
106 {
107 struct oval_behaviorcxx . . $ oval_behavior# *new_behavior = oval_behavior_newcxx . . $ oval_behavior_new(7fd9ca49075560ad).(new_model);
108 oval_behavior_set_keyvalcxx . . $ oval_behavior_set_keyval(ee1f879e3852d652).
109 (new_behavior, oval_behavior_get_keycxx . . $ oval_behavior_get_key(11d4889a96551e31).(old_behavior), oval_behavior_get_valuecxx . . $ oval_behavior_get_value(11d4889a96551e31).(old_behavior));
110 return new_behavior;
111 }
112
113 void oval_behavior_freecxx . . $ oval_behavior_free(b764472751a50bf).(struct oval_behaviorcxx . . $ oval_behavior# *behavior)
114 {
115 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(behavior);
116
117 if (behavior->valuecxx . . $ oval_behavior#value.)
118 freecxx . . $ free(5d22bdacc48458e8).(behavior->valuecxx . . $ oval_behavior#value.);
119 if (behavior->keycxx . . $ oval_behavior#key.)
120 freecxx . . $ free(5d22bdacc48458e8).(behavior->keycxx . . $ oval_behavior#key.);
121 behavior->keycxx . . $ oval_behavior#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
122 behavior->valuecxx . . $ oval_behavior#value. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
123 freecxx . . $ free(5d22bdacc48458e8).(behavior);
124 }
125
126 void oval_behavior_set_keyvalcxx . . $ oval_behavior_set_keyval(ee1f879e3852d652).(struct oval_behaviorcxx . . $ oval_behavior# *behavior, const char *key, const char *value)
127 {
128 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(behavior);
129
130 behavior->keycxx . . $ oval_behavior#key. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(key);
131 behavior->valuecxx . . $ oval_behavior#value. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(value);
132 }
133
134 //typedef void (*oval_behavior_consumer)(struct oval_behavior_node *, void*);
135 int oval_behavior_parse_tagcxx . . $ oval_behavior_parse_tag(e6943d31661351b4).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader,
136 struct oval_parser_contextcxx . . $ oval_parser_context# *context,
137 oval_family_tcxx . . $ oval_family_t# family, oval_behavior_consumercxx . . $ oval_behavior_consumer# consumer, void *user)
138 {
139 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(context);
140
141 while (xmlTextReaderMoveToNextAttributecxx . . $ xmlTextReaderMoveToNextAttribute(82a242a19623f75).(reader) == 1) {
142
143 const char *name = (const char *)xmlTextReaderConstNamecxx . . $ xmlTextReaderConstName(60a5affeeceb06fd).(reader);
144 const char *value = (const char *)xmlTextReaderConstValuecxx . . $ xmlTextReaderConstValue(60a5affeeceb06fd).(reader);
145
146 if (name && value) {
147 oval_behavior_tcxx . . $ oval_behavior_t# *behavior = oval_behavior_newcxx . . $ oval_behavior_new(7fd9ca49075560ad).(context->definition_modelcxx . . $ oval_parser_context#definition_model.);
148 oval_behavior_set_keyvalcxx . . $ oval_behavior_set_keyval(ee1f879e3852d652).(behavior, name, value);
149 (*consumer) (behavior, user);
150 }
151 }
152 return 0;
153 }
154