1 # This file was automatically generated by SWIG (http://www.swig.org).
4 # Do not make changes to this file unless you know what you are doing--modify
5 # the SWIG interface file instead.
9 use base qw(DynaLoader);
10 package Amanda::NDMPc;
11 bootstrap Amanda::NDMP;
15 # ---------- BASE METHODS -------------
20 my ($classname,$obj) = @_;
21 return bless $obj, $classname;
31 my ($self,$field) = @_;
32 my $member_func = "swig_${field}_get";
33 $self->$member_func();
37 my ($self,$field,$newval) = @_;
38 my $member_func = "swig_${field}_set";
39 $self->$member_func($newval);
48 # ------- FUNCTION WRAPPERS --------
53 ############# Class : Amanda::NDMP::NDMPConnection ##############
55 package Amanda::NDMP::NDMPConnection;
56 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
57 @ISA = qw( Amanda::NDMP );
62 my $self = Amanda::NDMPc::new_NDMPConnection(@_);
63 bless $self, $pkg if defined($self);
67 return unless $_[0]->isa('HASH');
68 my $self = tied(%{$_[0]});
69 return unless defined $self;
70 delete $ITERATORS{$self};
71 if (exists $OWNER{$self}) {
72 Amanda::NDMPc::delete_NDMPConnection($self);
77 *err_code = *Amanda::NDMPc::NDMPConnection_err_code;
78 *err_msg = *Amanda::NDMPc::NDMPConnection_err_msg;
79 *set_verbose = *Amanda::NDMPc::NDMPConnection_set_verbose;
80 *scsi_open = *Amanda::NDMPc::NDMPConnection_scsi_open;
81 *scsi_close = *Amanda::NDMPc::NDMPConnection_scsi_close;
82 *scsi_execute_cdb_C = *Amanda::NDMPc::NDMPConnection_scsi_execute_cdb_C;
83 *tape_open = *Amanda::NDMPc::NDMPConnection_tape_open;
84 *tape_close = *Amanda::NDMPc::NDMPConnection_tape_close;
85 *tape_mtio = *Amanda::NDMPc::NDMPConnection_tape_mtio;
86 *tape_write = *Amanda::NDMPc::NDMPConnection_tape_write;
87 *tape_read = *Amanda::NDMPc::NDMPConnection_tape_read;
88 *tape_get_state = *Amanda::NDMPc::NDMPConnection_tape_get_state;
91 my $ptr = tied(%$self);
97 my $ptr = tied(%$self);
102 # ------- VARIABLE STUBS --------
104 package Amanda::NDMP;
106 *NDMP9_SCSI_DATA_DIR_NONE = *Amanda::NDMPc::NDMP9_SCSI_DATA_DIR_NONE;
107 *NDMP9_SCSI_DATA_DIR_IN = *Amanda::NDMPc::NDMP9_SCSI_DATA_DIR_IN;
108 *NDMP9_SCSI_DATA_DIR_OUT = *Amanda::NDMPc::NDMP9_SCSI_DATA_DIR_OUT;
109 *NDMP9_TAPE_READ_MODE = *Amanda::NDMPc::NDMP9_TAPE_READ_MODE;
110 *NDMP9_TAPE_RDWR_MODE = *Amanda::NDMPc::NDMP9_TAPE_RDWR_MODE;
111 *NDMP9_TAPE_RAW_MODE = *Amanda::NDMPc::NDMP9_TAPE_RAW_MODE;
112 *NDMP9_MTIO_FSF = *Amanda::NDMPc::NDMP9_MTIO_FSF;
113 *NDMP9_MTIO_BSF = *Amanda::NDMPc::NDMP9_MTIO_BSF;
114 *NDMP9_MTIO_FSR = *Amanda::NDMPc::NDMP9_MTIO_FSR;
115 *NDMP9_MTIO_BSR = *Amanda::NDMPc::NDMP9_MTIO_BSR;
116 *NDMP9_MTIO_REW = *Amanda::NDMPc::NDMP9_MTIO_REW;
117 *NDMP9_MTIO_EOF = *Amanda::NDMPc::NDMP9_MTIO_EOF;
118 *NDMP9_MTIO_OFF = *Amanda::NDMPc::NDMP9_MTIO_OFF;
119 *NDMP9_MOVER_MODE_READ = *Amanda::NDMPc::NDMP9_MOVER_MODE_READ;
120 *NDMP9_MOVER_MODE_WRITE = *Amanda::NDMPc::NDMP9_MOVER_MODE_WRITE;
121 *NDMP9_ADDR_LOCAL = *Amanda::NDMPc::NDMP9_ADDR_LOCAL;
122 *NDMP9_ADDR_TCP = *Amanda::NDMPc::NDMP9_ADDR_TCP;
123 *NDMP9_ADDR_AS_CONNECTED = *Amanda::NDMPc::NDMP9_ADDR_AS_CONNECTED;
124 *NDMP9_MOVER_STATE_IDLE = *Amanda::NDMPc::NDMP9_MOVER_STATE_IDLE;
125 *NDMP9_MOVER_STATE_LISTEN = *Amanda::NDMPc::NDMP9_MOVER_STATE_LISTEN;
126 *NDMP9_MOVER_STATE_ACTIVE = *Amanda::NDMPc::NDMP9_MOVER_STATE_ACTIVE;
127 *NDMP9_MOVER_STATE_PAUSED = *Amanda::NDMPc::NDMP9_MOVER_STATE_PAUSED;
128 *NDMP9_MOVER_STATE_HALTED = *Amanda::NDMPc::NDMP9_MOVER_STATE_HALTED;
129 *NDMP9_MOVER_STATE_STANDBY = *Amanda::NDMPc::NDMP9_MOVER_STATE_STANDBY;
130 *NDMP9_DATA_HALT_NA = *Amanda::NDMPc::NDMP9_DATA_HALT_NA;
131 *NDMP9_DATA_HALT_SUCCESSFUL = *Amanda::NDMPc::NDMP9_DATA_HALT_SUCCESSFUL;
132 *NDMP9_DATA_HALT_ABORTED = *Amanda::NDMPc::NDMP9_DATA_HALT_ABORTED;
133 *NDMP9_DATA_HALT_INTERNAL_ERROR = *Amanda::NDMPc::NDMP9_DATA_HALT_INTERNAL_ERROR;
134 *NDMP9_DATA_HALT_CONNECT_ERROR = *Amanda::NDMPc::NDMP9_DATA_HALT_CONNECT_ERROR;
135 *NDMP9_MOVER_HALT_NA = *Amanda::NDMPc::NDMP9_MOVER_HALT_NA;
136 *NDMP9_MOVER_HALT_CONNECT_CLOSED = *Amanda::NDMPc::NDMP9_MOVER_HALT_CONNECT_CLOSED;
137 *NDMP9_MOVER_HALT_ABORTED = *Amanda::NDMPc::NDMP9_MOVER_HALT_ABORTED;
138 *NDMP9_MOVER_HALT_INTERNAL_ERROR = *Amanda::NDMPc::NDMP9_MOVER_HALT_INTERNAL_ERROR;
139 *NDMP9_MOVER_HALT_CONNECT_ERROR = *Amanda::NDMPc::NDMP9_MOVER_HALT_CONNECT_ERROR;
140 *NDMP9_MOVER_PAUSE_NA = *Amanda::NDMPc::NDMP9_MOVER_PAUSE_NA;
141 *NDMP9_MOVER_PAUSE_EOM = *Amanda::NDMPc::NDMP9_MOVER_PAUSE_EOM;
142 *NDMP9_MOVER_PAUSE_EOF = *Amanda::NDMPc::NDMP9_MOVER_PAUSE_EOF;
143 *NDMP9_MOVER_PAUSE_SEEK = *Amanda::NDMPc::NDMP9_MOVER_PAUSE_SEEK;
144 *NDMP9_MOVER_PAUSE_MEDIA_ERROR = *Amanda::NDMPc::NDMP9_MOVER_PAUSE_MEDIA_ERROR;
145 *NDMP9_MOVER_PAUSE_EOW = *Amanda::NDMPc::NDMP9_MOVER_PAUSE_EOW;
153 Amanda::NDMP - communicate via NDMP
157 use Amanda::NDMP qw( :constants );
159 my $conn = Amanda::NDMP::NDMPConnection->new($host, $port, $ident, $username,
161 my ($ok, $blocksize, $file_num, $blockno) = $conn->tape_get_state();
165 This package interfaces with the C class C<NDMPConnection> class declared in
166 C<ndmp-src/ndmpconnobj.h>. It is only available in builds that did not specify
167 C<--without-ndmp>. The C class, in turn, interfaces to the XDR code provided
168 by NDMJOB, which sends and receives NDMP messages on a TCP socket.
172 my $conn = Amanda::NDMP::NDMPConnection->new($host, $port, $ident, $username,
174 if ($conn->err_code()) {
178 This gets a new connection object. This will always return an object, but the
179 result should be checked for errors as described in the "Error Handling"
182 The C<$host> and C<$port> give the NDMP server's host and port, respectively.
183 The C<$auth> parameter defines the authentication mechanism to use: "md5" or
184 "text"; "none" for no authentication; or "void" to not send any authentication
185 packets at all. For md5 or text modes, C<$username> and C<$password> specify
186 the username and password for the NDMP server; these parameters must always be
187 included, but can be blank for none or void.
189 The C<$ident> parameter deserves some explanation. NDMP scopes many
190 server-side variables to the NDMP connection - for example, the "current" tape
191 and taper state are associated with the NDMP connection. To facilitate this,
192 the constructor returns the I<same connection> for any constructor invocation
193 with the same host, port, and identifier. In cases where multiple connections
194 are required (e.g., when two tapes are in use simultaneously), callers should
195 provide different identifiers for each connection.
199 Note that not all NDMPConnection methods are available. All of these methods
200 block until the appropriate reply is received. The underlying C class provides
201 appropriate locking fundamentals to prevent corrupted on-the-wire messages.
203 All methods return a boolean "ok" status, with false indicating an error.
205 =head3 Error Handling
207 my $code = $conn->err_code();
208 my $msg = $conn->err_msg();
210 Get the error code and message from the last method that returned false, or
211 after the constructor is invoked.
213 $conn->set_verbose(1);
215 This method will enable verbose logging of the NDMP transactions to the Amanda
218 =head3 SCSI Interface
220 my $ok = $conn->scsi_open($device); # NDMP_SCSI_OPEN
221 my $ok = $conn->scsi_close(); # NDMP_SCSI_CLOSE
222 # NDMP_SCSI_EXECUTE_CDB
223 my $res = $conn->scsi_execute_cdb(
227 datain_len => $datain_len, # only if $flags == $NDMP9_SCSI_DATA_DIR_IN
228 dataout => $dataout # only if $flags == $NDMP9_SCSI_DATA_DIR_OUT
231 The first two methods are clear; the third uses keyword parameters to simplify
232 a complex set of parameters. The C<flags> argument can be
233 C<$NDMP9_SCSI_DATA_DIR_IN>, to take data I<into> the server from the SCSI
234 device, or C<$NDMP9_SCSI_DATA_DIR_OUT> to send data I<out> to the SCSI device.
235 The C<timeout> is in milliseconds. The C<cdb> should be a SCSI control block
236 (the C<pack> function is useful here). If the data direction is in, then
237 C<datain_len> indicates the maximum amount of data to expect; otherwise,
238 C<dataout> is the data to send to the device.
240 The result is C<undef> for an error, or a hashref with the following keys:
242 status SCSI status byte
243 ext_sense SCSI extended sense data
244 datain data from the device
245 dataout_len number of bytes actually transmitted to the device
247 =head3 Tape Interface
249 my $ok = $conn->tape_open($device, $mode);
250 my $ok = $conn->tape_close();
252 The first method opens a tape device, using the give mode -
253 C<$NDMP9_TAPE_READ_MODE> or C<$NDMP9_TAPE_RDRW_MODE>. The second method closes
254 the tape device associated with this connection.
256 my ($ok, $resid) = $conn->tape_mtio($op, $count);
258 This method sends C<NDMP_TAPE_MTIO> with the given operation and count.
259 Operations have the prefix C<$NDMP9_MTIO_>. The number of incomplete
260 operations is returned in C<$resid>.
262 To read and write blocks, use these methods:
264 my ($ok, $actual) = $conn->tape_write($data);
265 my ($ok, $data) = $conn->tape_read($bufsize);
267 where C<$actual> and C<$bufsize> are byte counts, and C<$data> is a string of
268 data. Finally, to get the state of the tape agent, use
270 my ($ok, $blocksize, $file_num, $blockno) = $conn->tape_get_state();
274 The constants required for the interface exposed here are included in this
275 package. They all begin with the prefix C<$NDMP9_>, which is an implementation
276 detail of the NDMJOB library. The constants are available from the export tag
279 use Amanda::NDMP qw( :constants );
285 package Amanda::NDMP::NDMPConnection;
287 sub scsi_execute_cdb {
291 die "no 'flags' parameter'" unless defined $params{'flags'};
292 die "no 'timeout' parameter'" unless defined $params{'timeout'};
293 die "no 'cdb' parameter'" unless defined $params{'cdb'};
294 if ($params{'flags'} & $Amanda::NDMP::NDMP9_SCSI_DATA_DIR_IN) {
295 die "no 'datain_len' parameter'" unless defined $params{'datain_len'};
297 $params{'datain_len'} = 0;
299 if ($params{'flags'} & $Amanda::NDMP::NDMP9_SCSI_DATA_DIR_OUT) {
300 die "no 'dataout' parameter'" unless defined $params{'dataout'};
302 $params{'dataout'} = undef;
305 my ($ok, $dataout_len, $datain, $status, $ext_sense) =
306 $self->scsi_execute_cdb_C(
307 $params{'flags'}, $params{'timeout'},
308 $params{'cdb'}, $params{'dataout'},
309 $params{'datain_len'});
311 return 0 unless ($ok);
315 ext_sense => $ext_sense);
316 if ($params{'flags'} & $Amanda::NDMP::NDMP9_SCSI_DATA_DIR_IN) {
317 $result{'datain'} = $datain;
319 if ($params{'flags'} & $Amanda::NDMP::NDMP9_SCSI_DATA_DIR_OUT) {
320 $result{'dataout_len'} = $dataout_len;
325 package Amanda::NDMP;
327 push @EXPORT_OK, qw(scsi_data_dir_to_strings);
328 push @{$EXPORT_TAGS{"scsi_data_dir"}}, qw(scsi_data_dir_to_strings);
330 my %_scsi_data_dir_VALUES;
331 #Convert a flag value to a list of names for flags that are set.
332 sub scsi_data_dir_to_strings {
336 for my $k (keys %_scsi_data_dir_VALUES) {
337 my $v = $_scsi_data_dir_VALUES{$k};
339 #is this a matching flag?
340 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
345 #by default, just return the number as a 1-element list
353 push @EXPORT_OK, qw($NDMP9_SCSI_DATA_DIR_NONE);
354 push @{$EXPORT_TAGS{"scsi_data_dir"}}, qw($NDMP9_SCSI_DATA_DIR_NONE);
356 $_scsi_data_dir_VALUES{"NDMP9_SCSI_DATA_DIR_NONE"} = $NDMP9_SCSI_DATA_DIR_NONE;
358 push @EXPORT_OK, qw($NDMP9_SCSI_DATA_DIR_IN);
359 push @{$EXPORT_TAGS{"scsi_data_dir"}}, qw($NDMP9_SCSI_DATA_DIR_IN);
361 $_scsi_data_dir_VALUES{"NDMP9_SCSI_DATA_DIR_IN"} = $NDMP9_SCSI_DATA_DIR_IN;
363 push @EXPORT_OK, qw($NDMP9_SCSI_DATA_DIR_OUT);
364 push @{$EXPORT_TAGS{"scsi_data_dir"}}, qw($NDMP9_SCSI_DATA_DIR_OUT);
366 $_scsi_data_dir_VALUES{"NDMP9_SCSI_DATA_DIR_OUT"} = $NDMP9_SCSI_DATA_DIR_OUT;
368 #copy symbols in scsi_data_dir to constants
369 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"scsi_data_dir"}};
371 push @EXPORT_OK, qw(tape_open_mode_to_strings);
372 push @{$EXPORT_TAGS{"tape_open_mode"}}, qw(tape_open_mode_to_strings);
374 my %_tape_open_mode_VALUES;
375 #Convert a flag value to a list of names for flags that are set.
376 sub tape_open_mode_to_strings {
380 for my $k (keys %_tape_open_mode_VALUES) {
381 my $v = $_tape_open_mode_VALUES{$k};
383 #is this a matching flag?
384 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
389 #by default, just return the number as a 1-element list
397 push @EXPORT_OK, qw($NDMP9_TAPE_READ_MODE);
398 push @{$EXPORT_TAGS{"tape_open_mode"}}, qw($NDMP9_TAPE_READ_MODE);
400 $_tape_open_mode_VALUES{"NDMP9_TAPE_READ_MODE"} = $NDMP9_TAPE_READ_MODE;
402 push @EXPORT_OK, qw($NDMP9_TAPE_RDWR_MODE);
403 push @{$EXPORT_TAGS{"tape_open_mode"}}, qw($NDMP9_TAPE_RDWR_MODE);
405 $_tape_open_mode_VALUES{"NDMP9_TAPE_RDRW_MODE"} = $NDMP9_TAPE_RDWR_MODE;
407 push @EXPORT_OK, qw($NDMP9_TAPE_RAW_MODE);
408 push @{$EXPORT_TAGS{"tape_open_mode"}}, qw($NDMP9_TAPE_RAW_MODE);
410 $_tape_open_mode_VALUES{"NDMP9_TAPE_RAW_MODE"} = $NDMP9_TAPE_RAW_MODE;
412 #copy symbols in tape_open_mode to constants
413 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"tape_open_mode"}};
415 push @EXPORT_OK, qw(tape_mtio_op_to_strings);
416 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw(tape_mtio_op_to_strings);
418 my %_tape_mtio_op_VALUES;
419 #Convert a flag value to a list of names for flags that are set.
420 sub tape_mtio_op_to_strings {
424 for my $k (keys %_tape_mtio_op_VALUES) {
425 my $v = $_tape_mtio_op_VALUES{$k};
427 #is this a matching flag?
428 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
433 #by default, just return the number as a 1-element list
441 push @EXPORT_OK, qw($NDMP9_MTIO_FSF);
442 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_FSF);
444 $_tape_mtio_op_VALUES{"NDMP9_MTIO_FSF"} = $NDMP9_MTIO_FSF;
446 push @EXPORT_OK, qw($NDMP9_MTIO_BSF);
447 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_BSF);
449 $_tape_mtio_op_VALUES{"NDMP9_MTIO_BSF"} = $NDMP9_MTIO_BSF;
451 push @EXPORT_OK, qw($NDMP9_MTIO_FSR);
452 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_FSR);
454 $_tape_mtio_op_VALUES{"NDMP9_MTIO_FSR"} = $NDMP9_MTIO_FSR;
456 push @EXPORT_OK, qw($NDMP9_MTIO_BSR);
457 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_BSR);
459 $_tape_mtio_op_VALUES{"NDMP9_MTIO_BSR"} = $NDMP9_MTIO_BSR;
461 push @EXPORT_OK, qw($NDMP9_MTIO_REW);
462 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_REW);
464 $_tape_mtio_op_VALUES{"NDMP9_MTIO_REW"} = $NDMP9_MTIO_REW;
466 push @EXPORT_OK, qw($NDMP9_MTIO_EOF);
467 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_EOF);
469 $_tape_mtio_op_VALUES{"NDMP9_MTIO_EOF"} = $NDMP9_MTIO_EOF;
471 push @EXPORT_OK, qw($NDMP9_MTIO_OFF);
472 push @{$EXPORT_TAGS{"tape_mtio_op"}}, qw($NDMP9_MTIO_OFF);
474 $_tape_mtio_op_VALUES{"NDMP9_MTIO_OFF"} = $NDMP9_MTIO_OFF;
476 #copy symbols in tape_mtio_op to constants
477 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"tape_mtio_op"}};
479 push @EXPORT_OK, qw(mover_mode_to_strings);
480 push @{$EXPORT_TAGS{"mover_mode"}}, qw(mover_mode_to_strings);
482 my %_mover_mode_VALUES;
483 #Convert a flag value to a list of names for flags that are set.
484 sub mover_mode_to_strings {
488 for my $k (keys %_mover_mode_VALUES) {
489 my $v = $_mover_mode_VALUES{$k};
491 #is this a matching flag?
492 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
497 #by default, just return the number as a 1-element list
505 push @EXPORT_OK, qw($NDMP9_MOVER_MODE_READ);
506 push @{$EXPORT_TAGS{"mover_mode"}}, qw($NDMP9_MOVER_MODE_READ);
508 $_mover_mode_VALUES{"NDMP9_MOVER_MODE_READ"} = $NDMP9_MOVER_MODE_READ;
510 push @EXPORT_OK, qw($NDMP9_MOVER_MODE_WRITE);
511 push @{$EXPORT_TAGS{"mover_mode"}}, qw($NDMP9_MOVER_MODE_WRITE);
513 $_mover_mode_VALUES{"NDMP9_MOVER_MODE_WRITE"} = $NDMP9_MOVER_MODE_WRITE;
515 #copy symbols in mover_mode to constants
516 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"mover_mode"}};
518 push @EXPORT_OK, qw(addr_type_to_strings);
519 push @{$EXPORT_TAGS{"addr_type"}}, qw(addr_type_to_strings);
521 my %_addr_type_VALUES;
522 #Convert a flag value to a list of names for flags that are set.
523 sub addr_type_to_strings {
527 for my $k (keys %_addr_type_VALUES) {
528 my $v = $_addr_type_VALUES{$k};
530 #is this a matching flag?
531 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
536 #by default, just return the number as a 1-element list
544 push @EXPORT_OK, qw($NDMP9_ADDR_LOCAL);
545 push @{$EXPORT_TAGS{"addr_type"}}, qw($NDMP9_ADDR_LOCAL);
547 $_addr_type_VALUES{"NDMP9_ADDR_LOCAL"} = $NDMP9_ADDR_LOCAL;
549 push @EXPORT_OK, qw($NDMP9_ADDR_TCP);
550 push @{$EXPORT_TAGS{"addr_type"}}, qw($NDMP9_ADDR_TCP);
552 $_addr_type_VALUES{"NDMP9_ADDR_TCP"} = $NDMP9_ADDR_TCP;
554 push @EXPORT_OK, qw($NDMP9_ADDR_AS_CONNECTED);
555 push @{$EXPORT_TAGS{"addr_type"}}, qw($NDMP9_ADDR_AS_CONNECTED);
557 $_addr_type_VALUES{"NDMP9_ADDR_AS_CONNECTED"} = $NDMP9_ADDR_AS_CONNECTED;
559 #copy symbols in addr_type to constants
560 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"addr_type"}};
562 push @EXPORT_OK, qw(mover_state_to_strings);
563 push @{$EXPORT_TAGS{"mover_state"}}, qw(mover_state_to_strings);
565 my %_mover_state_VALUES;
566 #Convert a flag value to a list of names for flags that are set.
567 sub mover_state_to_strings {
571 for my $k (keys %_mover_state_VALUES) {
572 my $v = $_mover_state_VALUES{$k};
574 #is this a matching flag?
575 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
580 #by default, just return the number as a 1-element list
588 push @EXPORT_OK, qw($NDMP9_MOVER_STATE_IDLE);
589 push @{$EXPORT_TAGS{"mover_state"}}, qw($NDMP9_MOVER_STATE_IDLE);
591 $_mover_state_VALUES{"NDMP9_MOVER_STATE_IDLE"} = $NDMP9_MOVER_STATE_IDLE;
593 push @EXPORT_OK, qw($NDMP9_MOVER_STATE_LISTEN);
594 push @{$EXPORT_TAGS{"mover_state"}}, qw($NDMP9_MOVER_STATE_LISTEN);
596 $_mover_state_VALUES{"NDMP9_MOVER_STATE_LISTEN"} = $NDMP9_MOVER_STATE_LISTEN;
598 push @EXPORT_OK, qw($NDMP9_MOVER_STATE_ACTIVE);
599 push @{$EXPORT_TAGS{"mover_state"}}, qw($NDMP9_MOVER_STATE_ACTIVE);
601 $_mover_state_VALUES{"NDMP9_MOVER_STATE_ACTIVE"} = $NDMP9_MOVER_STATE_ACTIVE;
603 push @EXPORT_OK, qw($NDMP9_MOVER_STATE_PAUSED);
604 push @{$EXPORT_TAGS{"mover_state"}}, qw($NDMP9_MOVER_STATE_PAUSED);
606 $_mover_state_VALUES{"NDMP9_MOVER_STATE_PAUSED"} = $NDMP9_MOVER_STATE_PAUSED;
608 push @EXPORT_OK, qw($NDMP9_MOVER_STATE_HALTED);
609 push @{$EXPORT_TAGS{"mover_state"}}, qw($NDMP9_MOVER_STATE_HALTED);
611 $_mover_state_VALUES{"NDMP9_MOVER_STATE_HALTED"} = $NDMP9_MOVER_STATE_HALTED;
613 push @EXPORT_OK, qw($NDMP9_MOVER_STATE_STANDBY);
614 push @{$EXPORT_TAGS{"mover_state"}}, qw($NDMP9_MOVER_STATE_STANDBY);
616 $_mover_state_VALUES{"NDMP9_MOVER_STATE_STANDBY"} = $NDMP9_MOVER_STATE_STANDBY;
618 #copy symbols in mover_state to constants
619 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"mover_state"}};
621 push @EXPORT_OK, qw(data_halt_reason_to_strings);
622 push @{$EXPORT_TAGS{"data_halt_reason"}}, qw(data_halt_reason_to_strings);
624 my %_data_halt_reason_VALUES;
625 #Convert a flag value to a list of names for flags that are set.
626 sub data_halt_reason_to_strings {
630 for my $k (keys %_data_halt_reason_VALUES) {
631 my $v = $_data_halt_reason_VALUES{$k};
633 #is this a matching flag?
634 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
639 #by default, just return the number as a 1-element list
647 push @EXPORT_OK, qw($NDMP9_DATA_HALT_NA);
648 push @{$EXPORT_TAGS{"data_halt_reason"}}, qw($NDMP9_DATA_HALT_NA);
650 $_data_halt_reason_VALUES{"NDMP9_DATA_HALT_NA"} = $NDMP9_DATA_HALT_NA;
652 push @EXPORT_OK, qw($NDMP9_DATA_HALT_SUCCESSFUL);
653 push @{$EXPORT_TAGS{"data_halt_reason"}}, qw($NDMP9_DATA_HALT_SUCCESSFUL);
655 $_data_halt_reason_VALUES{"NDMP9_DATA_HALT_SUCCESSFUL"} = $NDMP9_DATA_HALT_SUCCESSFUL;
657 push @EXPORT_OK, qw($NDMP9_DATA_HALT_ABORTED);
658 push @{$EXPORT_TAGS{"data_halt_reason"}}, qw($NDMP9_DATA_HALT_ABORTED);
660 $_data_halt_reason_VALUES{"NDMP9_DATA_HALT_ABORTED"} = $NDMP9_DATA_HALT_ABORTED;
662 push @EXPORT_OK, qw($NDMP9_DATA_HALT_INTERNAL_ERROR);
663 push @{$EXPORT_TAGS{"data_halt_reason"}}, qw($NDMP9_DATA_HALT_INTERNAL_ERROR);
665 $_data_halt_reason_VALUES{"NDMP9_DATA_HALT_INTERNAL_ERROR"} = $NDMP9_DATA_HALT_INTERNAL_ERROR;
667 push @EXPORT_OK, qw($NDMP9_DATA_HALT_CONNECT_ERROR);
668 push @{$EXPORT_TAGS{"data_halt_reason"}}, qw($NDMP9_DATA_HALT_CONNECT_ERROR);
670 $_data_halt_reason_VALUES{"NDMP9_DATA_HALT_CONNECT_ERROR"} = $NDMP9_DATA_HALT_CONNECT_ERROR;
672 #copy symbols in data_halt_reason to constants
673 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"data_halt_reason"}};
675 push @EXPORT_OK, qw(mover_halt_reason_to_strings);
676 push @{$EXPORT_TAGS{"mover_halt_reason"}}, qw(mover_halt_reason_to_strings);
678 my %_mover_halt_reason_VALUES;
679 #Convert a flag value to a list of names for flags that are set.
680 sub mover_halt_reason_to_strings {
684 for my $k (keys %_mover_halt_reason_VALUES) {
685 my $v = $_mover_halt_reason_VALUES{$k};
687 #is this a matching flag?
688 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
693 #by default, just return the number as a 1-element list
701 push @EXPORT_OK, qw($NDMP9_MOVER_HALT_NA);
702 push @{$EXPORT_TAGS{"mover_halt_reason"}}, qw($NDMP9_MOVER_HALT_NA);
704 $_mover_halt_reason_VALUES{"NDMP9_MOVER_HALT_NA"} = $NDMP9_MOVER_HALT_NA;
706 push @EXPORT_OK, qw($NDMP9_MOVER_HALT_CONNECT_CLOSED);
707 push @{$EXPORT_TAGS{"mover_halt_reason"}}, qw($NDMP9_MOVER_HALT_CONNECT_CLOSED);
709 $_mover_halt_reason_VALUES{"NDMP9_MOVER_HALT_CONNECT_CLOSED"} = $NDMP9_MOVER_HALT_CONNECT_CLOSED;
711 push @EXPORT_OK, qw($NDMP9_MOVER_HALT_ABORTED);
712 push @{$EXPORT_TAGS{"mover_halt_reason"}}, qw($NDMP9_MOVER_HALT_ABORTED);
714 $_mover_halt_reason_VALUES{"NDMP9_MOVER_HALT_ABORTED"} = $NDMP9_MOVER_HALT_ABORTED;
716 push @EXPORT_OK, qw($NDMP9_MOVER_HALT_INTERNAL_ERROR);
717 push @{$EXPORT_TAGS{"mover_halt_reason"}}, qw($NDMP9_MOVER_HALT_INTERNAL_ERROR);
719 $_mover_halt_reason_VALUES{"NDMP9_MOVER_HALT_INTERNAL_ERROR"} = $NDMP9_MOVER_HALT_INTERNAL_ERROR;
721 push @EXPORT_OK, qw($NDMP9_MOVER_HALT_CONNECT_ERROR);
722 push @{$EXPORT_TAGS{"mover_halt_reason"}}, qw($NDMP9_MOVER_HALT_CONNECT_ERROR);
724 $_mover_halt_reason_VALUES{"NDMP9_MOVER_HALT_CONNECT_ERROR"} = $NDMP9_MOVER_HALT_CONNECT_ERROR;
726 #copy symbols in mover_halt_reason to constants
727 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"mover_halt_reason"}};
729 push @EXPORT_OK, qw(mover_pause_reason_to_strings);
730 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw(mover_pause_reason_to_strings);
732 my %_mover_pause_reason_VALUES;
733 #Convert a flag value to a list of names for flags that are set.
734 sub mover_pause_reason_to_strings {
738 for my $k (keys %_mover_pause_reason_VALUES) {
739 my $v = $_mover_pause_reason_VALUES{$k};
741 #is this a matching flag?
742 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
747 #by default, just return the number as a 1-element list
755 push @EXPORT_OK, qw($NDMP9_MOVER_PAUSE_NA);
756 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw($NDMP9_MOVER_PAUSE_NA);
758 $_mover_pause_reason_VALUES{"NDMP9_MOVER_PAUSE_NA"} = $NDMP9_MOVER_PAUSE_NA;
760 push @EXPORT_OK, qw($NDMP9_MOVER_PAUSE_EOM);
761 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw($NDMP9_MOVER_PAUSE_EOM);
763 $_mover_pause_reason_VALUES{"NDMP9_MOVER_PAUSE_EOM"} = $NDMP9_MOVER_PAUSE_EOM;
765 push @EXPORT_OK, qw($NDMP9_MOVER_PAUSE_EOF);
766 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw($NDMP9_MOVER_PAUSE_EOF);
768 $_mover_pause_reason_VALUES{"NDMP9_MOVER_PAUSE_EOF"} = $NDMP9_MOVER_PAUSE_EOF;
770 push @EXPORT_OK, qw($NDMP9_MOVER_PAUSE_SEEK);
771 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw($NDMP9_MOVER_PAUSE_SEEK);
773 $_mover_pause_reason_VALUES{"NDMP9_MOVER_PAUSE_SEEK"} = $NDMP9_MOVER_PAUSE_SEEK;
775 push @EXPORT_OK, qw($NDMP9_MOVER_PAUSE_MEDIA_ERROR);
776 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw($NDMP9_MOVER_PAUSE_MEDIA_ERROR);
778 $_mover_pause_reason_VALUES{"NDMP9_MOVER_PAUSE_MEDIA_ERROR"} = $NDMP9_MOVER_PAUSE_MEDIA_ERROR;
780 push @EXPORT_OK, qw($NDMP9_MOVER_PAUSE_EOW);
781 push @{$EXPORT_TAGS{"mover_pause_reason"}}, qw($NDMP9_MOVER_PAUSE_EOW);
783 $_mover_pause_reason_VALUES{"NDMP9_MOVER_PAUSE_EOW"} = $NDMP9_MOVER_PAUSE_EOW;
785 #copy symbols in mover_pause_reason to constants
786 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"mover_pause_reason"}};