Imported Upstream version 3.3.1
[debian/amanda] / perl / Amanda / Feature.pm
1 # This file was automatically generated by SWIG (http://www.swig.org).
2 # Version 2.0.4
3 #
4 # Do not make changes to this file unless you know what you are doing--modify
5 # the SWIG interface file instead.
6
7 package Amanda::Feature;
8 use base qw(Exporter);
9 use base qw(DynaLoader);
10 package Amanda::Featurec;
11 bootstrap Amanda::Feature;
12 package Amanda::Feature;
13 @EXPORT = qw();
14
15 # ---------- BASE METHODS -------------
16
17 package Amanda::Feature;
18
19 sub TIEHASH {
20     my ($classname,$obj) = @_;
21     return bless $obj, $classname;
22 }
23
24 sub CLEAR { }
25
26 sub FIRSTKEY { }
27
28 sub NEXTKEY { }
29
30 sub FETCH {
31     my ($self,$field) = @_;
32     my $member_func = "swig_${field}_get";
33     $self->$member_func();
34 }
35
36 sub STORE {
37     my ($self,$field,$newval) = @_;
38     my $member_func = "swig_${field}_set";
39     $self->$member_func($newval);
40 }
41
42 sub this {
43     my $ptr = shift;
44     return tied(%$ptr);
45 }
46
47
48 # ------- FUNCTION WRAPPERS --------
49
50 package Amanda::Feature;
51
52 *am_string_to_feature = *Amanda::Featurec::am_string_to_feature;
53 *am_set_default_feature_set = *Amanda::Featurec::am_set_default_feature_set;
54 *am_init_feature_set = *Amanda::Featurec::am_init_feature_set;
55 *am_features = *Amanda::Featurec::am_features;
56
57 ############# Class : Amanda::Feature::Set ##############
58
59 package Amanda::Feature::Set;
60 use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
61 @ISA = qw( Amanda::Feature );
62 %OWNER = ();
63 %ITERATORS = ();
64 sub DESTROY {
65     return unless $_[0]->isa('HASH');
66     my $self = tied(%{$_[0]});
67     return unless defined $self;
68     delete $ITERATORS{$self};
69     if (exists $OWNER{$self}) {
70         Amanda::Featurec::delete_Set($self);
71         delete $OWNER{$self};
72     }
73 }
74
75 *add = *Amanda::Featurec::Set_add;
76 *remove = *Amanda::Featurec::Set_remove;
77 *has = *Amanda::Featurec::Set_has;
78 *as_string = *Amanda::Featurec::Set_as_string;
79 sub new {
80     my $pkg = shift;
81     my $self = Amanda::Featurec::new_Set(@_);
82     bless $self, $pkg if defined($self);
83 }
84
85 sub DISOWN {
86     my $self = shift;
87     my $ptr = tied(%$self);
88     delete $OWNER{$ptr};
89 }
90
91 sub ACQUIRE {
92     my $self = shift;
93     my $ptr = tied(%$self);
94     $OWNER{$ptr} = 1;
95 }
96
97
98 # ------- VARIABLE STUBS --------
99
100 package Amanda::Feature;
101
102 *have_feature_support = *Amanda::Featurec::have_feature_support;
103 *fe_options_auth = *Amanda::Featurec::fe_options_auth;
104 *fe_selfcheck_req = *Amanda::Featurec::fe_selfcheck_req;
105 *fe_selfcheck_req_device = *Amanda::Featurec::fe_selfcheck_req_device;
106 *fe_selfcheck_rep = *Amanda::Featurec::fe_selfcheck_rep;
107 *fe_sendsize_req_no_options = *Amanda::Featurec::fe_sendsize_req_no_options;
108 *fe_sendsize_req_options = *Amanda::Featurec::fe_sendsize_req_options;
109 *fe_sendsize_req_device = *Amanda::Featurec::fe_sendsize_req_device;
110 *fe_sendsize_rep = *Amanda::Featurec::fe_sendsize_rep;
111 *fe_sendbackup_req = *Amanda::Featurec::fe_sendbackup_req;
112 *fe_sendbackup_req_device = *Amanda::Featurec::fe_sendbackup_req_device;
113 *fe_sendbackup_rep = *Amanda::Featurec::fe_sendbackup_rep;
114 *fe_noop_req = *Amanda::Featurec::fe_noop_req;
115 *fe_noop_rep = *Amanda::Featurec::fe_noop_rep;
116 *fe_program_dump = *Amanda::Featurec::fe_program_dump;
117 *fe_program_gnutar = *Amanda::Featurec::fe_program_gnutar;
118 *fe_program_application_api = *Amanda::Featurec::fe_program_application_api;
119 *fe_options_compress_fast = *Amanda::Featurec::fe_options_compress_fast;
120 *fe_options_compress_best = *Amanda::Featurec::fe_options_compress_best;
121 *fe_options_srvcomp_fast = *Amanda::Featurec::fe_options_srvcomp_fast;
122 *fe_options_srvcomp_best = *Amanda::Featurec::fe_options_srvcomp_best;
123 *fe_options_no_record = *Amanda::Featurec::fe_options_no_record;
124 *fe_options_index = *Amanda::Featurec::fe_options_index;
125 *fe_options_exclude_file = *Amanda::Featurec::fe_options_exclude_file;
126 *fe_options_exclude_list = *Amanda::Featurec::fe_options_exclude_list;
127 *fe_options_multiple_exclude = *Amanda::Featurec::fe_options_multiple_exclude;
128 *fe_options_optional_exclude = *Amanda::Featurec::fe_options_optional_exclude;
129 *fe_options_include_file = *Amanda::Featurec::fe_options_include_file;
130 *fe_options_include_list = *Amanda::Featurec::fe_options_include_list;
131 *fe_options_multiple_include = *Amanda::Featurec::fe_options_multiple_include;
132 *fe_options_optional_include = *Amanda::Featurec::fe_options_optional_include;
133 *fe_options_bsd_auth = *Amanda::Featurec::fe_options_bsd_auth;
134 *fe_options_krb4_auth = *Amanda::Featurec::fe_options_krb4_auth;
135 *fe_options_kencrypt = *Amanda::Featurec::fe_options_kencrypt;
136 *fe_req_options_maxdumps = *Amanda::Featurec::fe_req_options_maxdumps;
137 *fe_req_options_hostname = *Amanda::Featurec::fe_req_options_hostname;
138 *fe_req_options_features = *Amanda::Featurec::fe_req_options_features;
139 *fe_rep_options_maxdumps = *Amanda::Featurec::fe_rep_options_maxdumps;
140 *fe_rep_options_hostname = *Amanda::Featurec::fe_rep_options_hostname;
141 *fe_rep_options_features = *Amanda::Featurec::fe_rep_options_features;
142 *fe_rep_options_sendbackup_options = *Amanda::Featurec::fe_rep_options_sendbackup_options;
143 *fe_amindexd_fileno_in_OLSD = *Amanda::Featurec::fe_amindexd_fileno_in_OLSD;
144 *fe_amindexd_fileno_in_ORLD = *Amanda::Featurec::fe_amindexd_fileno_in_ORLD;
145 *fe_amidxtaped_fsf = *Amanda::Featurec::fe_amidxtaped_fsf;
146 *fe_amidxtaped_label = *Amanda::Featurec::fe_amidxtaped_label;
147 *fe_amidxtaped_device = *Amanda::Featurec::fe_amidxtaped_device;
148 *fe_amidxtaped_host = *Amanda::Featurec::fe_amidxtaped_host;
149 *fe_amidxtaped_disk = *Amanda::Featurec::fe_amidxtaped_disk;
150 *fe_amidxtaped_datestamp = *Amanda::Featurec::fe_amidxtaped_datestamp;
151 *fe_amidxtaped_header = *Amanda::Featurec::fe_amidxtaped_header;
152 *fe_amidxtaped_nargs = *Amanda::Featurec::fe_amidxtaped_nargs;
153 *fe_amidxtaped_config = *Amanda::Featurec::fe_amidxtaped_config;
154 *fe_partial_estimate = *Amanda::Featurec::fe_partial_estimate;
155 *fe_calcsize_estimate = *Amanda::Featurec::fe_calcsize_estimate;
156 *fe_selfcheck_calcsize = *Amanda::Featurec::fe_selfcheck_calcsize;
157 *fe_recover_splits = *Amanda::Featurec::fe_recover_splits;
158 *fe_amidxtaped_exchange_features = *Amanda::Featurec::fe_amidxtaped_exchange_features;
159 *fe_options_compress_cust = *Amanda::Featurec::fe_options_compress_cust;
160 *fe_options_srvcomp_cust = *Amanda::Featurec::fe_options_srvcomp_cust;
161 *fe_options_encrypt_cust = *Amanda::Featurec::fe_options_encrypt_cust;
162 *fe_options_encrypt_serv_cust = *Amanda::Featurec::fe_options_encrypt_serv_cust;
163 *fe_options_client_decrypt_option = *Amanda::Featurec::fe_options_client_decrypt_option;
164 *fe_options_server_decrypt_option = *Amanda::Featurec::fe_options_server_decrypt_option;
165 *fe_amindexd_marshall_in_OLSD = *Amanda::Featurec::fe_amindexd_marshall_in_OLSD;
166 *fe_amindexd_marshall_in_ORLD = *Amanda::Featurec::fe_amindexd_marshall_in_ORLD;
167 *fe_amindexd_marshall_in_DHST = *Amanda::Featurec::fe_amindexd_marshall_in_DHST;
168 *fe_amrecover_FEEDME = *Amanda::Featurec::fe_amrecover_FEEDME;
169 *fe_amrecover_timestamp = *Amanda::Featurec::fe_amrecover_timestamp;
170 *fe_interface_quoted_text = *Amanda::Featurec::fe_interface_quoted_text;
171 *fe_program_star = *Amanda::Featurec::fe_program_star;
172 *fe_amindexd_options_hostname = *Amanda::Featurec::fe_amindexd_options_hostname;
173 *fe_amindexd_options_features = *Amanda::Featurec::fe_amindexd_options_features;
174 *fe_amindexd_options_auth = *Amanda::Featurec::fe_amindexd_options_auth;
175 *fe_amidxtaped_options_hostname = *Amanda::Featurec::fe_amidxtaped_options_hostname;
176 *fe_amidxtaped_options_features = *Amanda::Featurec::fe_amidxtaped_options_features;
177 *fe_amidxtaped_options_auth = *Amanda::Featurec::fe_amidxtaped_options_auth;
178 *fe_amrecover_message = *Amanda::Featurec::fe_amrecover_message;
179 *fe_amrecover_feedme_tape = *Amanda::Featurec::fe_amrecover_feedme_tape;
180 *fe_req_options_config = *Amanda::Featurec::fe_req_options_config;
181 *fe_rep_sendsize_quoted_error = *Amanda::Featurec::fe_rep_sendsize_quoted_error;
182 *fe_req_xml = *Amanda::Featurec::fe_req_xml;
183 *fe_pp_script = *Amanda::Featurec::fe_pp_script;
184 *fe_amindexd_DLE = *Amanda::Featurec::fe_amindexd_DLE;
185 *fe_amrecover_dle_in_header = *Amanda::Featurec::fe_amrecover_dle_in_header;
186 *fe_xml_estimate = *Amanda::Featurec::fe_xml_estimate;
187 *fe_xml_property_priority = *Amanda::Featurec::fe_xml_property_priority;
188 *fe_sendsize_rep_warning = *Amanda::Featurec::fe_sendsize_rep_warning;
189 *fe_xml_estimatelist = *Amanda::Featurec::fe_xml_estimatelist;
190 *fe_xml_level_server = *Amanda::Featurec::fe_xml_level_server;
191 *fe_xml_data_path = *Amanda::Featurec::fe_xml_data_path;
192 *fe_xml_directtcp_list = *Amanda::Featurec::fe_xml_directtcp_list;
193 *fe_amidxtaped_datapath = *Amanda::Featurec::fe_amidxtaped_datapath;
194 *fe_sendbackup_noop = *Amanda::Featurec::fe_sendbackup_noop;
195 *fe_amrecover_origsize_in_header = *Amanda::Featurec::fe_amrecover_origsize_in_header;
196 *fe_amidxtaped_abort = *Amanda::Featurec::fe_amidxtaped_abort;
197 *fe_amrecover_correct_disk_quoting = *Amanda::Featurec::fe_amrecover_correct_disk_quoting;
198 *fe_amindexd_quote_label = *Amanda::Featurec::fe_amindexd_quote_label;
199 *fe_amrecover_receive_unfiltered = *Amanda::Featurec::fe_amrecover_receive_unfiltered;
200 *fe_application_client_name = *Amanda::Featurec::fe_application_client_name;
201 *fe_script_client_name = *Amanda::Featurec::fe_script_client_name;
202 *fe_dumptype_property = *Amanda::Featurec::fe_dumptype_property;
203 *last_feature = *Amanda::Featurec::last_feature;
204
205 @EXPORT_OK = ();
206 %EXPORT_TAGS = ();
207
208
209 =head1 NAME
210
211 Amanda::Feature - interface to Amanda feature bitfields
212
213 =head1 SYNOPSIS
214
215     # set up features for this instance and print them
216     my $features = Amanda::Feature::Set->mine();
217     print "my features: $features\n";
218
219     # parse the other side's features
220     my $client_feat = Amanda::Feature::Set->from_string($feat_str);
221
222     # or assume the other side's features are old
223     my $client_feat = Amanda::Feature::Set->old()
224
225     # test for a feature
226     if ($feat->has($Amanda::Feature::fe_options_bsd_auth)) {
227         print "has BSD auth\n";
228     }
229
230 =head1 DESCRIPTION
231
232 C<Amanda::Feature::Set> objects are fairly simple.  The three constructors are
233 shown in the SYNOPSIS: C<mine> (all currently-supported features), C<old> (only
234 the features present in versions of Amanda before features were invented), or
235 C<from_string>.
236
237 An object has three methods to address specific bits:
238
239     # set a bit
240     $feat->add($Amanda::Feature::fe_req_xml);
241
242     # clear a bit
243     $feat->remove($Amanda::Feature::fe_req_xml);
244
245     # test a bit
246     if ($feat->has($Amanda::Feature::fe_req_xml)) ..
247
248 And C<as_string> which converts the feature into a string.
249
250 All features are available in scalars of the same name in the
251 C<Amanda::Feature> namespace.
252
253 =head1 FEATURE DOCUMENTATION
254
255 This section includes as much information as is available for each feature.
256 Each subsection begins with a description of the protocols in
257 which the feature is relevant, and the end on which the feature is relevant.
258 Any known dependencies for the feature are also mentioned.  Assume that any
259 omissions in this section are due to limited information.
260
261 =over 2
262
263 =item fe_recover_splits
264
265  PROTOCOL: amidxtaped
266  FEATURE OF: client
267
268 If set, the recovery application supports a DATA connection on a separate TCP
269 connection.
270
271 Dependencies: this feature is always set when amidxtaped is invoked via
272 amandad.
273
274 =item fe_amidxtaped_exchange_features
275
276  PROTOCOL: amidxtaped
277  FEATURE OF: server
278
279 If set, amidxtaped can process the FEATURES= line in the command.
280 The flag is actually tested by amrecover on amindexd's feature matrix, due to
281 ordering constraints, so it assumes that amindexd and amidxtaped have the same
282 features.
283
284 =item fe_amrecover_FEEDME
285
286  PROTOCOL: amidxtaped
287  FEATURE OF: client
288
289 If set, amrecover understands FEEDME lines on the control connection.
290
291 Dependencies: this feature can only be set if fe_recover_splits is set.
292
293 =item fe_amrecover_timestamp
294
295  PROTOCOL: amindexd
296  FEATURE OF: client
297
298 If set, the recovery application supports full timestamps; otherwise, it can
299 only process datestamps.
300
301 =item fe_amidxtaped_options_hostname
302
303 =item fe_amidxtaped_options_features
304
305 =item fe_amidxtaped_options_auth
306
307  PROTOCOL: amidxtaped
308  FEATURE OF: server
309
310 These feature flags indicate what fields amidxtaped supports in the OPTIONS
311 line.  Of course, the client would need to know these features before it
312 received the OPTIONS line, which would necessitate sending a NOOP request
313 first.  In practice, they are completely unused.
314
315 =item fe_amrecover_message
316
317  PROTOCOL: amidxtaped
318  FEATURE OF: client
319
320 If set, the recovery applications understands MESSAGE lines on the control connection.
321
322 Dependencies: a control connection only exists if amidxtaped is launched from
323 amandad or I<fe_recover_splits> is used.
324
325 =item fe_amrecover_feedme_tape
326
327  PROTOCOL: amidxtaped
328  FEATURE OF: server
329
330 If set, amidxtaped recognizes the TAPE response to FEEDME.
331
332 =item fe_amrecover_dle_in_header
333
334 =item fe_amrecover_origsize_in_header
335
336  PROTOCOL: amidxtaped
337  FEATURE OF: client
338
339 If set, amrecover can process a header containing the corresponding attribute.
340 If not set, the attribute should be stripped from any headers sent to
341 amrecover.
342
343  Feature                Header Attribute
344  -------                ----------------
345  dle_in_header          dle_str
346  origsize_in_header     orig_size
347
348 =item fe_amidxtaped_abort
349
350  PROTOCOL: amidxtaped
351  FEATURE OF: server
352
353 If set, amidxtaped can handle an ABORT message just before the datapath
354 negotiation begins.
355
356 =item fe_amidxtaped_datapath
357
358  PROTOCOL: amidxtaped
359  FEATURE OF: client and server
360
361 If set on the client, then amrecover expects the server to start a DATAPATH
362 negotiation after the header is sent.  If set on the server, then amrecover can
363 process a DATAPATH negotiation after the header is sent.  In other words, the
364 feature must be present on both sides for this negotiation to take place.  The
365 DATAPATH negotiation is a three-way handshake:
366
367   AVAIL-DATAPATH <datapath list>         # to amidxtaped
368   USE-DATAPATH <datapath> [<ip:port> ..] # from amidxtaped
369   DATAPATH-OK                            # to amidxtaped
370
371 No data may be transmitted until the handshake is complete.  See the wiki
372 article entitled "amidxtaped protocol" for more detail.
373
374 =item fe_amidxtaped_fsf
375
376 =item fe_amidxtaped_label
377
378 =item fe_amidxtaped_device
379
380 =item fe_amidxtaped_host
381
382 =item fe_amidxtaped_disk
383
384 =item fe_amidxtaped_datestamp
385
386 =item fe_amidxtaped_header
387
388 =item fe_amidxtaped_config
389
390  PROTOCOL: amidxtaped
391  FEATURE OF: server
392
393 If set, each feature means that amidxtaped can process the corresponding
394 command line.  Note that I<fe_amidxtaped_label> does not indicate whether that
395 field contains a label or a tapespec.
396
397 =item fe_amidxtaped_nargs
398
399  PROTOCOL: amidxtaped
400  FEATURE OF: server
401
402 If set, then amidxtaped can handle the "nargs" form of a command: The first
403 line was the number of arguments, folloewd by one argument by line.  Amidxtaped
404 forked amrestore with these arguments.
405
406 This feature is no longer supported.
407
408 =item fe_amrecover_correct_disk_quoting
409
410  PROTOCOL: amidxtaped
411  FEATURE OF: amrecover
412
413 Amrecovers that do not have this flag may send incorrectly-quoted DISK lines, so
414 those DISK lines should be ignored.
415
416 =item fe_amindexd_quote_label
417
418  PROTOCOL: amindexd
419  FEATURE OF: server
420
421 If set, amindexd quote the label (holdingdisk filename)
422
423 =item fe_amrecover_receive_unfiltered
424
425  PROTOCOL: amidxtaped
426  FEATURE OF: client
427
428 If set, amidxtaped do not decompress/decrypt client compressed/decrypted stream.
429
430 =item fe_application_client_name
431
432 If set, add the 'client_name' for application in the xml code.
433
434 =item fe_script_client_name
435
436 If set, add the 'client_name' for script in the xml code.
437
438 =item fe_dumptype_property
439
440 If set, add the dumptype property in the xml code.
441
442 =back
443
444 =cut
445
446
447
448 package Amanda::Feature::Set;
449
450 # this does not work, because SWIG uses the string value of objects as a hash key
451 # even after calling their destructor, which leads to a segfault.
452 #
453 # use overload '""' => sub { $_[0]->as_string(); };
454
455 sub Amanda::Feature::Set::from_string {
456     my $class = shift;
457     return Amanda::Feature::am_string_to_feature(@_);
458 }
459
460 sub Amanda::Feature::Set::old {
461     my $class = shift;
462     return Amanda::Feature::am_set_default_feature_set();
463 }
464
465 sub Amanda::Feature::Set::mine {
466     my $class = shift;
467     return Amanda::Feature::am_init_feature_set();
468 }
469
470 sub Amanda::Feature::Set::features {
471     my $class = shift;
472     return Amanmda::Feature::features();
473 }
474
475
476 package Amanda::Feature;
477
478 1;