Imported Upstream version 3.2.0
[debian/amanda] / ndmp-src / ndmp4_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 #ifndef NDMOS_OPTION_NO_NDMP4
43
44
45 extern struct ndmp_enum_str_table ndmp4_error_table[];
46 extern char * ndmp4_error_to_str (ndmp4_error val);
47 extern int    ndmp4_error_from_str (ndmp4_error *valp, char *str);
48
49 char * ndmp4_error_to_str (ndmp4_error val) {
50         return ndmp_enum_to_str ((int)val, ndmp4_error_table);
51 }
52
53 int ndmp4_error_from_str (ndmp4_error *valp, char *str) {
54         return ndmp_enum_from_str ((int*)valp, str, ndmp4_error_table);
55 }
56
57 struct ndmp_enum_str_table ndmp4_error_table[] = {
58         { "NDMP4_NO_ERR",               NDMP4_NO_ERR, },
59         { "NDMP4_NOT_SUPPORTED_ERR",    NDMP4_NOT_SUPPORTED_ERR, },
60         { "NDMP4_DEVICE_BUSY_ERR",      NDMP4_DEVICE_BUSY_ERR, },
61         { "NDMP4_DEVICE_OPENED_ERR",    NDMP4_DEVICE_OPENED_ERR, },
62         { "NDMP4_NOT_AUTHORIZED_ERR",   NDMP4_NOT_AUTHORIZED_ERR, },
63         { "NDMP4_PERMISSION_ERR",       NDMP4_PERMISSION_ERR, },
64         { "NDMP4_DEV_NOT_OPEN_ERR",     NDMP4_DEV_NOT_OPEN_ERR, },
65         { "NDMP4_IO_ERR",               NDMP4_IO_ERR, },
66         { "NDMP4_TIMEOUT_ERR",          NDMP4_TIMEOUT_ERR, },
67         { "NDMP4_ILLEGAL_ARGS_ERR",     NDMP4_ILLEGAL_ARGS_ERR, },
68         { "NDMP4_NO_TAPE_LOADED_ERR",   NDMP4_NO_TAPE_LOADED_ERR, },
69         { "NDMP4_WRITE_PROTECT_ERR",    NDMP4_WRITE_PROTECT_ERR, },
70         { "NDMP4_EOF_ERR",              NDMP4_EOF_ERR, },
71         { "NDMP4_EOM_ERR",              NDMP4_EOM_ERR, },
72         { "NDMP4_FILE_NOT_FOUND_ERR",   NDMP4_FILE_NOT_FOUND_ERR, },
73         { "NDMP4_BAD_FILE_ERR",         NDMP4_BAD_FILE_ERR, },
74         { "NDMP4_NO_DEVICE_ERR",        NDMP4_NO_DEVICE_ERR, },
75         { "NDMP4_NO_BUS_ERR",           NDMP4_NO_BUS_ERR, },
76         { "NDMP4_XDR_DECODE_ERR",       NDMP4_XDR_DECODE_ERR, },
77         { "NDMP4_ILLEGAL_STATE_ERR",    NDMP4_ILLEGAL_STATE_ERR, },
78         { "NDMP4_UNDEFINED_ERR",        NDMP4_UNDEFINED_ERR, },
79         { "NDMP4_XDR_ENCODE_ERR",       NDMP4_XDR_ENCODE_ERR, },
80         { "NDMP4_NO_MEM_ERR",           NDMP4_NO_MEM_ERR, },
81         { "NDMP4_CONNECT_ERR",          NDMP4_CONNECT_ERR, },
82         { 0 }
83 };
84
85
86 extern struct ndmp_enum_str_table ndmp4_header_message_type_table[];
87 extern char * ndmp4_header_message_type_to_str (ndmp4_header_message_type val);
88 extern int    ndmp4_header_message_type_from_str (ndmp4_header_message_type *valp, char *str);
89
90 char * ndmp4_header_message_type_to_str (ndmp4_header_message_type val) {
91         return ndmp_enum_to_str ((int)val, ndmp4_header_message_type_table);
92 }
93
94 int ndmp4_header_message_type_from_str (ndmp4_header_message_type *valp, char *str) {
95         return ndmp_enum_from_str ((int*)valp, str, ndmp4_header_message_type_table);
96 }
97
98 struct ndmp_enum_str_table ndmp4_header_message_type_table[] = {
99         { "NDMP4_MESSAGE_REQUEST",      NDMP4_MESSAGE_REQUEST, },
100         { "NDMP4_MESSAGE_REPLY",        NDMP4_MESSAGE_REPLY, },
101         { 0 }
102 };
103
104
105 extern struct ndmp_enum_str_table ndmp4_message_table[];
106 extern char * ndmp4_message_to_str (ndmp4_message val);
107 extern int    ndmp4_message_from_str (ndmp4_message *valp, char *str);
108
109 char * ndmp4_message_to_str (ndmp4_message val) {
110         return ndmp_enum_to_str ((int)val, ndmp4_message_table);
111 }
112
113 int ndmp4_message_from_str (ndmp4_message *valp, char *str) {
114         return ndmp_enum_from_str ((int*)valp, str, ndmp4_message_table);
115 }
116
117 struct ndmp_enum_str_table ndmp4_message_table[] = {
118         { "NDMP4_CONNECT_OPEN",         NDMP4_CONNECT_OPEN, },
119         { "NDMP4_CONNECT_CLIENT_AUTH",  NDMP4_CONNECT_CLIENT_AUTH, },
120         { "NDMP4_CONNECT_CLOSE",        NDMP4_CONNECT_CLOSE, },
121         { "NDMP4_CONNECT_SERVER_AUTH",  NDMP4_CONNECT_SERVER_AUTH, },
122         { "NDMP4_CONFIG_GET_HOST_INFO", NDMP4_CONFIG_GET_HOST_INFO, },
123         { "NDMP4_CONFIG_GET_CONNECTION_TYPE",
124                                         NDMP4_CONFIG_GET_CONNECTION_TYPE, },
125         { "NDMP4_CONFIG_GET_AUTH_ATTR", NDMP4_CONFIG_GET_AUTH_ATTR, },
126         { "NDMP4_CONFIG_GET_BUTYPE_INFO", NDMP4_CONFIG_GET_BUTYPE_INFO, },
127         { "NDMP4_CONFIG_GET_FS_INFO",   NDMP4_CONFIG_GET_FS_INFO, },
128         { "NDMP4_CONFIG_GET_TAPE_INFO", NDMP4_CONFIG_GET_TAPE_INFO, },
129         { "NDMP4_CONFIG_GET_SCSI_INFO", NDMP4_CONFIG_GET_SCSI_INFO, },
130         { "NDMP4_CONFIG_GET_SERVER_INFO",NDMP4_CONFIG_GET_SERVER_INFO, },
131         { "NDMP4_SCSI_OPEN",            NDMP4_SCSI_OPEN, },
132         { "NDMP4_SCSI_CLOSE",           NDMP4_SCSI_CLOSE, },
133         { "NDMP4_SCSI_GET_STATE",       NDMP4_SCSI_GET_STATE, },
134 /*      { "NDMP4_SCSI_SET_TARGET",      NDMP4_SCSI_SET_TARGET, }, */
135         { "NDMP4_SCSI_RESET_DEVICE",    NDMP4_SCSI_RESET_DEVICE, },
136 /*      { "NDMP4_SCSI_RESET_BUS",       NDMP4_SCSI_RESET_BUS, }, */
137         { "NDMP4_SCSI_EXECUTE_CDB",     NDMP4_SCSI_EXECUTE_CDB, },
138         { "NDMP4_TAPE_OPEN",            NDMP4_TAPE_OPEN, },
139         { "NDMP4_TAPE_CLOSE",           NDMP4_TAPE_CLOSE, },
140         { "NDMP4_TAPE_GET_STATE",       NDMP4_TAPE_GET_STATE, },
141         { "NDMP4_TAPE_MTIO",            NDMP4_TAPE_MTIO, },
142         { "NDMP4_TAPE_WRITE",           NDMP4_TAPE_WRITE, },
143         { "NDMP4_TAPE_READ",            NDMP4_TAPE_READ, },
144         { "NDMP4_TAPE_EXECUTE_CDB",     NDMP4_TAPE_EXECUTE_CDB, },
145         { "NDMP4_DATA_GET_STATE",       NDMP4_DATA_GET_STATE, },
146         { "NDMP4_DATA_START_BACKUP",    NDMP4_DATA_START_BACKUP, },
147         { "NDMP4_DATA_START_RECOVER",   NDMP4_DATA_START_RECOVER, },
148         { "NDMP4_DATA_START_RECOVER_FILEHIST",
149                                         NDMP4_DATA_START_RECOVER_FILEHIST, },
150         { "NDMP4_DATA_ABORT",           NDMP4_DATA_ABORT, },
151         { "NDMP4_DATA_GET_ENV",         NDMP4_DATA_GET_ENV, },
152         { "NDMP4_DATA_STOP",            NDMP4_DATA_STOP, },
153         { "NDMP4_DATA_LISTEN",          NDMP4_DATA_LISTEN, },
154         { "NDMP4_DATA_CONNECT",         NDMP4_DATA_CONNECT, },
155         { "NDMP4_NOTIFY_DATA_HALTED",   NDMP4_NOTIFY_DATA_HALTED, },
156         { "NDMP4_NOTIFY_CONNECTION_STATUS",
157                                         NDMP4_NOTIFY_CONNECTION_STATUS, },
158         { "NDMP4_NOTIFY_MOVER_HALTED",  NDMP4_NOTIFY_MOVER_HALTED, },
159         { "NDMP4_NOTIFY_MOVER_PAUSED",  NDMP4_NOTIFY_MOVER_PAUSED, },
160         { "NDMP4_NOTIFY_DATA_READ",     NDMP4_NOTIFY_DATA_READ, },
161         { "NDMP4_LOG_FILE",             NDMP4_LOG_FILE, },
162         { "NDMP4_LOG_MESSAGE",          NDMP4_LOG_MESSAGE, },
163         { "NDMP4_FH_ADD_FILE",          NDMP4_FH_ADD_FILE, },
164         { "NDMP4_FH_ADD_DIR",           NDMP4_FH_ADD_DIR, },
165         { "NDMP4_FH_ADD_NODE",          NDMP4_FH_ADD_NODE, },
166         { "NDMP4_MOVER_GET_STATE",      NDMP4_MOVER_GET_STATE, },
167         { "NDMP4_MOVER_LISTEN",         NDMP4_MOVER_LISTEN, },
168         { "NDMP4_MOVER_CONTINUE",       NDMP4_MOVER_CONTINUE, },
169         { "NDMP4_MOVER_ABORT",          NDMP4_MOVER_ABORT, },
170         { "NDMP4_MOVER_STOP",           NDMP4_MOVER_STOP, },
171         { "NDMP4_MOVER_SET_WINDOW",     NDMP4_MOVER_SET_WINDOW, },
172         { "NDMP4_MOVER_READ",           NDMP4_MOVER_READ, },
173         { "NDMP4_MOVER_CLOSE",          NDMP4_MOVER_CLOSE, },
174         { "NDMP4_MOVER_SET_RECORD_SIZE", NDMP4_MOVER_SET_RECORD_SIZE, },
175         { "NDMP4_MOVER_CONNECT",        NDMP4_MOVER_CONNECT, },
176 /*      { "NDMP4_VENDORS_BASE",         NDMP4_VENDORS_BASE, }, */
177 /*      { "NDMP4_RESERVED_BASE",        NDMP4_RESERVED_BASE, }, */
178         { 0 }
179 };
180
181
182 extern struct ndmp_enum_str_table ndmp4_auth_type_table[];
183 extern char * ndmp4_auth_type_to_str (ndmp4_auth_type val);
184 extern int    ndmp4_auth_type_from_str (ndmp4_auth_type *valp, char *str);
185
186 char * ndmp4_auth_type_to_str (ndmp4_auth_type val) {
187         return ndmp_enum_to_str ((int)val, ndmp4_auth_type_table);
188 }
189
190 int ndmp4_auth_type_from_str (ndmp4_auth_type *valp, char *str) {
191         return ndmp_enum_from_str ((int*)valp, str, ndmp4_auth_type_table);
192 }
193
194 struct ndmp_enum_str_table ndmp4_auth_type_table[] = {
195         { "NDMP4_AUTH_NONE",            NDMP4_AUTH_NONE, },
196         { "NDMP4_AUTH_TEXT",            NDMP4_AUTH_TEXT, },
197         { "NDMP4_AUTH_MD5",             NDMP4_AUTH_MD5, },
198         { 0 }
199 };
200
201
202 extern struct ndmp_enum_str_table ndmp4_addr_type_table[];
203 extern char * ndmp4_addr_type_to_str (ndmp4_addr_type val);
204 extern int    ndmp4_addr_type_from_str (ndmp4_addr_type *valp, char *str);
205
206 char * ndmp4_addr_type_to_str (ndmp4_addr_type val) {
207         return ndmp_enum_to_str ((int)val, ndmp4_addr_type_table);
208 }
209
210 int ndmp4_addr_type_from_str (ndmp4_addr_type *valp, char *str) {
211         return ndmp_enum_from_str ((int*)valp, str, ndmp4_addr_type_table);
212 }
213
214 struct ndmp_enum_str_table ndmp4_addr_type_table[] = {
215         { "NDMP4_ADDR_LOCAL",           NDMP4_ADDR_LOCAL, },
216         { "NDMP4_ADDR_TCP",             NDMP4_ADDR_TCP, },
217         { "NDMP4_ADDR_RESERVED",        NDMP4_ADDR_RESERVED, },
218         { "NDMP4_ADDR_IPC",             NDMP4_ADDR_IPC, },
219         { 0 }
220 };
221
222
223 extern struct ndmp_enum_str_table ndmp4_tape_open_mode_table[];
224 extern char * ndmp4_tape_open_mode_to_str (ndmp4_tape_open_mode val);
225 extern int    ndmp4_tape_open_mode_from_str (ndmp4_tape_open_mode *valp, char *str);
226
227 char * ndmp4_tape_open_mode_to_str (ndmp4_tape_open_mode val) {
228         return ndmp_enum_to_str ((int)val, ndmp4_tape_open_mode_table);
229 }
230
231 int ndmp4_tape_open_mode_from_str (ndmp4_tape_open_mode *valp, char *str) {
232         return ndmp_enum_from_str ((int*)valp, str, ndmp4_tape_open_mode_table);
233 }
234
235 struct ndmp_enum_str_table ndmp4_tape_open_mode_table[] = {
236         { "NDMP4_TAPE_READ_MODE",       NDMP4_TAPE_READ_MODE, },
237         { "NDMP4_TAPE_RDWR_MODE",       NDMP4_TAPE_RDWR_MODE, },
238         { "NDMP4_TAPE_RAW_MODE",        NDMP4_TAPE_RAW_MODE, },
239         { 0 }
240 };
241
242
243 extern struct ndmp_enum_str_table ndmp4_tape_mtio_op_table[];
244 extern char * ndmp4_tape_mtio_op_to_str (ndmp4_tape_mtio_op val);
245 extern int    ndmp4_tape_mtio_op_from_str (ndmp4_tape_mtio_op *valp, char *str);
246
247 char * ndmp4_tape_mtio_op_to_str (ndmp4_tape_mtio_op val) {
248         return ndmp_enum_to_str ((int)val, ndmp4_tape_mtio_op_table);
249 }
250
251 int ndmp4_tape_mtio_op_from_str (ndmp4_tape_mtio_op *valp, char *str) {
252         return ndmp_enum_from_str ((int*)valp, str, ndmp4_tape_mtio_op_table);
253 }
254
255 struct ndmp_enum_str_table ndmp4_tape_mtio_op_table[] = {
256         { "NDMP4_MTIO_FSF",             NDMP4_MTIO_FSF, },
257         { "NDMP4_MTIO_BSF",             NDMP4_MTIO_BSF, },
258         { "NDMP4_MTIO_FSR",             NDMP4_MTIO_FSR, },
259         { "NDMP4_MTIO_BSR",             NDMP4_MTIO_BSR, },
260         { "NDMP4_MTIO_REW",             NDMP4_MTIO_REW, },
261         { "NDMP4_MTIO_EOF",             NDMP4_MTIO_EOF, },
262         { "NDMP4_MTIO_OFF",             NDMP4_MTIO_OFF, },
263         { 0 }
264 };
265
266
267 extern struct ndmp_enum_str_table ndmp4_mover_state_table[];
268 extern char * ndmp4_mover_state_to_str (ndmp4_mover_state val);
269 extern int    ndmp4_mover_state_from_str (ndmp4_mover_state *valp, char *str);
270
271 char * ndmp4_mover_state_to_str (ndmp4_mover_state val) {
272         return ndmp_enum_to_str ((int)val, ndmp4_mover_state_table);
273 }
274
275 int ndmp4_mover_state_from_str (ndmp4_mover_state *valp, char *str) {
276         return ndmp_enum_from_str ((int*)valp, str, ndmp4_mover_state_table);
277 }
278
279 struct ndmp_enum_str_table ndmp4_mover_state_table[] = {
280         { "NDMP4_MOVER_STATE_IDLE",     NDMP4_MOVER_STATE_IDLE, },
281         { "NDMP4_MOVER_STATE_LISTEN",   NDMP4_MOVER_STATE_LISTEN, },
282         { "NDMP4_MOVER_STATE_ACTIVE",   NDMP4_MOVER_STATE_ACTIVE, },
283         { "NDMP4_MOVER_STATE_PAUSED",   NDMP4_MOVER_STATE_PAUSED, },
284         { "NDMP4_MOVER_STATE_HALTED",   NDMP4_MOVER_STATE_HALTED, },
285         { 0 }
286 };
287
288
289 extern struct ndmp_enum_str_table ndmp4_mover_pause_reason_table[];
290 extern char * ndmp4_mover_pause_reason_to_str (ndmp4_mover_pause_reason val);
291 extern int    ndmp4_mover_pause_reason_from_str (ndmp4_mover_pause_reason *valp, char *str);
292
293 char * ndmp4_mover_pause_reason_to_str (ndmp4_mover_pause_reason val) {
294         return ndmp_enum_to_str ((int)val, ndmp4_mover_pause_reason_table);
295 }
296
297 int ndmp4_mover_pause_reason_from_str (ndmp4_mover_pause_reason *valp, char *str) {
298         return ndmp_enum_from_str ((int*)valp, str, ndmp4_mover_pause_reason_table);
299 }
300
301 struct ndmp_enum_str_table ndmp4_mover_pause_reason_table[] = {
302         { "NDMP4_MOVER_PAUSE_NA",       NDMP4_MOVER_PAUSE_NA, },
303         { "NDMP4_MOVER_PAUSE_EOM",      NDMP4_MOVER_PAUSE_EOM, },
304         { "NDMP4_MOVER_PAUSE_EOF",      NDMP4_MOVER_PAUSE_EOF, },
305         { "NDMP4_MOVER_PAUSE_SEEK",     NDMP4_MOVER_PAUSE_SEEK, },
306         { "NDMP4_MOVER_PAUSE_EOW",      NDMP4_MOVER_PAUSE_EOW, },
307         { 0 }
308 };
309
310
311 extern struct ndmp_enum_str_table ndmp4_mover_halt_reason_table[];
312 extern char * ndmp4_mover_halt_reason_to_str (ndmp4_mover_halt_reason val);
313 extern int    ndmp4_mover_halt_reason_from_str (ndmp4_mover_halt_reason *valp, char *str);
314
315 char * ndmp4_mover_halt_reason_to_str (ndmp4_mover_halt_reason val) {
316         return ndmp_enum_to_str ((int)val, ndmp4_mover_halt_reason_table);
317 }
318
319 int ndmp4_mover_halt_reason_from_str (ndmp4_mover_halt_reason *valp, char *str) {
320         return ndmp_enum_from_str ((int*)valp, str, ndmp4_mover_halt_reason_table);
321 }
322
323 struct ndmp_enum_str_table ndmp4_mover_halt_reason_table[] = {
324         { "NDMP4_MOVER_HALT_NA",        NDMP4_MOVER_HALT_NA, },
325         { "NDMP4_MOVER_HALT_CONNECT_CLOSED",
326                                         NDMP4_MOVER_HALT_CONNECT_CLOSED, },
327         { "NDMP4_MOVER_HALT_ABORTED",   NDMP4_MOVER_HALT_ABORTED, },
328         { "NDMP4_MOVER_HALT_INTERNAL_ERROR",
329                                         NDMP4_MOVER_HALT_INTERNAL_ERROR, },
330         { "NDMP4_MOVER_HALT_CONNECT_ERROR",
331                                         NDMP4_MOVER_HALT_CONNECT_ERROR, },
332         { "NDMP4_MOVER_HALT_MEDIA_ERROR",
333                                         NDMP4_MOVER_HALT_MEDIA_ERROR, },
334         { 0 }
335 };
336
337
338 extern struct ndmp_enum_str_table ndmp4_mover_mode_table[];
339 extern char * ndmp4_mover_mode_to_str (ndmp4_mover_mode val);
340 extern int    ndmp4_mover_mode_from_str (ndmp4_mover_mode *valp, char *str);
341
342 char * ndmp4_mover_mode_to_str (ndmp4_mover_mode val) {
343         return ndmp_enum_to_str ((int)val, ndmp4_mover_mode_table);
344 }
345
346 int ndmp4_mover_mode_from_str (ndmp4_mover_mode *valp, char *str) {
347         return ndmp_enum_from_str ((int*)valp, str, ndmp4_mover_mode_table);
348 }
349
350 struct ndmp_enum_str_table ndmp4_mover_mode_table[] = {
351         { "NDMP4_MOVER_MODE_READ",      NDMP4_MOVER_MODE_READ, },
352         { "NDMP4_MOVER_MODE_WRITE",     NDMP4_MOVER_MODE_WRITE, },
353         { 0 }
354 };
355
356
357 extern struct ndmp_enum_str_table ndmp4_data_operation_table[];
358 extern char * ndmp4_data_operation_to_str (ndmp4_data_operation val);
359 extern int    ndmp4_data_operation_from_str (ndmp4_data_operation *valp, char *str);
360
361 char * ndmp4_data_operation_to_str (ndmp4_data_operation val) {
362         return ndmp_enum_to_str ((int)val, ndmp4_data_operation_table);
363 }
364
365 int ndmp4_data_operation_from_str (ndmp4_data_operation *valp, char *str) {
366         return ndmp_enum_from_str ((int*)valp, str, ndmp4_data_operation_table);
367 }
368
369 struct ndmp_enum_str_table ndmp4_data_operation_table[] = {
370         { "NDMP4_DATA_OP_NOACTION",     NDMP4_DATA_OP_NOACTION, },
371         { "NDMP4_DATA_OP_BACKUP",       NDMP4_DATA_OP_BACKUP, },
372         { "NDMP4_DATA_OP_RECOVER",      NDMP4_DATA_OP_RECOVER, },
373         { "NDMP4_DATA_OP_RECOVER_FILEHIST",
374                                         NDMP4_DATA_OP_RECOVER_FILEHIST, },
375         { 0 }
376 };
377
378
379 extern struct ndmp_enum_str_table ndmp4_data_state_table[];
380 extern char * ndmp4_data_state_to_str (ndmp4_data_state val);
381 extern int    ndmp4_data_state_from_str (ndmp4_data_state *valp, char *str);
382
383 char * ndmp4_data_state_to_str (ndmp4_data_state val) {
384         return ndmp_enum_to_str ((int)val, ndmp4_data_state_table);
385 }
386
387 int ndmp4_data_state_from_str (ndmp4_data_state *valp, char *str) {
388         return ndmp_enum_from_str ((int*)valp, str, ndmp4_data_state_table);
389 }
390
391 struct ndmp_enum_str_table ndmp4_data_state_table[] = {
392         { "NDMP4_DATA_STATE_IDLE",      NDMP4_DATA_STATE_IDLE, },
393         { "NDMP4_DATA_STATE_ACTIVE",    NDMP4_DATA_STATE_ACTIVE, },
394         { "NDMP4_DATA_STATE_HALTED",    NDMP4_DATA_STATE_HALTED, },
395         { "NDMP4_DATA_STATE_LISTEN",    NDMP4_DATA_STATE_LISTEN, },
396         { "NDMP4_DATA_STATE_CONNECTED", NDMP4_DATA_STATE_CONNECTED, },
397         { 0 }
398 };
399
400
401 extern struct ndmp_enum_str_table ndmp4_data_halt_reason_table[];
402 extern char * ndmp4_data_halt_reason_to_str (ndmp4_data_halt_reason val);
403 extern int    ndmp4_data_halt_reason_from_str (ndmp4_data_halt_reason *valp, char *str);
404
405 char * ndmp4_data_halt_reason_to_str (ndmp4_data_halt_reason val) {
406         return ndmp_enum_to_str ((int)val, ndmp4_data_halt_reason_table);
407 }
408
409 int ndmp4_data_halt_reason_from_str (ndmp4_data_halt_reason *valp, char *str) {
410         return ndmp_enum_from_str ((int*)valp, str, ndmp4_data_halt_reason_table);
411 }
412
413 struct ndmp_enum_str_table ndmp4_data_halt_reason_table[] = {
414         { "NDMP4_DATA_HALT_NA",         NDMP4_DATA_HALT_NA, },
415         { "NDMP4_DATA_HALT_SUCCESSFUL", NDMP4_DATA_HALT_SUCCESSFUL, },
416         { "NDMP4_DATA_HALT_ABORTED",    NDMP4_DATA_HALT_ABORTED, },
417         { "NDMP4_DATA_HALT_INTERNAL_ERROR", NDMP4_DATA_HALT_INTERNAL_ERROR, },
418         { "NDMP4_DATA_HALT_CONNECT_ERROR", NDMP4_DATA_HALT_CONNECT_ERROR, },
419         { 0 }
420 };
421
422
423 extern struct ndmp_enum_str_table ndmp4_connection_status_reason_table[];
424 extern char * ndmp4_connection_status_reason_to_str (ndmp4_connection_status_reason val);
425 extern int    ndmp4_connection_status_reason_from_str (ndmp4_connection_status_reason *valp, char *str);
426
427 char * ndmp4_connection_status_reason_to_str (ndmp4_connection_status_reason val) {
428         return ndmp_enum_to_str ((int)val, ndmp4_connection_status_reason_table);
429 }
430
431 int ndmp4_connection_status_reason_from_str (ndmp4_connection_status_reason *valp, char *str) {
432         return ndmp_enum_from_str ((int*)valp, str, ndmp4_connection_status_reason_table);
433 }
434
435 struct ndmp_enum_str_table ndmp4_connection_status_reason_table[] = {
436         { "NDMP4_CONNECTED",            NDMP4_CONNECTED, },
437         { "NDMP4_SHUTDOWN",             NDMP4_SHUTDOWN, },
438         { "NDMP4_REFUSED",              NDMP4_REFUSED, },
439         { 0 }
440 };
441
442
443 extern struct ndmp_enum_str_table ndmp4_log_type_table[];
444 extern char * ndmp4_log_type_to_str (ndmp4_log_type val);
445 extern int    ndmp4_log_type_from_str (ndmp4_log_type *valp, char *str);
446
447 char * ndmp4_log_type_to_str (ndmp4_log_type val) {
448         return ndmp_enum_to_str ((int)val, ndmp4_log_type_table);
449 }
450
451 int ndmp4_log_type_from_str (ndmp4_log_type *valp, char *str) {
452         return ndmp_enum_from_str ((int*)valp, str, ndmp4_log_type_table);
453 }
454
455 struct ndmp_enum_str_table ndmp4_log_type_table[] = {
456         { "NDMP4_LOG_NORMAL",           NDMP4_LOG_NORMAL, },
457         { "NDMP4_LOG_DEBUG",            NDMP4_LOG_DEBUG, },
458         { "NDMP4_LOG_ERROR",            NDMP4_LOG_ERROR, },
459         { "NDMP4_LOG_WARNING",          NDMP4_LOG_WARNING, },
460         { 0 }
461 };
462
463
464 extern struct ndmp_enum_str_table ndmp4_fs_type_table[];
465 extern char * ndmp4_fs_type_to_str (ndmp4_fs_type val);
466 extern int    ndmp4_fs_type_from_str (ndmp4_fs_type *valp, char *str);
467
468 char * ndmp4_fs_type_to_str (ndmp4_fs_type val) {
469         return ndmp_enum_to_str ((int)val, ndmp4_fs_type_table);
470 }
471
472 int ndmp4_fs_type_from_str (ndmp4_fs_type *valp, char *str) {
473         return ndmp_enum_from_str ((int*)valp, str, ndmp4_fs_type_table);
474 }
475
476 struct ndmp_enum_str_table ndmp4_fs_type_table[] = {
477         { "NDMP4_FS_UNIX",              NDMP4_FS_UNIX, },
478         { "NDMP4_FS_NT",                NDMP4_FS_NT, },
479         { "NDMP4_FS_OTHER",             NDMP4_FS_OTHER, },
480         { 0 }
481 };
482
483
484 extern struct ndmp_enum_str_table ndmp4_file_type_table[];
485 extern char * ndmp4_file_type_to_str (ndmp4_file_type val);
486 extern int    ndmp4_file_type_from_str (ndmp4_file_type *valp, char *str);
487
488 char * ndmp4_file_type_to_str (ndmp4_file_type val) {
489         return ndmp_enum_to_str ((int)val, ndmp4_file_type_table);
490 }
491
492 int ndmp4_file_type_from_str (ndmp4_file_type *valp, char *str) {
493         return ndmp_enum_from_str ((int*)valp, str, ndmp4_file_type_table);
494 }
495
496 struct ndmp_enum_str_table ndmp4_file_type_table[] = {
497         { "NDMP4_FILE_DIR",             NDMP4_FILE_DIR, },
498         { "NDMP4_FILE_FIFO",            NDMP4_FILE_FIFO, },
499         { "NDMP4_FILE_CSPEC",           NDMP4_FILE_CSPEC, },
500         { "NDMP4_FILE_BSPEC",           NDMP4_FILE_BSPEC, },
501         { "NDMP4_FILE_REG",             NDMP4_FILE_REG, },
502         { "NDMP4_FILE_SLINK",           NDMP4_FILE_SLINK, },
503         { "NDMP4_FILE_SOCK",            NDMP4_FILE_SOCK, },
504         { "NDMP4_FILE_REGISTRY",        NDMP4_FILE_REGISTRY, },
505         { "NDMP4_FILE_OTHER",           NDMP4_FILE_OTHER, },
506         { 0 }
507 };
508
509
510 extern struct ndmp_enum_str_table ndmp4_recovery_status_table[];
511 extern char * ndmp4_recovery_status_to_str (ndmp4_recovery_status val);
512 extern int    ndmp4_recovery_status_from_str (ndmp4_recovery_status *valp, char *str);
513
514 char * ndmp4_recovery_status_to_str (ndmp4_recovery_status val) {
515         return ndmp_enum_to_str ((int)val, ndmp4_recovery_status_table);
516 }
517
518 int ndmp4_recovery_status_from_str (ndmp4_recovery_status *valp, char *str) {
519         return ndmp_enum_from_str ((int*)valp, str, ndmp4_recovery_status_table);
520 }
521
522 struct ndmp_enum_str_table ndmp4_recovery_status_table[] = {
523         { "NDMP4_RECOVERY_SUCCESSFUL",
524                         NDMP4_RECOVERY_SUCCESSFUL, },
525         { "NDMP4_RECOVERY_FAILED_PERMISSION",
526                         NDMP4_RECOVERY_FAILED_PERMISSION, },
527         { "NDMP4_RECOVERY_FAILED_NOT_FOUND",
528                         NDMP4_RECOVERY_FAILED_NOT_FOUND, },
529         { "NDMP4_RECOVERY_FAILED_NO_DIRECTORY",
530                         NDMP4_RECOVERY_FAILED_NO_DIRECTORY, },
531         { "NDMP4_RECOVERY_FAILED_OUT_OF_MEMORY",
532                         NDMP4_RECOVERY_FAILED_OUT_OF_MEMORY, },
533         { "NDMP4_RECOVERY_FAILED_IO_ERROR",
534                         NDMP4_RECOVERY_FAILED_IO_ERROR, },
535         { "NDMP4_RECOVERY_FAILED_UNDEFINED_ERROR",
536                         NDMP4_RECOVERY_FAILED_UNDEFINED_ERROR, },
537         { 0 }
538 };
539
540 #endif /* !NDMOS_OPTION_NO_NDMP4 */
541