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
00037 struct option;
00038 class XrdCks;
00039 class XrdCksCalc;
00040 class XrdCpFile;
00041 class XrdSysError;
00042
00043 class XrdCpConfig
00044 {
00045 public:
00046
00047 struct defVar
00048 { defVar *Next;
00049 const char *vName;
00050 union {const char *strVal;
00051 int intVal;
00052 };
00053 defVar(const char *vn, const char *vl)
00054 : Next(0), vName(vn), strVal(vl) {}
00055 defVar(const char *vn, int vl)
00056 : Next(0), vName(vn), intVal(vl) {}
00057 };
00058
00059 defVar *intDefs;
00060 defVar *strDefs;
00061 const char *dstOpq;
00062 const char *srcOpq;
00063 const char *Pgm;
00064 long long xRate;
00065 int Parallel;
00066 char *pHost;
00067 int pPort;
00068 int OpSpec;
00069 int Dlvl;
00070 int nSrcs;
00071 int nStrm;
00072 int Retry;
00073 int Verbose;
00074 int CksLen;
00075
00076 int numFiles;
00077 long long totBytes;
00078
00079 XrdCksData CksData;
00080 XrdCks *CksMan;
00081 XrdCksCalc *CksObj;
00082 const char *CksVal;
00083
00084 XrdCpFile *srcFile;
00085 XrdCpFile *dstFile;
00086
00087 char *zipFile;
00088
00089 static XrdSysError *Log;
00090
00091 static const int OpCksum = 'C';
00092 static const int DoCksrc = 0x00000001;
00093 static const int DoCksum = 0x00000002;
00094 static const int DoCkprt = 0x00000004;
00095
00096 static const int OpCoerce = 'F';
00097 static const int DoCoerce = 0x00000008;
00098
00099 static const int OpDebug = 'd';
00100 static const int DoDebug = 0x00000010;
00101
00102 static const int OpForce = 'f';
00103 static const int DoForce = 0x00000020;
00104
00105 static const int OpHelp = 'h';
00106 static const int DoHelp = 0x00000040;
00107
00108 static const int OpIfile = 'I';
00109 static const int DoIfile = 0x00000080;
00110
00111 static const int OpLicense = 'H';
00112
00113 static const int OpNoPbar = 'N';
00114 static const int DoNoPbar = 0x00000100;
00115
00116 static const int OpPosc = 'P';
00117 static const int DoPosc = 0x00000200;
00118
00119 static const int OpProxy = 'D';
00120 static const int DoProxy = 0x00000400;
00121
00122 static const int OpRecurse = 'r';
00123 static const int OpRecursv = 'R';
00124 static const int DoRecurse = 0x00000800;
00125
00126 static const int OpRetry = 't';
00127 static const int DoRetry = 0x00001000;
00128
00129 static const int OpServer = 0x03;
00130 static const int DoServer = 0x00002000;
00131
00132 static const int OpSilent = 's';
00133 static const int DoSilent = 0x00004000;
00134
00135 static const int OpSources = 'y';
00136 static const int DoSources = 0x00008000;
00137
00138 static const int OpStreams = 'S';
00139 static const int DoStreams = 0x00010000;
00140
00141 static const int OpTpc = 'T';
00142 static const int DoTpc = 0x00020000;
00143 static const int DoTpcOnly = 0x00100000;
00144 static const int DoTpcDlgt = 0x00800000;
00145
00146 static const int OpVerbose = 'v';
00147 static const int DoVerbose = 0x00040000;
00148
00149 static const int OpVersion = 'V';
00150
00151 static const int OpXrate = 'X';
00152 static const int DoXrate = 0x00080000;
00153
00154 static const int OpParallel = 0x04;
00155 static const int DoParallel = 0x00200000;
00156
00157 static const int OpDynaSrc = 'Z';
00158 static const int DoDynaSrc = 0x00400000;
00159
00160
00161
00162 static const int OpZip = 'z';
00163 static const int DoZip = 0x01000000;
00164
00165 static const int OpPath = 'p';
00166 static const int DoPath = 0x0000000010000000LL;
00167
00168
00169
00170
00171 static const int OpAllowHttp = 'A';
00172 static const int DoAllowHttp = 0x2000000;
00173
00174
00175
00176
00177
00178 static const int opt1Src = 0x00000001;
00179 static const int optNoXtnd = 0x00000002;
00180 static const int optRmtRec = 0x00000004;
00181 static const int optNoStdIn = 0x00000008;
00182 static const int optNoLclCp = 0x00000010;
00183
00184 void Config(int argc, char **argv, int Opts=0);
00185
00186
00187
00188 inline int Want(int What) {return (OpSpec & What) != 0;}
00189
00190 XrdCpConfig(const char *pgname);
00191 ~XrdCpConfig();
00192
00193 private:
00194 int a2i(const char *item, int *val, int minv, int maxv=-1);
00195 int a2l(const char *item, long long *val,
00196 long long minv, long long maxv=-1);
00197 int a2t(const char *item, int *val, int minv, int maxv=-1);
00198 int a2x(const char *Val, char *Buff, int Vlen);
00199 int a2z(const char *item, long long *val,
00200 long long minv, long long maxv=-1);
00201 int defCks(const char *opval);
00202 int defOpq(const char *theOp);
00203 int defOpt(const char *theOp, const char *theArg);
00204 void defPxy(const char *opval);
00205 const char *Human(long long Val, char *Buff, int Blen);
00206 int Legacy(int oIndex);
00207 int Legacy(const char *theOp, const char *theArg);
00208 void License();
00209 const char *OpName();
00210 void ProcFile(const char *fname);
00211 void Usage(int rc=0);
00212
00213 static void toLower( char cstr[] )
00214 {
00215 for( int i = 0; cstr[i]; ++i )
00216 cstr[i] = tolower( cstr[i] );
00217 }
00218
00219
00220 const char *PName;
00221 int Opts;
00222 int Argc;
00223 char **Argv;
00224 defVar *intDend;
00225 defVar *strDend;
00226
00227 static const char *opLetters;
00228 static struct option opVec[];
00229
00230 static const int dfltSrcs = 12;
00231
00232 XrdCpFile *pFile;
00233 XrdCpFile *pLast;
00234 XrdCpFile *pPrev;
00235 char *inFile;
00236 char **parmVal;
00237 int parmCnt;
00238 int isLcl;
00239 };
00240 #endif