2 * Copyright (c) 1998,1999,2000
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"
42 #ifndef NDMOS_OPTION_NO_NDMP4
46 ndmp4_pp_header (void *data, char *buf)
48 ndmp4_header * mh = (ndmp4_header *) data;
50 if (mh->message_type == NDMP4_MESSAGE_REQUEST) {
51 sprintf (buf, "C %s %lu",
52 ndmp4_message_to_str (mh->message_code),
54 } else if (mh->message_type == NDMP4_MESSAGE_REPLY) {
55 sprintf (buf, "R %s %lu (%lu)",
56 ndmp4_message_to_str (mh->message_code),
59 if (mh->error_code != NDMP4_NO_ERR) {
60 sprintf (NDMOS_API_STREND(buf), " %s",
61 ndmp4_error_to_str (mh->error_code));
62 return 0; /* no body */
65 strcpy (buf, "??? INVALID MESSAGE TYPE");
66 return -1; /* no body */
72 ndmp4_pp_addr (char *buf, ndmp4_addr *ma)
77 sprintf (buf, "%s", ndmp4_addr_type_to_str (ma->addr_type));
78 if (ma->addr_type == NDMP4_ADDR_TCP) {
79 for (i = 0; i < ma->ndmp4_addr_u.tcp_addr.tcp_addr_len; i++) {
80 tcp = &ma->ndmp4_addr_u.tcp_addr.tcp_addr_val[i];
82 sprintf (NDMOS_API_STREND(buf), " #%d(%lx,%d",
83 i, tcp->ip_addr, tcp->port);
84 for (j = 0; j < tcp->addr_env.addr_env_len; j++) {
85 sprintf (NDMOS_API_STREND(buf), ",%s=%s",
86 tcp->addr_env.addr_env_val[j].name,
87 tcp->addr_env.addr_env_val[j].value);
89 sprintf (NDMOS_API_STREND(buf), ")");
97 ndmp4_pp_request (ndmp4_message msg, void *data, int lineno, char *buf)
104 strcpy (buf, "<<INVALID MSG>>");
107 case NDMP4_CONNECT_OPEN:
108 NDMP_PP_WITH(ndmp4_connect_open_request)
109 sprintf (buf, "version=%d", p->protocol_version);
113 case NDMP4_CONNECT_CLIENT_AUTH:
114 NDMP_PP_WITH(ndmp4_connect_client_auth_request)
115 sprintf (buf, "auth_type=%s",
116 ndmp4_auth_type_to_str (p->auth_data.auth_type));
117 sprintf (buf, "auth_type=%s",
118 ndmp4_auth_type_to_str (p->auth_data.auth_type));
119 switch (p->auth_data.auth_type) {
120 case NDMP4_AUTH_NONE:
123 case NDMP4_AUTH_TEXT:
124 sprintf (NDMOS_API_STREND(buf), " auth_id=%s",
125 p->auth_data.ndmp4_auth_data_u.auth_text.auth_id);
129 sprintf (NDMOS_API_STREND(buf), " auth_id=%s",
130 p->auth_data.ndmp4_auth_data_u.auth_md5.auth_id);
134 sprintf (NDMOS_API_STREND(buf), " ????");
140 case NDMP4_CONNECT_CLOSE:
141 case NDMP4_CONFIG_GET_HOST_INFO:
142 case NDMP4_CONFIG_GET_CONNECTION_TYPE:
143 case NDMP4_CONFIG_GET_SERVER_INFO:
144 case NDMP4_CONFIG_GET_TAPE_INFO:
145 case NDMP4_CONFIG_GET_SCSI_INFO:
146 case NDMP4_SCSI_CLOSE:
147 case NDMP4_SCSI_GET_STATE:
148 case NDMP4_SCSI_RESET_DEVICE:
149 /* case NDMP4_SCSI_RESET_BUS: */
150 case NDMP4_TAPE_GET_STATE:
151 case NDMP4_TAPE_CLOSE:
152 case NDMP4_MOVER_GET_STATE:
153 case NDMP4_MOVER_CONTINUE:
154 case NDMP4_MOVER_ABORT:
155 case NDMP4_MOVER_STOP:
156 case NDMP4_MOVER_CLOSE:
157 case NDMP4_DATA_GET_STATE:
158 case NDMP4_DATA_ABORT:
159 case NDMP4_DATA_STOP:
160 case NDMP4_DATA_GET_ENV:
161 *buf = 0; /* no body */
164 case NDMP4_CONNECT_SERVER_AUTH:
165 strcpy (buf, "<<unimplemented pp>>");
168 case NDMP4_CONFIG_GET_AUTH_ATTR:
169 NDMP_PP_WITH(ndmp4_config_get_auth_attr_request)
170 sprintf (buf, "auth_type=%s", ndmp4_auth_type_to_str (p->auth_type));
174 case NDMP4_SCSI_OPEN:
175 NDMP_PP_WITH(ndmp4_scsi_open_request)
176 sprintf (buf, "device='%s'", p->device);
181 case NDMP4_SCSI_SET_TARGET:
182 NDMP_PP_WITH(ndmp4_scsi_set_target_request)
183 sprintf (buf, "device='%s' cont=%d sid=%d lun=%d",
184 p->device, p->target_controller,
185 p->target_id, p->target_lun);
190 case NDMP4_SCSI_EXECUTE_CDB:
191 case NDMP4_TAPE_EXECUTE_CDB:
192 NDMP_PP_WITH(ndmp4_execute_cdb_request)
194 case 0: sprintf (buf, "flags=0x%lx timeout=%ld datain_len=%ld",
195 p->flags, p->timeout, p->datain_len);
197 case 1: sprintf (buf, "cmd[%d]={", p->cdb.cdb_len);
198 for (j = 0; j < p->cdb.cdb_len; j++) {
199 sprintf (NDMOS_API_STREND(buf), " %02x",
200 p->cdb.cdb_val[j]&0xFF);
209 case NDMP4_TAPE_OPEN:
210 NDMP_PP_WITH(ndmp4_tape_open_request)
211 sprintf (buf, "device='%s' mode=%s",
213 ndmp4_tape_open_mode_to_str (p->mode));
217 case NDMP4_TAPE_MTIO:
218 NDMP_PP_WITH(ndmp4_tape_mtio_request)
219 sprintf (buf, "op=%s count=%ld",
220 ndmp4_tape_mtio_op_to_str(p->tape_op),
225 case NDMP4_TAPE_WRITE:
226 NDMP_PP_WITH(ndmp4_tape_write_request)
227 sprintf (buf, "data_out_len=%d", p->data_out.data_out_len);
231 case NDMP4_TAPE_READ:
232 NDMP_PP_WITH(ndmp4_tape_read_request)
233 sprintf (buf, "count=%ld", p->count);
237 case NDMP4_DATA_START_BACKUP:
238 NDMP_PP_WITH(ndmp4_data_start_backup_request)
240 sprintf (buf, "butype_name='%s' n_env=%d",
241 p->butype_name, p->env.env_len);
244 if (0 <= i && (unsigned)i < p->env.env_len) {
245 sprintf (buf, "env[%d] name='%s' value='%s'",
246 i, p->env.env_val[i].name,
247 p->env.env_val[i].value);
249 strcpy (buf, "--INVALID--");
252 return 1 + p->env.env_len;
256 case NDMP4_DATA_START_RECOVER:
257 case NDMP4_DATA_START_RECOVER_FILEHIST:
258 NDMP_PP_WITH(ndmp4_data_start_recover_request)
260 sprintf (buf, "butype_name='%s' n_env=%d n_nlist=%d",
261 p->butype_name, p->env.env_len,
265 if (0 <= i && (unsigned)i < p->env.env_len) {
266 sprintf (buf, "env[%d] name='%s' value='%s'",
267 i, p->env.env_val[i].name,
268 p->env.env_val[i].value);
271 if (0 <= i && (unsigned)i < p->nlist.nlist_len*4) {
272 ndmp4_name *nm = &p->nlist.nlist_val[i/4];
276 sprintf (buf, "nl[%d] original_path='%s'",
277 i/4, nm->original_path);
280 sprintf (buf, "..... destination_path='%s'",
281 nm->destination_path);
284 sprintf (buf, "..... name='%s' other='%s'",
285 nm->name, nm->other_name);
288 sprintf (buf, "..... node=%lld fh_info=%lld",
289 nm->node, nm->fh_info);
293 strcpy (buf, "--INVALID--");
297 return 1 + p->env.env_len + p->nlist.nlist_len*4;
301 case NDMP4_DATA_LISTEN:
302 NDMP_PP_WITH(ndmp4_data_listen_request)
303 sprintf (buf, "addr_type=%s", ndmp4_addr_type_to_str (p->addr_type));
307 case NDMP4_DATA_CONNECT:
308 NDMP_PP_WITH(ndmp4_data_connect_request)
309 sprintf (buf, "addr=");
310 ndmp4_pp_addr (NDMOS_API_STREND(buf), &p->addr);
314 case NDMP4_NOTIFY_DATA_HALTED:
315 NDMP_PP_WITH(ndmp4_notify_data_halted_post)
316 sprintf (buf, "reason=%s", ndmp4_data_halt_reason_to_str(p->reason));
320 case NDMP4_NOTIFY_CONNECTION_STATUS:
321 NDMP_PP_WITH(ndmp4_notify_connection_status_post)
322 sprintf (buf, "reason=%s protocol_version=%d text_reason='%s'",
323 ndmp4_connection_status_reason_to_str(p->reason),
329 case NDMP4_NOTIFY_MOVER_HALTED:
330 NDMP_PP_WITH(ndmp4_notify_mover_halted_post)
331 sprintf (buf, "reason=%s", ndmp4_mover_halt_reason_to_str(p->reason));
335 case NDMP4_NOTIFY_MOVER_PAUSED:
336 NDMP_PP_WITH(ndmp4_notify_mover_paused_post)
337 sprintf (buf, "reason=%s seek_position=%lld",
338 ndmp4_mover_pause_reason_to_str(p->reason),
343 case NDMP4_NOTIFY_DATA_READ:
344 NDMP_PP_WITH(ndmp4_notify_data_read_post)
345 sprintf (buf, "offset=%lld length=%lld",
346 p->offset, p->length);
351 NDMP_PP_WITH(ndmp4_log_file_post)
352 sprintf (buf, "file=%s recovery_status=%s",
354 ndmp4_recovery_status_to_str(p->recovery_status));
358 case NDMP4_LOG_MESSAGE:
359 NDMP_PP_WITH(ndmp4_log_message_post)
360 sprintf (buf, "log_type=%s id=%lu message='%s'",
361 ndmp4_log_type_to_str(p->log_type), p->message_id, p->entry);
365 case NDMP4_FH_ADD_FILE:
366 NDMP_PP_WITH(ndmp4_fh_add_file_post)
367 int n_line = 0, n_names = 0, n_stats = 0;
368 unsigned int n_normal = 0;
371 for (j = 0; j < p->files.files_len; j++) {
374 nn = p->files.files_val[j].names.names_len;
375 ns = p->files.files_val[j].stats.stats_len;
377 n_line += 1 + nn + ns;
378 if (nn == 1 && ns == 1)
384 if (n_normal == p->files.files_len) {
385 /* could do something more efficient here */
389 sprintf (buf, "n_files=%d total n_names=%d n_stats=%d",
390 p->files.files_len, n_names, n_stats);
394 for (j = 0; j < p->files.files_len; j++) {
395 ndmp4_file * file = &p->files.files_val[j];
399 sprintf (buf, "[%ud] n_names=%d n_stats=%d node=%lld fhinfo=%lld",
401 file->names.names_len,
402 file->stats.stats_len,
410 for (k = 0; k < file->names.names_len; k++, lineno--) {
411 ndmp4_file_name *filename;
416 filename = &file->names.names_val[k];
418 sprintf (buf, " name[%ud] fs_type=%s",
419 k, ndmp4_fs_type_to_str (filename->fs_type));
421 switch (filename->fs_type) {
423 sprintf (NDMOS_API_STREND(buf), " other=%s",
424 filename->ndmp4_file_name_u.other_name);
428 sprintf (NDMOS_API_STREND(buf), " unix=%s",
429 filename->ndmp4_file_name_u.unix_name);
433 sprintf (NDMOS_API_STREND(buf)," nt=%s dos=%s",
434 filename->ndmp4_file_name_u.nt_name.nt_path,
435 filename->ndmp4_file_name_u.nt_name.dos_path);
441 for (k = 0; k < file->stats.stats_len; k++, lineno--) {
442 ndmp4_file_stat *filestat;
447 filestat = &file->stats.stats_val[k];
449 sprintf (buf, " stat[%d] fs_type=%s ftype=%s size=%lld",
451 ndmp4_fs_type_to_str (filestat->fs_type),
452 ndmp4_file_type_to_str (filestat->ftype),
458 sprintf (buf, " YIKES n_line=%d lineno=%d", n_line, lineno);
463 case NDMP4_FH_ADD_DIR:
464 NDMP_PP_WITH(ndmp4_fh_add_dir_post)
465 int n_line = 0, n_names = 0;
466 unsigned int n_normal = 0;
469 for (j = 0; j < p->dirs.dirs_len; j++) {
472 nn = p->dirs.dirs_val[j].names.names_len;
480 if (n_normal == p->dirs.dirs_len) {
481 /* could do something more efficient here */
485 sprintf (buf, "n_dirs=%d total n_names=%d",
486 p->dirs.dirs_len, n_names);
490 for (j = 0; j < p->dirs.dirs_len; j++) {
491 ndmp4_dir * dir = &p->dirs.dirs_val[j];
495 sprintf (buf, "[%ud] n_names=%d node=%lld parent=%lld",
497 dir->names.names_len,
505 for (k = 0; k < dir->names.names_len; k++, lineno--) {
506 ndmp4_file_name *filename;
511 filename = &dir->names.names_val[k];
513 sprintf (buf, " name[%d] fs_type=%s",
514 k, ndmp4_fs_type_to_str (filename->fs_type));
516 switch (filename->fs_type) {
518 sprintf (NDMOS_API_STREND(buf), " other=%s",
519 filename->ndmp4_file_name_u.other_name);
523 sprintf (NDMOS_API_STREND(buf), " unix=%s",
524 filename->ndmp4_file_name_u.unix_name);
528 sprintf (NDMOS_API_STREND(buf)," nt=%s dos=%s",
529 filename->ndmp4_file_name_u.nt_name.nt_path,
530 filename->ndmp4_file_name_u.nt_name.dos_path);
536 sprintf (buf, " YIKES n_line=%d lineno=%d", n_line, lineno);
541 case NDMP4_FH_ADD_NODE:
542 NDMP_PP_WITH(ndmp4_fh_add_node_post)
543 int n_line = 0, n_stats = 0;
544 unsigned int n_normal = 0;
547 for (j = 0; j < p->nodes.nodes_len; j++) {
550 ns = p->nodes.nodes_val[j].stats.stats_len;
558 if (n_normal == p->nodes.nodes_len) {
559 /* could do something more efficient here */
563 sprintf (buf, "n_nodes=%d total n_stats=%d",
564 p->nodes.nodes_len, n_stats);
568 for (j = 0; j < p->nodes.nodes_len; j++) {
569 ndmp4_node * node = &p->nodes.nodes_val[j];
573 sprintf (buf, "[%ud] n_stats=%d node=%lld fhinfo=%lld",
575 node->stats.stats_len,
583 for (k = 0; k < node->stats.stats_len; k++, lineno--) {
584 ndmp4_file_stat *filestat;
589 filestat = &node->stats.stats_val[k];
591 sprintf (buf, " stat[%ud] fs_type=%s ftype=%s size=%lld",
593 ndmp4_fs_type_to_str (filestat->fs_type),
594 ndmp4_file_type_to_str (filestat->ftype),
600 sprintf (buf, " YIKES n_line=%d lineno=%d", n_line, lineno);
605 case NDMP4_MOVER_LISTEN:
606 NDMP_PP_WITH(ndmp4_mover_listen_request)
607 sprintf (buf, "mode=%s addr_type=%s",
608 ndmp4_mover_mode_to_str (p->mode),
609 ndmp4_addr_type_to_str (p->addr_type));
613 case NDMP4_MOVER_SET_WINDOW:
614 NDMP_PP_WITH(ndmp4_mover_set_window_request)
615 sprintf (buf, "offset=%lld length=%lld", p->offset, p->length);
619 case NDMP4_MOVER_READ:
620 NDMP_PP_WITH(ndmp4_mover_read_request)
621 sprintf (buf, "offset=%lld length=%lld", p->offset, p->length);
625 case NDMP4_MOVER_SET_RECORD_SIZE:
626 NDMP_PP_WITH(ndmp4_mover_set_record_size_request)
627 sprintf (buf, "len=%lu", p->len);
631 case NDMP4_MOVER_CONNECT:
632 NDMP_PP_WITH(ndmp4_mover_connect_request)
633 sprintf (buf, "mode=%s addr=", ndmp4_mover_mode_to_str (p->mode));
634 ndmp4_pp_addr (NDMOS_API_STREND(buf), &p->addr);
639 return 1; /* one line in buf */
645 ndmp4_pp_reply (ndmp4_message msg, void *data, int lineno, char *buf)
652 strcpy (buf, "<<INVALID MSG>>");
655 case NDMP4_CONNECT_OPEN:
656 case NDMP4_CONNECT_CLIENT_AUTH:
657 case NDMP4_SCSI_OPEN:
658 case NDMP4_SCSI_CLOSE:
659 /* case NDMP4_SCSI_SET_TARGET: */
660 case NDMP4_SCSI_RESET_DEVICE:
661 /* case NDMP4_SCSI_RESET_BUS: */
662 case NDMP4_TAPE_OPEN:
663 case NDMP4_TAPE_CLOSE:
664 case NDMP4_MOVER_CONTINUE:
665 case NDMP4_MOVER_ABORT:
666 case NDMP4_MOVER_STOP:
667 case NDMP4_MOVER_READ:
668 case NDMP4_MOVER_SET_WINDOW:
669 case NDMP4_MOVER_CLOSE:
670 case NDMP4_MOVER_SET_RECORD_SIZE:
671 case NDMP4_MOVER_CONNECT:
672 case NDMP4_DATA_START_BACKUP:
673 case NDMP4_DATA_START_RECOVER:
674 case NDMP4_DATA_START_RECOVER_FILEHIST:
675 case NDMP4_DATA_ABORT:
676 case NDMP4_DATA_STOP:
677 case NDMP4_DATA_CONNECT:
678 NDMP_PP_WITH(ndmp4_error)
679 sprintf (buf, "error=%s", ndmp4_error_to_str(*p));
683 case NDMP4_CONNECT_CLOSE:
687 case NDMP4_CONNECT_SERVER_AUTH:
688 strcpy (buf, "<<unimplemented pp>>");
691 case NDMP4_CONFIG_GET_HOST_INFO:
692 NDMP_PP_WITH(ndmp4_config_get_host_info_reply)
694 case 0: sprintf (buf, "error=%s hostname=%s",
695 ndmp4_error_to_str(p->error),
698 case 1: sprintf (buf, "os_type=%s os_vers=%s hostid=%s",
699 p->os_type, p->os_vers, p->hostid);
702 strcpy (buf, "--INVALID--");
709 case NDMP4_CONFIG_GET_CONNECTION_TYPE:
710 NDMP_PP_WITH(ndmp4_config_get_connection_type_reply)
711 sprintf (buf, "error=%s addr_types[%d]={",
712 ndmp4_error_to_str(p->error),
713 p->addr_types.addr_types_len);
714 for (j = 0; j < p->addr_types.addr_types_len; j++) {
715 sprintf (NDMOS_API_STREND(buf), " %s",
716 ndmp4_addr_type_to_str(p->addr_types.addr_types_val[j]));
723 case NDMP4_CONFIG_GET_SERVER_INFO:
724 case NDMP4_CONFIG_GET_TAPE_INFO:
725 case NDMP4_CONFIG_GET_SCSI_INFO:
726 strcpy (buf, "<<unimplemented pp>>");
729 case NDMP4_CONFIG_GET_AUTH_ATTR:
730 strcpy (buf, "<<unimplemented pp>>");
733 case NDMP4_SCSI_GET_STATE:
734 NDMP_PP_WITH(ndmp4_scsi_get_state_reply)
735 sprintf (buf, "error=%s cont=%d sid=%d lun=%d",
736 ndmp4_error_to_str(p->error),
737 p->target_controller,
738 p->target_id, p->target_lun);
742 case NDMP4_SCSI_EXECUTE_CDB:
743 case NDMP4_TAPE_EXECUTE_CDB:
744 NDMP_PP_WITH(ndmp4_execute_cdb_reply)
746 case 0: sprintf (buf,
747 "error=%s status=%02x dataout_len=%ld datain_len=%d",
748 ndmp4_error_to_str(p->error),
749 p->status, p->dataout_len, p->datain.datain_len);
751 case 1: sprintf (buf, "sense[%d]={", p->ext_sense.ext_sense_len);
752 for (j = 0; j < p->ext_sense.ext_sense_len; j++) {
753 sprintf (NDMOS_API_STREND(buf), " %02x",
754 p->ext_sense.ext_sense_val[j]&0xFF);
763 case NDMP4_TAPE_GET_STATE:
764 NDMP_PP_WITH(ndmp4_tape_get_state_reply)
766 case 0: sprintf (buf, "unsupp=%lx error=%s flags=0x%lx file_num=%ld",
768 ndmp4_error_to_str(p->error),
769 p->flags, p->file_num);
771 case 1: sprintf (buf, "soft_errors=%lu block_size=%lu blockno=%lu",
772 p->soft_errors, p->block_size, p->blockno);
774 case 2: sprintf (buf, "total_space=%lld space_remain=%lld",
775 p->total_space, p->space_remain);
778 strcpy (buf, "--INVALID--");
785 case NDMP4_TAPE_MTIO:
786 NDMP_PP_WITH(ndmp4_tape_mtio_reply)
787 sprintf (buf, "error=%s resid_count=%ld",
788 ndmp4_error_to_str(p->error), p->resid_count);
792 case NDMP4_TAPE_WRITE:
793 NDMP_PP_WITH(ndmp4_tape_write_reply)
794 sprintf (buf, "error=%s count=%ld",
795 ndmp4_error_to_str(p->error), p->count);
799 case NDMP4_TAPE_READ:
800 NDMP_PP_WITH(ndmp4_tape_read_reply)
801 sprintf (buf, "error=%s data_in_len=%d",
802 ndmp4_error_to_str(p->error), p->data_in.data_in_len);
806 case NDMP4_DATA_GET_STATE:
807 NDMP_PP_WITH(ndmp4_data_get_state_reply)
809 case 0: sprintf (buf, "unsupp=%lx error=%s op=%s",
811 ndmp4_error_to_str(p->error),
812 ndmp4_data_operation_to_str(p->operation));
814 case 1: sprintf (buf, "state=%s",
815 ndmp4_data_state_to_str(p->state));
817 case 2: sprintf (buf, "halt_reason=%s",
818 ndmp4_data_halt_reason_to_str(p->halt_reason));
820 case 3: sprintf (buf, "bytes_processed=%lld est_bytes_remain=%lld",
821 p->bytes_processed, p->est_bytes_remain);
823 case 4: sprintf (buf, "est_time_remain=%ld data_conn_addr=",
825 ndmp4_pp_addr (NDMOS_API_STREND(buf),
826 &p->data_connection_addr);
828 case 5: sprintf (buf, "read_offset=%lld read_length=%lld",
829 p->read_offset, p->read_length);
832 strcpy (buf, "--INVALID--");
839 case NDMP4_DATA_GET_ENV:
840 NDMP_PP_WITH(ndmp4_data_get_env_reply)
842 sprintf (buf, "error=%s n_env=%d",
843 ndmp4_error_to_str(p->error),
847 if (0 <= i && (unsigned)i < p->env.env_len) {
848 sprintf (buf, "[%d] name='%s' value='%s'",
849 i, p->env.env_val[i].name,
850 p->env.env_val[i].value);
852 strcpy (buf, "--INVALID--");
855 return p->env.env_len + 1;
859 case NDMP4_NOTIFY_DATA_HALTED:
860 case NDMP4_NOTIFY_CONNECTION_STATUS:
861 case NDMP4_NOTIFY_MOVER_HALTED:
862 case NDMP4_NOTIFY_MOVER_PAUSED:
863 case NDMP4_NOTIFY_DATA_READ:
865 case NDMP4_LOG_MESSAGE:
866 case NDMP4_FH_ADD_FILE:
867 case NDMP4_FH_ADD_DIR:
868 case NDMP4_FH_ADD_NODE:
869 strcpy (buf, "<<ILLEGAL REPLY>>");
872 case NDMP4_MOVER_GET_STATE:
873 NDMP_PP_WITH(ndmp4_mover_get_state_reply)
875 case 0: sprintf (buf, "error=%s state=%s",
876 ndmp4_error_to_str(p->error),
877 ndmp4_mover_state_to_str(p->state));
879 case 1: sprintf (buf, "pause_reason=%s",
880 ndmp4_mover_pause_reason_to_str(p->pause_reason));
882 case 2: sprintf (buf, "halt_reason=%s",
883 ndmp4_mover_halt_reason_to_str(p->halt_reason));
885 case 3: sprintf (buf,"record_size=%lu record_num=%lu bytes_moved=%lld",
886 p->record_size, p->record_num, p->bytes_moved);
888 case 4: sprintf (buf, "seek=%lld to_read=%lld win_off=%lld win_len=%lld",
889 p->seek_position, p->bytes_left_to_read,
890 p->window_offset, p->window_length);
892 case 5: sprintf (buf, "data_conn_addr=");
893 ndmp4_pp_addr (NDMOS_API_STREND(buf),
894 &p->data_connection_addr);
897 strcpy (buf, "--INVALID--");
904 case NDMP4_MOVER_LISTEN:
905 NDMP_PP_WITH(ndmp4_mover_listen_reply)
906 sprintf (buf, "error=%s data_conn_addr=",
907 ndmp4_error_to_str(p->error));
908 ndmp4_pp_addr (NDMOS_API_STREND(buf), &p->connect_addr);
913 return 1; /* one line in buf */
916 #endif /* !NDMOS_OPTION_NO_NDMP4 */