81a989fa7041eab3ebba17313d3922b9d64f4bab
[debian/amanda] / perl / Amanda / Device.pm
1 # This file was automatically generated by SWIG (http://www.swig.org).
2 # Version 1.3.35
3 #
4 # Don't modify this file, modify the SWIG interface instead.
5
6 package Amanda::Device;
7 require Exporter;
8 require DynaLoader;
9 @ISA = qw(Exporter DynaLoader);
10 require Amanda::Types;
11 package Amanda::Devicec;
12 bootstrap Amanda::Device;
13 package Amanda::Device;
14 @EXPORT = qw( );
15
16 # ---------- BASE METHODS -------------
17
18 package Amanda::Device;
19
20 sub TIEHASH {
21     my ($classname,$obj) = @_;
22     return bless $obj, $classname;
23 }
24
25 sub CLEAR { }
26
27 sub FIRSTKEY { }
28
29 sub NEXTKEY { }
30
31 sub FETCH {
32     my ($self,$field) = @_;
33     my $member_func = "swig_${field}_get";
34     $self->$member_func();
35 }
36
37 sub STORE {
38     my ($self,$field,$newval) = @_;
39     my $member_func = "swig_${field}_set";
40     $self->$member_func($newval);
41 }
42
43 sub this {
44     my $ptr = shift;
45     return tied(%$ptr);
46 }
47
48
49 # ------- FUNCTION WRAPPERS --------
50
51 package Amanda::Device;
52
53 *IS_WRITABLE_ACCESS_MODE = *Amanda::Devicec::IS_WRITABLE_ACCESS_MODE;
54
55 ############# Class : Amanda::Device::queue_fd_t ##############
56
57 package Amanda::Device::queue_fd_t;
58 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
59 @ISA = qw( Amanda::Device );
60 %OWNER = ();
61 %ITERATORS = ();
62 *swig_fd_get = *Amanda::Devicec::queue_fd_t_fd_get;
63 *swig_fd_set = *Amanda::Devicec::queue_fd_t_fd_set;
64 *swig_errmsg_get = *Amanda::Devicec::queue_fd_t_errmsg_get;
65 *swig_errmsg_set = *Amanda::Devicec::queue_fd_t_errmsg_set;
66 sub new {
67     my $pkg = shift;
68     my $self = Amanda::Devicec::new_queue_fd_t(@_);
69     bless $self, $pkg if defined($self);
70 }
71
72 sub DESTROY {
73     return unless $_[0]->isa('HASH');
74     my $self = tied(%{$_[0]});
75     return unless defined $self;
76     delete $ITERATORS{$self};
77     if (exists $OWNER{$self}) {
78         Amanda::Devicec::delete_queue_fd_t($self);
79         delete $OWNER{$self};
80     }
81 }
82
83 sub DISOWN {
84     my $self = shift;
85     my $ptr = tied(%$self);
86     delete $OWNER{$ptr};
87 }
88
89 sub ACQUIRE {
90     my $self = shift;
91     my $ptr = tied(%$self);
92     $OWNER{$ptr} = 1;
93 }
94
95
96 ############# Class : Amanda::Device::Device ##############
97
98 package Amanda::Device::Device;
99 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
100 @ISA = qw( Amanda::Device );
101 %OWNER = ();
102 %ITERATORS = ();
103 sub new {
104     my $pkg = shift;
105     my $self = Amanda::Devicec::new_Device(@_);
106     bless $self, $pkg if defined($self);
107 }
108
109 sub DESTROY {
110     return unless $_[0]->isa('HASH');
111     my $self = tied(%{$_[0]});
112     return unless defined $self;
113     delete $ITERATORS{$self};
114     if (exists $OWNER{$self}) {
115         Amanda::Devicec::delete_Device($self);
116         delete $OWNER{$self};
117     }
118 }
119
120 *configure = *Amanda::Devicec::Device_configure;
121 *error = *Amanda::Devicec::Device_error;
122 *status_error = *Amanda::Devicec::Device_status_error;
123 *error_or_status = *Amanda::Devicec::Device_error_or_status;
124 *read_label = *Amanda::Devicec::Device_read_label;
125 *start = *Amanda::Devicec::Device_start;
126 *finish = *Amanda::Devicec::Device_finish;
127 *start_file = *Amanda::Devicec::Device_start_file;
128 *write_block = *Amanda::Devicec::Device_write_block;
129 *write_from_fd = *Amanda::Devicec::Device_write_from_fd;
130 *finish_file = *Amanda::Devicec::Device_finish_file;
131 *seek_file = *Amanda::Devicec::Device_seek_file;
132 *seek_block = *Amanda::Devicec::Device_seek_block;
133 *read_block = *Amanda::Devicec::Device_read_block;
134 *read_to_fd = *Amanda::Devicec::Device_read_to_fd;
135 *property_list = *Amanda::Devicec::Device_property_list;
136 *property_get = *Amanda::Devicec::Device_property_get;
137 *property_set = *Amanda::Devicec::Device_property_set;
138 *property_set_ex = *Amanda::Devicec::Device_property_set_ex;
139 *recycle_file = *Amanda::Devicec::Device_recycle_file;
140 *file = *Amanda::Devicec::Device_file;
141 *block = *Amanda::Devicec::Device_block;
142 *in_file = *Amanda::Devicec::Device_in_file;
143 *device_name = *Amanda::Devicec::Device_device_name;
144 *access_mode = *Amanda::Devicec::Device_access_mode;
145 *is_eof = *Amanda::Devicec::Device_is_eof;
146 *volume_label = *Amanda::Devicec::Device_volume_label;
147 *volume_time = *Amanda::Devicec::Device_volume_time;
148 *status = *Amanda::Devicec::Device_status;
149 *min_block_size = *Amanda::Devicec::Device_min_block_size;
150 *max_block_size = *Amanda::Devicec::Device_max_block_size;
151 *block_size = *Amanda::Devicec::Device_block_size;
152 *volume_header = *Amanda::Devicec::Device_volume_header;
153 sub DISOWN {
154     my $self = shift;
155     my $ptr = tied(%$self);
156     delete $OWNER{$ptr};
157 }
158
159 sub ACQUIRE {
160     my $self = shift;
161     my $ptr = tied(%$self);
162     $OWNER{$ptr} = 1;
163 }
164
165
166 # ------- VARIABLE STUBS --------
167
168 package Amanda::Device;
169
170 *ACCESS_NULL = *Amanda::Devicec::ACCESS_NULL;
171 *ACCESS_READ = *Amanda::Devicec::ACCESS_READ;
172 *ACCESS_WRITE = *Amanda::Devicec::ACCESS_WRITE;
173 *ACCESS_APPEND = *Amanda::Devicec::ACCESS_APPEND;
174 *DEVICE_STATUS_SUCCESS = *Amanda::Devicec::DEVICE_STATUS_SUCCESS;
175 *DEVICE_STATUS_DEVICE_ERROR = *Amanda::Devicec::DEVICE_STATUS_DEVICE_ERROR;
176 *DEVICE_STATUS_DEVICE_BUSY = *Amanda::Devicec::DEVICE_STATUS_DEVICE_BUSY;
177 *DEVICE_STATUS_VOLUME_MISSING = *Amanda::Devicec::DEVICE_STATUS_VOLUME_MISSING;
178 *DEVICE_STATUS_VOLUME_UNLABELED = *Amanda::Devicec::DEVICE_STATUS_VOLUME_UNLABELED;
179 *DEVICE_STATUS_VOLUME_ERROR = *Amanda::Devicec::DEVICE_STATUS_VOLUME_ERROR;
180 *DEVICE_STATUS_FLAGS_MAX = *Amanda::Devicec::DEVICE_STATUS_FLAGS_MAX;
181 *PROPERTY_PHASE_BEFORE_START = *Amanda::Devicec::PROPERTY_PHASE_BEFORE_START;
182 *PROPERTY_PHASE_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_BETWEEN_FILE_WRITE;
183 *PROPERTY_PHASE_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_INSIDE_FILE_WRITE;
184 *PROPERTY_PHASE_BETWEEN_FILE_READ = *Amanda::Devicec::PROPERTY_PHASE_BETWEEN_FILE_READ;
185 *PROPERTY_PHASE_INSIDE_FILE_READ = *Amanda::Devicec::PROPERTY_PHASE_INSIDE_FILE_READ;
186 *PROPERTY_PHASE_MAX = *Amanda::Devicec::PROPERTY_PHASE_MAX;
187 *PROPERTY_PHASE_MASK = *Amanda::Devicec::PROPERTY_PHASE_MASK;
188 *PROPERTY_PHASE_SHIFT = *Amanda::Devicec::PROPERTY_PHASE_SHIFT;
189 *PROPERTY_ACCESS_GET_BEFORE_START = *Amanda::Devicec::PROPERTY_ACCESS_GET_BEFORE_START;
190 *PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE;
191 *PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE;
192 *PROPERTY_ACCESS_GET_BETWEEN_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_GET_BETWEEN_FILE_READ;
193 *PROPERTY_ACCESS_GET_INSIDE_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_GET_INSIDE_FILE_READ;
194 *PROPERTY_ACCESS_SET_BEFORE_START = *Amanda::Devicec::PROPERTY_ACCESS_SET_BEFORE_START;
195 *PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE;
196 *PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE;
197 *PROPERTY_ACCESS_SET_BETWEEN_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_SET_BETWEEN_FILE_READ;
198 *PROPERTY_ACCESS_SET_INSIDE_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_SET_INSIDE_FILE_READ;
199 *PROPERTY_ACCESS_GET_MASK = *Amanda::Devicec::PROPERTY_ACCESS_GET_MASK;
200 *PROPERTY_ACCESS_SET_MASK = *Amanda::Devicec::PROPERTY_ACCESS_SET_MASK;
201 *CONCURRENCY_PARADIGM_EXCLUSIVE = *Amanda::Devicec::CONCURRENCY_PARADIGM_EXCLUSIVE;
202 *CONCURRENCY_PARADIGM_SHARED_READ = *Amanda::Devicec::CONCURRENCY_PARADIGM_SHARED_READ;
203 *CONCURRENCY_PARADIGM_RANDOM_ACCESS = *Amanda::Devicec::CONCURRENCY_PARADIGM_RANDOM_ACCESS;
204 *STREAMING_REQUIREMENT_NONE = *Amanda::Devicec::STREAMING_REQUIREMENT_NONE;
205 *STREAMING_REQUIREMENT_DESIRED = *Amanda::Devicec::STREAMING_REQUIREMENT_DESIRED;
206 *STREAMING_REQUIREMENT_REQUIRED = *Amanda::Devicec::STREAMING_REQUIREMENT_REQUIRED;
207 *MEDIA_ACCESS_MODE_READ_ONLY = *Amanda::Devicec::MEDIA_ACCESS_MODE_READ_ONLY;
208 *MEDIA_ACCESS_MODE_WORM = *Amanda::Devicec::MEDIA_ACCESS_MODE_WORM;
209 *MEDIA_ACCESS_MODE_READ_WRITE = *Amanda::Devicec::MEDIA_ACCESS_MODE_READ_WRITE;
210 *MEDIA_ACCESS_MODE_WRITE_ONLY = *Amanda::Devicec::MEDIA_ACCESS_MODE_WRITE_ONLY;
211 *SIZE_ACCURACY_UNKNOWN = *Amanda::Devicec::SIZE_ACCURACY_UNKNOWN;
212 *SIZE_ACCURACY_ESTIMATE = *Amanda::Devicec::SIZE_ACCURACY_ESTIMATE;
213 *SIZE_ACCURACY_REAL = *Amanda::Devicec::SIZE_ACCURACY_REAL;
214 *PROPERTY_SURETY_BAD = *Amanda::Devicec::PROPERTY_SURETY_BAD;
215 *PROPERTY_SURETY_GOOD = *Amanda::Devicec::PROPERTY_SURETY_GOOD;
216 *PROPERTY_SOURCE_DEFAULT = *Amanda::Devicec::PROPERTY_SOURCE_DEFAULT;
217 *PROPERTY_SOURCE_DETECTED = *Amanda::Devicec::PROPERTY_SOURCE_DETECTED;
218 *PROPERTY_SOURCE_USER = *Amanda::Devicec::PROPERTY_SOURCE_USER;
219
220 @EXPORT_OK = ();
221 %EXPORT_TAGS = ();
222
223 =head1 NAME
224
225 Amanda::Device - interact with Amanda data-storage devices
226
227 =head1 SYNOPSIS
228
229   use Amanda::Device qw( :constants );
230
231   my $dev = Amanda::Device->new($device_name);
232   if ($dev->read_label() == $DEVICE_STATUS_SUCCESS) {
233       print "Label on $device_name is '$dev->volume_label'\n";
234   }
235   
236 See http://wiki.zmanda.com/index.php/Device_API for details on how Devices are used.
237
238 =head1 API STATUS
239
240 Stable
241
242 =head1 Amanda::Device Objects
243
244 See the wiki for descriptions of these functions.  Note that C instance variables
245 are represented by accessor functions of the same name.
246
247 =over
248
249 =item C<configure($use_global_config)>
250
251 =item C<read_label()>
252
253 =item C<start($mode, $label, $timestamp)>
254
255 =item C<finish()>
256
257 =item C<start_file($jobinfo)>
258
259 where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Types>)
260
261 =item C<write_block($size, $data, $short_block)>
262
263 Note that Perl code is not expected to handle on-device data, so there
264 is currently no way to provide data to this function from Perl.  This may
265 change in future revisions.
266
267 =item C<write_from_fd($queue_fd)>
268
269 where C<$fd> is an integer file descriptor, not a filehandle
270
271 =item C<finish_file()>
272
273 =item C<seek_file($file)>
274
275 =item C<seek_block($block)>
276
277 =item C<read_block($size)>
278
279 =item C<read_to_fd($queue_fd)>
280
281 where C<$fd> is an integer file descriptor, not a filehandle
282
283 Note that Perl code is not expected to handle on-device data, so there
284 is currently no way to access the data this function returns.  This may
285 change in future revisions.
286
287 =item C<property_list()>
288
289 returns a list of properties, each represented as a hash:
290
291   { 'access' => $access_flags,
292     'name' => $property_name,
293     'description' => $property_description }
294
295 =item C<property_get($property_name)>
296
297 returns the property, with the appropriate Perl type, or undef.  In array
298 context, returns the list C<($value, $surety, $source)>.
299
300 =item C<property_set($property_name, $value)>
301
302 =item C<property_set_ex($property_name, $value, $surety, $source)>
303
304 where C<$value> is of an appropriate type for the given property, C<$surety> is
305 a C<$PROPERTY_SURETY_*> constant, and C<$source> is a C<$PROPERTY_SOURCE_*>
306 constant.
307
308 =item C<recycle_file($filenum)>
309
310 =item C<file()> (accessor function)
311
312 =item C<block()> (accessor function)
313
314 =item C<in_file()> (accessor function)
315
316 =item C<device_name()> (accessor function)
317
318 =item C<access_mode()> (accessor function)
319
320 =item C<is_eof()> (accessor function)
321
322 =item C<volume_label()> (accessor function)
323
324 =item C<volume_time()> (accessor function)
325
326 =item C<min_block_size()> (accessor function)
327
328 =item C<max_block_size()> (accessor function)
329
330 =item C<block_size()> (accessor function)
331
332 =item C<volume_header()> (accessor function)
333
334 =back
335
336 =head1 CONSTANTS
337
338 This module defines a large number of constants.  Again, consult the
339 wiki or C<device.h> for the details on their meaning.  These constants
340 are available from the package namespace (e.g.,
341 C<Amanda::Device::ACCESS_WRITE>), or imported with the C<:constant>
342 import tag.
343
344 =cut
345
346 push @EXPORT_OK, qw(DeviceAccessMode_to_strings);
347 push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw(DeviceAccessMode_to_strings);
348
349 my %_DeviceAccessMode_VALUES;
350 #Convert a flag value to a list of names for flags that are set.
351 sub DeviceAccessMode_to_strings {
352     my ($flags) = @_;
353     my @result = ();
354
355     for my $k (keys %_DeviceAccessMode_VALUES) {
356         my $v = $_DeviceAccessMode_VALUES{$k};
357
358         #is this a matching flag?
359         if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
360             push @result, $k;
361         }
362     }
363
364 #by default, just return the number as a 1-element list
365     if (!@result) {
366         return ($flags);
367     }
368
369     return @result;
370 }
371
372 push @EXPORT_OK, qw($ACCESS_NULL);
373 push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_NULL);
374
375 $_DeviceAccessMode_VALUES{"NULL"} = $ACCESS_NULL;
376
377 push @EXPORT_OK, qw($ACCESS_READ);
378 push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_READ);
379
380 $_DeviceAccessMode_VALUES{"READ"} = $ACCESS_READ;
381
382 push @EXPORT_OK, qw($ACCESS_WRITE);
383 push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_WRITE);
384
385 $_DeviceAccessMode_VALUES{"WRITE"} = $ACCESS_WRITE;
386
387 push @EXPORT_OK, qw($ACCESS_APPEND);
388 push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_APPEND);
389
390 $_DeviceAccessMode_VALUES{"APPEND"} = $ACCESS_APPEND;
391
392 push @EXPORT_OK, qw(IS_WRITABLE_ACCESS_MODE);
393 push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw(IS_WRITABLE_ACCESS_MODE);
394
395 #copy symbols in DeviceAccessMode to constants
396 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"DeviceAccessMode"}};
397
398 push @EXPORT_OK, qw(DeviceStatusFlags_to_strings);
399 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw(DeviceStatusFlags_to_strings);
400
401 my %_DeviceStatusFlags_VALUES;
402 #Convert a flag value to a list of names for flags that are set.
403 sub DeviceStatusFlags_to_strings {
404     my ($flags) = @_;
405     my @result = ();
406
407     for my $k (keys %_DeviceStatusFlags_VALUES) {
408         my $v = $_DeviceStatusFlags_VALUES{$k};
409
410         #is this a matching flag?
411         if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
412             push @result, $k;
413         }
414     }
415
416 #by default, just return the number as a 1-element list
417     if (!@result) {
418         return ($flags);
419     }
420
421     return @result;
422 }
423
424 push @EXPORT_OK, qw($DEVICE_STATUS_SUCCESS);
425 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_SUCCESS);
426
427 $_DeviceStatusFlags_VALUES{"SUCCESS"} = $DEVICE_STATUS_SUCCESS;
428
429 push @EXPORT_OK, qw($DEVICE_STATUS_DEVICE_ERROR);
430 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_DEVICE_ERROR);
431
432 $_DeviceStatusFlags_VALUES{"DEVICE_ERROR"} = $DEVICE_STATUS_DEVICE_ERROR;
433
434 push @EXPORT_OK, qw($DEVICE_STATUS_DEVICE_BUSY);
435 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_DEVICE_BUSY);
436
437 $_DeviceStatusFlags_VALUES{"DEVICE_BUSY"} = $DEVICE_STATUS_DEVICE_BUSY;
438
439 push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_MISSING);
440 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_MISSING);
441
442 $_DeviceStatusFlags_VALUES{"VOLUME_MISSING"} = $DEVICE_STATUS_VOLUME_MISSING;
443
444 push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_UNLABELED);
445 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_UNLABELED);
446
447 $_DeviceStatusFlags_VALUES{"VOLUME_UNLABELED"} = $DEVICE_STATUS_VOLUME_UNLABELED;
448
449 push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_ERROR);
450 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_ERROR);
451
452 $_DeviceStatusFlags_VALUES{"VOLUME_ERROR"} = $DEVICE_STATUS_VOLUME_ERROR;
453
454 push @EXPORT_OK, qw($DEVICE_STATUS_FLAGS_MAX);
455 push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_FLAGS_MAX);
456
457 #copy symbols in DeviceStatusFlags to constants
458 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"DeviceStatusFlags"}};
459
460 push @EXPORT_OK, qw(PropertyPhaseFlags_to_strings);
461 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw(PropertyPhaseFlags_to_strings);
462
463 my %_PropertyPhaseFlags_VALUES;
464 #Convert a flag value to a list of names for flags that are set.
465 sub PropertyPhaseFlags_to_strings {
466     my ($flags) = @_;
467     my @result = ();
468
469     for my $k (keys %_PropertyPhaseFlags_VALUES) {
470         my $v = $_PropertyPhaseFlags_VALUES{$k};
471
472         #is this a matching flag?
473         if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
474             push @result, $k;
475         }
476     }
477
478 #by default, just return the number as a 1-element list
479     if (!@result) {
480         return ($flags);
481     }
482
483     return @result;
484 }
485
486 push @EXPORT_OK, qw($PROPERTY_PHASE_BEFORE_START);
487 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_BEFORE_START);
488
489 $_PropertyPhaseFlags_VALUES{"BEFORE_START"} = $PROPERTY_PHASE_BEFORE_START;
490
491 push @EXPORT_OK, qw($PROPERTY_PHASE_BETWEEN_FILE_WRITE);
492 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_BETWEEN_FILE_WRITE);
493
494 $_PropertyPhaseFlags_VALUES{"BETWEEN_FILE_WRITE"} = $PROPERTY_PHASE_BETWEEN_FILE_WRITE;
495
496 push @EXPORT_OK, qw($PROPERTY_PHASE_INSIDE_FILE_WRITE);
497 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_INSIDE_FILE_WRITE);
498
499 $_PropertyPhaseFlags_VALUES{"INSIDE_FILE_WRITE"} = $PROPERTY_PHASE_INSIDE_FILE_WRITE;
500
501 push @EXPORT_OK, qw($PROPERTY_PHASE_BETWEEN_FILE_READ);
502 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_BETWEEN_FILE_READ);
503
504 $_PropertyPhaseFlags_VALUES{"BETWEEN_FILE_READ"} = $PROPERTY_PHASE_BETWEEN_FILE_READ;
505
506 push @EXPORT_OK, qw($PROPERTY_PHASE_INSIDE_FILE_READ);
507 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_INSIDE_FILE_READ);
508
509 $_PropertyPhaseFlags_VALUES{"INSIDE_FILE_READ"} = $PROPERTY_PHASE_INSIDE_FILE_READ;
510
511 push @EXPORT_OK, qw($PROPERTY_PHASE_MAX);
512 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_MAX);
513
514 push @EXPORT_OK, qw($PROPERTY_PHASE_MASK);
515 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_MASK);
516
517 push @EXPORT_OK, qw($PROPERTY_PHASE_SHIFT);
518 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw($PROPERTY_PHASE_SHIFT);
519
520 #copy symbols in PropertyPhaseFlags to constants
521 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"PropertyPhaseFlags"}};
522
523 push @EXPORT_OK, qw(PropertyAccessFlags_to_strings);
524 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw(PropertyAccessFlags_to_strings);
525
526 my %_PropertyAccessFlags_VALUES;
527 #Convert a flag value to a list of names for flags that are set.
528 sub PropertyAccessFlags_to_strings {
529     my ($flags) = @_;
530     my @result = ();
531
532     for my $k (keys %_PropertyAccessFlags_VALUES) {
533         my $v = $_PropertyAccessFlags_VALUES{$k};
534
535         #is this a matching flag?
536         if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
537             push @result, $k;
538         }
539     }
540
541 #by default, just return the number as a 1-element list
542     if (!@result) {
543         return ($flags);
544     }
545
546     return @result;
547 }
548
549 push @EXPORT_OK, qw($PROPERTY_ACCESS_GET_BEFORE_START);
550 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_GET_BEFORE_START);
551
552 $_PropertyAccessFlags_VALUES{"GET_BEFORE_START"} = $PROPERTY_ACCESS_GET_BEFORE_START;
553
554 push @EXPORT_OK, qw($PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE);
555 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE);
556
557 $_PropertyAccessFlags_VALUES{"GET_BETWEEN_FILE_WRITE"} = $PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE;
558
559 push @EXPORT_OK, qw($PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE);
560 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE);
561
562 $_PropertyAccessFlags_VALUES{"GET_INSIDE_FILE_WRITE"} = $PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE;
563
564 push @EXPORT_OK, qw($PROPERTY_ACCESS_GET_BETWEEN_FILE_READ);
565 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_GET_BETWEEN_FILE_READ);
566
567 $_PropertyAccessFlags_VALUES{"GET_BETWEEN_FILE_READ"} = $PROPERTY_ACCESS_GET_BETWEEN_FILE_READ;
568
569 push @EXPORT_OK, qw($PROPERTY_ACCESS_GET_INSIDE_FILE_READ);
570 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_GET_INSIDE_FILE_READ);
571
572 $_PropertyAccessFlags_VALUES{"GET_INSIDE_FILE_READ"} = $PROPERTY_ACCESS_GET_INSIDE_FILE_READ;
573
574 push @EXPORT_OK, qw($PROPERTY_ACCESS_SET_BEFORE_START);
575 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_SET_BEFORE_START);
576
577 $_PropertyAccessFlags_VALUES{"SET_BEFORE_START"} = $PROPERTY_ACCESS_SET_BEFORE_START;
578
579 push @EXPORT_OK, qw($PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE);
580 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE);
581
582 $_PropertyAccessFlags_VALUES{"SET_BETWEEN_FILE_WRITE"} = $PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE;
583
584 push @EXPORT_OK, qw($PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE);
585 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE);
586
587 $_PropertyAccessFlags_VALUES{"SET_INSIDE_FILE_WRITE"} = $PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE;
588
589 push @EXPORT_OK, qw($PROPERTY_ACCESS_SET_BETWEEN_FILE_READ);
590 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_SET_BETWEEN_FILE_READ);
591
592 $_PropertyAccessFlags_VALUES{"SET_BETWEEN_FILE_READ"} = $PROPERTY_ACCESS_SET_BETWEEN_FILE_READ;
593
594 push @EXPORT_OK, qw($PROPERTY_ACCESS_SET_INSIDE_FILE_READ);
595 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_SET_INSIDE_FILE_READ);
596
597 $_PropertyAccessFlags_VALUES{"SET_INSIDE_FILE_READ"} = $PROPERTY_ACCESS_SET_INSIDE_FILE_READ;
598
599 push @EXPORT_OK, qw($PROPERTY_ACCESS_GET_MASK);
600 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_GET_MASK);
601
602 push @EXPORT_OK, qw($PROPERTY_ACCESS_SET_MASK);
603 push @{$EXPORT_TAGS{"PropertyAccessFlags"}}, qw($PROPERTY_ACCESS_SET_MASK);
604
605 #copy symbols in PropertyAccessFlags to constants
606 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"PropertyAccessFlags"}};
607
608 push @EXPORT_OK, qw(ConcurrencyParadigm_to_string);
609 push @{$EXPORT_TAGS{"ConcurrencyParadigm"}}, qw(ConcurrencyParadigm_to_string);
610
611 my %_ConcurrencyParadigm_VALUES;
612 #Convert an enum value to a single string
613 sub ConcurrencyParadigm_to_string {
614     my ($enumval) = @_;
615
616     for my $k (keys %_ConcurrencyParadigm_VALUES) {
617         my $v = $_ConcurrencyParadigm_VALUES{$k};
618
619         #is this a matching flag?
620         if ($enumval == $v) {
621             return $k;
622         }
623     }
624
625 #default, just return the number
626     return $enumval;
627 }
628
629 push @EXPORT_OK, qw($CONCURRENCY_PARADIGM_EXCLUSIVE);
630 push @{$EXPORT_TAGS{"ConcurrencyParadigm"}}, qw($CONCURRENCY_PARADIGM_EXCLUSIVE);
631
632 $_ConcurrencyParadigm_VALUES{"EXCLUSIVE"} = $CONCURRENCY_PARADIGM_EXCLUSIVE;
633
634 push @EXPORT_OK, qw($CONCURRENCY_PARADIGM_SHARED_READ);
635 push @{$EXPORT_TAGS{"ConcurrencyParadigm"}}, qw($CONCURRENCY_PARADIGM_SHARED_READ);
636
637 $_ConcurrencyParadigm_VALUES{"SHARED_READ"} = $CONCURRENCY_PARADIGM_SHARED_READ;
638
639 push @EXPORT_OK, qw($CONCURRENCY_PARADIGM_RANDOM_ACCESS);
640 push @{$EXPORT_TAGS{"ConcurrencyParadigm"}}, qw($CONCURRENCY_PARADIGM_RANDOM_ACCESS);
641
642 $_ConcurrencyParadigm_VALUES{"RANDOM_ACCESS"} = $CONCURRENCY_PARADIGM_RANDOM_ACCESS;
643
644 #copy symbols in ConcurrencyParadigm to constants
645 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"ConcurrencyParadigm"}};
646
647 push @EXPORT_OK, qw(StreamingRequirement_to_string);
648 push @{$EXPORT_TAGS{"StreamingRequirement"}}, qw(StreamingRequirement_to_string);
649
650 my %_StreamingRequirement_VALUES;
651 #Convert an enum value to a single string
652 sub StreamingRequirement_to_string {
653     my ($enumval) = @_;
654
655     for my $k (keys %_StreamingRequirement_VALUES) {
656         my $v = $_StreamingRequirement_VALUES{$k};
657
658         #is this a matching flag?
659         if ($enumval == $v) {
660             return $k;
661         }
662     }
663
664 #default, just return the number
665     return $enumval;
666 }
667
668 push @EXPORT_OK, qw($STREAMING_REQUIREMENT_NONE);
669 push @{$EXPORT_TAGS{"StreamingRequirement"}}, qw($STREAMING_REQUIREMENT_NONE);
670
671 $_StreamingRequirement_VALUES{"NONE"} = $STREAMING_REQUIREMENT_NONE;
672
673 push @EXPORT_OK, qw($STREAMING_REQUIREMENT_DESIRED);
674 push @{$EXPORT_TAGS{"StreamingRequirement"}}, qw($STREAMING_REQUIREMENT_DESIRED);
675
676 $_StreamingRequirement_VALUES{"DESIRED"} = $STREAMING_REQUIREMENT_DESIRED;
677
678 push @EXPORT_OK, qw($STREAMING_REQUIREMENT_REQUIRED);
679 push @{$EXPORT_TAGS{"StreamingRequirement"}}, qw($STREAMING_REQUIREMENT_REQUIRED);
680
681 $_StreamingRequirement_VALUES{"REQUIRED"} = $STREAMING_REQUIREMENT_REQUIRED;
682
683 #copy symbols in StreamingRequirement to constants
684 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"StreamingRequirement"}};
685
686 push @EXPORT_OK, qw(MediaAccessMode_to_string);
687 push @{$EXPORT_TAGS{"MediaAccessMode"}}, qw(MediaAccessMode_to_string);
688
689 my %_MediaAccessMode_VALUES;
690 #Convert an enum value to a single string
691 sub MediaAccessMode_to_string {
692     my ($enumval) = @_;
693
694     for my $k (keys %_MediaAccessMode_VALUES) {
695         my $v = $_MediaAccessMode_VALUES{$k};
696
697         #is this a matching flag?
698         if ($enumval == $v) {
699             return $k;
700         }
701     }
702
703 #default, just return the number
704     return $enumval;
705 }
706
707 push @EXPORT_OK, qw($MEDIA_ACCESS_MODE_READ_ONLY);
708 push @{$EXPORT_TAGS{"MediaAccessMode"}}, qw($MEDIA_ACCESS_MODE_READ_ONLY);
709
710 $_MediaAccessMode_VALUES{"READ_ONLY"} = $MEDIA_ACCESS_MODE_READ_ONLY;
711
712 push @EXPORT_OK, qw($MEDIA_ACCESS_MODE_WORM);
713 push @{$EXPORT_TAGS{"MediaAccessMode"}}, qw($MEDIA_ACCESS_MODE_WORM);
714
715 $_MediaAccessMode_VALUES{"WORM"} = $MEDIA_ACCESS_MODE_WORM;
716
717 push @EXPORT_OK, qw($MEDIA_ACCESS_MODE_READ_WRITE);
718 push @{$EXPORT_TAGS{"MediaAccessMode"}}, qw($MEDIA_ACCESS_MODE_READ_WRITE);
719
720 $_MediaAccessMode_VALUES{"READ_WRITE"} = $MEDIA_ACCESS_MODE_READ_WRITE;
721
722 push @EXPORT_OK, qw($MEDIA_ACCESS_MODE_WRITE_ONLY);
723 push @{$EXPORT_TAGS{"MediaAccessMode"}}, qw($MEDIA_ACCESS_MODE_WRITE_ONLY);
724
725 $_MediaAccessMode_VALUES{"WRITE_ONLY"} = $MEDIA_ACCESS_MODE_WRITE_ONLY;
726
727 #copy symbols in MediaAccessMode to constants
728 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"MediaAccessMode"}};
729
730 push @EXPORT_OK, qw(SizeAccuracy_to_string);
731 push @{$EXPORT_TAGS{"SizeAccuracy"}}, qw(SizeAccuracy_to_string);
732
733 my %_SizeAccuracy_VALUES;
734 #Convert an enum value to a single string
735 sub SizeAccuracy_to_string {
736     my ($enumval) = @_;
737
738     for my $k (keys %_SizeAccuracy_VALUES) {
739         my $v = $_SizeAccuracy_VALUES{$k};
740
741         #is this a matching flag?
742         if ($enumval == $v) {
743             return $k;
744         }
745     }
746
747 #default, just return the number
748     return $enumval;
749 }
750
751 push @EXPORT_OK, qw($SIZE_ACCURACY_UNKNOWN);
752 push @{$EXPORT_TAGS{"SizeAccuracy"}}, qw($SIZE_ACCURACY_UNKNOWN);
753
754 $_SizeAccuracy_VALUES{"UNKNOWN"} = $SIZE_ACCURACY_UNKNOWN;
755
756 push @EXPORT_OK, qw($SIZE_ACCURACY_ESTIMATE);
757 push @{$EXPORT_TAGS{"SizeAccuracy"}}, qw($SIZE_ACCURACY_ESTIMATE);
758
759 $_SizeAccuracy_VALUES{"ESTIMATE"} = $SIZE_ACCURACY_ESTIMATE;
760
761 push @EXPORT_OK, qw($SIZE_ACCURACY_REAL);
762 push @{$EXPORT_TAGS{"SizeAccuracy"}}, qw($SIZE_ACCURACY_REAL);
763
764 $_SizeAccuracy_VALUES{"REAL"} = $SIZE_ACCURACY_REAL;
765
766 #copy symbols in SizeAccuracy to constants
767 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"SizeAccuracy"}};
768
769 push @EXPORT_OK, qw(PropertySurety_to_strings);
770 push @{$EXPORT_TAGS{"PropertySurety"}}, qw(PropertySurety_to_strings);
771
772 my %_PropertySurety_VALUES;
773 #Convert a flag value to a list of names for flags that are set.
774 sub PropertySurety_to_strings {
775     my ($flags) = @_;
776     my @result = ();
777
778     for my $k (keys %_PropertySurety_VALUES) {
779         my $v = $_PropertySurety_VALUES{$k};
780
781         #is this a matching flag?
782         if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
783             push @result, $k;
784         }
785     }
786
787 #by default, just return the number as a 1-element list
788     if (!@result) {
789         return ($flags);
790     }
791
792     return @result;
793 }
794
795 push @EXPORT_OK, qw($PROPERTY_SURETY_BAD);
796 push @{$EXPORT_TAGS{"PropertySurety"}}, qw($PROPERTY_SURETY_BAD);
797
798 $_PropertySurety_VALUES{"SURETY_BAD"} = $PROPERTY_SURETY_BAD;
799
800 push @EXPORT_OK, qw($PROPERTY_SURETY_GOOD);
801 push @{$EXPORT_TAGS{"PropertySurety"}}, qw($PROPERTY_SURETY_GOOD);
802
803 $_PropertySurety_VALUES{"SURETY_GOOD"} = $PROPERTY_SURETY_GOOD;
804
805 #copy symbols in PropertySurety to constants
806 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"PropertySurety"}};
807
808 push @EXPORT_OK, qw(PropertySource_to_strings);
809 push @{$EXPORT_TAGS{"PropertySource"}}, qw(PropertySource_to_strings);
810
811 my %_PropertySource_VALUES;
812 #Convert a flag value to a list of names for flags that are set.
813 sub PropertySource_to_strings {
814     my ($flags) = @_;
815     my @result = ();
816
817     for my $k (keys %_PropertySource_VALUES) {
818         my $v = $_PropertySource_VALUES{$k};
819
820         #is this a matching flag?
821         if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
822             push @result, $k;
823         }
824     }
825
826 #by default, just return the number as a 1-element list
827     if (!@result) {
828         return ($flags);
829     }
830
831     return @result;
832 }
833
834 push @EXPORT_OK, qw($PROPERTY_SOURCE_DEFAULT);
835 push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_DEFAULT);
836
837 $_PropertySource_VALUES{"SOURCE_DEFAULT"} = $PROPERTY_SOURCE_DEFAULT;
838
839 push @EXPORT_OK, qw($PROPERTY_SOURCE_DETECTED);
840 push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_DETECTED);
841
842 $_PropertySource_VALUES{"SOURCE_DETECTED"} = $PROPERTY_SOURCE_DETECTED;
843
844 push @EXPORT_OK, qw($PROPERTY_SOURCE_USER);
845 push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_USER);
846
847 $_PropertySource_VALUES{"SOURCE_USER"} = $PROPERTY_SOURCE_USER;
848
849 #copy symbols in PropertySource to constants
850 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"PropertySource"}};
851
852
853 # SWIG produces a sub-package for the Device "class", in this case named 
854 # Amanda::Device::Device.  For user convenience, we allow Amanda::Device->new(..) to
855 # do the same thing.  This is a wrapper function, and not just a typeglob assignment,
856 # because we want to get the right blessing.
857 sub new {
858     my $pkg = shift;
859     Amanda::Device::Device->new(@_);
860 }
861 1;