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 require Amanda::MainLoop;
11 package Amanda::Xferc;
12 bootstrap Amanda::Xfer;
16 # ---------- BASE METHODS -------------
21 my ($classname,$obj) = @_;
22 return bless $obj, $classname;
32 my ($self,$field) = @_;
33 my $member_func = "swig_${field}_get";
34 $self->$member_func();
38 my ($self,$field,$newval) = @_;
39 my $member_func = "swig_${field}_set";
40 $self->$member_func($newval);
49 # ------- FUNCTION WRAPPERS --------
53 *xfer_new = *Amanda::Xferc::xfer_new;
54 *xfer_unref = *Amanda::Xferc::xfer_unref;
55 *xfer_get_status = *Amanda::Xferc::xfer_get_status;
56 *xfer_repr = *Amanda::Xferc::xfer_repr;
57 *xfer_start = *Amanda::Xferc::xfer_start;
58 *xfer_cancel = *Amanda::Xferc::xfer_cancel;
59 *xfer_element_unref = *Amanda::Xferc::xfer_element_unref;
60 *xfer_element_repr = *Amanda::Xferc::xfer_element_repr;
61 *same_elements = *Amanda::Xferc::same_elements;
62 *xfer_source_random = *Amanda::Xferc::xfer_source_random;
63 *xfer_source_random_get_seed = *Amanda::Xferc::xfer_source_random_get_seed;
64 *xfer_source_pattern = *Amanda::Xferc::xfer_source_pattern;
65 *xfer_source_fd = *Amanda::Xferc::xfer_source_fd;
66 *xfer_source_directtcp_listen = *Amanda::Xferc::xfer_source_directtcp_listen;
67 *xfer_source_directtcp_listen_get_addrs = *Amanda::Xferc::xfer_source_directtcp_listen_get_addrs;
68 *xfer_source_directtcp_connect = *Amanda::Xferc::xfer_source_directtcp_connect;
69 *xfer_filter_xor = *Amanda::Xferc::xfer_filter_xor;
70 *xfer_filter_process = *Amanda::Xferc::xfer_filter_process;
71 *xfer_dest_null = *Amanda::Xferc::xfer_dest_null;
72 *xfer_dest_buffer = *Amanda::Xferc::xfer_dest_buffer;
73 *xfer_dest_buffer_get = *Amanda::Xferc::xfer_dest_buffer_get;
74 *xfer_dest_fd = *Amanda::Xferc::xfer_dest_fd;
75 *xfer_dest_directtcp_listen = *Amanda::Xferc::xfer_dest_directtcp_listen;
76 *xfer_dest_directtcp_listen_get_addrs = *Amanda::Xferc::xfer_dest_directtcp_listen_get_addrs;
77 *xfer_dest_directtcp_connect = *Amanda::Xferc::xfer_dest_directtcp_connect;
78 *xfer_get_amglue_source = *Amanda::Xferc::xfer_get_amglue_source;
80 # ------- VARIABLE STUBS --------
84 *XFER_INIT = *Amanda::Xferc::XFER_INIT;
85 *XFER_START = *Amanda::Xferc::XFER_START;
86 *XFER_RUNNING = *Amanda::Xferc::XFER_RUNNING;
87 *XFER_DONE = *Amanda::Xferc::XFER_DONE;
88 *XMSG_INFO = *Amanda::Xferc::XMSG_INFO;
89 *XMSG_ERROR = *Amanda::Xferc::XMSG_ERROR;
90 *XMSG_DONE = *Amanda::Xferc::XMSG_DONE;
91 *XMSG_CANCEL = *Amanda::Xferc::XMSG_CANCEL;
92 *XMSG_PART_DONE = *Amanda::Xferc::XMSG_PART_DONE;
93 *XMSG_READY = *Amanda::Xferc::XMSG_READY;
101 Amanda::Xfer - the transfer architecture
105 use Amanda::MainLoop;
106 use Amanda::Xfer qw( :constants );
109 my $infd = POSIX::open("input", POSIX::O_RDONLY, 0);
110 my $outfd = POSIX::open("output", POSIX::O_CREAT|POSIX::O_WRONLY, 0640);
111 my $xfer = Amanda::Xfer->new([
112 Amanda::Xfer::Source::Fd->new($infd),
113 Amanda::Xfer::Dest::Fd->new($outfd)
116 my ($src, $xmsg, $xfer) = @_;
117 print "Message from $xfer: $xmsg\n"; # use stringify operations
118 if ($msg->{'type'} == $XMSG_DONE) {
119 Amanda::MainLoop::quit();
122 Amanda::MainLoop::run();
124 See L<http://wiki.zmanda.com/index.php/XFA> for background on the
125 transfer architecture.
127 =head1 Amanda::Xfer Objects
129 A new transfer is created with C<< Amanda::Xfer->new() >>, which takes
130 an arrayref giving the transfer elements which should compose the
133 The resulting object has the following methods:
139 Start this transfer. Processing takes place asynchronously, and messages will
140 begin queueing up immediately. If C<$cb> is given, then it is installed as the
141 callback for messages from this transfer. The callback receives three
142 arguments: the event source, the message, and a reference to the controlling
143 transfer. See the description of C<Amanda::Xfer::Msg>, below, for details.
145 There is no need to remove the source on completion of the transfer - that is
150 Stop transferring data. The transfer will send an C<XMSG_CANCEL>,
151 "drain" any buffered data as best it can, and then complete normally
152 with an C<XMSG_DONE>.
156 Get the transfer's status. The result will be one of C<$XFER_INIT>,
157 C<$XFER_START>, C<$XFER_RUNNING>, or C<$XFER_DONE>. These symbols are
158 available for import with the tag C<:constants>.
162 Return a string representation of this transfer, suitable for use in
163 debugging messages. This method is automatically invoked when a
164 transfer is interpolated into a string:
166 print "Starting $xfer\n";
170 Get the L<Amanda::MainLoop> event source through which messages will
171 be delivered for this transfer. Use its C<set_callback> method to
172 connect a perl sub for processing events.
174 Use of this method is deprecated; instead, pass a callback to the C<start>
175 method. If you set a callback via C<get_source>, then you I<must> C<remove>
176 the source when the transfer is complete!
180 =head1 Amanda::Xfer::Element objects
182 The individual transfer elements that compose a transfer are instances
183 of subclasses of Amanda::Xfer::Element. All such objects have a
184 C<repr()> method, similar to that for transfers, and support a similar
185 kind of string interpolation.
187 Note that the names of these classes contain the words "Source",
188 "Filter", and "Dest". This is merely suggestive of their intended
189 purpose -- there are no such abstract classes.
191 =head2 Transfer Sources
193 =head3 Amanda::Xfer::Source::Device (SERVER ONLY)
195 Amanda::Xfer::Source::Device->new($device);
197 This source reads data from a device. The device should already be
198 queued up for reading (C<< $device->seek_file(..) >>). The element
199 will read until the end of the device file.
201 =head3 Amanda::Xfer::Source::Fd
203 Amanda::Xfer::Source::Fd->new(fileno($fh));
205 This source reads data from a file descriptor. It reads until EOF,
206 but does not close the descriptor. Be careful not to let Perl close
209 =head3 Amanda::Xfer::Source::Holding (SERVER-ONLY)
211 Amanda::Xfer::Source::Holding->new($filename);
213 This source reads data from a holding file (see L<Amanda::Holding>).
214 If the transfer only consists of a C<Amanda::Xfer::Source::Holding>
215 and an C<Amanda::Xfer::Dest::Taper::Splitter> (with no filters), then the source
216 will call the destination's C<cache_inform> method so that it can use
217 holding chunks for a split-part cache.
219 =head3 Amanda::Xfer::Source::Random
221 Amanda::Xfer::Source::Random->new($length, $seed);
223 This source provides I<length> bytes of random data (or an unlimited
224 amount of data if I<length> is zero). C<$seed> is the seed used to
225 generate the random numbers; this seed can be used in a destination to
226 check for correct output.
228 If you need to string multiple transfers together into a coherent sequence of
229 random numbers, for example when testing the re-assembly of spanned dumps, call
231 my $seed = $src->get_seed();
233 to get the finishing seed for the source, then pass this to the source
234 constructor for the next transfer. When concatenated, the bytestreams from the
235 transfers will verify correctly using the original random seed.
237 =head3 Amanda::Xfer::Source::Pattern
239 Amanda::Xfer::Source::Pattern->new($length, $pattern);
241 This source provides I<length> bytes containing copies of
242 I<pattern>. If I<length> is zero, the source provides an unlimited
245 =head3 Amanda::Xfer::Source::Recovery (SERVER ONLY)
247 Amanda::Xfer::Source::Recovery->new($first_device);
249 This source reads a datastream composed of on-device files. Its constructor
250 takes a pointer to the first device that will be read from; this is used
251 internally to determine whether DirectTCP is supported.
253 The element sense C<$XMSG_READY> when it is ready for the first C<start_part>
254 invocation. Don't do anything with the device between the start of the
255 transfer and when the element sends an C<$XMSG_READY>.
257 The element contains no logic to decide I<which> files to assemble into the
258 datastream; instead, it relies on the caller to supply pre-positioned devices:
260 $src->start_part($device);
262 Once C<start_part> is called, the source will read until C<$device> produces an
263 EOF. As each part is completed, the element sends an C<$XMSG_PART_DONE>
264 L<Amanda::Xfer::Msg>, with the following keys:
266 size bytes read from the device
267 duration time spent reading
268 fileno the on-media file number from which the part was read
270 Call C<start_part> with C<$device = undef> to indicate that there are no more
273 To switch to a new device in mid-transfer, use C<use_device>:
275 $dest->use_device($device);
277 This method must be called with a device that is not yet started, and thus must
278 be called before the C<start_part> method is called with a new device.
280 =head3 Amanda::Xfer::Source::DirectTCPListen
282 Amanda::Xfer::Source::DirectTCPListen->new();
284 This source is for use when the transfer data will come in via DirectTCP, with
285 the data's I<source> connecting to the data's I<destination>. Set up the
286 transfer, and after starting it, call its C<get_addrs> method to get an
287 arrayref of ip/port pairs, e.g., C<[ "192.168.4.5", 9924 ]>, all of which are
288 listening for an incoming data connection. Once a connection arrives, this
289 element will read data from it and send those data into the transfer.
291 my $addrs = $src->get_addrs();
293 =head3 Amanda::Xfer::Source::DirectTCPConnect
295 Amanda::Xfer::Source::DirectTCPConnect->new($addrs);
297 This source is for use when the transfer data will come in via DirectTCP, with
298 the data's I<destination> connecting to the the data's I<source>. The element
299 connects to C<$addrs> and reads the transfer data from the connection.
301 =head2 Transfer Filters
303 =head3 Amanda::Xfer::Filter:Process
305 Amanda::Xfer::Filter::Process->new([@args], $need_root);
307 This filter will pipe data through the standard file descriptors of the
308 subprocess specified by C<@args>. If C<$need_root> is true, it will attempt to
309 change to uid 0 before executing the process. Standard output from the process
310 is redirected to the debug log. Note that the process is invoked directly, not
311 via a shell, so shell metacharcters (e.g., C<< 2>&1 >>) will not function as
314 =head3 Amanda::Xfer::Filter:Xor
316 Amanda::Xfer::Filter::Xor->new($key);
318 This filter applies a bytewise XOR operation to the data flowing
321 =head2 Transfer Destinations
323 =head3 Amanda::Xfer::Dest::Device (SERVER ONLY)
325 Amanda::Xfer::Dest::Device->new($device, $max_memory);
327 This source writes data to a device. The device should be ready for
328 writing (C<< $device->start_file(..) >>). No more than C<$max_memory>
329 will be used for buffers. Use zero for the default buffer size. On
330 completion of the transfer, the file will be finished.
332 =head3 Amanda::Xfer::Dest::Buffer
334 Amanda::Xfer::Dest::Buffer->new($max_size);
336 This destination records data into an in-memory buffer which can grow up to
337 C<$max_size> bytes. The buffer is available with the C<get> method, which
338 returns a copy of the buffer as a perl scalar:
340 my $buf = $xdb->get();
342 =head3 Amanda::Xfer::Dest::DirectTCPListen
344 Amanda::Xfer::Dest::DirectTCPListen->new();
346 This destination is for use when the transfer data will come in via DirectTCP,
347 with the data's I<destination> connecting to the data's I<source>. Set up the
348 transfer, and after starting it, call this element's C<get_addrs> method to get
349 an arrayref of ip/port pairs, e.g., C<[ "192.168.4.5", 9924 ]>, all of which
350 are listening for an incoming data connection. Once a connection arrives, this
351 element will write the transfer data to it.
353 my $addrs = $src->get_addrs();
355 =head3 Amanda::Xfer::Dest::DirectTCPConnect
357 Amanda::Xfer::Dest::DirectTCPConnect->new($addrs);
359 This destination is for use when the transfer data will come in via DirectTCP,
360 with the data's I<source> connecting to the the data's I<destination>. The
361 element connects to C<$addrs> and writes the transfer data to the connection.
363 =head3 Amanda::Xfer::Dest::Fd
365 Amanda::Xfer::Dest::Fd->new(fileno($fh));
367 This destination writes data to a file descriptor. The file is not
368 closed after the transfer is completed. Be careful not to let Perl
369 close the file for you!
371 =head3 Amanda::Xfer::Dest::Null
373 Amanda::Xfer::Dest::Null->new($seed);
375 This destination discards the data it receives. If C<$seed> is
376 nonzero, then the element will validate that it receives the data that
377 C<Amanda::Xfer::Source::Random> produced with the same seed. No
378 validation is performed if C<$seed> is zero.
380 =head3 Amanda::Xfer::Dest::Taper (SERVER ONLY)
382 This is the parent class to C<Amanda::Xfer::Dest::Taper::Splitter> and
383 C<Amanda::Xfer::Dest::Taper::DirectTCP>. These subclasses allow a single
384 transfer to write to multiple files (parts) on a device, and even spread those
385 parts over multiple devices, without interrupting the transfer itself.
387 The subclass constructors all take a C<$first_device>, which should be
388 configured but not yet started; and a C<$part_size> giving the maximum size of
389 each part. Note that this value may be rounded up internally as necessary.
391 When a transfer using a taper destination element is first started, no data is
392 transfered until the element's C<start_part> method is called:
394 $dest->start_part($retry_part);
396 where C<$device> is the device to which the part should be written. The device
397 should have a file open and ready to write (that is,
398 C<< $device->start_file(..) >> has already been called). If C<$retry_part> is
399 true, then the previous, unsuccessful part will be retried.
401 As each part is completed, the element sends an C<$XMSG_PART_DONE>
402 C<Amanda::Xfer::Msg>, with the following keys:
404 successful true if the part was written successfully
405 eof recipient should not call start_part again
406 eom this volume is at EOM; a new volume is required
407 size bytes written to volume
408 duration time spent writing, not counting changer ops, etc.
409 partnum the zero-based number of this part in the overall dumpfile
410 fileno the on-media file number used for this part, or 0 if no file
413 If C<eom> is true, then the caller should find a new volume before
414 continuing. If C<eof> is not true, then C<start_part> should be called
415 again, with C<$retry_part = !successful>. Note that it is possible
416 for some destinations to write a portion of a part successfully,
417 but still stop at EOM. That is, C<eom> does not necessarily imply
420 To switch to a new device in mid-transfer, use C<use_device>:
422 $dest->use_device($device);
424 This method must be called with a device that is not yet started.
426 If neither the memory nor disk caches are in use, but the dumpfile is
427 available on disk, then the C<cache_inform> method allows the element
428 to use that on-disk data to support retries. This is intended to
429 support transfers from Amanda's holding disk (see
430 C<Amanda::Xfer::Source::Holding>), but may be useful for other
433 $dest->cache_inform($filename, $offset, $length);
435 This function indicates that C<$filename> contains C<$length> bytes of
436 data, beginning at offset C<$offset> from the beginning of the file.
437 These bytes are assumed to follow immediately after any bytes
438 previously specified to C<cache_inform>. That is, no gaps or overlaps
439 are allowed in the data stream described to C<cache_inform>.
440 Furthermore, the location of each byte must be specified to this
441 method I<before> it is sent through the transfer.
443 $dest->get_part_bytes_written();
445 This function returns the number of bytes written for the current part
448 =head3 Amanda::Xfer::Dest::Taper::Splitter
450 Amanda::Xfer::Dest::Taper::Splitter->new($first_device, $max_memory,
451 $part_size, $use_mem_cache, $disk_cache_dirname);
453 This class caches data from each part in one of a variety of ways, and supports
454 "rewinding" to retry a failed part (e.g., one that does not fit on a device).
455 It assumes that when a device reaches EOM while writing, the entire file is
456 corrupt. It does not (yet) support logical EOM, which can render this
457 assumption incorrect.
459 The C<$first_device> is used to calculate some internal constants, notably the
460 slab size, based on the device characteristics. Subsequent devices must have
461 the same block size. The C<$part_size> and C<$first_device> parameters are
464 If C<$use_mem_cache> is true, each part will be cached in memory (using
465 C<$part_size> bytes of memory; plan accordingly!). If C<$disk_cache_dirname>
466 is defined, then each part will be cached on-disk in a file in this directory.
467 It is an error to specify both in-memory and on-disk caching. If neither
468 option is specified, the element will operate successfully, but will not be
469 able to retry a part unless C<cache_inform> has been used properly (see above).
471 =head3 Amanda::Xfer::Dest::Taper::DirectTCP
473 Amanda::Xfer::Dest::Taper::DirectTCP->new($first_device, $part_size);
475 This class uses the Device API DirectTCP methods to write data to a device via
476 DirectTCP. Since all DirectTCP devices support logical EOM, this class does
477 not cache any data, and will never re-start an unsuccessful part.
479 As state above, C<$first_device> must not be started when C<new> is called.
480 Furthermore, no use of that device is allowed until the element sens an
481 C<$XMSG_READY> to indicate that it is finished with the device. The
482 C<start_part> method must not be called until this method is received either.
484 =head1 Amanda::Xfer::Msg objects
486 Messages are simple hashrefs, with a few convenience methods. Like
487 transfers, they have a C<repr()> method that formats the message
488 nicely, and is available through string interpolation:
490 print "Received message $msg\n";
492 The canonical description of the message types and keys is in
493 C<xfer-src/xmsg.h>, and is not duplicated here. Every message has the
494 following basic keys.
500 The message type -- one of the C<xmsg_type> constants available from
501 the import tag C<:constants>.
505 The transfer element that sent the message.
509 The version of the message. This is used to support extensibility of
514 Additional keys are described in the documentation for the elements
515 that use them. All keys are listed in C<xfer-src/xmsg.h>.
521 push @EXPORT_OK, qw(xfer_status_to_string);
522 push @{$EXPORT_TAGS{"xfer_status"}}, qw(xfer_status_to_string);
524 my %_xfer_status_VALUES;
525 #Convert an enum value to a single string
526 sub xfer_status_to_string {
529 for my $k (keys %_xfer_status_VALUES) {
530 my $v = $_xfer_status_VALUES{$k};
532 #is this a matching flag?
533 if ($enumval == $v) {
538 #default, just return the number
542 push @EXPORT_OK, qw($XFER_INIT);
543 push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_INIT);
545 $_xfer_status_VALUES{"XFER_INIT"} = $XFER_INIT;
547 push @EXPORT_OK, qw($XFER_START);
548 push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_START);
550 $_xfer_status_VALUES{"XFER_START"} = $XFER_START;
552 push @EXPORT_OK, qw($XFER_RUNNING);
553 push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_RUNNING);
555 $_xfer_status_VALUES{"XFER_RUNNING"} = $XFER_RUNNING;
557 push @EXPORT_OK, qw($XFER_DONE);
558 push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_DONE);
560 $_xfer_status_VALUES{"XFER_DONE"} = $XFER_DONE;
562 #copy symbols in xfer_status to constants
563 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"xfer_status"}};
565 push @EXPORT_OK, qw(xmsg_type_to_string);
566 push @{$EXPORT_TAGS{"xmsg_type"}}, qw(xmsg_type_to_string);
568 my %_xmsg_type_VALUES;
569 #Convert an enum value to a single string
570 sub xmsg_type_to_string {
573 for my $k (keys %_xmsg_type_VALUES) {
574 my $v = $_xmsg_type_VALUES{$k};
576 #is this a matching flag?
577 if ($enumval == $v) {
582 #default, just return the number
586 push @EXPORT_OK, qw($XMSG_INFO);
587 push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_INFO);
589 $_xmsg_type_VALUES{"XMSG_INFO"} = $XMSG_INFO;
591 push @EXPORT_OK, qw($XMSG_ERROR);
592 push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_ERROR);
594 $_xmsg_type_VALUES{"XMSG_ERROR"} = $XMSG_ERROR;
596 push @EXPORT_OK, qw($XMSG_DONE);
597 push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_DONE);
599 $_xmsg_type_VALUES{"XMSG_DONE"} = $XMSG_DONE;
601 push @EXPORT_OK, qw($XMSG_CANCEL);
602 push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_CANCEL);
604 $_xmsg_type_VALUES{"XMSG_CANCEL"} = $XMSG_CANCEL;
606 push @EXPORT_OK, qw($XMSG_PART_DONE);
607 push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_PART_DONE);
609 $_xmsg_type_VALUES{"XMSG_PART_DONE"} = $XMSG_PART_DONE;
611 push @EXPORT_OK, qw($XMSG_READY);
612 push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_READY);
614 $_xmsg_type_VALUES{"XMSG_READY"} = $XMSG_READY;
616 #copy symbols in xmsg_type to constants
617 push @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"xmsg_type"}};
619 sub xfer_start_with_callback {
620 my ($xfer, $cb) = @_;
622 my $releasing_cb = sub {
623 my ($src, $msg, $xfer) = @_;
624 my $done = $msg->{'type'} == $XMSG_DONE;
625 $src->remove() if $done;
627 $cb = undef if $done; # break potential reference loop
629 $xfer->get_source()->set_callback($releasing_cb);
634 package Amanda::Xfer::Xfer;
640 Amanda::Xfer::xfer_new(@_);
642 *DESTROY = *Amanda::Xfer::xfer_unref;
644 use overload '""' => sub { $_[0]->repr(); };
646 use overload '==' => sub { Amanda::Xfer::same_elements($_[0], $_[1]); };
647 use overload '!=' => sub { not Amanda::Xfer::same_elements($_[0], $_[1]); };
648 *repr = *Amanda::Xfer::xfer_repr;
649 *get_status = *Amanda::Xfer::xfer_get_status;
650 *get_source = *Amanda::Xfer::xfer_get_amglue_source;
651 *start = *Amanda::Xfer::xfer_start_with_callback;
652 *cancel = *Amanda::Xfer::xfer_cancel;
654 package Amanda::Xfer::Element;
655 *DESTROY = *Amanda::Xfer::xfer_element_unref;
657 use overload '""' => sub { $_[0]->repr(); };
659 use overload '==' => sub { Amanda::Xfer::same_elements($_[0], $_[1]); };
660 use overload '!=' => sub { not Amanda::Xfer::same_elements($_[0], $_[1]); };
661 *repr = *Amanda::Xfer::xfer_element_repr;
663 package Amanda::Xfer::Element::Glue;
666 @ISA = qw( Amanda::Xfer::Element );
668 package Amanda::Xfer::Source::Fd;
671 @ISA = qw( Amanda::Xfer::Element );
677 Amanda::Xfer::xfer_source_fd(@_);
680 package Amanda::Xfer::Source::Random;
683 @ISA = qw( Amanda::Xfer::Element );
689 Amanda::Xfer::xfer_source_random(@_);
691 *get_seed = *Amanda::Xfer::xfer_source_random_get_seed;
693 package Amanda::Xfer::Source::DirectTCPListen;
696 @ISA = qw( Amanda::Xfer::Element );
702 Amanda::Xfer::xfer_source_directtcp_listen(@_);
704 *get_addrs = *Amanda::Xfer::xfer_source_directtcp_listen_get_addrs;
706 package Amanda::Xfer::Source::DirectTCPConnect;
709 @ISA = qw( Amanda::Xfer::Element );
715 Amanda::Xfer::xfer_source_directtcp_connect(@_);
718 package Amanda::Xfer::Source::Pattern;
721 @ISA = qw( Amanda::Xfer::Element );
727 Amanda::Xfer::xfer_source_pattern(@_);
730 package Amanda::Xfer::Filter::Xor;
733 @ISA = qw( Amanda::Xfer::Element );
739 Amanda::Xfer::xfer_filter_xor(@_);
742 package Amanda::Xfer::Filter::Process;
745 @ISA = qw( Amanda::Xfer::Element );
751 Amanda::Xfer::xfer_filter_process(@_);
754 package Amanda::Xfer::Dest::Fd;
757 @ISA = qw( Amanda::Xfer::Element );
763 Amanda::Xfer::xfer_dest_fd(@_);
766 package Amanda::Xfer::Dest::Null;
769 @ISA = qw( Amanda::Xfer::Element );
775 Amanda::Xfer::xfer_dest_null(@_);
778 package Amanda::Xfer::Dest::Buffer;
781 @ISA = qw( Amanda::Xfer::Element );
787 Amanda::Xfer::xfer_dest_buffer(@_);
789 *get = *Amanda::Xfer::xfer_dest_buffer_get;
791 package Amanda::Xfer::Dest::DirectTCPListen;
794 @ISA = qw( Amanda::Xfer::Element );
800 Amanda::Xfer::xfer_dest_directtcp_listen(@_);
802 *get_addrs = *Amanda::Xfer::xfer_dest_directtcp_listen_get_addrs;
804 package Amanda::Xfer::Dest::DirectTCPConnect;
807 @ISA = qw( Amanda::Xfer::Element );
813 Amanda::Xfer::xfer_dest_directtcp_connect(@_);
816 package Amanda::Xfer::Msg;
819 use overload '""' => sub { $_[0]->repr(); };
823 local $Data::Dumper::Indent = 0;
824 local $Data::Dumper::Terse = 1;
825 local $Data::Dumper::Useqq = 1;
827 my $typestr = Amanda::Xfer::xmsg_type_to_string($self->{'type'});
828 my $str = "{ type => \$$typestr, elt => $self->{'elt'}, version => $self->{'version'},";
830 my %skip = ( "type" => 1, "elt" => 1, "version" => 1 );
831 for my $k (keys %$self) {
833 $str .= " $k => " . Dumper($self->{$k}) . ",";
836 # strip the trailing comma and add a closing brace
842 package Amanda::Xfer;
844 # make Amanda::Xfer->new equivalent to Amanda::Xfer::Xfer->new (don't
845 # worry, the blessings work out just fine)
846 *new = *Amanda::Xfer::Xfer::new;
848 # try to load Amanda::XferServer, which is server-only. If it's not found, then
849 # its classes just remain undefined.
851 eval "use Amanda::XferServer;";