Imported Upstream version 3.1.0
[debian/amanda] / ndmp-src / ndmp0_enum_strs.c
1 /*
2  * Copyright (c) 2000
3  *      Traakan, Inc., Los Altos, CA
4  *      All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice unmodified, this list of conditions, and the following
11  *    disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28
29 /*
30  * Project:  NDMJOB
31  * Ident:    $Id: $
32  *
33  * Description:
34  *
35  */
36
37
38 #include "ndmos.h"              /* rpc/rpc.h */
39 #include "ndmprotocol.h"
40
41
42
43
44
45 extern struct ndmp_enum_str_table ndmp0_error_table[];
46 extern char * ndmp0_error_to_str (ndmp0_error val);
47 extern int    ndmp0_error_from_str (ndmp0_error *valp, char *str);
48
49 char * ndmp0_error_to_str (ndmp0_error val) {
50         return ndmp_enum_to_str ((int)val, ndmp0_error_table);
51 }
52
53 int ndmp0_error_from_str (ndmp0_error *valp, char *str) {
54         return ndmp_enum_from_str ((int*)valp, str, ndmp0_error_table);
55 }
56
57 struct ndmp_enum_str_table ndmp0_error_table[] = {
58         { "NDMP0_NO_ERR",               NDMP0_NO_ERR, },
59         { "NDMP0_NOT_SUPPORTED_ERR",    NDMP0_NOT_SUPPORTED_ERR, },
60         { "NDMP0_DEVICE_BUSY_ERR",      NDMP0_DEVICE_BUSY_ERR, },
61         { "NDMP0_DEVICE_OPENED_ERR",    NDMP0_DEVICE_OPENED_ERR, },
62         { "NDMP0_NOT_AUTHORIZED_ERR",   NDMP0_NOT_AUTHORIZED_ERR, },
63         { "NDMP0_PERMISSION_ERR",       NDMP0_PERMISSION_ERR, },
64         { "NDMP0_DEV_NOT_OPEN_ERR",     NDMP0_DEV_NOT_OPEN_ERR, },
65         { "NDMP0_IO_ERR",               NDMP0_IO_ERR, },
66         { "NDMP0_TIMEOUT_ERR",          NDMP0_TIMEOUT_ERR, },
67         { "NDMP0_ILLEGAL_ARGS_ERR",     NDMP0_ILLEGAL_ARGS_ERR, },
68         { "NDMP0_NO_TAPE_LOADED_ERR",   NDMP0_NO_TAPE_LOADED_ERR, },
69         { "NDMP0_WRITE_PROTECT_ERR",    NDMP0_WRITE_PROTECT_ERR, },
70         { "NDMP0_EOF_ERR",              NDMP0_EOF_ERR, },
71         { "NDMP0_EOM_ERR",              NDMP0_EOM_ERR, },
72         { "NDMP0_FILE_NOT_FOUND_ERR",   NDMP0_FILE_NOT_FOUND_ERR, },
73         { "NDMP0_BAD_FILE_ERR",         NDMP0_BAD_FILE_ERR, },
74         { "NDMP0_NO_DEVICE_ERR",        NDMP0_NO_DEVICE_ERR, },
75         { "NDMP0_NO_BUS_ERR",           NDMP0_NO_BUS_ERR, },
76         { "NDMP0_XDR_DECODE_ERR",       NDMP0_XDR_DECODE_ERR, },
77         { "NDMP0_ILLEGAL_STATE_ERR",    NDMP0_ILLEGAL_STATE_ERR, },
78         { "NDMP0_UNDEFINED_ERR",        NDMP0_UNDEFINED_ERR, },
79         { "NDMP0_XDR_ENCODE_ERR",       NDMP0_XDR_ENCODE_ERR, },
80         { "NDMP0_NO_MEM_ERR",           NDMP0_NO_MEM_ERR, },
81         { 0 }
82 };
83
84
85 extern struct ndmp_enum_str_table ndmp0_header_message_type_table[];
86 extern char * ndmp0_header_message_type_to_str (ndmp0_header_message_type val);
87 extern int    ndmp0_header_message_type_from_str (ndmp0_header_message_type *valp, char *str);
88
89 char * ndmp0_header_message_type_to_str (ndmp0_header_message_type val) {
90         return ndmp_enum_to_str ((int)val, ndmp0_header_message_type_table);
91 }
92
93 int ndmp0_header_message_type_from_str (ndmp0_header_message_type *valp, char *str) {
94         return ndmp_enum_from_str ((int*)valp, str, ndmp0_header_message_type_table);
95 }
96
97 struct ndmp_enum_str_table ndmp0_header_message_type_table[] = {
98         { "NDMP0_MESSAGE_REQUEST",      NDMP0_MESSAGE_REQUEST, },
99         { "NDMP0_MESSAGE_REPLY",        NDMP0_MESSAGE_REPLY, },
100         { 0 }
101 };
102
103
104 extern struct ndmp_enum_str_table ndmp0_message_table[];
105 extern char * ndmp0_message_to_str (ndmp0_message val);
106 extern int    ndmp0_message_from_str (ndmp0_message *valp, char *str);
107
108 char * ndmp0_message_to_str (ndmp0_message val) {
109         return ndmp_enum_to_str ((int)val, ndmp0_message_table);
110 }
111
112 int ndmp0_message_from_str (ndmp0_message *valp, char *str) {
113         return ndmp_enum_from_str ((int*)valp, str, ndmp0_message_table);
114 }
115
116 struct ndmp_enum_str_table ndmp0_message_table[] = {
117         { "NDMP0_CONNECT_OPEN",         NDMP0_CONNECT_OPEN, },
118         { "NDMP0_CONNECT_CLOSE",        NDMP0_CONNECT_CLOSE, },
119         { "NDMP0_NOTIFY_CONNECTED",     NDMP0_NOTIFY_CONNECTED, },
120         { 0 }
121 };
122
123
124 extern struct ndmp_enum_str_table ndmp0_connect_reason_table[];
125 extern char * ndmp0_connect_reason_to_str (ndmp0_connect_reason val);
126 extern int    ndmp0_connect_reason_from_str (ndmp0_connect_reason *valp, char *str);
127
128 char * ndmp0_connect_reason_to_str (ndmp0_connect_reason val) {
129         return ndmp_enum_to_str ((int)val, ndmp0_connect_reason_table);
130 }
131
132 int ndmp0_connect_reason_from_str (ndmp0_connect_reason *valp, char *str) {
133         return ndmp_enum_from_str ((int*)valp, str, ndmp0_connect_reason_table);
134 }
135
136 struct ndmp_enum_str_table ndmp0_connect_reason_table[] = {
137         { "NDMP0_CONNECTED",            NDMP0_CONNECTED, },
138         { "NDMP0_SHUTDOWN",             NDMP0_SHUTDOWN, },
139         { "NDMP0_REFUSED",              NDMP0_REFUSED, },
140         { 0 }
141 };