RcpJobSubmitter.hpp 3.74 KB
Newer Older
1
/******************************************************************************
2
 *                      RcpJobSubmitter.hpp
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * This file is part of the Castor project.
 * See http://castor.web.cern.ch/castor
 *
 * Copyright (C) 2003  CERN
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *
 *
 *
23
 * @author Nicola.Bessone@cern.ch Steven.Murray@cern.ch
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 *****************************************************************************/
#ifndef _CASTOR_TAPE_AGGREGATOR_RCPJOBSUBMITTER_HPP_
#define _CASTOR_TAPE_AGGREGATOR_RCPJOBSUBMITTER_HPP_

#include "h/net.h"

#include <string>


namespace castor {

namespace io {
  class AbstractTCPSocket;
}

namespace tape {
namespace aggregator {
    
  /**
   * Remote copy job submitter.
   *
   * A helper class for submitting remote copy jobs to either RTCPD or tape
   * aggregator daemons.
   */
48
  class RcpJobSubmitter {
49
50
51
52
53
54

  public:

    /**
     * Submits a remote copy job to either a RTCPD or tape aggregator daemon.
     * 
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
     * @param host The hostname of the RTCPD or tape aggregator daemon.
     * @param port The port number of the RTCPD or tape aggregator daemon.
     * @param netReadWriteTimeout The timeout to be used when performing
     * network reads and writes.
     * @param remoteCopyType The remote copy type to be used for exception
     * messages
     * @param tapeRequestID The tape request ID.
     * @param clientUserName The client user name.
     * @param clientHost The client host.
     * @param clientPort The client port.
     * @param clientEuid The client user ID.
     * @param clientEgid The client group ID.
     * @param deviceGroupName The device group name.
     * @param driveName The tape drive name.
     * @param reply The reply from RTCPD which may be positive or negative.
70
71
     */
    static void submit(
72
73
74
75
76
77
78
79
80
81
82
      const std::string  &host,
      const unsigned int  port,
      const int           netReadWriteTimeout,
      const char         *remoteCopyType,
      const u_signed64    tapeRequestID,
      const std::string  &clientUserName,
      const std::string  &clientHost,
      const int           clientPort,
      const int           clientEuid,
      const int           clientEgid,
      const std::string  &deviceGroupName,
83
      const std::string  &driveName,
84
      RcpJobReplyMsgBody &reply)
85
      throw(castor::exception::Exception);    
86
87
88
89
90

      
  private:
      
    /**
91
     * Reads the reply of the RTCOPY or tape aggregator daemon.
92
     * 
93
94
95
96
97
98
99
     * @param socket The socket of the connection to the RTCOPY or tape
     * aggregator daemon.
     * @param netReadWriteTimeout The timeout to be used when performing
     * network reads and writes.
     * @param remoteCopyType The remote copy type to be used for exception
     * messages.
     * @param reply The reply from RTCPD.
100
101
     */
    static void readReply(castor::io::AbstractTCPSocket &socket,
102
      const int netReadWriteTimeout, const char *remoteCopyType,
103
      RcpJobReplyMsgBody &reply) throw(castor::exception::Exception);    
104

105
  }; // class RcpJobSubmitter
106
107
108
109
110
111

} // namespace aggregator
} // namespace tape
} // namespace castor      

#endif // _CASTOR_TAPE_AGGREGATOR_RCPJOBSUBMITTER_HPP_