2003-12-02 Richard Hult <richard@imendio.com>
[platform/upstream/dbus.git] / dbus / dbus-errors.h
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-errors.h Error reporting
3  *
4  * Copyright (C) 2002  Red Hat Inc.
5  * Copyright (C) 2003  CodeFactory AB
6  *
7  * Licensed under the Academic Free License version 2.0
8  * 
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  * 
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  *
23  */
24 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
25 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
26 #endif
27
28 #ifndef DBUS_ERROR_H
29 #define DBUS_ERROR_H
30
31 #include <dbus/dbus-macros.h>
32 #include <dbus/dbus-types.h>
33
34 DBUS_BEGIN_DECLS;
35
36 typedef struct DBusError DBusError;
37
38 /**
39  * Object representing an exception.
40  */
41 struct DBusError
42 {
43   const char *name;    /**< error name */
44   const char *message; /**< error message */
45
46   unsigned int dummy1 : 1; /**< placeholder */
47   unsigned int dummy2 : 1; /**< placeholder */
48   unsigned int dummy3 : 1; /**< placeholder */
49   unsigned int dummy4 : 1; /**< placeholder */
50   unsigned int dummy5 : 1; /**< placeholder */
51
52   void *padding1; /**< placeholder */
53 };
54
55 #define DBUS_ERROR_FAILED                     "org.freedesktop.DBus.Error.Failed"
56 #define DBUS_ERROR_NO_MEMORY                  "org.freedesktop.DBus.Error.NoMemory"
57 #define DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.ServiceNotFound"
58 #define DBUS_ERROR_SERVICE_DOES_NOT_EXIST     "org.freedesktop.DBus.Error.ServiceDoesNotExist"
59 #define DBUS_ERROR_NO_REPLY                   "org.freedesktop.DBus.Error.NoReply"
60 #define DBUS_ERROR_IO_ERROR                   "org.freedesktop.DBus.Error.IOError"
61 #define DBUS_ERROR_BAD_ADDRESS                "org.freedesktop.DBus.Error.BadAddress"
62 #define DBUS_ERROR_NOT_SUPPORTED              "org.freedesktop.DBus.Error.NotSupported"
63 #define DBUS_ERROR_LIMITS_EXCEEDED            "org.freedesktop.DBus.Error.LimitsExceeded"
64 #define DBUS_ERROR_ACCESS_DENIED              "org.freedesktop.DBus.Error.AccessDenied"
65 #define DBUS_ERROR_AUTH_FAILED                "org.freedesktop.DBus.Error.AuthFailed"
66 #define DBUS_ERROR_NO_SERVER                  "org.freedesktop.DBus.Error.NoServer"
67 #define DBUS_ERROR_TIMEOUT                    "org.freedesktop.DBus.Error.Timeout"
68 #define DBUS_ERROR_NO_NETWORK                 "org.freedesktop.DBus.Error.NoNetwork"
69 #define DBUS_ERROR_ADDRESS_IN_USE             "org.freedesktop.DBus.Error.AddressInUse"
70 #define DBUS_ERROR_DISCONNECTED               "org.freedesktop.DBus.Error.Disconnected"
71 #define DBUS_ERROR_INVALID_ARGS               "org.freedesktop.DBus.Error.InvalidArgs"
72 #define DBUS_ERROR_FILE_NOT_FOUND             "org.freedesktop.DBus.Error.FileNotFound"
73 #define DBUS_ERROR_UNKNOWN_METHOD             "org.freedesktop.DBus.Error.UnknownMethod"
74 #define DBUS_ERROR_TIMED_OUT                  "org.freedesktop.DBus.Error.TimedOut"
75 #define DBUS_ERROR_MATCH_RULE_NOT_FOUND       "org.freedesktop.DBus.Error.MatchRuleNotFound"
76 #define DBUS_ERROR_MATCH_RULE_INVALID         "org.freedesktop.DBus.Error.MatchRuleInvalid"
77 #define DBUS_ERROR_SPAWN_EXEC_FAILED          "org.freedesktop.DBus.Error.Spawn.ExecFailed"
78 #define DBUS_ERROR_SPAWN_FORK_FAILED          "org.freedesktop.DBus.Error.Spawn.ForkFailed"
79 #define DBUS_ERROR_SPAWN_CHILD_EXITED         "org.freedesktop.DBus.Error.Spawn.ChildExited"
80 #define DBUS_ERROR_SPAWN_CHILD_SIGNALED       "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
81 #define DBUS_ERROR_SPAWN_FAILED               "org.freedesktop.DBus.Error.Spawn.Failed"
82
83 void        dbus_error_init      (DBusError       *error);
84 void        dbus_error_free      (DBusError       *error);
85 void        dbus_set_error       (DBusError       *error,
86                                   const char      *name,
87                                   const char      *message,
88                                   ...);
89 void        dbus_set_error_const (DBusError       *error,
90                                   const char      *name,
91                                   const char      *message);
92 void        dbus_move_error      (DBusError       *src,
93                                   DBusError       *dest);
94 dbus_bool_t dbus_error_has_name  (const DBusError *error,
95                                   const char      *name);
96 dbus_bool_t dbus_error_is_set    (const DBusError *error);
97
98 DBUS_END_DECLS;
99
100 #endif /* DBUS_ERROR_H */