| 1 | /* |
| 2 | * Copyright 2023 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 | * Evgenii Kolesnikov <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #ifndef OPENSCAP_OVAL_DBUS_H_ |
| 24 | #define OPENSCAP_OVAL_DBUS_H_ |
| 25 | |
| 26 | #include <dbus/dbus.h> |
| 27 | |
| 28 | |
| 29 | // Old versions of libdbus API don't have DBusBasicValue and DBus8ByteStruct |
| 30 | // as a public typedefs. |
| 31 | // These two typedefs were copied from libdbus 1.8 branch, see |
| 32 | // http://cgit.freedesktop.org/dbus/dbus/tree/dbus/dbus-types.h?h=dbus-1.8#n137 |
| 33 | typedef struct |
| 34 | { |
| 35 | dbus_uint32_t first32; |
| 36 | dbus_uint32_t second32; |
| 37 | } _DBus8ByteStruct; |
| 38 | |
| 39 | typedef union |
| 40 | { |
| 41 | unsigned char bytes[8]; /**< as 8 individual bytes */ |
| 42 | dbus_int16_t i16; /**< as int16 */ |
| 43 | dbus_uint16_t u16; /**< as int16 */ |
| 44 | dbus_int32_t i32; /**< as int32 */ |
| 45 | dbus_uint32_t u32; /**< as int32 */ |
| 46 | dbus_bool_t bool_val; /**< as boolean */ |
| 47 | #ifdef DBUS_HAVE_INT64 |
| 48 | dbus_int64_t i64; /**< as int64 */ |
| 49 | dbus_uint64_t u64; /**< as int64 */ |
| 50 | #endif |
| 51 | _DBus8ByteStruct eight; /**< as 8-byte struct */ |
| 52 | double dbl; /**< as double */ |
| 53 | unsigned char byt; /**< as byte */ |
| 54 | char *str; /**< as char* (string, object path or signature) */ |
| 55 | int fd; /**< as Unix file descriptor */ |
| 56 | } _DBusBasicValue; |
| 57 | |
| 58 | |
| 59 | char *oval_dbus_value_to_string(DBusMessageIter *iter); |
| 60 | |
| 61 | DBusConnection *oval_connect_dbus(void); |
| 62 | |
| 63 | void oval_disconnect_dbus(DBusConnection *conn); |
| 64 | |
| 65 | #endif |