4 This file is part of avahi.
6 avahi is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 avahi is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14 Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with avahi; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30 #include <avahi-common/error.h>
31 #include <avahi-common/dbus.h>
33 static const char * const table[- AVAHI_ERR_MAX] = {
35 AVAHI_DBUS_ERR_FAILURE,
36 AVAHI_DBUS_ERR_BAD_STATE,
37 AVAHI_DBUS_ERR_INVALID_HOST_NAME,
38 AVAHI_DBUS_ERR_INVALID_DOMAIN_NAME,
39 AVAHI_DBUS_ERR_NO_NETWORK,
40 AVAHI_DBUS_ERR_INVALID_TTL,
41 AVAHI_DBUS_ERR_IS_PATTERN,
42 AVAHI_DBUS_ERR_LOCAL_COLLISION,
43 AVAHI_DBUS_ERR_INVALID_RECORD,
44 AVAHI_DBUS_ERR_INVALID_SERVICE_NAME,
45 AVAHI_DBUS_ERR_INVALID_SERVICE_TYPE,
46 AVAHI_DBUS_ERR_INVALID_PORT,
47 AVAHI_DBUS_ERR_INVALID_KEY,
48 AVAHI_DBUS_ERR_INVALID_ADDRESS,
49 AVAHI_DBUS_ERR_TIMEOUT,
50 AVAHI_DBUS_ERR_TOO_MANY_CLIENTS,
51 AVAHI_DBUS_ERR_TOO_MANY_OBJECTS,
52 AVAHI_DBUS_ERR_TOO_MANY_ENTRIES,
54 AVAHI_DBUS_ERR_ACCESS_DENIED,
55 AVAHI_DBUS_ERR_INVALID_OPERATION,
56 AVAHI_DBUS_ERR_DBUS_ERROR,
57 AVAHI_DBUS_ERR_NOT_CONNECTED,
58 AVAHI_DBUS_ERR_NO_MEMORY,
59 AVAHI_DBUS_ERR_INVALID_OBJECT,
60 AVAHI_DBUS_ERR_NO_DAEMON,
61 AVAHI_DBUS_ERR_INVALID_INTERFACE,
62 AVAHI_DBUS_ERR_INVALID_PROTOCOL,
63 AVAHI_DBUS_ERR_INVALID_FLAGS,
64 AVAHI_DBUS_ERR_NOT_FOUND,
65 AVAHI_DBUS_ERR_INVALID_CONFIG,
66 AVAHI_DBUS_ERR_VERSION_MISMATCH
69 int avahi_error_dbus_to_number(const char *s) {
74 for (e = -1; e > AVAHI_ERR_MAX; e--)
75 if (strcmp(s, table[-e]) == 0)
78 return AVAHI_ERR_DBUS_ERROR;
81 const char *avahi_error_number_to_dbus(int error) {
82 assert(error > AVAHI_ERR_MAX);