1/***
2  This file is part of avahi.
3
4  avahi is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) any later version.
8
9  avahi is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
12  Public License for more details.
13
14  You should have received a copy of the GNU Lesser General Public
15  License along with avahi; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  USA.
18 ***/
19
20#ifdef HAVE_CONFIG_H
21#include <config.h>
22#endif
23
24#include "error.h"
25#include "i18n.h"
26
27const char *avahi_strerror(int error) {
28
29    const char * const msg[- AVAHI_ERR_MAX] = {
30        N_("OK"),
31        N_("Operation failed"),
32        N_("Bad state"),
33        N_("Invalid host name"),
34        N_("Invalid domain name"),
35        N_("No suitable network protocol available"),
36        N_("Invalid DNS TTL"),
37        N_("Resource record key is pattern"),
38        N_("Local name collision"),
39        N_("Invalid record"),
40
41        N_("Invalid service name"),
42        N_("Invalid service type"),
43        N_("Invalid port number"),
44        N_("Invalid record key"),
45        N_("Invalid address"),
46        N_("Timeout reached"),
47        N_("Too many clients"),
48        N_("Too many objects"),
49        N_("Too many entries"),
50        N_("OS Error"),
51
52        N_("Access denied"),
53        N_("Invalid operation"),
54        N_("An unexpected D-Bus error occured"),
55        N_("Daemon connection failed"),
56        N_("Memory exhausted"),
57        N_("The object passed in was not valid"),
58        N_("Daemon not running"),
59        N_("Invalid interface index"),
60        N_("Invalid protocol specification"),
61        N_("Invalid flags"),
62
63        N_("Not found"),
64        N_("Invalid configuration"),
65        N_("Version mismatch"),
66        N_("Invalid service subtype"),
67        N_("Invalid packet"),
68        N_("Invalid DNS return code"),
69        N_("DNS failure: FORMERR"),
70        N_("DNS failure: SERVFAIL"),
71        N_("DNS failure: NXDOMAIN"),
72        N_("DNS failure: NOTIMP"),
73
74        N_("DNS failure: REFUSED"),
75        N_("DNS failure: YXDOMAIN"),
76        N_("DNS failure: YXRRSET"),
77        N_("DNS failure: NXRRSET"),
78        N_("DNS failure: NOTAUTH"),
79        N_("DNS failure: NOTZONE"),
80        N_("Invalid RDATA"),
81        N_("Invalid DNS type"),
82        N_("Invalid DNS class"),
83        N_("Not supported"),
84
85        N_("Not permitted"),
86        N_("Invalid argument"),
87        N_("Is empty"),
88        N_("The requested operation is invalid because redundant"),
89        N_("New entry is requested to be published with invalid group")
90    };
91
92    avahi_init_i18n();
93
94    if (-error < 0 || -error >= -AVAHI_ERR_MAX)
95        return _("Invalid Error Code");
96
97    return _(msg[-error]);
98}
99