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_NDMP3
46 ndmp3_pp_header (void *data, char *buf)
48 ndmp3_header * mh = (ndmp3_header *) data;
50 if (mh->message_type == NDMP3_MESSAGE_REQUEST) {
51 sprintf (buf, "C %s %lu",
52 ndmp3_message_to_str (mh->message),
54 } else if (mh->message_type == NDMP3_MESSAGE_REPLY) {
55 sprintf (buf, "R %s %lu (%lu)",
56 ndmp3_message_to_str (mh->message),
59 if (mh->error != NDMP3_NO_ERR) {
60 sprintf (NDMOS_API_STREND(buf), " %s",
61 ndmp3_error_to_str (mh->error));
62 return 0; /* no body */
65 strcpy (buf, "??? INVALID MESSAGE TYPE");
66 return -1; /* no body */
72 ndmp3_pp_addr (char *buf, ndmp3_addr *ma)
74 sprintf (buf, "%s", ndmp3_addr_type_to_str (ma->addr_type));
75 if (ma->addr_type == NDMP3_ADDR_TCP) {
76 sprintf (NDMOS_API_STREND(buf), "(%lx,%d)",
77 ma->ndmp3_addr_u.tcp_addr.ip_addr,
78 ma->ndmp3_addr_u.tcp_addr.port);
85 ndmp3_pp_request (ndmp3_message msg, void *data, int lineno, char *buf)
92 strcpy (buf, "<<INVALID MSG>>");
95 case NDMP3_CONNECT_OPEN:
96 NDMP_PP_WITH(ndmp3_connect_open_request)
97 sprintf (buf, "version=%d", p->protocol_version);
101 case NDMP3_CONNECT_CLIENT_AUTH:
102 NDMP_PP_WITH(ndmp3_connect_client_auth_request)
103 sprintf (buf, "auth_type=%s",
104 ndmp3_auth_type_to_str (p->auth_data.auth_type));
105 sprintf (buf, "auth_type=%s",
106 ndmp3_auth_type_to_str (p->auth_data.auth_type));
107 switch (p->auth_data.auth_type) {
108 case NDMP3_AUTH_NONE:
111 case NDMP3_AUTH_TEXT:
112 sprintf (NDMOS_API_STREND(buf), " auth_id=%s",
113 p->auth_data.ndmp3_auth_data_u.auth_text.auth_id);
117 sprintf (NDMOS_API_STREND(buf), " auth_id=%s",
118 p->auth_data.ndmp3_auth_data_u.auth_md5.auth_id);
122 sprintf (NDMOS_API_STREND(buf), " ????");
128 case NDMP3_CONNECT_CLOSE:
129 case NDMP3_CONFIG_GET_HOST_INFO:
130 case NDMP3_CONFIG_GET_CONNECTION_TYPE:
131 case NDMP3_CONFIG_GET_SERVER_INFO:
132 case NDMP3_CONFIG_GET_BUTYPE_INFO:
133 case NDMP3_CONFIG_GET_FS_INFO:
134 case NDMP3_CONFIG_GET_TAPE_INFO:
135 case NDMP3_CONFIG_GET_SCSI_INFO:
136 case NDMP3_SCSI_CLOSE:
137 case NDMP3_SCSI_GET_STATE:
138 case NDMP3_SCSI_RESET_DEVICE:
139 case NDMP3_SCSI_RESET_BUS:
140 case NDMP3_TAPE_GET_STATE:
141 case NDMP3_TAPE_CLOSE:
142 case NDMP3_MOVER_GET_STATE:
143 case NDMP3_MOVER_CONTINUE:
144 case NDMP3_MOVER_ABORT:
145 case NDMP3_MOVER_STOP:
146 case NDMP3_MOVER_CLOSE:
147 case NDMP3_DATA_GET_STATE:
148 case NDMP3_DATA_ABORT:
149 case NDMP3_DATA_STOP:
150 case NDMP3_DATA_GET_ENV:
151 *buf = 0; /* no body */
154 case NDMP3_CONNECT_SERVER_AUTH:
155 strcpy (buf, "<<unimplemented pp>>");
158 case NDMP3_CONFIG_GET_AUTH_ATTR:
159 NDMP_PP_WITH(ndmp3_config_get_auth_attr_request)
160 sprintf (buf, "auth_type=%s", ndmp3_auth_type_to_str (p->auth_type));
164 case NDMP3_SCSI_OPEN:
165 NDMP_PP_WITH(ndmp3_scsi_open_request)
166 sprintf (buf, "device='%s'", p->device);
170 case NDMP3_SCSI_SET_TARGET:
171 NDMP_PP_WITH(ndmp3_scsi_set_target_request)
172 sprintf (buf, "device='%s' cont=%d sid=%d lun=%d",
173 p->device, p->target_controller,
174 p->target_id, p->target_lun);
178 case NDMP3_SCSI_EXECUTE_CDB:
179 case NDMP3_TAPE_EXECUTE_CDB:
180 NDMP_PP_WITH(ndmp3_execute_cdb_request)
182 case 0: sprintf (buf, "flags=0x%lx timeout=%ld datain_len=%ld",
183 p->flags, p->timeout, p->datain_len);
185 case 1: sprintf (buf, "cmd[%d]={", p->cdb.cdb_len);
186 for (j = 0; j < p->cdb.cdb_len; j++) {
187 sprintf (NDMOS_API_STREND(buf), " %02x",
188 p->cdb.cdb_val[j]&0xFF);
197 case NDMP3_TAPE_OPEN:
198 NDMP_PP_WITH(ndmp3_tape_open_request)
199 sprintf (buf, "device='%s' mode=%s",
201 ndmp3_tape_open_mode_to_str (p->mode));
205 case NDMP3_TAPE_MTIO:
206 NDMP_PP_WITH(ndmp3_tape_mtio_request)
207 sprintf (buf, "op=%s count=%ld",
208 ndmp3_tape_mtio_op_to_str(p->tape_op),
213 case NDMP3_TAPE_WRITE:
214 NDMP_PP_WITH(ndmp3_tape_write_request)
215 sprintf (buf, "data_out_len=%d", p->data_out.data_out_len);
219 case NDMP3_TAPE_READ:
220 NDMP_PP_WITH(ndmp3_tape_read_request)
221 sprintf (buf, "count=%ld", p->count);
225 case NDMP3_DATA_START_BACKUP:
226 NDMP_PP_WITH(ndmp3_data_start_backup_request)
228 sprintf (buf, "bu_type='%s' n_env=%d",
229 p->bu_type, p->env.env_len);
232 if (0 <= i && (unsigned)i < p->env.env_len) {
233 sprintf (buf, "env[%d] name='%s' value='%s'",
234 i, p->env.env_val[i].name,
235 p->env.env_val[i].value);
237 strcpy (buf, "--INVALID--");
240 return 1 + p->env.env_len;
244 case NDMP3_DATA_START_RECOVER:
245 case NDMP3_DATA_START_RECOVER_FILEHIST:
246 NDMP_PP_WITH(ndmp3_data_start_recover_request)
248 sprintf (buf, "bu_type='%s' n_env=%d n_nlist=%d",
249 p->bu_type, p->env.env_len,
253 if (0 <= i && (unsigned)i < p->env.env_len) {
254 sprintf (buf, "env[%d] name='%s' value='%s'",
255 i, p->env.env_val[i].name,
256 p->env.env_val[i].value);
259 if (0 <= i && (unsigned)i < p->nlist.nlist_len*4) {
260 ndmp3_name *nm = &p->nlist.nlist_val[i/4];
264 sprintf (buf, "nl[%d] original_path='%s'",
265 i/4, nm->original_path);
268 sprintf (buf, "..... destination_dir='%s'",
269 nm->destination_dir);
272 sprintf (buf, "..... new_name='%s' other='%s'",
273 nm->new_name, nm->other_name);
276 sprintf (buf, "..... node=%lld fh_info=%lld",
277 nm->node, nm->fh_info);
281 strcpy (buf, "--INVALID--");
285 return 1 + p->env.env_len + p->nlist.nlist_len*4;
289 case NDMP3_DATA_LISTEN:
290 NDMP_PP_WITH(ndmp3_data_listen_request)
291 sprintf (buf, "addr_type=%s", ndmp3_addr_type_to_str (p->addr_type));
295 case NDMP3_DATA_CONNECT:
296 NDMP_PP_WITH(ndmp3_data_connect_request)
297 sprintf (buf, "addr=");
298 ndmp3_pp_addr (NDMOS_API_STREND(buf), &p->addr);
302 case NDMP3_NOTIFY_DATA_HALTED:
303 NDMP_PP_WITH(ndmp3_notify_data_halted_request)
304 sprintf (buf, "reason=%s text_reason='%s'",
305 ndmp3_data_halt_reason_to_str(p->reason),
310 case NDMP3_NOTIFY_CONNECTED:
311 NDMP_PP_WITH(ndmp3_notify_connected_request)
312 sprintf (buf, "reason=%s protocol_version=%d text_reason='%s'",
313 ndmp3_connect_reason_to_str(p->reason),
319 case NDMP3_NOTIFY_MOVER_HALTED:
320 NDMP_PP_WITH(ndmp3_notify_mover_halted_request)
321 sprintf (buf, "reason=%s text_reason='%s'",
322 ndmp3_mover_halt_reason_to_str(p->reason),
327 case NDMP3_NOTIFY_MOVER_PAUSED:
328 NDMP_PP_WITH(ndmp3_notify_mover_paused_request)
329 sprintf (buf, "reason=%s seek_position=%lld",
330 ndmp3_mover_pause_reason_to_str(p->reason),
335 case NDMP3_NOTIFY_DATA_READ:
336 NDMP_PP_WITH(ndmp3_notify_data_read_request)
337 sprintf (buf, "offset=%lld length=%lld",
338 p->offset, p->length);
343 NDMP_PP_WITH(ndmp3_log_file_request)
344 sprintf (buf, "file=%s error=%s",
346 ndmp3_error_to_str(p->error));
350 case NDMP3_LOG_MESSAGE:
351 NDMP_PP_WITH(ndmp3_log_message_request)
352 sprintf (buf, "log_type=%s id=%lu message='%s'",
353 ndmp3_log_type_to_str(p->log_type), p->message_id, p->entry);
357 case NDMP3_FH_ADD_FILE:
358 NDMP_PP_WITH(ndmp3_fh_add_file_request)
359 int n_line = 0, n_names = 0, n_stats = 0;
360 unsigned int n_normal = 0;
363 for (j = 0; j < p->files.files_len; j++) {
366 nn = p->files.files_val[j].names.names_len;
367 ns = p->files.files_val[j].stats.stats_len;
369 n_line += 1 + nn + ns;
370 if (nn == 1 && ns == 1)
376 if (n_normal == p->files.files_len) {
377 /* could do something more efficient here */
381 sprintf (buf, "n_files=%d total n_names=%d n_stats=%d",
382 p->files.files_len, n_names, n_stats);
386 for (j = 0; j < p->files.files_len; j++) {
387 ndmp3_file * file = &p->files.files_val[j];
391 sprintf (buf, "[%d] n_names=%d n_stats=%d node=%lld fhinfo=%lld",
393 file->names.names_len,
394 file->stats.stats_len,
402 for (k = 0; k < file->names.names_len; k++, lineno--) {
403 ndmp3_file_name *filename;
408 filename = &file->names.names_val[k];
410 sprintf (buf, " name[%d] fs_type=%s",
411 k, ndmp3_fs_type_to_str (filename->fs_type));
413 switch (filename->fs_type) {
415 sprintf (NDMOS_API_STREND(buf), " other=%s",
416 filename->ndmp3_file_name_u.other_name);
420 sprintf (NDMOS_API_STREND(buf), " unix=%s",
421 filename->ndmp3_file_name_u.unix_name);
425 sprintf (NDMOS_API_STREND(buf)," nt=%s dos=%s",
426 filename->ndmp3_file_name_u.nt_name.nt_path,
427 filename->ndmp3_file_name_u.nt_name.dos_path);
433 for (k = 0; k < file->stats.stats_len; k++, lineno--) {
434 ndmp3_file_stat *filestat;
439 filestat = &file->stats.stats_val[k];
441 sprintf (buf, " stat[%ud] fs_type=%s ftype=%s size=%lld",
443 ndmp3_fs_type_to_str (filestat->fs_type),
444 ndmp3_file_type_to_str (filestat->ftype),
450 sprintf (buf, " YIKES n_line=%d lineno=%d", n_line, lineno);
455 case NDMP3_FH_ADD_DIR:
456 NDMP_PP_WITH(ndmp3_fh_add_dir_request)
457 int n_line = 0, n_names = 0;
458 unsigned int n_normal = 0;
461 for (j = 0; j < p->dirs.dirs_len; j++) {
464 nn = p->dirs.dirs_val[j].names.names_len;
472 if (n_normal == p->dirs.dirs_len) {
473 /* could do something more efficient here */
477 sprintf (buf, "n_dirs=%d total n_names=%d",
478 p->dirs.dirs_len, n_names);
482 for (j = 0; j < p->dirs.dirs_len; j++) {
483 ndmp3_dir * dir = &p->dirs.dirs_val[j];
487 sprintf (buf, "[%ud] n_names=%d node=%lld parent=%lld",
489 dir->names.names_len,
497 for (k = 0; k < dir->names.names_len; k++, lineno--) {
498 ndmp3_file_name *filename;
503 filename = &dir->names.names_val[k];
505 sprintf (buf, " name[%ud] fs_type=%s",
506 k, ndmp3_fs_type_to_str (filename->fs_type));
508 switch (filename->fs_type) {
510 sprintf (NDMOS_API_STREND(buf), " other=%s",
511 filename->ndmp3_file_name_u.other_name);
515 sprintf (NDMOS_API_STREND(buf), " unix=%s",
516 filename->ndmp3_file_name_u.unix_name);
520 sprintf (NDMOS_API_STREND(buf)," nt=%s dos=%s",
521 filename->ndmp3_file_name_u.nt_name.nt_path,
522 filename->ndmp3_file_name_u.nt_name.dos_path);
528 sprintf (buf, " YIKES n_line=%d lineno=%d", n_line, lineno);
533 case NDMP3_FH_ADD_NODE:
534 NDMP_PP_WITH(ndmp3_fh_add_node_request)
535 int n_line = 0, n_stats = 0;
536 unsigned int n_normal = 0;
539 for (j = 0; j < p->nodes.nodes_len; j++) {
542 ns = p->nodes.nodes_val[j].stats.stats_len;
550 if (n_normal == p->nodes.nodes_len) {
551 /* could do something more efficient here */
555 sprintf (buf, "n_nodes=%d total n_stats=%d",
556 p->nodes.nodes_len, n_stats);
560 for (j = 0; j < p->nodes.nodes_len; j++) {
561 ndmp3_node * node = &p->nodes.nodes_val[j];
565 sprintf (buf, "[%ud] n_stats=%d node=%lld fhinfo=%lld",
567 node->stats.stats_len,
575 for (k = 0; k < node->stats.stats_len; k++, lineno--) {
576 ndmp3_file_stat *filestat;
581 filestat = &node->stats.stats_val[k];
583 sprintf (buf, " stat[%ud] fs_type=%s ftype=%s size=%lld",
585 ndmp3_fs_type_to_str (filestat->fs_type),
586 ndmp3_file_type_to_str (filestat->ftype),
592 sprintf (buf, " YIKES n_line=%d lineno=%d", n_line, lineno);
597 case NDMP3_MOVER_LISTEN:
598 NDMP_PP_WITH(ndmp3_mover_listen_request)
599 sprintf (buf, "mode=%s addr_type=%s",
600 ndmp3_mover_mode_to_str (p->mode),
601 ndmp3_addr_type_to_str (p->addr_type));
605 case NDMP3_MOVER_SET_WINDOW:
606 NDMP_PP_WITH(ndmp3_mover_set_window_request)
607 sprintf (buf, "offset=%lld length=%lld", p->offset, p->length);
611 case NDMP3_MOVER_READ:
612 NDMP_PP_WITH(ndmp3_mover_read_request)
613 sprintf (buf, "offset=%lld length=%lld", p->offset, p->length);
617 case NDMP3_MOVER_SET_RECORD_SIZE:
618 NDMP_PP_WITH(ndmp3_mover_set_record_size_request)
619 sprintf (buf, "len=%lu", p->len);
623 case NDMP3_MOVER_CONNECT:
624 NDMP_PP_WITH(ndmp3_mover_connect_request)
625 sprintf (buf, "mode=%s addr=", ndmp3_mover_mode_to_str (p->mode));
626 ndmp3_pp_addr (NDMOS_API_STREND(buf), &p->addr);
631 return 1; /* one line in buf */
637 ndmp3_pp_reply (ndmp3_message msg, void *data, int lineno, char *buf)
644 strcpy (buf, "<<INVALID MSG>>");
647 case NDMP3_CONNECT_OPEN:
648 case NDMP3_CONNECT_CLIENT_AUTH:
649 case NDMP3_SCSI_OPEN:
650 case NDMP3_SCSI_CLOSE:
651 case NDMP3_SCSI_SET_TARGET:
652 case NDMP3_SCSI_RESET_DEVICE:
653 case NDMP3_SCSI_RESET_BUS:
654 case NDMP3_TAPE_OPEN:
655 case NDMP3_TAPE_CLOSE:
656 case NDMP3_MOVER_CONTINUE:
657 case NDMP3_MOVER_ABORT:
658 case NDMP3_MOVER_STOP:
659 case NDMP3_MOVER_READ:
660 case NDMP3_MOVER_SET_WINDOW:
661 case NDMP3_MOVER_CLOSE:
662 case NDMP3_MOVER_SET_RECORD_SIZE:
663 case NDMP3_MOVER_CONNECT:
664 case NDMP3_DATA_START_BACKUP:
665 case NDMP3_DATA_START_RECOVER:
666 case NDMP3_DATA_START_RECOVER_FILEHIST:
667 case NDMP3_DATA_ABORT:
668 case NDMP3_DATA_STOP:
669 case NDMP3_DATA_CONNECT:
670 NDMP_PP_WITH(ndmp3_error)
671 sprintf (buf, "error=%s", ndmp3_error_to_str(*p));
675 case NDMP3_CONFIG_GET_CONNECTION_TYPE:
676 NDMP_PP_WITH(ndmp3_config_get_connection_type_reply)
677 sprintf (buf, "error=%s addr_types[%d]={",
678 ndmp3_error_to_str(p->error),
679 p->addr_types.addr_types_len);
680 for (j = 0; j < p->addr_types.addr_types_len; j++) {
681 sprintf (NDMOS_API_STREND(buf), " %s",
682 ndmp3_addr_type_to_str(p->addr_types.addr_types_val[j]));
688 case NDMP3_CONFIG_GET_SERVER_INFO:
689 case NDMP3_CONFIG_GET_BUTYPE_INFO:
690 case NDMP3_CONFIG_GET_FS_INFO:
691 case NDMP3_CONFIG_GET_TAPE_INFO:
692 case NDMP3_CONFIG_GET_SCSI_INFO:
693 strcpy (buf, "<<unimplemented pp>>");
696 case NDMP3_CONNECT_CLOSE:
700 case NDMP3_CONNECT_SERVER_AUTH:
701 strcpy (buf, "<<unimplemented pp>>");
704 case NDMP3_CONFIG_GET_HOST_INFO:
705 NDMP_PP_WITH(ndmp3_config_get_host_info_reply)
707 case 0: sprintf (buf, "error=%s hostname=%s",
708 ndmp3_error_to_str(p->error),
711 case 1: sprintf (buf, "os_type=%s os_vers=%s hostid=%s",
712 p->os_type, p->os_vers, p->hostid);
715 strcpy (buf, "--INVALID--");
722 case NDMP3_CONFIG_GET_AUTH_ATTR:
723 strcpy (buf, "<<unimplemented pp>>");
726 case NDMP3_SCSI_GET_STATE:
727 NDMP_PP_WITH(ndmp3_scsi_get_state_reply)
728 sprintf (buf, "error=%s cont=%d sid=%d lun=%d",
729 ndmp3_error_to_str(p->error),
730 p->target_controller,
731 p->target_id, p->target_lun);
735 case NDMP3_SCSI_EXECUTE_CDB:
736 case NDMP3_TAPE_EXECUTE_CDB:
737 NDMP_PP_WITH(ndmp3_execute_cdb_reply)
739 case 0: sprintf (buf,
740 "error=%s status=%02x dataout_len=%ld datain_len=%d",
741 ndmp3_error_to_str(p->error),
742 p->status, p->dataout_len, p->datain.datain_len);
744 case 1: sprintf (buf, "sense[%d]={", p->ext_sense.ext_sense_len);
745 for (j = 0; j < p->ext_sense.ext_sense_len; j++) {
746 sprintf (NDMOS_API_STREND(buf), " %02x",
747 p->ext_sense.ext_sense_val[j]&0xFF);
756 case NDMP3_TAPE_GET_STATE:
757 NDMP_PP_WITH(ndmp3_tape_get_state_reply)
759 case 0: sprintf (buf, "invalid=%lx error=%s flags=0x%lx file_num=%ld",
761 ndmp3_error_to_str(p->error),
762 p->flags, p->file_num);
764 case 1: sprintf (buf, "soft_errors=%lu block_size=%lu blockno=%lu",
765 p->soft_errors, p->block_size, p->blockno);
767 case 2: sprintf (buf, "total_space=%lld space_remain=%lld partition=%lu",
768 p->total_space, p->space_remain, p->partition);
771 strcpy (buf, "--INVALID--");
778 case NDMP3_TAPE_MTIO:
779 NDMP_PP_WITH(ndmp3_tape_mtio_reply)
780 sprintf (buf, "error=%s resid_count=%ld",
781 ndmp3_error_to_str(p->error), p->resid_count);
785 case NDMP3_TAPE_WRITE:
786 NDMP_PP_WITH(ndmp3_tape_write_reply)
787 sprintf (buf, "error=%s count=%ld",
788 ndmp3_error_to_str(p->error), p->count);
792 case NDMP3_TAPE_READ:
793 NDMP_PP_WITH(ndmp3_tape_read_reply)
794 sprintf (buf, "error=%s data_in_len=%d",
795 ndmp3_error_to_str(p->error), p->data_in.data_in_len);
799 case NDMP3_DATA_GET_STATE:
800 NDMP_PP_WITH(ndmp3_data_get_state_reply)
802 case 0: sprintf (buf, "invalid=%lx error=%s op=%s",
804 ndmp3_error_to_str(p->error),
805 ndmp3_data_operation_to_str(p->operation));
807 case 1: sprintf (buf, "state=%s",
808 ndmp3_data_state_to_str(p->state));
810 case 2: sprintf (buf, "halt_reason=%s",
811 ndmp3_data_halt_reason_to_str(p->halt_reason));
813 case 3: sprintf (buf, "bytes_processed=%lld est_bytes_remain=%lld",
814 p->bytes_processed, p->est_bytes_remain);
816 case 4: sprintf (buf, "est_time_remain=%ld data_conn_addr=",
818 ndmp3_pp_addr (NDMOS_API_STREND(buf),
819 &p->data_connection_addr);
821 case 5: sprintf (buf, "read_offset=%lld read_length=%lld",
822 p->read_offset, p->read_length);
825 strcpy (buf, "--INVALID--");
832 case NDMP3_DATA_GET_ENV:
833 NDMP_PP_WITH(ndmp3_data_get_env_reply)
835 sprintf (buf, "error=%s n_env=%d",
836 ndmp3_error_to_str(p->error),
840 if (0 <= i && (unsigned)i < p->env.env_len) {
841 sprintf (buf, "[%d] name='%s' value='%s'",
842 i, p->env.env_val[i].name,
843 p->env.env_val[i].value);
845 strcpy (buf, "--INVALID--");
848 return p->env.env_len + 1;
852 case NDMP3_NOTIFY_DATA_HALTED:
853 case NDMP3_NOTIFY_CONNECTED:
854 case NDMP3_NOTIFY_MOVER_HALTED:
855 case NDMP3_NOTIFY_MOVER_PAUSED:
856 case NDMP3_NOTIFY_DATA_READ:
858 case NDMP3_LOG_MESSAGE:
859 case NDMP3_FH_ADD_FILE:
860 case NDMP3_FH_ADD_DIR:
861 case NDMP3_FH_ADD_NODE:
862 strcpy (buf, "<<ILLEGAL REPLY>>");
865 case NDMP3_MOVER_GET_STATE:
866 NDMP_PP_WITH(ndmp3_mover_get_state_reply)
868 case 0: sprintf (buf, "error=%s state=%s",
869 ndmp3_error_to_str(p->error),
870 ndmp3_mover_state_to_str(p->state));
872 case 1: sprintf (buf, "pause_reason=%s",
873 ndmp3_mover_pause_reason_to_str(p->pause_reason));
875 case 2: sprintf (buf, "halt_reason=%s",
876 ndmp3_mover_halt_reason_to_str(p->halt_reason));
878 case 3: sprintf (buf,"record_size=%lu record_num=%lu data_written=%lld",
879 p->record_size, p->record_num, p->data_written);
881 case 4: sprintf (buf, "seek=%lld to_read=%lld win_off=%lld win_len=%lld",
882 p->seek_position, p->bytes_left_to_read,
883 p->window_offset, p->window_length);
885 case 5: sprintf (buf, "data_conn_addr=");
886 ndmp3_pp_addr (NDMOS_API_STREND(buf),
887 &p->data_connection_addr);
890 strcpy (buf, "--INVALID--");
897 case NDMP3_DATA_LISTEN:
898 NDMP_PP_WITH(ndmp3_data_listen_reply)
899 sprintf (buf, "error=%s mover_conn_addr=",
900 ndmp3_error_to_str(p->error));
901 ndmp3_pp_addr (NDMOS_API_STREND(buf), &p->data_connection_addr);
905 case NDMP3_MOVER_LISTEN:
906 NDMP_PP_WITH(ndmp3_mover_listen_reply)
907 sprintf (buf, "error=%s data_conn_addr=",
908 ndmp3_error_to_str(p->error));
909 ndmp3_pp_addr (NDMOS_API_STREND(buf), &p->data_connection_addr);
914 return 1; /* one line in buf */
917 #endif /* !NDMOS_OPTION_NO_NDMP3 */