Debian Codegraph @

src/XCCDF_POLICY/xccdf_policy_resolve.h

raw symbols SCIP
1 /*
2 * Copyright 2015 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 */
20
21 #ifndef XCCDF_POLICY_RESOLVE_H_
22 #define XCCDF_POLICY_RESOLVE_H_
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <xccdf_benchmark.h>
29 #include <xccdf_policy_priv.h>
30 #include <math.h>
31
32
33 /*
34 * Struct contains final values defined in several xccdf_refine_rule structures.
35 * There is no "item" member. Hash-table key is used instead of this member.
36 * This structure is used only for internal rule processing.
37 */
38 struct xccdf_refine_rule_internal;
39
40 char* xccdf_refine_rule_internal_get_selector(const struct xccdf_refine_rule_internal*);
41 xccdf_role_t xccdf_refine_rule_internal_get_role(const struct xccdf_refine_rule_internal*);
42 xccdf_level_t xccdf_refine_rule_internal_get_severity(const struct xccdf_refine_rule_internal*);
43 xccdf_numeric xccdf_refine_rule_internal_get_weight(const struct xccdf_refine_rule_internal*);
44
45 /**
46 * Return refine-rule belonging to an item (by item ID)
47 * @return refine-rule or NULL
48 */
49 struct xccdf_refine_rule_internal* xccdf_policy_get_refine_rule_by_item(struct xccdf_policy* policy, struct xccdf_item* item);
50
51 /**
52 * Return true, if value of weight is valid
53 */
54 bool xccdf_weight_defined(xccdf_numeric weight);
55
56 /**
57 * Return final role of rule (role set by role potentially refined by refine-rule)
58 */
59 xccdf_role_t xccdf_get_final_role(const struct xccdf_rule* rule, const struct xccdf_refine_rule_internal* r_rule);
60
61 /**
62 * Return final weight of rule (role set by role potentially refined by refine-rule)
63 */
64 float xccdf_get_final_weight(const struct xccdf_rule* rule, const struct xccdf_refine_rule_internal* r_rule);
65
66 /**
67 * Return final severity of rule (role set by role potentially refined by refine-rule)
68 */
69 xccdf_level_t xccdf_get_final_severity(const struct xccdf_rule* rule, const struct xccdf_refine_rule_internal* r_rule);
70
71 /**
72 * Process refine-rules from profile and fill hash table with final value of refine-rules for specific item-id
73 */
74 void xccdf_policy_add_profile_refine_rules(struct xccdf_policy* policy, struct xccdf_benchmark* benchmark, struct xccdf_profile* profile);
75
76 /**
77 * Free function for xccdf_refine_rule_internal
78 */
79 void xccdf_refine_rule_internal_free(struct xccdf_refine_rule_internal* item);
80
81 #endif