Imported Upstream version 3.2.0
[debian/amanda] / perl / Amanda / Taper / Protocol.pm
1 #! @PERL@
2 # Copyright (c) 2009, 2010 Zmanda Inc.  All Rights Reserved.
3 #
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.
7 #
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
11 # for more details.
12 #
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
16 #
17 # Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
18 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
19
20 =head1 NAME
21
22 Amanda::Taper::Protocol
23
24 =head1 DESCRIPTION
25
26 This package is a component of the Amanda taper, and is not intended for use by
27 other scripts or applications.
28
29 This package define the protocol between the taper and the driver, it is
30 used by L<Amanda::Taper::Controller> and L<Amanda::Taper::Worker>
31
32 =cut
33
34 use lib '@amperldir@';
35 use strict;
36 use warnings;
37
38 package Amanda::Taper::Protocol;
39
40 use Amanda::IPC::LineProtocol;
41 use base "Amanda::IPC::LineProtocol";
42
43 use constant START_TAPER => message("START-TAPER",
44     format => [ qw( worker_name timestamp ) ],
45 );
46
47 use constant PORT_WRITE => message("PORT-WRITE",
48     format => [ qw( worker_name handle hostname diskname level datestamp
49             dle_tape_splitsize dle_split_diskbuffer dle_fallback_splitsize dle_allow_split
50             part_size part_cache_type part_cache_dir part_cache_max_size
51             data_path ) ],
52 );
53
54 use constant FILE_WRITE => message("FILE-WRITE",
55     format => [ qw( worker_name handle filename hostname diskname level datestamp
56             dle_tape_splitsize dle_split_diskbuffer dle_fallback_splitsize dle_allow_split
57             part_size part_cache_type part_cache_dir part_cache_max_size
58             orig_kb) ],
59 );
60
61 use constant START_SCAN => message("START-SCAN",
62     format => [ qw( worker_name handle ) ],
63 );
64
65 use constant NEW_TAPE => message("NEW-TAPE",
66     format => {
67         in => [ qw( worker_name handle ) ],
68         out => [ qw( handle label ) ],
69     },
70 );
71
72 use constant NO_NEW_TAPE => message("NO-NEW-TAPE",
73     format => {
74         in => [ qw( worker_name handle reason ) ],
75         out => [ qw( handle ) ],
76     }
77 );
78
79 use constant FAILED => message("FAILED",
80     format => {
81         in => [ qw( worker_name handle ) ],
82         out => [ qw( handle input taper inputerr tapererr ) ],
83     },
84 );
85
86 use constant DONE => message("DONE",
87     format => {
88         in => [ qw( worker_name handle orig_kb ) ],
89         out => [ qw( handle input taper stats inputerr tapererr ) ],
90     },
91 );
92
93 use constant QUIT => message("QUIT",
94     on_eof => 1,
95 );
96
97 use constant TAPER_OK => message("TAPER-OK",
98     format => [ qw( worker_name ) ],
99 );
100
101 use constant TAPE_ERROR => message("TAPE-ERROR",
102     format => [ qw( worker_name message ) ],
103 );
104
105 use constant PARTIAL => message("PARTIAL",
106     format => [ qw( handle input taper stats inputerr tapererr ) ],
107 );
108
109 use constant PARTDONE => message("PARTDONE",
110     format => [ qw( handle label fileno kb stats ) ],
111 );
112
113 use constant REQUEST_NEW_TAPE => message("REQUEST-NEW-TAPE",
114     format => [ qw( handle ) ],
115 );
116
117 use constant PORT => message("PORT",
118     format => [ qw( worker_name handle port ipports ) ],
119 );
120
121 use constant BAD_COMMAND => message("BAD-COMMAND",
122     format => [ qw( message ) ],
123 );
124
125 use constant TAKE_SCRIBE_FROM => message("TAKE-SCRIBE-FROM",
126     format => [ qw( worker_name handle from_worker_name) ],
127 );
128
129 use constant DUMPER_STATUS => message("DUMPER-STATUS",
130     format => [ qw( handle ) ],
131 );
132
133 1;