00001 #ifndef _XRDPSS_URLINFO_H
00002 #define _XRDPSS_URLINFO_H
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 <stdio.h>
00034
00035 class XrdOucEnv;
00036
00037 class XrdPssUrlInfo
00038 {
00039 public:
00040
00041 bool addCGI(char *buff, int blen)
00042 {if ((CgiSsz + CgiUsz) >= blen) return false;
00043 int n = snprintf(buff, blen, "?%s%s", CgiUsr, CgiSfx);
00044 return n < blen;
00045 }
00046
00047 bool Extend(const char *cgi, int cgiln);
00048
00049 const char *getID() {return theID;}
00050
00051 bool hasCGI() {return CgiSsz || CgiUsz;}
00052
00053 void setID(const char *tid=0);
00054
00055 void setID(XrdOucSid *sP)
00056 {if (sP != 0 && !(sP->Obtain(&idVal))) return;
00057 sidP = sP;
00058 snprintf(theID, sizeof(theID), "p%d@", idVal.sidS);
00059 }
00060
00061 const char *thePath() {return Path;}
00062
00063 const char *Tident() {return tident;}
00064
00065 XrdPssUrlInfo(XrdOucEnv *envP, const char *path, const char *xtra="",
00066 bool addusrcgi=true, bool addident=true)
00067 : tident("unk.0:0@host"), Path(path), CgiBuff(0), CgiUsr(""), CgiUsz(0),
00068 CgiSsz(0), sidP(0) {Setup(envP, xtra, addusrcgi, addident);}
00069
00070 XrdPssUrlInfo(const char *tid, const char *path, const char *xtra="",
00071 bool addusrcgi=true, bool addident=true)
00072 : tident(tid), Path(path), CgiBuff(0), CgiUsr(""), CgiUsz(0),
00073 CgiSsz(0), sidP(0) {Setup(0, xtra, addusrcgi, addident);}
00074
00075 ~XrdPssUrlInfo() {if (*theID == 'p' && sidP) sidP->Release(&idVal);
00076 if (CgiBuff) free(CgiBuff);
00077 }
00078
00079 private:
00080 void Setup(XrdOucEnv *envP, const char *xtra, bool addusrcgi, bool addident);
00081
00082 const char *tident;
00083 const char *Path;
00084 char *CgiBuff;
00085 const char *CgiUsr;
00086 int CgiUsz;
00087 int CgiSsz;
00088 XrdOucSid *sidP;
00089 char theID[14];
00090 XrdOucSid::theSid idVal;
00091 char CgiSfx[512];
00092 };
00093 #endif