Loading...
Searching...
No Matches
XrdPssUrlInfo Class Reference

`#include <XrdPssUrlInfo.hh>`

Collaboration diagram for XrdPssUrlInfo:

## Public Member Functions

| XrdPssUrlInfo (XrdOucEnv *envP, const char *path, const char *xtra="", bool addusrcgi=true, bool addident=true)
| ~XrdPssUrlInfo ()
bool | addCGI (const char *prot, char *buff, int blen)
bool | Extend (const char *cgi, int cgiln)
const char * | getID ()
bool | hasCGI ()
void | setID (const char *tid=0)
void | setID (XrdOucSid *sP)
const char * | thePath ()
const char * | Tident ()

## Static Public Member Functions

static void | setMapID (bool onoff)

## Detailed Description

Definition at line 37 of file XrdPssUrlInfo.hh.

## Constructor & Destructor Documentation

## XrdPssUrlInfo()

XrdPssUrlInfo::XrdPssUrlInfo | ( | XrdOucEnv * | envP,
|  | const char * | path,
|  | const char * | xtra = "",
|  | bool | addusrcgi = true,
|  | bool | addident = true )

Definition at line 109 of file XrdPssUrlInfo.cc.

: Path(path), CgiUsr(""), CgiUsz(0), CgiSsz(0), sidP(0),
eIDvalid(false)
{
const char *amp1= "", *amp2 = "";
// Preset for no id in the url
//
*theID = 0;
tident = 0;
// If there is an environment point, get user's cgi and set the tident from it
//
if (envP)
{if (addusrcgi && !(CgiUsr = envP->Env(CgiUsz))) CgiUsr = "";
const XrdSecEntity *secP = envP->secEnv();
if (secP)
{entityID = secP->ueid;
eIDvalid = true;
tident = secP->tident;
}
}
// Make sure we have a tident
//
if (!tident) tident = "unk.0:0@host";
// Generate additional cgi information as needed
//
if (*xtra && *xtra != '&') amp2 = "&";
if (CgiUsz) amp1 = "&";
if (addident)
{CgiSsz = snprintf(CgiSfx, sizeof(CgiSfx),
"%spss.tid=%s%s%s", amp1, tident, amp2, xtra);
} else {
if (*xtra) CgiSsz = snprintf(CgiSfx, sizeof(CgiSfx), "%s%s", amp1, xtra);
else *CgiSfx = 0;
}
}
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
XrdOucEnv::Env
char * Env(int &envlen)
Definition XrdOucEnv.hh:48
XrdOucEnv::secEnv
const XrdSecEntity * secEnv() const
Definition XrdOucEnv.hh:107
XrdSecEntity::tident
const char * tident
Trace identifier always preset.
Definition XrdSecEntity.hh:81
XrdSecEntity::ueid
unsigned int ueid
Unique ID of entity instance.
Definition XrdSecEntity.hh:79
XrdProxy::envP
XrdOucEnv * envP
Definition XrdPss.cc:109

References XrdOucEnv::Env(), XrdOucEnv::secEnv(), XrdSecEntity::tident, and XrdSecEntity::ueid.

Here is the call graph for this function:

## ~XrdPssUrlInfo()

XrdPssUrlInfo::~XrdPssUrlInfo | ( |  | ) |

inline

Definition at line 66 of file XrdPssUrlInfo.hh.

{if (*theID == 'p' && sidP) sidP->Release(&idVal);}

## Member Function Documentation

## addCGI()

bool XrdPssUrlInfo::addCGI | ( | const char * | prot,
|  | char * | buff,
|  | int | blen )

Definition at line 155 of file XrdPssUrlInfo.cc.

{
bool forXrd = XrdPssUtils::is4Xrootd(prot);
// Short circuit all of this if there is no cgi
//
if (!CgiUsz && (!CgiSsz || forXrd))
{*buff = 0;
return true;
}
// Make sure that we can fit whatever CGI we have into the buffer. Include the
// implicit question mark and ending null byte.
//
int n = CgiUsz + (forXrd ? CgiSsz : 0) + 1;
if (n >= blen) return false;
*buff++ = '?'; blen--;
// If the protocol is headed to an xroot server then we need to remove any
// offending CGI elements from the user CGI. Otherwise, we can use the CGI
// that was specified by the client.
//
if (CgiUsz)
{if (forXrd) n = copyCGI(CgiUsr, buff, blen);
else {n = CgiUsz;
strcpy(buff, CgiUsr);
}
buff += n; blen -= n;
}
// If this is destined to an xroot server, add any extended CGI.
//
if (forXrd && CgiSsz)
{if (CgiSsz >= blen) return false;
strcpy(buff, CgiSfx);
} else *buff = 0;
// All done
//
//std::cerr <<"Final URL: '" <<prot <<"' " <<strlen(prot) <<'\n' <<std::flush;
return true;
}
XrdPssUtils::is4Xrootd
static bool is4Xrootd(const char *pname)
Definition XrdPssUtils.cc:68

References XrdPssUtils::is4Xrootd().

Referenced by XrdPssSys::P2OUT(), and XrdPssSys::P2URL().

Here is the call graph for this function:
Here is the caller graph for this function:

## Extend()

bool XrdPssUrlInfo::Extend | ( | const char * | cgi,
|  | int | cgiln )

Definition at line 202 of file XrdPssUrlInfo.cc.

{
const char *amp = (*cgi == '&' ? "" : "&");
int blen = sizeof(CgiSfx) - CgiSsz;
if (blen <= cgiln) return false;
int n = snprintf(&CgiSfx[CgiSsz], blen, "%s%s", amp, cgi);
if (n >= blen) return false;
CgiSsz += n;
return true;
}

## getID()

const char * XrdPssUrlInfo::getID | ( |  | ) |

inline

Definition at line 45 of file XrdPssUrlInfo.hh.

{return theID;}

Referenced by XrdPssSys::P2OUT(), and XrdPssSys::P2URL().

Here is the caller graph for this function:

## hasCGI()

bool XrdPssUrlInfo::hasCGI | ( |  | ) |

inline

Definition at line 47 of file XrdPssUrlInfo.hh.

{return CgiSsz || CgiUsz;}

Referenced by XrdPssSys::P2URL().

Here is the caller graph for this function:

## setID() [1/2]

void XrdPssUrlInfo::setID | ( | const char * | tid = 0 | ) |

Definition at line 218 of file XrdPssUrlInfo.cc.

{
const char *atP, *colon;
// If we are mapping id then use the entity's idenification
//
if (MapID && eIDvalid)
{const char *fmt = (entityID & 0xf0000000 ? "%x@" : "U%x@");
snprintf(theID, sizeof(theID), fmt, entityID); // 8+1+nul = 10 bytes
return;
}
// Use the connection file descriptor number as the id lgnid.pid:fd@host
//
if (tid == 0) tid = tident;
if ((colon = index(tid, ':')) && (atP = index(colon+1, '@')))
{int n = atP - colon;
if (n <= (int)sizeof(theID))
{*theID = 'u';
strncpy(theID+1, colon+1, n); // Include '@'
theID[n+1] = 0;
} else *theID = 0;
} else *theID = 0;
}

Referenced by XrdPssCks::Get(), XrdPssFile::Open(), XrdPssDir::Opendir(), and XrdPssSys::Stat().

Here is the caller graph for this function:

## setID() [2/2]

void XrdPssUrlInfo::setID | ( | XrdOucSid * | sP | ) |

inline

Definition at line 51 of file XrdPssUrlInfo.hh.

{if (sP != 0 && !(sP->Obtain(&idVal))) return;
sidP = sP;
snprintf(theID, sizeof(theID), "p%d@", idVal.sidS);
}
XrdOucSid::Obtain
bool Obtain(theSid *sidP)
Definition XrdOucSid.cc:70

References XrdOucSid::Obtain().

Here is the call graph for this function:

## setMapID()

void XrdPssUrlInfo::setMapID | ( | bool | onoff | ) |

inline static

Definition at line 57 of file XrdPssUrlInfo.hh.

{MapID = onoff;}

Referenced by XrdPssSys::ConfigMapID().

Here is the caller graph for this function:

## thePath()

const char * XrdPssUrlInfo::thePath | ( |  | ) |

inline

Definition at line 59 of file XrdPssUrlInfo.hh.

{return Path;}

Referenced by XrdPssSys::P2OUT(), and XrdPssSys::P2URL().

Here is the caller graph for this function:

## Tident()

const char * XrdPssUrlInfo::Tident | ( |  | ) |

inline

Definition at line 61 of file XrdPssUrlInfo.hh.

{return tident;}

Referenced by XrdPssCks::Get(), XrdPssSys::Mkdir(), XrdPssFile::Open(), XrdPssDir::Opendir(), XrdPssSys::Remdir(), XrdPssSys::Rename(), XrdPssSys::Stat(), XrdPssSys::Truncate(), and XrdPssSys::Unlink().

Here is the caller graph for this function:

The documentation for this class was generated from the following files:

- XrdPssUrlInfo.hh
- XrdPssUrlInfo.cc