-
Michael Davis authoredMichael Davis authored
XrdSsiCtaRequestMessage.cpp 78.98 KiB
/*!
* @project The CERN Tape Archive (CTA)
* @brief XRootD EOS Notification handler
* @copyright Copyright 2019 CERN
* @license 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <XrdSsiPbException.hpp>
using XrdSsiPb::PbException;
#include "common/utils/Regex.hpp"
#include <cmdline/CtaAdminCmdParse.hpp>
#include "XrdSsiCtaRequestMessage.hpp"
#include "XrdCtaAdminLs.hpp"
#include "XrdCtaArchiveRouteLs.hpp"
#include "XrdCtaDriveLs.hpp"
#include "XrdCtaFailedRequestLs.hpp"
#include "XrdCtaGroupMountRuleLs.hpp"
#include "XrdCtaListPendingQueue.hpp"
#include "XrdCtaLogicalLibraryLs.hpp"
#include "XrdCtaMountPolicyLs.hpp"
#include "XrdCtaMediaTypeLs.hpp"
#include "XrdCtaRepackLs.hpp"
#include "XrdCtaRequesterMountRuleLs.hpp"
#include "XrdCtaShowQueues.hpp"
#include "XrdCtaTapeLs.hpp"
#include "XrdCtaTapeFileLs.hpp"
#include "XrdCtaStorageClassLs.hpp"
#include "XrdCtaTapePoolLs.hpp"
#include "XrdCtaDiskSystemLs.hpp"
#include "XrdCtaVirtualOrganizationLs.hpp"
#include "XrdCtaVersion.hpp"
#include "XrdCtaSchedulingInfosLs.hpp"
#include <limits>
#include <sstream>
namespace cta {
namespace xrd {
// Codes to change colours for console output (when sending a response to cta-admin)
const char* const TEXT_RED = "\x1b[31;1m";
const char* const TEXT_NORMAL = "\x1b[0m\n";
/*
* Convert AdminCmd <Cmd, SubCmd> pair to an integer so that it can be used in a switch statement
*/
constexpr unsigned int cmd_pair(cta::admin::AdminCmd::Cmd cmd, cta::admin::AdminCmd::SubCmd subcmd) {
return (cmd << 16) + subcmd;
}
void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Response &response, XrdSsiStream* &stream)
{
// Branch on the Request payload type
switch(request.request_case())
{