Skip to content

Commit

Permalink
[xrdcp] Add --notlsok and --tlsdata options.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 authored and osschar committed Oct 10, 2019
1 parent d5e9e75 commit ddb76a9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 37 deletions.
14 changes: 11 additions & 3 deletions src/XrdApps/XrdCpConfig.cc
Expand Up @@ -81,7 +81,7 @@ static XrdSysError eDest(&Logger, "");

XrdSysError *XrdCpConfig::Log = &XrdCpConfiguration::eDest;

const char *XrdCpConfig::opLetters = ":C:d:D:fFhHI:NpPrRsS:t:T:vVX:y:z:ZA";
const char *XrdCpConfig::opLetters = ":C:d:D:EfFhHI:NpPrRsS:t:T:vVX:y:z:ZA";

struct option XrdCpConfig::opVec[] = // For getopt_long()
{
Expand All @@ -94,6 +94,7 @@ struct option XrdCpConfig::opVec[] = // For getopt_long()
{OPT_TYPE "infiles", 1, 0, XrdCpConfig::OpIfile},
{OPT_TYPE "license", 0, 0, XrdCpConfig::OpLicense},
{OPT_TYPE "nopbar", 0, 0, XrdCpConfig::OpNoPbar},
{OPT_TYPE "notlsok", 0, 0, XrdCpConfig::OpNoTlsOK},
{OPT_TYPE "path", 0, 0, XrdCpConfig::OpPath},
{OPT_TYPE "posc", 0, 0, XrdCpConfig::OpPosc},
{OPT_TYPE "proxy", 1, 0, XrdCpConfig::OpProxy},
Expand All @@ -103,6 +104,7 @@ struct option XrdCpConfig::opVec[] = // For getopt_long()
{OPT_TYPE "silent", 0, 0, XrdCpConfig::OpSilent},
{OPT_TYPE "sources", 1, 0, XrdCpConfig::OpSources},
{OPT_TYPE "streams", 1, 0, XrdCpConfig::OpStreams},
{OPT_TYPE "tlsdata", 0, 0, XrdCpConfig::OpTlsData},
{OPT_TYPE "tpc", 1, 0, XrdCpConfig::OpTpc},
{OPT_TYPE "verbose", 0, 0, XrdCpConfig::OpVerbose},
{OPT_TYPE "version", 0, 0, XrdCpConfig::OpVersion},
Expand Down Expand Up @@ -241,6 +243,8 @@ do{while(optind < Argc && Legacy(optind)) {}
break;
case OpNoPbar: OpSpec |= DoNoPbar;
break;
case OpNoTlsOK: OpSpec |= DoNoTlsOK;
break;
case OpPath: OpSpec |= DoPath;
break;
case OpPosc: OpSpec |= DoPosc;
Expand All @@ -265,6 +269,8 @@ do{while(optind < Argc && Legacy(optind)) {}
case OpStreams: OpSpec |= DoStreams;
if (!a2i(optarg, &nStrm, 1, 15)) Usage(22);
break;
case OpTlsData: OpSpec |= DoTlsData;
break;
case OpTpc: OpSpec |= DoTpc;
if (!strcmp("delegate", optarg))
{OpSpec|= DoTpcDlgt;
Expand Down Expand Up @@ -881,9 +887,9 @@ void XrdCpConfig::Usage(int rc)
static const char *Options= "\n"
"Options: [--cksum <args>] [--debug <lvl>] [--coerce] [--dynamic-src]\n"
" [--force] [--help] [--infiles <fn>] [--license] [--nopbar]\n"
" [--path] [--parallel <n>] [--posc] [--proxy <host>:<port>]\n"
" [--notlsok] [--path] [--parallel <n>] [--posc] [--proxy <host>:<port>]\n"
" [--recursive] [--retry <n>] [--server] [--silent] [--sources <n>]\n"
" [--streams <n>] [--tpc [delegate] {first|only}] [--verbose]\n"
" [--streams <n>] [--tlsdata] [--tpc [delegate] {first|only}] [--verbose]\n"
" [--version] [--xrate <rate>] [--zip <file>] [--allow-http]";

static const char *Syntax2= "\n"
Expand Down Expand Up @@ -911,6 +917,7 @@ void XrdCpConfig::Usage(int rc)
"-H | --license prints license terms and conditions\n"
"-I | --infiles specifies the file that contains a list of input files\n"
"-N | --nopbar does not print the progress bar\n"
" --notlsok allow fallback to xroot protocol if xroots specified\n"
"-p | --path automatically create remote destination path\n"
"-P | --posc enables persist on successful close semantics\n"
"-D | --proxy uses the specified SOCKS4 proxy connection\n"
Expand All @@ -920,6 +927,7 @@ void XrdCpConfig::Usage(int rc)
"-s | --silent produces no output other than error messages\n"
"-y | --sources <n> uses up to the number of sources specified in parallel\n"
"-S | --streams <n> copies using the specified number of TCP connections\n"
"-E | --tlsdata entrcypt data as well for xroots protocol\n"
"-T | --tpc uses third party copy mode between the src and dest.\n"
" Both the src and dest must allow tpc mode. Argument\n"
" 'first' tries tpc and if it fails, does a normal copy;\n"
Expand Down
74 changes: 40 additions & 34 deletions src/XrdApps/XrdCpConfig.hh
Expand Up @@ -65,7 +65,7 @@ struct defVar
int Parallel; // Number of simultaneous copy ops (1 to 4)
char *pHost; // -> SOCKS4 proxy hname (0 if none)
int pPort; // SOCKS4 proxy port
int OpSpec; // Bit mask of set options (see Doxxxx)
long long OpSpec; // Bit mask of set options (see Doxxxx)
int Dlvl; // Debug level (0 to 3)
int nSrcs; // Number of sources wanted (dflt 1)
int nStrm; // Number of streams wanted (dflt 1)
Expand All @@ -88,82 +88,88 @@ char *zipFile; // The file name if the URL points to a ZIP a

static XrdSysError *Log; // -> Error message object

static const int OpCksum = 'C'; // -adler -MD5 legacy -> DoCksrc
static const int DoCksrc = 0x00000001; // --cksum <type>:source
static const int DoCksum = 0x00000002; // --cksum <type>
static const int DoCkprt = 0x00000004; // --cksum <type>:print
static const int OpCksum = 'C'; // -adler -MD5 legacy -> DoCksrc
static const int DoCksrc = 0x0000000000000001LL; // --cksum <type>:source
static const int DoCksum = 0x0000000000000002LL; // --cksum <type>
static const int DoCkprt = 0x0000000000000004LL; // --cksum <type>:print

static const int OpCoerce = 'F';
static const int DoCoerce = 0x00000008; // -F | --coerce
static const int DoCoerce = 0x0000000000000008LL; // -F | --coerce

static const int OpDebug = 'd';
static const int DoDebug = 0x00000010; // -d | --debug <val>
static const int DoDebug = 0x0000000000000010LL; // -d | --debug <val>

static const int OpForce = 'f';
static const int DoForce = 0x00000020; // -f | --force
static const int DoForce = 0x0000000000000020LL; // -f | --force

static const int OpHelp = 'h';
static const int DoHelp = 0x00000040; // -h | --help
static const int DoHelp = 0x0000000000000040LL; // -h | --help

static const int OpIfile = 'I';
static const int DoIfile = 0x00000080; // -I | --infiles
static const int DoIfile = 0x0000000000000080LL; // -I | --infiles

static const int OpLicense = 'H'; // -H | --license
static const int OpLicense = 'H'; // -H | --license

static const int OpNoPbar = 'N';
static const int DoNoPbar = 0x00000100; // -N | --nopbar | -np {legacy}
static const int OpNoPbar = 'N'; // -N | --nopbar | -np {legacy}
static const int DoNoPbar = 0x0000000000000100LL;

static const int OpPath = 'p';
static const int DoPath = 0x00800000; // -p | --path
static const int DoPath = 0x0000000000800000LL; // -p | --path

static const int OpPosc = 'P';
static const int DoPosc = 0x00000200; // -P | --posc
static const int DoPosc = 0x0000000000000200LL; // -P | --posc

static const int OpProxy = 'D';
static const int DoProxy = 0x00000400; // -D | --proxy
static const int DoProxy = 0x0000000000000400LL; // -D | --proxy

static const int OpRecurse = 'r';
static const int OpRecursv = 'R';
static const int DoRecurse = 0x00000800; // -r | --recursive | -R {legacy}
static const int OpRecursv = 'R'; // -r | --recursive | -R {legacy}
static const int DoRecurse = 0x0000000000000800LL;

static const int OpRetry = 't';
static const int DoRetry = 0x00001000; // -t | --retry
static const int DoRetry = 0x0000000000001000LL; // -t | --retry

static const int OpServer = 0x03;
static const int DoServer = 0x00002000; // --server
static const int DoServer = 0x0000000000002000LL; // --server

static const int OpSilent = 's';
static const int DoSilent = 0x00004000; // -s | --silent
static const int DoSilent = 0x0000000000004000LL; // -s | --silent

static const int OpSources = 'y';
static const int DoSources = 0x00008000; // -y | --sources
static const int DoSources = 0x0000000000008000LL; // -y | --sources

static const int OpStreams = 'S';
static const int DoStreams = 0x00010000; // -S | --streams
static const int DoStreams = 0x0000000000010000LL; // -S | --streams

static const int OpTpc = 'T';
static const int DoTpc = 0x00020000; // -T | --tpc {first | only}
static const int DoTpcOnly = 0x00100000; // -T | --tpc only
static const int DoTpcDlgt = 0x00800000; // -T | --tpc delegate ...
static const int OpTpc = 'T'; // -T | --tpc [delegate] {first | only}
static const int DoTpc = 0x0000000000020000LL; // --tpc {first | only}
static const int DoTpcOnly = 0x0000000000100000LL; // --tpc only
static const int DoTpcDlgt = 0x0000000000800000LL; // --tpc delegate ...

static const int OpVerbose = 'v';
static const int DoVerbose = 0x00040000; // -v | --verbose
static const int DoVerbose = 0x0000000000040000LL; // -v | --verbose

static const int OpVersion = 'V'; // -V | --version
static const int OpVersion = 'V'; // -V | --version

static const int OpXrate = 'X';
static const int DoXrate = 0x00080000; // -X | --xrate
static const int DoXrate = 0x0000000000080000LL; // -X | --xrate

static const int OpParallel = 0x04;
static const int DoParallel = 0x00200000; // --parallel
static const int DoParallel = 0x0000000000200000LL; // --parallel

static const int OpDynaSrc = 'Z';
static const int DoDynaSrc = 0x00400000; // --dynamic-src
static const int DoDynaSrc = 0x0000000000400000LL; // --dynamic-src

// const int DoTpcDlgt = 0x00800000; // Marker to show bit used
// const int DoTpcDlgt = 0x0000000000800000LL; // Marker for bit used

static const int OpZip = 'z';
static const int DoZip = 0x01000000;// --zip
static const int DoZip = 0x0000000001000000LL; // -z | --zip

static const int OpTlsData = 'E';
static const int DoTlsData = 0x0000000002000000LL; // -E | --tlsdata

static const int OpNoTlsOK = 0x05;
static const int DoNoTlsOK = 0x0000000004000000LL; // --notlsok

// Flag to allow the use of HTTP (and HTTPS) as source and destination
// protocols. If specified, the XrdClHttp client plugin must be available
Expand Down

0 comments on commit ddb76a9

Please sign in to comment.