Commit 4582de61 authored by Steven Murray's avatar Steven Murray
Browse files

This is the first attempt at adding the bare minimum of tapeserverd to the CTA project

Please note that you will have to install the following CASTOR rpms
in order to compile:

  castor
  castor-devel
  castor-lib
  castor-lib-server
  castor-lib-tape
parent 15587fb4
...@@ -3,7 +3,14 @@ cmake_minimum_required (VERSION 2.6) ...@@ -3,7 +3,14 @@ cmake_minimum_required (VERSION 2.6)
project(cta) project(cta)
set(CMAKE_C_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter") set(CMAKE_C_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter -Wno-long-long -std=c++0x")
# Please note that the -fms-extensions option should be dropped when this
# project gets to be compiled on a fully C++ 11 compliant compiler. The option
# is being used to support anonymous structs and avoid errors similar to the
# following:
#
# ClientSimulator.hpp:65: error: ISO C++ prohibits anonymous structs
set(CMAKE_CXX_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter -Wno-long-long -std=c++0x -fms-extensions")
# Explicitly setting the C and C++ compiler flags for the RelWithDebInfo build # Explicitly setting the C and C++ compiler flags for the RelWithDebInfo build
...@@ -37,6 +44,6 @@ add_subdirectory(objectstore) ...@@ -37,6 +44,6 @@ add_subdirectory(objectstore)
add_subdirectory(nameserver) add_subdirectory(nameserver)
add_subdirectory(remotens) add_subdirectory(remotens)
add_subdirectory(scheduler) add_subdirectory(scheduler)
#add_subdirectory(tapeserver) add_subdirectory(tapeserver)
add_subdirectory(tests) add_subdirectory(tests)
add_subdirectory(xroot_plugins) add_subdirectory(xroot_plugins)
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
add_subdirectory (castor) add_subdirectory (castor)
add_subdirectory (common)
add_subdirectory (dlf)
add_subdirectory (rfio)
add_subdirectory (tape)
add_subdirectory (test) add_subdirectory (test)
# 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.
#
# @author Castor Dev team, castor-dev@cern.ch
#
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
add_subdirectory (legacymsg)
add_subdirectory (mediachanger)
add_subdirectory (utils) add_subdirectory (utils)
add_subdirectory (mediachanger)
add_subdirectory (messages) add_subdirectory (messages)
add_subdirectory (log) add_subdirectory (log)
add_subdirectory (server)
add_subdirectory (tape) add_subdirectory (tape)
set (CLIENT_LIB_SRC_FILES
BaseAddress.cpp
VectorAddress.cpp
BaseCnvSvc.cpp
BaseObject.cpp
BaseSvc.cpp
Constants.cpp
Converters.cpp
Factories.cpp
IObject.cpp
IClient.cpp
IClientFactory.cpp
MessageAck.cpp
ObjectCatalog.cpp
ObjectSet.cpp
Services.cpp
System.cpp
client/BaseClient.cpp
client/BasicResponseHandler.cpp
client/VectorResponseHandler.cpp
dlf/Dlf.cpp
dlf/IPAddress.cpp
dlf/Message.cpp
dlf/Param.cpp
dlf/TimeStamp.cpp
io/AbstractSocket.cpp
io/AbstractTCPSocket.cpp
io/AuthServerSocket.cpp
io/AuthClientSocket.cpp
io/IpAndPort.cpp
io/UDPSocket.cpp
io/PipeSocket.cpp
io/ClientSocket.cpp
io/io.cpp
io/ServerSocket.cpp
io/StreamAddress.cpp
io/StreamBaseCnv.cpp
io/StreamBaseAddressCnv.cpp
io/StreamClientCnv.cpp
io/StreamCnvSvc.cpp
io/StreamDiskCopyForRecallCnv.cpp
io/StreamDiskCopyInfoCnv.cpp
io/StreamEndResponseCnv.cpp
io/StreamFileResponseCnv.cpp
io/StreamFiles2DeleteCnv.cpp
io/StreamFilesDeletedCnv.cpp
io/StreamNsFilesDeletedCnv.cpp
io/StreamNsFilesDeletedResponseCnv.cpp
io/StreamFilesDeletionFailedCnv.cpp
io/StreamGCFilesResponseCnv.cpp
io/StreamGCLocalFileCnv.cpp
io/StreamGCFileCnv.cpp
io/StreamMessageAckCnv.cpp
io/StreamPtrCnv.cpp
io/StreamQueryParameterCnv.cpp
io/StreamBasicResponseCnv.cpp
io/StreamSetFileGCWeightCnv.cpp
io/StreamStringResponseCnv.cpp
io/StreamSubRequestCnv.cpp
io/StreamStageAbortRequestCnv.cpp
io/StreamStageFileQueryRequestCnv.cpp
io/StreamStageGetRequestCnv.cpp
io/StreamStagePrepareToGetRequestCnv.cpp
io/StreamStagePrepareToPutRequestCnv.cpp
io/StreamStagePutDoneRequestCnv.cpp
io/StreamStagePutRequestCnv.cpp
io/StreamStageRmRequestCnv.cpp
io/StreamStgFilesDeletedCnv.cpp
io/StreamStgFilesDeletedResponseCnv.cpp
io/StreamAbortResponseCnv.cpp
io/StreamFileQryResponseCnv.cpp
io/StreamIOResponseCnv.cpp
io/StreamDiskPoolQueryResponseCnv.cpp
io/StreamFileSystemDescriptionCnv.cpp
io/StreamDiskServerDescriptionCnv.cpp
io/StreamDiskPoolQueryCnv.cpp
io/StreamDiskPoolQueryCnvOld.cpp
io/StreamVersionQueryCnv.cpp
io/StreamVersionResponseCnv.cpp
io/StreamPrivilegeCnv.cpp
io/StreamListPrivilegesCnv.cpp
io/StreamListPrivilegesResponseCnv.cpp
io/StreamChangePrivilegeCnv.cpp
io/StreamBWUserCnv.cpp
io/StreamRequestTypeCnv.cpp
io/StreamNsFileIdCnv.cpp
add_library (castorclient SHARED
${CLIENT_LIB_SRC_FILES})
# Relax compilation of old code full of pointer casting. Funnily enough,
# the compiler only complains in -O2 mode (RelWithDebInfo in cmake).
set_property(SOURCE ../client/src/stager/stager_errmsg.c APPEND PROPERTY COMPILE_FLAGS -fno-strict-aliasing)
CastorSetLibraryVersions (castorclient)
target_link_libraries (castorclient castordlf castorutils)
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
#pragma once #pragma once
#include "osdep.h"
#include <iostream> #include <iostream>
#include <shift/osdep.h>
#include <string> #include <string>
namespace castor { namespace castor {
......
...@@ -16,43 +16,50 @@ ...@@ -16,43 +16,50 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
*
*
*
* @author Castor Dev team, castor-dev@cern.ch * @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/ *****************************************************************************/
#pragma once #pragma once
#include "castor/BaseObject.hpp" namespace castor {
namespace acs {
namespace test {
class RrTest: public castor::BaseObject {
public:
RrTest();
int start();
}; // class RrTest /**
* The default TCP/IP port on which the CASTOR ACS daemon listens for incoming Zmq
* connections from the tape server.
*/
const unsigned short ACS_PORT = 54521;
/**
* Default time to wait in seconds between queries to ACS Library for responses.
*/
const int ACS_QUERY_INTERVAL = 10;
class RrTestClient { /**
* Default time to wait in seconds for the tape-library command to conclude.
public: */
RrTestClient(char *srvIp); const int ACS_CMD_TIMEOUT = 610;
int start();
~RrTestClient();
protected: /**
int listen(); * The maximum ACS sequence number value to be used.
int mListenPort; */
int mSocket; const unsigned short ACS_MAX_SEQ = 65535;
int mChallenge;
char *mSrvIp;
}; // class RrTest /**
* Default timeout for the response command to the ACS library.
*/
const int ACS_RESPONSE_TIMEOUT = 5;
/**
* Enumeration of the states of an ACS request.
*/
enum RequestState {
ACS_REQUEST_TO_EXECUTE,
ACS_REQUEST_IS_RUNNING,
ACS_REQUEST_COMPLETED,
ACS_REQUEST_FAILED,
ACS_REQUEST_TO_DELETE};
} // namespace acs
} // namespace castor
} // Namespace test
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include "castor/dlf/Message.hpp" #include "castor/dlf/Message.hpp"
#include "castor/dlf/Param.hpp" #include "castor/dlf/Param.hpp"
#include "castor/exception/Exception.hpp" #include "castor/exception/Exception.hpp"
#include "dlf_api.h"
#include <shift/dlf_api.h>
#include <vector> #include <vector>
/** /**
......
...@@ -27,9 +27,8 @@ ...@@ -27,9 +27,8 @@
#include "castor/dlf/IPAddress.hpp" #include "castor/dlf/IPAddress.hpp"
#include "castor/dlf/TimeStamp.hpp" #include "castor/dlf/TimeStamp.hpp"
#include "castor/IObject.hpp" #include "castor/IObject.hpp"
#include "castor/stager/TapeVid.hpp"
#include "dlf_api.h"
#include <shift/dlf_api.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -169,20 +168,6 @@ namespace castor { ...@@ -169,20 +168,6 @@ namespace castor {
m_cParam.value.par_double = value; m_cParam.value.par_double = value;
}; };
/**
* Constructor for Tape VIDS
*/
Param(const char* name, castor::stager::TapeVid value) :
m_deallocate(false) {
m_cParam.name = (char*) name;
m_cParam.type = DLF_MSG_PARAM_TPVID;
if (0 != value.vid()) {
m_cParam.value.par_string = strdup(value.vid());
} else {
m_cParam.value.par_string = 0;
}
};
/** /**
* Constructor for Raw parameters * Constructor for Raw parameters
*/ */
......
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
#pragma once #pragma once
#include "net.h"
#include "castor/BaseObject.hpp" #include "castor/BaseObject.hpp"
#include "castor/exception/Exception.hpp" #include "castor/exception/Exception.hpp"
#include <shift/net.h>
#include <string> #include <string>
#include <netinet/in.h> #include <netinet/in.h>
......
...@@ -227,7 +227,7 @@ static void check16BitsWereMarshalledBigEndian(const char *const buf) { ...@@ -227,7 +227,7 @@ static void check16BitsWereMarshalledBigEndian(const char *const buf) {
} }
TEST_F(castor_io_IoTest, marshalInt16) { TEST_F(castor_io_IoTest, marshalInt16) {
const int16_t v = 0x8765; const uint16_t v = 0x8765;
char buf[2]; char buf[2];
char *ptr = buf; char *ptr = buf;
...@@ -380,7 +380,7 @@ TEST_F(castor_io_IoTest, marshall_STRING) { ...@@ -380,7 +380,7 @@ TEST_F(castor_io_IoTest, marshall_STRING) {
} }
TEST_F(castor_io_IoTest, unmarshalUint8) { TEST_F(castor_io_IoTest, unmarshalUint8) {
char buf[] = {0x87}; char buf[] = {'\x87'};
size_t bufLen = sizeof(buf); size_t bufLen = sizeof(buf);
const char *ptr = buf; const char *ptr = buf;
uint8_t v = 0; uint8_t v = 0;
...@@ -391,7 +391,7 @@ TEST_F(castor_io_IoTest, unmarshalUint8) { ...@@ -391,7 +391,7 @@ TEST_F(castor_io_IoTest, unmarshalUint8) {
} }
TEST_F(castor_io_IoTest, unmarshall_BYTE) { TEST_F(castor_io_IoTest, unmarshall_BYTE) {
char buf[] = {0x87}; char buf[] = {'\x87'};
const char *ptr = buf; const char *ptr = buf;
uint8_t v = 0; uint8_t v = 0;
unmarshall_BYTE(ptr, v); unmarshall_BYTE(ptr, v);
...@@ -400,7 +400,7 @@ TEST_F(castor_io_IoTest, unmarshall_BYTE) { ...@@ -400,7 +400,7 @@ TEST_F(castor_io_IoTest, unmarshall_BYTE) {
} }
TEST_F(castor_io_IoTest, unmarshalInt16) { TEST_F(castor_io_IoTest, unmarshalInt16) {
char buf[] = {0x87, 0x65}; char buf[] = {'\x87', '\x65'};
size_t bufLen = sizeof(buf); size_t bufLen = sizeof(buf);
const char *ptr = buf; const char *ptr = buf;
int16_t v = 0; int16_t v = 0;
...@@ -411,7 +411,7 @@ TEST_F(castor_io_IoTest, unmarshalInt16) { ...@@ -411,7 +411,7 @@ TEST_F(castor_io_IoTest, unmarshalInt16) {
} }
TEST_F(castor_io_IoTest, unmarshalUint16) { TEST_F(castor_io_IoTest, unmarshalUint16) {
char buf[] = {0x87, 0x65}; char buf[] = {'\x87', '\x65'};
size_t bufLen = sizeof(buf); size_t bufLen = sizeof(buf);
const char *ptr = buf; const char *ptr = buf;
uint16_t v = 0; uint16_t v = 0;
...@@ -422,7 +422,7 @@ TEST_F(castor_io_IoTest, unmarshalUint16) { ...@@ -422,7 +422,7 @@ TEST_F(castor_io_IoTest, unmarshalUint16) {
} }
TEST_F(castor_io_IoTest, unmarshall_SHORT) { TEST_F(castor_io_IoTest, unmarshall_SHORT) {
char buf[] = {0x87, 0x65}; char buf[] = {'\x87', '\x65'};
const char *ptr = buf; const char *ptr = buf;
uint16_t v = 0; uint16_t v = 0;
unmarshall_SHORT(ptr, v); unmarshall_SHORT(ptr, v);
...@@ -431,7 +431,7 @@ TEST_F(castor_io_IoTest, unmarshall_SHORT) { ...@@ -431,7 +431,7 @@ TEST_F(castor_io_IoTest, unmarshall_SHORT) {
} }
TEST_F(castor_io_IoTest, unmarshalUint32) { TEST_F(castor_io_IoTest, unmarshalUint32) {
char buf[] = {0x87, 0x65, 0x43, 0x21}; char buf[] = {'\x87', '\x65', '\x43', '\x21'};
size_t bufLen = sizeof(buf); size_t bufLen = sizeof(buf);
const char *ptr = buf; const char *ptr = buf;
uint32_t v = 0; uint32_t v = 0;
...@@ -442,7 +442,7 @@ TEST_F(castor_io_IoTest, unmarshalUint32) { ...@@ -442,7 +442,7 @@ TEST_F(castor_io_IoTest, unmarshalUint32) {
} }
TEST_F(castor_io_IoTest, unmarshall_LONG) { TEST_F(castor_io_IoTest, unmarshall_LONG) {
char buf[] = {0x87, 0x65, 0x43, 0x21}; char buf[] = {'\x87', '\x65', '\x43', '\x21'};
const char *ptr = buf; const char *ptr = buf;
uint32_t v = 0; uint32_t v = 0;
unmarshall_LONG(ptr, v); unmarshall_LONG(ptr, v);
...@@ -451,7 +451,7 @@ TEST_F(castor_io_IoTest, unmarshall_LONG) { ...@@ -451,7 +451,7 @@ TEST_F(castor_io_IoTest, unmarshall_LONG) {
} }
TEST_F(castor_io_IoTest, unmarshalInt32) { TEST_F(castor_io_IoTest, unmarshalInt32) {
char buf[] = {0x87, 0x65, 0x43, 0x21}; char buf[] = {'\x87', '\x65', '\x43', '\x21'};
size_t bufLen = sizeof(buf); size_t bufLen = sizeof(buf);
const char *ptr = buf; const char *ptr = buf;
int32_t v = 0; int32_t v = 0;
...@@ -462,7 +462,7 @@ TEST_F(castor_io_IoTest, unmarshalInt32) { ...@@ -462,7 +462,7 @@ TEST_F(castor_io_IoTest, unmarshalInt32) {
} }
TEST_F(castor_io_IoTest, unmarshalUint64) { TEST_F(castor_io_IoTest, unmarshalUint64) {
char buf[] = {0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11}; char buf[] = {'\x88', '\x77', '\x66', '\x55', '\x44', '\x33', '\x22', '\x11'};
size_t bufLen = sizeof(buf); size_t bufLen = sizeof(buf);
const char *ptr = buf; const char *ptr = buf;
uint64_t v = 0; uint64_t v = 0;
...@@ -476,7 +476,7 @@ TEST_F(castor_io_IoTest, unmarshalUint64) { ...@@ -476,7 +476,7 @@ TEST_F(castor_io_IoTest, unmarshalUint64) {
// order to prove that the new C++ un-marshalling code of castor::io is // order to prove that the new C++ un-marshalling code of castor::io is
// compatible with that of the legacy code found in h/mashall.h // compatible with that of the legacy code found in h/mashall.h
TEST_F(castor_io_IoTest, unmarshall_HYPER) { TEST_F(castor_io_IoTest, unmarshall_HYPER) {
char buf[] = {0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11}; char buf[] = {'\x88', '\x77', '\x66', '\x55', '\x44', '\x33', '\x22', '\x11'};
const char *ptr = buf; const char *ptr = buf;
uint64_t v = 0; uint64_t v = 0;
unmarshall_HYPER(ptr, v); unmarshall_HYPER(ptr, v);
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
#include "castor/BaseObject.hpp" #include "castor/BaseObject.hpp"
#include "castor/exception/Exception.hpp" #include "castor/exception/Exception.hpp"
#include "castor/io/AbstractTCPSocket.hpp" #include "castor/io/AbstractTCPSocket.hpp"
#include "net.h"
#include <shift/net.h>
#include <string> #include <string>
#include <netinet/in.h> #include <netinet/in.h>
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
# #
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
include_directories(/usr/include/shift)
include_directories(${PROJECT_SOURCE_DIR}/tapeserver)
################################################################################ ################################################################################
# Rules to build and install libcastorlegacymsg.so # Rules to build and install libcastorlegacymsg.so
################################################################################ ################################################################################
...@@ -71,9 +74,6 @@ set (CASTOR_LEGACYMSG_LIB_SRC_FILES ...@@ -71,9 +74,6 @@ set (CASTOR_LEGACYMSG_LIB_SRC_FILES
VmgrTapeInfoRqstMsgBody.cpp VmgrTapeInfoRqstMsgBody.cpp
VmgrTapeMountedMsgBody.cpp) VmgrTapeMountedMsgBody.cpp)
add_library (castorlegacymsg SHARED ${CASTOR_LEGACYMSG_LIB_SRC_FILES}) add_library (castorlegacymsg SHARED ${CASTOR_LEGACYMSG_LIB_SRC_FILES})
CastorSetLibraryVersions (castorlegacymsg)
target_link_libraries (castorlegacymsg target_link_libraries (castorlegacymsg
castorclient castorclient
castorcommon) castorcommon)
install (TARGETS castorlegacymsg LIBRARY DESTINATION ${CASTOR_DEST_LIB_DIR}
NAMELINK_SKIP)
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#pragma once #pragma once
#include "Castor_limits.h" #include <shift/Castor_limits.h>
#include <stdint.h> #include <stdint.h>
namespace castor { namespace castor {
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#include "castor/io/io.hpp" #include "castor/io/io.hpp"
#include "castor/legacymsg/CupvMarshal.hpp" #include "castor/legacymsg/CupvMarshal.hpp"
#include "Cupv.h"
#include <shift/Cupv.h>
#include <string.h> #include <string.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "castor/utils/SmartFd.hpp" #include "castor/utils/SmartFd.hpp"
#include "castor/utils/utils.hpp" #include "castor/utils/utils.hpp"
#include "Cupv.h" #include <shift/Cupv.h>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#pragma once #pragma once
#include "Castor_limits.h" #include <shift/Castor_limits.h>
#include <stdint.h> #include <stdint.h>
namespace castor { namespace castor {
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#pragma once #pragma once