From 51a5af96d2d685858e48dd134bc68cf30fd35f75 Mon Sep 17 00:00:00 2001
From: Steven Murray <steven.murray@cern.ch>
Date: Thu, 5 Jan 2017 13:07:10 +0100
Subject: [PATCH] Renamed RmcProxyTcpIp RmcProxy

---
 mediachanger/CMakeLists.txt                   |  2 +-
 mediachanger/MediaChangerFacade.hpp           |  4 +--
 .../{RmcProxyTcpIp.cpp => RmcProxy.cpp}       | 32 ++++++++-----------
 .../{RmcProxyTcpIp.hpp => RmcProxy.hpp}       |  8 ++---
 4 files changed, 20 insertions(+), 26 deletions(-)
 rename mediachanger/{RmcProxyTcpIp.cpp => RmcProxy.cpp} (88%)
 rename mediachanger/{RmcProxyTcpIp.hpp => RmcProxy.hpp} (98%)

diff --git a/mediachanger/CMakeLists.txt b/mediachanger/CMakeLists.txt
index af9ef246e0..8a8fa468ce 100644
--- a/mediachanger/CMakeLists.txt
+++ b/mediachanger/CMakeLists.txt
@@ -45,7 +45,7 @@ set (MEDIACHANGER_LIB_SRC_FILES
   RmcMarshal.cpp
   RmcMarshal.hpp
   RmcMountMsgBody.cpp
-  RmcProxyTcpIp.cpp
+  RmcProxy.cpp
   RmcUnmountMsgBody.cpp
   ScsiLibrarySlot.cpp
   TapeLibraryType.cpp
diff --git a/mediachanger/MediaChangerFacade.hpp b/mediachanger/MediaChangerFacade.hpp
index 0a2e68913a..93753776bd 100644
--- a/mediachanger/MediaChangerFacade.hpp
+++ b/mediachanger/MediaChangerFacade.hpp
@@ -23,7 +23,7 @@
 #include "mediachanger/LibrarySlot.hpp"
 #include "mediachanger/MediaChangerProxy.hpp"
 #include "mediachanger/MmcProxyLog.hpp"
-#include "mediachanger/RmcProxyTcpIp.hpp"
+#include "mediachanger/RmcProxy.hpp"
 #include "mediachanger/ZmqContextSingleton.hpp"
 
 #include <memory>
@@ -114,7 +114,7 @@ private:
   /**
    * SCSI media changer proxy.
    */
-  RmcProxyTcpIp m_rmcProxy;
+  RmcProxy m_rmcProxy;
 
   /**
    * Returns the media changer proxy for the specified library type.
diff --git a/mediachanger/RmcProxyTcpIp.cpp b/mediachanger/RmcProxy.cpp
similarity index 88%
rename from mediachanger/RmcProxyTcpIp.cpp
rename to mediachanger/RmcProxy.cpp
index 491590a095..e3a222c03d 100644
--- a/mediachanger/RmcProxyTcpIp.cpp
+++ b/mediachanger/RmcProxy.cpp
@@ -21,7 +21,7 @@
 #include "mediachanger/CommonMarshal.hpp"
 #include "mediachanger/io.hpp"
 #include "mediachanger/RmcMarshal.hpp"
-#include "mediachanger/RmcProxyTcpIp.hpp"
+#include "mediachanger/RmcProxy.hpp"
 #include "mediachanger/ScsiLibrarySlot.hpp"
 
 namespace cta {
@@ -30,7 +30,7 @@ namespace mediachanger {
 //------------------------------------------------------------------------------
 // constructor
 //------------------------------------------------------------------------------
-RmcProxyTcpIp::RmcProxyTcpIp(
+RmcProxy::RmcProxy(
   const unsigned short rmcPort,
   const int netTimeout,
   const unsigned int maxRqstAttempts) throw():
@@ -42,13 +42,13 @@ RmcProxyTcpIp::RmcProxyTcpIp(
 //------------------------------------------------------------------------------
 // destructor
 //------------------------------------------------------------------------------
-RmcProxyTcpIp::~RmcProxyTcpIp() throw() {
+RmcProxy::~RmcProxy() throw() {
 }
 
 //------------------------------------------------------------------------------
 // mountTapeReadOnly
 //------------------------------------------------------------------------------
-void RmcProxyTcpIp::mountTapeReadOnly(const std::string &vid, const LibrarySlot &librarySlot) {
+void RmcProxy::mountTapeReadOnly(const std::string &vid, const LibrarySlot &librarySlot) {
   // SCSI libraries do not support read-only mounts
   mountTapeReadWrite(vid, librarySlot);
 }
@@ -56,7 +56,7 @@ void RmcProxyTcpIp::mountTapeReadOnly(const std::string &vid, const LibrarySlot
 //------------------------------------------------------------------------------
 // mountTapeReadWrite
 //------------------------------------------------------------------------------
-void RmcProxyTcpIp::mountTapeReadWrite(const std::string &vid, const LibrarySlot &librarySlot) {
+void RmcProxy::mountTapeReadWrite(const std::string &vid, const LibrarySlot &librarySlot) {
   try {
     RmcMountMsgBody rqstBody;
     rqstBody.uid = geteuid();
@@ -79,7 +79,7 @@ void RmcProxyTcpIp::mountTapeReadWrite(const std::string &vid, const LibrarySlot
 //------------------------------------------------------------------------------
 // dismountTape
 //------------------------------------------------------------------------------
-void RmcProxyTcpIp::dismountTape(const std::string &vid, const LibrarySlot &librarySlot) {
+void RmcProxy::dismountTape(const std::string &vid, const LibrarySlot &librarySlot) {
   try {
     RmcUnmountMsgBody rqstBody;
     rqstBody.uid = geteuid();
@@ -103,7 +103,7 @@ void RmcProxyTcpIp::dismountTape(const std::string &vid, const LibrarySlot &libr
 //------------------------------------------------------------------------------
 // forceDismountTape
 //------------------------------------------------------------------------------
-void RmcProxyTcpIp::forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) {
+void RmcProxy::forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) {
   // SCSI libraries do not support forced dismounts
   dismountTape(vid, librarySlot);
 }
@@ -111,7 +111,7 @@ void RmcProxyTcpIp::forceDismountTape(const std::string &vid, const LibrarySlot
 //-----------------------------------------------------------------------------
 // connectToRmc
 //-----------------------------------------------------------------------------
-int RmcProxyTcpIp::connectToRmc()
+int RmcProxy::connectToRmc()
   const {
   const std::string rmcHost = "localhost";
   cta::SmartFd smartConnectSock;
@@ -131,8 +131,7 @@ int RmcProxyTcpIp::connectToRmc()
 //-----------------------------------------------------------------------------
 // writeRmcMountMsg
 //-----------------------------------------------------------------------------
-void RmcProxyTcpIp::writeRmcMountMsg(const int fd,
-  const RmcMountMsgBody &body) {
+void RmcProxy::writeRmcMountMsg(const int fd, const RmcMountMsgBody &body) {
   char buf[RMC_MSGBUFSIZ];
   const size_t len = marshal(buf, body);
 
@@ -149,8 +148,7 @@ void RmcProxyTcpIp::writeRmcMountMsg(const int fd,
 //-----------------------------------------------------------------------------
 // readRmcMsgHeader
 //-----------------------------------------------------------------------------
-MessageHeader
-  RmcProxyTcpIp::readRmcMsgHeader(const int fd) {
+MessageHeader RmcProxy::readRmcMsgHeader(const int fd) {
   char buf[12]; // Magic + type + len
   MessageHeader header;
 
@@ -181,8 +179,7 @@ MessageHeader
 //-----------------------------------------------------------------------------
 // writeRmcUnmountMsg
 //-----------------------------------------------------------------------------
-void RmcProxyTcpIp::writeRmcUnmountMsg(const int fd,
-  const RmcUnmountMsgBody &body) {
+void RmcProxy::writeRmcUnmountMsg(const int fd, const RmcUnmountMsgBody &body) {
   char buf[RMC_MSGBUFSIZ];
   const size_t len = marshal(buf, body);
 
@@ -199,8 +196,7 @@ void RmcProxyTcpIp::writeRmcUnmountMsg(const int fd,
 //-----------------------------------------------------------------------------
 // rmcReplyTypeToStr
 //-----------------------------------------------------------------------------
-std::string RmcProxyTcpIp::rmcReplyTypeToStr(
-  const int replyType) {
+std::string RmcProxy::rmcReplyTypeToStr(const int replyType) {
   std::ostringstream oss;
   switch(replyType) {
   case RMC_RC:
@@ -218,9 +214,7 @@ std::string RmcProxyTcpIp::rmcReplyTypeToStr(
 //-----------------------------------------------------------------------------
 // handleMSG_ERR
 //-----------------------------------------------------------------------------
-std::string RmcProxyTcpIp::handleMSG_ERR(
-  const MessageHeader &header,
-  const int fd) {
+std::string RmcProxy::handleMSG_ERR(const MessageHeader &header, const int fd) {
   char errorBuf[1024];
   const int nbBytesToRead = header.lenOrStatus > sizeof(errorBuf) ?
     sizeof(errorBuf) : header.lenOrStatus;
diff --git a/mediachanger/RmcProxyTcpIp.hpp b/mediachanger/RmcProxy.hpp
similarity index 98%
rename from mediachanger/RmcProxyTcpIp.hpp
rename to mediachanger/RmcProxy.hpp
index 5bdbaefa13..651304de29 100644
--- a/mediachanger/RmcProxyTcpIp.hpp
+++ b/mediachanger/RmcProxy.hpp
@@ -55,7 +55,7 @@ namespace mediachanger {
 /**
  * A concrete implementation of the interface to the rmc daemon.
  */
-class RmcProxyTcpIp: public MediaChangerProxy {
+class RmcProxy: public MediaChangerProxy {
 public:
 
   /**
@@ -67,7 +67,7 @@ public:
    * @parm maxRqstAttempts The maximum number of attempts a retriable RMC
    * request should be issued.
    */
-  RmcProxyTcpIp(
+  RmcProxy(
     const unsigned short rmcPort = RMC_PORT,
     const int netTimeout = RMC_NET_TIMEOUT,
     const unsigned int maxRqstAttempts = RMC_MAX_RQST_ATTEMPTS) throw();
@@ -75,7 +75,7 @@ public:
   /**
    * Destructor.
    */
-  ~RmcProxyTcpIp() throw();
+  ~RmcProxy() throw();
 
   /**
    * Requests the media changer to mount the specified tape for read-only
@@ -297,7 +297,7 @@ protected:
    */
   std::string handleMSG_ERR(const MessageHeader &header, const int fd);
 
-}; // class RmcProxyTcpIp
+}; // class RmcProxy
 
 } // namespace mediachanger
 } // namespace cta
-- 
GitLab