2 * Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
22 %module "Amanda::Application"
23 %include "amglue/amglue.swg"
24 %include "exception.i"
27 %include "Amanda/Application.pod"
30 push @ISA, qw(Amanda::Script_App);
31 require Amanda::Script_App;
36 use Amanda::Config qw( :init :getconf config_dir_relative );
41 my $config_name = shift @_;
43 my $self = Amanda::Script_App::new($class, "client", "application", $config_name);
45 $self->{known_commands} = {
60 run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
64 sub default_validate {
69 sysread STDIN, $buffer, 1048576;
70 } while (defined $buffer and length($buffer) > 0);
73 sub write_magic_block {
77 my $dump_str = pack("a512", $type);
78 print STDOUT $dump_str;
81 sub read_magic_block {
84 my $magic_block = Amanda::Util::full_read(0, 512);
86 $magic_block =~ /^([^\0]*)/;
95 my $mesgout = IO::Handle->new();
96 $mesgout->fdopen(3,"a") || die("Can't open mesgout_fd: $!");
97 $mesgout->autoflush(1);
98 $self->{mesgout} = $mesgout;
103 /* C interfaces used by the above */
107 #include "client_util.h"
110 %typemap(in) GSList *levels {
112 GSList *level = NULL;
118 croak("Argument $argnum is not a reference.");
119 if (SvTYPE(SvRV($input)) != SVt_PVAV)
120 croak("Argument $argnum is not an array.");
121 tempav = (AV*)SvRV($input);
122 num = av_len(tempav);
123 for (i=0; i <= num; i++) {
124 tv = av_fetch(tempav, i, 0);
125 /* (gint) cast is required because sizeof(IV) may not be sizeof(gint).
126 * Both will be >= 32 bits, though, and that's sufficient for a level. */
127 level = g_slist_append(level, GINT_TO_POINTER((gint)SvIV(*tv)));
132 %typemap(freearg) GSList *levels {
137 %rename(run_calcsize_C) run_calcsize;
139 run_calcsize(char *config, char *program, char *disk, char *dirname,
140 GSList *levels, char *file_exclude, char *file_include);
142 %typemap(in) GSList *levels;
143 %typemap(freearg) GSList *levels;