XRootD
XrdOucTPC Class Reference

#include <XrdOucTPC.hh>

+ Collaboration diagram for XrdOucTPC:

Public Member Functions

 XrdOucTPC ()
 
 ~XrdOucTPC ()
 

Static Public Member Functions

static const char * cgiC2Dst (const char *cKey, const char *xSrc, const char *xLfn, const char *xCks, char *Buff, int Blen, int strms=0, const char *iHst=0, const char *sprt=0, const char *tprt=0, bool dlgon=false, bool push=false)
 
static const char * cgiC2Src (const char *cKey, const char *xDst, int xTTL, char *Buff, int Blen)
 
static const char * cgiD2Src (const char *cKey, const char *cOrg, char *Buff, int Blen)
 
static int copyCGI (const char *cgi, char *Buff, int Blen)
 

Static Public Attributes

static const char * tpcCks = "tpc.cks"
 
static const char * tpcDlg = "tpc.dlg"
 
static const char * tpcDlgOn = "tpc.dlgon"
 
static const char * tpcDst = "tpc.dst"
 
static const char * tpcKey = "tpc.key"
 
static const char * tpcLfn = "tpc.lfn"
 
static const char * tpcOrg = "tpc.org"
 
static const char * tpcPsh = "tpc.psh"
 
static const char * tpcSgi = "tpc.scgi"
 
static const char * tpcSpr = "tpc.spr"
 
static const char * tpcSrc = "tpc.src"
 
static const char * tpcStr = "tpc.str"
 
static const char * tpcTpr = "tpc.tpr"
 
static const char * tpcTtl = "tpc.ttl"
 

Detailed Description

Definition at line 35 of file XrdOucTPC.hh.

Constructor & Destructor Documentation

◆ XrdOucTPC()

XrdOucTPC::XrdOucTPC ( )
inline

Definition at line 70 of file XrdOucTPC.hh.

70 {}

◆ ~XrdOucTPC()

XrdOucTPC::~XrdOucTPC ( )
inline

Definition at line 71 of file XrdOucTPC.hh.

71 {}

Member Function Documentation

◆ cgiC2Dst()

const char * XrdOucTPC::cgiC2Dst ( const char *  cKey,
const char *  xSrc,
const char *  xLfn,
const char *  xCks,
char *  Buff,
int  Blen,
int  strms = 0,
const char *  iHst = 0,
const char *  sprt = 0,
const char *  tprt = 0,
bool  dlgon = false,
bool  push = false 
)
static

Definition at line 62 of file XrdOucTPC.cc.

69 {
70  tpcInfo Info;
71  char *bP = Buff;
72  int n;
73 
74 // Make sure we have the minimum amount of information here
75 //
76  if (!cKey || !xSrc || Blen <= 0) return "!Invalid cgi parameters.";
77 
78 // Generate the full name of the source
79 //
80  if (!cgiHost(Info, xSrc)) return "!Invalid source specification.";
81 
82 // Construct the cgi string. For the destination we need the full source spec
83 //
84  n = snprintf(bP, Blen, "%s=%s&%s=%s%s%s", tpcKey, cKey, tpcSrc,
85  Info.uName, Info.hName, Info.pName);
86  if (xLfn)
87  {bP += n; Blen -= n;
88  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%s", tpcLfn, xLfn);
89  }
90  if (xCks)
91  {bP += n; Blen -= n;
92  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%s", tpcCks, xCks);
93  }
94 
95  if (strms > 0)
96  {bP += n; Blen -= n;
97  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%d", tpcStr, strms);
98  }
99 
100  if (iHst)
101  {bP += n; Blen -= n;
102  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%s", tpcDlg, iHst);
103  }
104 
105  if (sprt)
106  {bP += n; Blen -= n;
107  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%s", tpcSpr, sprt);
108  }
109 
110  if (tprt)
111  {bP += n; Blen -= n;
112  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%s", tpcTpr, tprt);
113  }
114 
115  if (push)
116  {bP += n; Blen -= n;
117  if (Blen > 1) n = snprintf(bP, Blen, "&%s=1", tpcPsh);
118  }
119 
120  // tpc.dlgon
121  {bP += n; Blen -= n;
122  const char* cgistr = dlgon ? "&%s=1" : "&%s=0";
123  if (Blen > 1) n = snprintf(bP, Blen, cgistr, tpcDlgOn);
124  }
125 
126 
127 // All done
128 //
129  return (n > Blen ? "!Unable to generate full cgi." : Buff);
130 }
@ Info
static const char * tpcSpr
Definition: XrdOucTPC.hh:63
static const char * tpcDlgOn
Definition: XrdOucTPC.hh:68
static const char * tpcTpr
Definition: XrdOucTPC.hh:66
static const char * tpcLfn
Definition: XrdOucTPC.hh:59
static const char * tpcKey
Definition: XrdOucTPC.hh:58
static const char * tpcDlg
Definition: XrdOucTPC.hh:56
static const char * tpcSrc
Definition: XrdOucTPC.hh:64
static const char * tpcCks
Definition: XrdOucTPC.hh:55
static const char * tpcPsh
Definition: XrdOucTPC.hh:61
static const char * tpcStr
Definition: XrdOucTPC.hh:65

References Info, tpcCks, tpcDlg, tpcDlgOn, tpcKey, tpcLfn, tpcPsh, tpcSpr, tpcSrc, tpcStr, and tpcTpr.

◆ cgiC2Src()

const char * XrdOucTPC::cgiC2Src ( const char *  cKey,
const char *  xDst,
int  xTTL,
char *  Buff,
int  Blen 
)
static

Definition at line 136 of file XrdOucTPC.cc.

138 {
139  tpcInfo Info;
140  char *bP = Buff;
141  int n;
142 
143 // Make sure we have the minimum amount of information here
144 //
145  if (!cKey || !xDst || Blen <= 0) return "!Invalid cgi parameters.";
146 
147 // Generate the full name of the source
148 //
149  if (!cgiHost(Info, xDst)) return "!Invalid destination specification.";
150 
151 // Construct the cgi string. The source needs only the dest hostname.
152 //
153  n = snprintf(Buff, Blen, "%s=%s&%s=%s", tpcKey, cKey, tpcDst, Info.hName);
154  if (xTTL >= 0)
155  {bP += n; Blen -= n;
156  if (Blen > 1) n = snprintf(bP, Blen, "&%s=%d", tpcTtl, xTTL);
157  }
158 
159 // All done
160 //
161  return (n > Blen ? "!Unable to generate full cgi." : Buff);
162 }
static const char * tpcDst
Definition: XrdOucTPC.hh:57
static const char * tpcTtl
Definition: XrdOucTPC.hh:67

References Info, tpcDst, tpcKey, and tpcTtl.

◆ cgiD2Src()

const char * XrdOucTPC::cgiD2Src ( const char *  cKey,
const char *  cOrg,
char *  Buff,
int  Blen 
)
static

Definition at line 168 of file XrdOucTPC.cc.

170 {
171  int n;
172 
173 // Make sure we have the minimum amount of information here
174 //
175  if (!cKey || !cOrg || Blen <= 0) return "!Invalid cgi parameters.";
176 
177 // Construct the cgi string
178 //
179  n = snprintf(Buff, Blen, "%s=%s&%s=%s", tpcKey, cKey, tpcOrg, cOrg);
180 
181 // All done
182 //
183  return (n > Blen ? "!Unable to generate full cgi." : Buff);
184 }
static const char * tpcOrg
Definition: XrdOucTPC.hh:60

References tpcKey, and tpcOrg.

Referenced by XrdOfsTPC::Validate().

+ Here is the caller graph for this function:

◆ copyCGI()

int XrdOucTPC::copyCGI ( const char *  cgi,
char *  Buff,
int  Blen 
)
static

Definition at line 233 of file XrdOucTPC.cc.

234 {
235  const char *bgi;
236  char *bP = Buff;
237  int xlen;
238  bool eqs;
239 
240  if (!cgi) {*Buff = 0; return 0;}
241 
242 // Skip over initial ampersands
243 //
244  while(*cgi == '&' && *cgi) cgi++;
245 
246 // Check if there is anything here
247 //
248  if (!*cgi) {*Buff = 0; return 0;}
249  Blen--;
250 
251 // Copy all keys except system oriented ones.
252 //
253 //std::cerr <<"TPC cgi IN: " <<cgi <<'\n' <<std::flush;
254 do{bgi = cgi; eqs = false;
255  while(*cgi != '\t' && *cgi)
256  {if (*cgi == '=') eqs = true;
257  cgi++;
258  }
259  if (*bgi && eqs && strncmp(bgi, "tpc.", 4) && strncmp(bgi, "xrd.", 4)
260  && strncmp(bgi, "xrdcl.", 4))
261  {xlen = cgi - bgi;
262  if (bP != Buff && Blen > 0) {*bP++ = '&'; Blen--;}
263  if (xlen > Blen) xlen = Blen;
264  strncpy(bP, bgi, xlen);
265  bP += xlen;
266  Blen -= xlen;
267  }
268  while(*cgi && *cgi == '\t') cgi++;
269  } while(*cgi && Blen > 2);
270 
271 // Compute length and return
272 //
273  *bP = 0;
274 // std::cerr <<"TPC cgi OT: " <<Buff <<" len=" <<(bP-Buff) <<'\n' <<std::flush;
275  return bP - Buff;
276 }

Referenced by XrdOfsTPC::Validate().

+ Here is the caller graph for this function:

Member Data Documentation

◆ tpcCks

const char * XrdOucTPC::tpcCks = "tpc.cks"
static

Definition at line 55 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcDlg

const char * XrdOucTPC::tpcDlg = "tpc.dlg"
static

Definition at line 56 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcDlgOn

const char * XrdOucTPC::tpcDlgOn = "tpc.dlgon"
static

Definition at line 68 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsFile::open().

◆ tpcDst

const char * XrdOucTPC::tpcDst = "tpc.dst"
static

Definition at line 57 of file XrdOucTPC.hh.

Referenced by XrdOfsTPC::Authorize(), and cgiC2Src().

◆ tpcKey

const char * XrdOucTPC::tpcKey = "tpc.key"
static

Definition at line 58 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), cgiC2Src(), cgiD2Src(), and XrdOfsFile::open().

◆ tpcLfn

const char * XrdOucTPC::tpcLfn = "tpc.lfn"
static

Definition at line 59 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcOrg

const char * XrdOucTPC::tpcOrg = "tpc.org"
static

Definition at line 60 of file XrdOucTPC.hh.

Referenced by XrdOfsTPC::Authorize(), and cgiD2Src().

◆ tpcPsh

const char * XrdOucTPC::tpcPsh = "tpc.psh"
static

Definition at line 61 of file XrdOucTPC.hh.

Referenced by cgiC2Dst().

◆ tpcSgi

const char * XrdOucTPC::tpcSgi = "tpc.scgi"
static

Definition at line 62 of file XrdOucTPC.hh.

Referenced by XrdOfsTPC::Validate().

◆ tpcSpr

const char * XrdOucTPC::tpcSpr = "tpc.spr"
static

Definition at line 63 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcSrc

const char * XrdOucTPC::tpcSrc = "tpc.src"
static

Definition at line 64 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcStr

const char * XrdOucTPC::tpcStr = "tpc.str"
static

Definition at line 65 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcTpr

const char * XrdOucTPC::tpcTpr = "tpc.tpr"
static

Definition at line 66 of file XrdOucTPC.hh.

Referenced by cgiC2Dst(), and XrdOfsTPC::Validate().

◆ tpcTtl

const char * XrdOucTPC::tpcTtl = "tpc.ttl"
static

Definition at line 67 of file XrdOucTPC.hh.

Referenced by cgiC2Src(), and XrdOfsTPC::getTTL().


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