| 1 | /** |
| 2 | * @file oval_cmp_evr_string_impl.h |
| 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 | * Šimon Lukašík |
| 28 | */ |
| 29 | |
| 30 | #ifndef OSCAP_OVAL_EVR_STRING_IMPL_H_ |
| 31 | #define OSCAP_OVAL_EVR_STRING_IMPL_H_ |
| 32 | |
| 33 | #include "../common/util.h" |
| 34 | |
| 35 | #include "oval_definitions.h" |
| 36 | #include "oval_types.h" |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * Compare two EVR (Epoch:Version-Release) strings. The format of input types shall |
| 41 | * conform to EntityStateEVRStringType. Comparisons involving this datatype follow |
| 42 | * the algorithm of librpm's rpmvercmp() function. |
| 43 | * @param state evr_string as defined by state element |
| 44 | * @param sys evr_string as captured from system (from syschar object) |
| 45 | * @param operation type of comparison operation |
| 46 | * @returns result of comparison |
| 47 | */ |
| 48 | oval_result_t oval_evr_string_cmp(const char *state, const char *sys, oval_operation_t operation); |
| 49 | |
| 50 | oval_result_t oval_versiontype_cmp(const char *state, const char *syschar, oval_operation_t operation); |
| 51 | |
| 52 | oval_result_t oval_debian_evr_string_cmp(const char *state, const char *sys, oval_operation_t operation); |
| 53 | |
| 54 | /* |
| 55 | * Code copied from lib/dpkg/version.h |
| 56 | */ |
| 57 | struct dpkg_version { |
| 58 | /** The epoch. It will be zero if no epoch is present. */ |
| 59 | unsigned int epoch; |
| 60 | /** The upstream part of the version. */ |
| 61 | const char *version; |
| 62 | /** The Debian revision part of the version. */ |
| 63 | const char *revision; |
| 64 | }; |
| 65 | |
| 66 | #endif |