2 * Copyright (c) 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
18 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
21 %module "Amanda::Application"
22 %include "amglue/amglue.swg"
23 %include "exception.i"
26 %include "Amanda/Application.pod"
29 push @ISA, qw(Amanda::Script_App);
30 require Amanda::Script_App;
34 use Amanda::Config qw( :init :getconf config_dir_relative );
39 my $config_name = shift @_;
41 my $self = Amanda::Script_App::new($class, "client", "application", $config_name);
43 $self->{known_commands} = {
58 run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
62 sub default_validate {
67 sysread STDIN, $buffer, 1048576;
68 } while (defined $buffer and length($buffer) > 0);
71 sub write_magic_block {
75 my $dump_str = pack("a512", $type);
76 print STDOUT $dump_str;
79 sub read_magic_block {
82 my $magic_block = Amanda::Util::full_read(0, 512);
84 $magic_block =~ /^([^\0]*)/;
94 open ($mesgout_fd, '>&=3') || die("Can't open mesgout_fd: $!");
95 $self->{mesgout} = $mesgout_fd;
100 /* C interfaces used by the above */
104 #include "client_util.h"
107 %typemap(in) GSList *levels {
109 GSList *level = NULL;
115 croak("Argument $argnum is not a reference.");
116 if (SvTYPE(SvRV($input)) != SVt_PVAV)
117 croak("Argument $argnum is not an array.");
118 tempav = (AV*)SvRV($input);
119 num = av_len(tempav);
120 for (i=0; i <= num; i++) {
121 tv = av_fetch(tempav, i, 0);
122 /* (gint) cast is required because sizeof(IV) may not be sizeof(gint).
123 * Both will be >= 32 bits, though, and that's sufficient for a level. */
124 level = g_slist_append(level, GINT_TO_POINTER((gint)SvIV(*tv)));
129 %typemap(freearg) GSList *levels {
134 %rename(run_calcsize_C) run_calcsize;
136 run_calcsize(char *config, char *program, char *disk, char *dirname,
137 GSList *levels, char *file_exclude, char *file_include);
139 %typemap(in) GSList *levels;
140 %typemap(freearg) GSList *levels;