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.
7 package Amanda::Application;
9 use base qw(DynaLoader);
10 package Amanda::Applicationc;
11 bootstrap Amanda::Application;
12 package Amanda::Application;
15 # ---------- BASE METHODS -------------
17 package Amanda::Application;
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 --------
50 package Amanda::Application;
52 *run_calcsize_C = *Amanda::Applicationc::run_calcsize_C;
54 # ------- VARIABLE STUBS --------
56 package Amanda::Application;
65 Amanda::Application - perl utility functions for Applications.
69 package Amanda::Application::my_application;
70 use base qw(Amanda::Application);
73 my ($class, $config, $foo) = @_;
74 my $self = $class->SUPER::new($config);
76 $self->{'foo'} = $foo;
77 $self->{'bar'} = $bar;
82 # Define all command_* subs that you need, e.g.,
90 # .. parse arguments ..
92 my $application = Amanda::Application::my_application->new($opt_foo, $opt_bar);
93 $application->do($cmd);
97 =head2 write_magic_block
99 $self->write_magic_block($type)
101 Write a 512 bytes magic block to STDOUT.
103 =head2 read_magic_bloc
105 $type = $self->read_magic_block()
107 Read the 512 bytes magic block from STDIN and return the type.
112 push @ISA, qw(Amanda::Script_App);
113 require Amanda::Script_App;
117 use Amanda::Config qw( :init :getconf config_dir_relative );
121 my $class = shift @_;
122 my $config_name = shift @_;
124 my $self = Amanda::Script_App::new($class, "client", "application", $config_name);
126 $self->{known_commands} = {
141 run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
145 sub default_validate {
150 sysread STDIN, $buffer, 1048576;
151 } while (defined $buffer and length($buffer) > 0);
154 sub write_magic_block {
158 my $dump_str = pack("a512", $type);
159 print STDOUT $dump_str;
162 sub read_magic_block {
165 my $magic_block = Amanda::Util::full_read(0, 512);
167 $magic_block =~ /^([^\0]*)/;