D-Bus  1.16.2
dbus-errors.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-errors.h Error reporting
3  *
4  * Copyright (C) 2002 Red Hat Inc.
5  * Copyright (C) 2003 CodeFactory AB
6  *
7  * SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
8  *
9  * Licensed under the Academic Free License version 2.1
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24  *
25  */
26 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
27 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
28 #endif
29 
30 #ifndef DBUS_ERROR_H
31 #define DBUS_ERROR_H
32 
33 #include <dbus/dbus-macros.h>
34 #include <dbus/dbus-types.h>
35 #include <dbus/dbus-protocol.h>
36 
38 
45 typedef struct DBusError DBusError;
46 
50 struct DBusError
51 {
52  const char *name;
53  const char *message;
55  unsigned int dummy1 : 1;
56  unsigned int dummy2 : 1;
57  unsigned int dummy3 : 1;
58  unsigned int dummy4 : 1;
59  unsigned int dummy5 : 1;
61  void *padding1;
62 };
63 
64 #define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
65 
66 DBUS_EXPORT
67 void dbus_error_init (DBusError *error);
68 DBUS_EXPORT
69 void dbus_error_free (DBusError *error);
70 DBUS_EXPORT
71 void dbus_set_error (DBusError *error,
72  const char *name,
73  const char *message,
74  ...) _DBUS_GNUC_PRINTF (3, 4);
75 DBUS_EXPORT
76 void dbus_set_error_const (DBusError *error,
77  const char *name,
78  const char *message);
79 DBUS_EXPORT
80 void dbus_move_error (DBusError *src,
81  DBusError *dest);
82 DBUS_EXPORT
84  const char *name);
85 DBUS_EXPORT
87 
91 
92 #endif /* DBUS_ERROR_H */
dbus_bool_t dbus_error_has_name(const DBusError *error, const char *name)
Checks whether the error is set and has the given name.
Definition: dbus-errors.c:304
const char * message
public error message field
Definition: dbus-errors.h:53
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
Definition: dbus-errors.c:213
unsigned int dummy1
placeholder
Definition: dbus-errors.h:55
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:37
Object representing an exception.
Definition: dbus-errors.h:50
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
Definition: dbus-errors.c:356
unsigned int dummy2
placeholder
Definition: dbus-errors.h:56
unsigned int dummy5
placeholder
Definition: dbus-errors.h:59
void dbus_move_error(DBusError *src, DBusError *dest)
Moves an error src into dest, freeing src and overwriting dest.
Definition: dbus-errors.c:281
const char * name
public error name field
Definition: dbus-errors.h:52
unsigned int dummy3
placeholder
Definition: dbus-errors.h:57
void dbus_error_init(DBusError *error)
Initializes a DBusError structure.
Definition: dbus-errors.c:190
unsigned int dummy4
placeholder
Definition: dbus-errors.h:58
void dbus_set_error_const(DBusError *error, const char *name, const char *message)
Assigns an error name and message to a DBusError.
Definition: dbus-errors.c:245
void * padding1
placeholder
Definition: dbus-errors.h:61
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).
Definition: dbus-errors.c:331
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.