File: OscapCapabilities.h

package info (click to toggle)
scap-workbench 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,292 kB
  • sloc: cpp: 7,519; sh: 205; xml: 38; ansic: 15; makefile: 13
file content (122 lines) | stat: -rw-r--r-- 3,744 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 * Copyright 2013 Red Hat Inc., Durham, North Carolina.
 * All Rights Reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Martin Preisler <mpreisle@redhat.com>
 */

#ifndef SCAP_WORKBENCH_OSCAP_SCANNER_CAPABILITIES_H_
#define SCAP_WORKBENCH_OSCAP_SCANNER_CAPABILITIES_H_

#include "ForwardDecls.h"

#include <QString>

/**
 * @brief Figures out oscap capabilities based on version and compile flags
 */
class OscapCapabilities
{
    public:
        OscapCapabilities();

        /**
         * @brief Resets all stored capabilities to unknown or not supported
         *
         * @see OscapCapabilities::parse
         */
        void clear();

        /**
         * @brief Parses output of 'oscap --v' and interprets the results
         *
         * The results are stored in this class. All previously stored results
         * will be lost!
         *
         * @param mmv Verbatim output of 'oscap --v' to be processed
         */
        void parse(const QString& mmv);

        /**
         * @brief Returns version of openscap that was detected
         */
        const QString& getOpenSCAPVersion() const;

        /**
         * @brief Returns true if enough is supported for workbench to use the oscap
         *
         * This is a critical requirement, for very old oscap versions this will
         * return false and these versions just can't be used with the new
         * workbench!
         */
        bool baselineSupport() const;

        /**
         * @brief Returns true if --progress flag is supported
         *
         * If the flag is not supported, we don't do any GUI progress reporting.
         */
        bool progressReporting() const;

        /**
         * @brief Returns true of online remediation is supported
         *
         * Only returns true if --progress flag is supported and works correctly for online remediation
         * If the flag is not supported, we don't do any GUI progress reporting when remediating.
         */
        bool onlineRemediation() const;

        /**
         * @brief Returns true if source datastreams are supported
         */
        bool sourceDatastreams() const;

        /**
         * @brief Returns true if ARFs are supported as input
         */
        bool ARFInput() const;

        /**
         * @brief Returns true if tailoring is supported to the full extent workbench requires
         *
         * This means that XCCDF 1.1 can take tailoring via the openscap extension and XCCDF 1.2
         * has proper tailoring including profile inheritance.
         */
        bool tailoringSupport() const;

        const QString& XCCDFVersion() const;
        const QString& OVALVersion() const;
        const QString& CPEVersion() const;

    private:
        QString mVersion;

        bool mBaselineSupport;
        bool mProgressReporting;
        bool mOnlineRemediation;
        bool mSourceDataStreams;
        bool mARFInput;
        bool mTailoringSupport;
        bool mSCE;

        QString mXCCDFVersion;
        QString mOVALVersion;
        QString mCPEVersion;
        QString mSCEVersion;
};

#endif