![]() |
|
|||
File indexing completed on 2025-09-18 09:10:18
0001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 0002 /* dbus-types.h types such as dbus_bool_t 0003 * 0004 * Copyright (C) 2002 Red Hat Inc. 0005 * 0006 * SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later 0007 * 0008 * Licensed under the Academic Free License version 2.1 0009 * 0010 * This program is free software; you can redistribute it and/or modify 0011 * it under the terms of the GNU General Public License as published by 0012 * the Free Software Foundation; either version 2 of the License, or 0013 * (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU General Public License 0021 * along with this program; if not, write to the Free Software 0022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0023 * 0024 */ 0025 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION) 0026 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents." 0027 #endif 0028 0029 #ifndef DBUS_TYPES_H 0030 #define DBUS_TYPES_H 0031 0032 #include <stddef.h> 0033 #include <dbus/dbus-arch-deps.h> 0034 0035 typedef dbus_uint32_t dbus_unichar_t; 0036 /* boolean size must be fixed at 4 bytes due to wire protocol! */ 0037 typedef dbus_uint32_t dbus_bool_t; 0038 0039 /* Normally docs are in .c files, but there isn't a .c file for this. */ 0040 /** 0041 * @defgroup DBusTypes Basic types 0042 * @ingroup DBus 0043 * @brief dbus_bool_t, dbus_int32_t, etc. 0044 * 0045 * Typedefs for common primitive types. 0046 * 0047 * @{ 0048 */ 0049 0050 /** 0051 * @typedef dbus_bool_t 0052 * 0053 * A boolean, valid values are #TRUE and #FALSE. 0054 */ 0055 0056 /** 0057 * @typedef dbus_uint32_t 0058 * 0059 * A 32-bit unsigned integer on all platforms. 0060 */ 0061 0062 /** 0063 * @typedef dbus_int32_t 0064 * 0065 * A 32-bit signed integer on all platforms. 0066 */ 0067 0068 /** 0069 * @typedef dbus_uint16_t 0070 * 0071 * A 16-bit unsigned integer on all platforms. 0072 */ 0073 0074 /** 0075 * @typedef dbus_int16_t 0076 * 0077 * A 16-bit signed integer on all platforms. 0078 */ 0079 0080 0081 /** 0082 * @typedef dbus_uint64_t 0083 * 0084 * A 64-bit unsigned integer. 0085 */ 0086 0087 /** 0088 * @typedef dbus_int64_t 0089 * 0090 * A 64-bit signed integer. 0091 */ 0092 0093 /** 0094 * @def DBUS_HAVE_INT64 0095 * 0096 * Always defined. 0097 * 0098 * In older libdbus versions, this would be undefined if there was no 0099 * 64-bit integer type on that platform. libdbus no longer supports 0100 * such platforms. 0101 */ 0102 0103 /** 0104 * @def DBUS_INT64_CONSTANT 0105 * 0106 * Declare a 64-bit signed integer constant. The macro 0107 * adds the necessary "LL" or whatever after the integer, 0108 * giving a literal such as "325145246765LL" 0109 */ 0110 0111 /** 0112 * @def DBUS_UINT64_CONSTANT 0113 * 0114 * Declare a 64-bit unsigned integer constant. The macro 0115 * adds the necessary "ULL" or whatever after the integer, 0116 * giving a literal such as "325145246765ULL" 0117 */ 0118 0119 /** 0120 * @def DBUS_INT64_MODIFIER 0121 * 0122 * A string literal for a length modifier that is appropriate to print 0123 * the #dbus_int64_t and #dbus_uint64_t types. 0124 * For example, it might be an empty string, "l", "ll", or "I64". 0125 * 0126 * This modifier needs to be concatenated with a literal "%" and a 0127 * conversion specifier that can print signed or unsigned integers, 0128 * for example: 0129 * 0130 * @code 0131 * dbus_int64_t i = -123; 0132 * dbus_uint64_t u = 456; 0133 * 0134 * printf ("signed: %" DBUS_INT64_MODIFIER "d\n", i); 0135 * printf ("unsigned decimal: %" DBUS_INT64_MODIFIER "u\n", u); 0136 * printf ("unsigned hex: 0x%" DBUS_INT64_MODIFIER "x\n", x); 0137 * @endcode 0138 */ 0139 0140 /** 0141 * An 8-byte struct you could use to access int64 without having 0142 * int64 support. Use #dbus_int64_t or #dbus_uint64_t instead. 0143 */ 0144 typedef struct 0145 { 0146 dbus_uint32_t first32; /**< first 32 bits in the 8 bytes (beware endian issues) */ 0147 dbus_uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */ 0148 } DBus8ByteStruct; 0149 0150 /** 0151 * A simple value union that lets you access bytes as if they 0152 * were various types; useful when dealing with basic types via 0153 * void pointers and varargs. 0154 * 0155 * This union also contains a pointer member (which can be used 0156 * to retrieve a string from dbus_message_iter_get_basic(), for 0157 * instance), so on future platforms it could conceivably be larger 0158 * than 8 bytes. 0159 */ 0160 typedef union 0161 { 0162 unsigned char bytes[8]; /**< as 8 individual bytes */ 0163 dbus_int16_t i16; /**< as int16 */ 0164 dbus_uint16_t u16; /**< as int16 */ 0165 dbus_int32_t i32; /**< as int32 */ 0166 dbus_uint32_t u32; /**< as int32 */ 0167 dbus_bool_t bool_val; /**< as boolean */ 0168 dbus_int64_t i64; /**< as int64 */ 0169 dbus_uint64_t u64; /**< as int64 */ 0170 DBus8ByteStruct eight; /**< as 8-byte struct */ 0171 double dbl; /**< as double */ 0172 unsigned char byt; /**< as byte */ 0173 char *str; /**< as char* (string, object path or signature) */ 0174 int fd; /**< as Unix file descriptor */ 0175 } DBusBasicValue; 0176 0177 /** @} */ 0178 0179 #endif /* DBUS_TYPES_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |