3 * Traakan, Inc., Los Altos, CA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice unmodified, this list of conditions, and the following
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.
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
38 #include "ndmos.h" /* rpc/rpc.h */
39 #include "ndmprotocol.h"
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);
49 char * ndmp0_error_to_str (ndmp0_error val) {
50 return ndmp_enum_to_str ((int)val, ndmp0_error_table);
53 int ndmp0_error_from_str (ndmp0_error *valp, char *str) {
54 return ndmp_enum_from_str ((int*)valp, str, ndmp0_error_table);
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, },
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);
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);
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);
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, },
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);
108 char * ndmp0_message_to_str (ndmp0_message val) {
109 return ndmp_enum_to_str ((int)val, ndmp0_message_table);
112 int ndmp0_message_from_str (ndmp0_message *valp, char *str) {
113 return ndmp_enum_from_str ((int*)valp, str, ndmp0_message_table);
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, },
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);
128 char * ndmp0_connect_reason_to_str (ndmp0_connect_reason val) {
129 return ndmp_enum_to_str ((int)val, ndmp0_connect_reason_table);
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);
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, },