Imported Upstream version 3.3.2
[debian/amanda] / perl / Amanda / Taper / Protocol.pm
1 # Copyright (c) 2009-2012 Zmanda Inc.  All Rights Reserved.
2 #
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License version 2 as published
5 # by the Free Software Foundation.
6 #
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10 # for more details.
11 #
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc.,
14 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 #
16 # Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
17 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
18
19 =head1 NAME
20
21 Amanda::Taper::Protocol
22
23 =head1 DESCRIPTION
24
25 This package is a component of the Amanda taper, and is not intended for use by
26 other scripts or applications.
27
28 This package define the protocol between the taper and the driver, it is
29 used by L<Amanda::Taper::Controller> and L<Amanda::Taper::Worker>
30
31 =cut
32
33 use lib '@amperldir@';
34 use strict;
35 use warnings;
36
37 package Amanda::Taper::Protocol;
38
39 use Amanda::IPC::LineProtocol;
40 use base "Amanda::IPC::LineProtocol";
41
42 use constant START_TAPER => message("START-TAPER",
43     format => [ qw( worker_name timestamp ) ],
44 );
45
46 use constant PORT_WRITE => message("PORT-WRITE",
47     format => [ qw( worker_name handle hostname diskname level datestamp
48             dle_tape_splitsize dle_split_diskbuffer dle_fallback_splitsize dle_allow_split
49             part_size part_cache_type part_cache_dir part_cache_max_size
50             data_path ) ],
51 );
52
53 use constant FILE_WRITE => message("FILE-WRITE",
54     format => [ qw( worker_name handle filename hostname diskname level datestamp
55             dle_tape_splitsize dle_split_diskbuffer dle_fallback_splitsize dle_allow_split
56             part_size part_cache_type part_cache_dir part_cache_max_size
57             orig_kb) ],
58 );
59
60 use constant START_SCAN => message("START-SCAN",
61     format => [ qw( worker_name handle ) ],
62 );
63
64 use constant NEW_TAPE => message("NEW-TAPE",
65     format => {
66         in => [ qw( worker_name handle ) ],
67         out => [ qw( handle label ) ],
68     },
69 );
70
71 use constant NO_NEW_TAPE => message("NO-NEW-TAPE",
72     format => {
73         in => [ qw( worker_name handle reason ) ],
74         out => [ qw( handle ) ],
75     }
76 );
77
78 use constant FAILED => message("FAILED",
79     format => {
80         in => [ qw( worker_name handle ) ],
81         out => [ qw( handle input taper inputerr tapererr ) ],
82     },
83 );
84
85 use constant DONE => message("DONE",
86     format => {
87         in => [ qw( worker_name handle orig_kb ) ],
88         out => [ qw( handle input taper stats inputerr tapererr ) ],
89     },
90 );
91
92 use constant QUIT => message("QUIT",
93     on_eof => 1,
94 );
95
96 use constant TAPER_OK => message("TAPER-OK",
97     format => [ qw( worker_name ) ],
98 );
99
100 use constant TAPE_ERROR => message("TAPE-ERROR",
101     format => [ qw( worker_name message ) ],
102 );
103
104 use constant PARTIAL => message("PARTIAL",
105     format => [ qw( handle input taper stats inputerr tapererr ) ],
106 );
107
108 use constant PARTDONE => message("PARTDONE",
109     format => [ qw( handle label fileno kb stats ) ],
110 );
111
112 use constant REQUEST_NEW_TAPE => message("REQUEST-NEW-TAPE",
113     format => [ qw( handle ) ],
114 );
115
116 use constant PORT => message("PORT",
117     format => [ qw( worker_name handle port ipports ) ],
118 );
119
120 use constant BAD_COMMAND => message("BAD-COMMAND",
121     format => [ qw( message ) ],
122 );
123
124 use constant TAKE_SCRIBE_FROM => message("TAKE-SCRIBE-FROM",
125     format => [ qw( worker_name handle from_worker_name) ],
126 );
127
128 use constant DUMPER_STATUS => message("DUMPER-STATUS",
129     format => [ qw( handle ) ],
130 );
131
132 use constant CLOSE_VOLUME => message("CLOSE-VOLUME",
133     format => [ qw( worker_name ) ],
134 );
135
136 1;