Merge from vendor branch CVS:
[dragonfly.git] / contrib / isc-dhcp / omapip / result.c
1 /* result.c
2
3    Cheap knock-off of libisc result table code.   This is just a place-holder
4    until the actual libisc merge. */
5
6 /*
7  * Copyright (c) 1999-2001 Internet Software Consortium.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of The Internet Software Consortium nor the names
20  *    of its contributors may be used to endorse or promote products derived
21  *    from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
24  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
28  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
31  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
34  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  * This software has been written for the Internet Software Consortium
38  * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
39  * To learn more about the Internet Software Consortium, see
40  * ``http://www.isc.org/''.  To learn more about Vixie Enterprises,
41  * see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
42  * ``http://www.nominum.com''.
43  *
44  * $DragonFly: src/contrib/isc-dhcp/omapip/Attic/result.c,v 1.2 2003/10/11 21:14:25 dillon Exp $
45  */
46
47 #include <omapip/omapip_p.h>
48
49 static const char *text[ISC_R_NRESULTS] = {
50         "success",                              /*  0 */
51         "out of memory",                        /*  1 */
52         "timed out",                            /*  2 */
53         "no available threads",                 /*  3 */
54         "address not available",                /*  4 */
55         "address in use",                       /*  5 */
56         "permission denied",                    /*  6 */
57         "no pending connections",               /*  7 */
58         "network unreachable",                  /*  8 */
59         "host unreachable",                     /*  9 */
60         "network down",                         /* 10 */
61         "host down",                            /* 11 */
62         "connection refused",                   /* 12 */
63         "not enough free resources",            /* 13 */
64         "end of file",                          /* 14 */
65         "socket already bound",                 /* 15 */
66         "task is done",                         /* 16 */
67         "lock busy",                            /* 17 */
68         "already exists",                       /* 18 */
69         "ran out of space",                     /* 19 */
70         "operation canceled",                   /* 20 */
71         "sending events is not allowed",        /* 21 */
72         "shutting down",                        /* 22 */
73         "not found",                            /* 23 */
74         "unexpected end of input",              /* 24 */
75         "failure",                              /* 25 */
76         "I/O error",                            /* 26 */
77         "not implemented",                      /* 27 */
78         "unbalanced parentheses",               /* 28 */
79         "no more",                              /* 29 */
80         "invalid file",                         /* 30 */
81         "bad base64 encoding",                  /* 31 */
82         "unexpected token",                     /* 32 */
83         "quota reached",                        /* 33 */
84         "unexpected error",                     /* 34 */
85         "already running",                      /* 35 */
86         "host unknown",                         /* 36 */
87         "protocol version mismatch",            /* 37 */
88         "protocol error",                       /* 38 */
89         "invalid argument",                     /* 39 */
90         "not connected",                        /* 40 */
91         "data not yet available",               /* 41 */
92         "object unchanged",                     /* 42 */
93         "more than one object matches key",     /* 43 */
94         "key conflict",                         /* 44 */
95         "parse error(s) occurred",              /* 45 */
96         "no key specified",                     /* 46 */
97         "zone TSIG key not known",              /* 47 */
98         "invalid TSIG key",                     /* 48 */
99         "operation in progress",                /* 49 */
100         "DNS format error",                     /* 50 */
101         "DNS server failed",                    /* 51 */
102         "no such domain",                       /* 52 */
103         "not implemented",                      /* 53 */
104         "refused",                              /* 54 */
105         "domain already exists",                /* 55 */
106         "RRset already exists",                 /* 56 */
107         "no such RRset",                        /* 57 */
108         "not authorized",                       /* 58 */
109         "not a zone",                           /* 59 */
110         "bad DNS signature",                    /* 60 */
111         "bad DNS key",                          /* 61 */
112         "clock skew too great",                 /* 62 */
113         "no root zone",                         /* 63 */
114         "destination address required",         /* 64 */
115         "cross-zone update",                    /* 65 */
116         "no TSIG signature",                    /* 66 */
117         "not equal",                            /* 67 */
118         "connection reset by peer",             /* 68 */
119         "unknown attribute"                     /* 69 */
120 };
121
122 const char *isc_result_totext (isc_result_t result)
123 {
124         static char ebuf[40];
125
126         if (result >= ISC_R_SUCCESS && result < ISC_R_NRESULTS)
127                 return text [result];
128         sprintf(ebuf, "unknown error: %d", result);
129         return ebuf;
130 }