00001 #ifndef __XRDCPCONFIG_HH__
00002 #define __XRDCPCONFIG_HH__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "XrdCks/XrdCksData.hh"
00034
00035 #include <ctype.h>
00036 #include <stdint.h>
00037
00038 struct option;
00039 class XrdCks;
00040 class XrdCksCalc;
00041 class XrdCpFile;
00042 class XrdSysError;
00043
00044 class XrdCpConfig
00045 {
00046 public:
00047
00048 struct defVar
00049 { defVar *Next;
00050 const char *vName;
00051 union {const char *strVal;
00052 int intVal;
00053 };
00054 defVar(const char *vn, const char *vl)
00055 : Next(0), vName(vn), strVal(vl) {}
00056 defVar(const char *vn, int vl)
00057 : Next(0), vName(vn), intVal(vl) {}
00058 };
00059
00060 defVar *intDefs;
00061 defVar *strDefs;
00062 const char *dstOpq;
00063 const char *srcOpq;
00064 const char *Pgm;
00065 long long xRate;
00066 int Parallel;
00067 char *pHost;
00068 int pPort;
00069 long long OpSpec;
00070 int Dlvl;
00071 int nSrcs;
00072 int nStrm;
00073 int Retry;
00074 int Verbose;
00075 int CksLen;
00076
00077 int numFiles;
00078 long long totBytes;
00079
00080 XrdCksData CksData;
00081 XrdCks *CksMan;
00082 XrdCksCalc *CksObj;
00083 const char *CksVal;
00084
00085 XrdCpFile *srcFile;
00086 XrdCpFile *dstFile;
00087
00088 char *zipFile;
00089
00090 static XrdSysError *Log;
00091
00092 static const uint64_t OpCksum = 'C';
00093 static const uint64_t DoCksrc = 0x0000000000000001LL;
00094 static const uint64_t DoCksum = 0x0000000000000002LL;
00095 static const uint64_t DoCkprt = 0x0000000000000004LL;
00096
00097 static const uint64_t OpCoerce = 'F';
00098 static const uint64_t DoCoerce = 0x0000000000000008LL;
00099
00100 static const uint64_t OpDebug = 'd';
00101 static const uint64_t DoDebug = 0x0000000000000010LL;
00102
00103 static const uint64_t OpForce = 'f';
00104 static const uint64_t DoForce = 0x0000000000000020LL;
00105
00106 static const uint64_t OpHelp = 'h';
00107 static const uint64_t DoHelp = 0x0000000000000040LL;
00108
00109 static const uint64_t OpIfile = 'I';
00110 static const uint64_t DoIfile = 0x0000000000000080LL;
00111
00112 static const uint64_t OpLicense = 'H';
00113
00114 static const uint64_t OpNoPbar = 'N';
00115 static const uint64_t DoNoPbar = 0x0000000000000100LL;
00116
00117 static const uint64_t OpPosc = 'P';
00118 static const uint64_t DoPosc = 0x0000000000000200LL;
00119
00120 static const uint64_t OpProxy = 'D';
00121 static const uint64_t DoProxy = 0x0000000000000400LL;
00122
00123 static const uint64_t OpRecurse = 'r';
00124 static const uint64_t OpRecursv = 'R';
00125 static const uint64_t DoRecurse = 0x0000000000000800LL;
00126
00127 static const uint64_t OpRetry = 't';
00128 static const uint64_t DoRetry = 0x0000000000001000LL;
00129
00130 static const uint64_t OpServer = 0x03;
00131 static const uint64_t DoServer = 0x0000000000002000LL;
00132
00133 static const uint64_t OpSilent = 's';
00134 static const uint64_t DoSilent = 0x0000000000004000LL;
00135
00136 static const uint64_t OpSources = 'y';
00137 static const uint64_t DoSources = 0x0000000000008000LL;
00138
00139 static const uint64_t OpStreams = 'S';
00140 static const uint64_t DoStreams = 0x0000000000010000LL;
00141
00142 static const uint64_t OpTpc = 'T';
00143 static const uint64_t DoTpc = 0x0000000000020000LL;
00144 static const uint64_t DoTpcOnly = 0x0000000000100000LL;
00145 static const uint64_t DoTpcDlgt = 0x0000000000800000LL;
00146
00147 static const uint64_t OpVerbose = 'v';
00148 static const uint64_t DoVerbose = 0x0000000000040000LL;
00149
00150 static const uint64_t OpVersion = 'V';
00151
00152 static const uint64_t OpXrate = 'X';
00153 static const uint64_t DoXrate = 0x0000000000080000LL;
00154
00155 static const uint64_t OpParallel = 0x04;
00156 static const uint64_t DoParallel = 0x0000000000200000LL;
00157
00158 static const uint64_t OpDynaSrc = 'Z';
00159 static const uint64_t DoDynaSrc = 0x0000000000400000LL;
00160
00161
00162
00163 static const uint64_t OpZip = 'z';
00164 static const uint64_t DoZip = 0x0000000001000000LL;
00165
00166 static const uint64_t OpTlsNoData = 'E';
00167 static const uint64_t DoTlsNoData = 0x0000000002000000LL;
00168
00169 static const uint64_t OpNoTlsOK = 0x05;
00170 static const uint64_t DoNoTlsOK = 0x0000000004000000LL;
00171
00172 static const uint64_t OpTlsMLF = 0x06;
00173 static const uint64_t DoTlsMLF = 0x0000000008000000LL;
00174
00175 static const uint64_t OpPath = 'p';
00176 static const uint64_t DoPath = 0x0000000010000000LL;
00177
00178 static const uint64_t OpXAttr = 0x07;
00179 static const uint64_t DoXAttr = 0x0000000020000000LL;
00180
00181 static const uint64_t OpZipMtlnCksum = 0x08;
00182 static const uint64_t DoZipMtlnCksum = 0x0000000040000000LL;
00183
00184 static const uint64_t OpRmOnBadCksum = 0x09;
00185 static const uint64_t DoRmOnBadCksum = 0x0000000080000000LL;
00186
00187 static const uint64_t OpContinue = 0x10;
00188 static const uint64_t DoContinue = 0x0000000100000000LL;
00189
00190
00191
00192
00193 static const int OpAllowHttp = 'A';
00194 static const int DoAllowHttp = 0x2000000;
00195
00196
00197
00198
00199
00200 static const int opt1Src = 0x00000001;
00201 static const int optNoXtnd = 0x00000002;
00202 static const int optRmtRec = 0x00000004;
00203 static const int optNoStdIn = 0x00000008;
00204 static const int optNoLclCp = 0x00000010;
00205
00206 void Config(int argc, char **argv, int Opts=0);
00207
00208
00209
00210 inline int Want(uint64_t What) {return (OpSpec & What) != 0;}
00211
00212 XrdCpConfig(const char *pgname);
00213 ~XrdCpConfig();
00214
00215 private:
00216 int a2i(const char *item, int *val, int minv, int maxv=-1);
00217 int a2l(const char *item, long long *val,
00218 long long minv, long long maxv=-1);
00219 int a2t(const char *item, int *val, int minv, int maxv=-1);
00220 int a2x(const char *Val, char *Buff, int Vlen);
00221 int a2z(const char *item, long long *val,
00222 long long minv, long long maxv=-1);
00223 int defCks(const char *opval);
00224 int defOpq(const char *theOp);
00225 int defOpt(const char *theOp, const char *theArg);
00226 void defPxy(const char *opval);
00227 const char *Human(long long Val, char *Buff, int Blen);
00228 int Legacy(int oIndex);
00229 int Legacy(const char *theOp, const char *theArg);
00230 void License();
00231 const char *OpName();
00232 void ProcFile(const char *fname);
00233 void Usage(int rc=0);
00234
00235 static void toLower( char cstr[] )
00236 {
00237 for( int i = 0; cstr[i]; ++i )
00238 cstr[i] = tolower( cstr[i] );
00239 }
00240
00241
00242 const char *PName;
00243 int Opts;
00244 int Argc;
00245 char **Argv;
00246 defVar *intDend;
00247 defVar *strDend;
00248
00249 static const char *opLetters;
00250 static struct option opVec[];
00251
00252 static const int dfltSrcs = 12;
00253
00254 XrdCpFile *pFile;
00255 XrdCpFile *pLast;
00256 XrdCpFile *pPrev;
00257 char *inFile;
00258 char **parmVal;
00259 int parmCnt;
00260 int isLcl;
00261 };
00262 #endif