Loading...
Searching...
No Matches
XrdCmsParser Class Reference

`#include <XrdCmsParser.hh>`

Collaboration diagram for XrdCmsParser:

## Public Member Functions

| XrdCmsParser ()
| ~XrdCmsParser ()
int | Parse (int rnum, const char *Aps, const char *Apt, XrdCmsRRData *Data)
int | Parse (XrdCms::CmsLoginData *Data, const char *Aps, const char *Apt)

## Static Public Member Functions

static int | Decode (const char *Man, XrdCms::CmsRRHdr &hdr, XrdOucBuffer *dBuff, XrdOucErrInfo *eInfo)
static int | mapError (const char *ecode)
static int | mapError (int ecode)
static int | Pack (int rnum, struct iovec *iovP, struct iovec *iovE, char *Base, char *Work)
static XrdOucPupArgs * | PupArgs (int rnum)

## Static Public Attributes

static XrdOucPup | Pup

## Detailed Description

Definition at line 45 of file XrdCmsParser.hh.

## Constructor & Destructor Documentation

## XrdCmsParser()

XrdCmsParser::XrdCmsParser | ( |  | ) |

Definition at line 254 of file XrdCmsParser.cc.

{
static int Done = 0;
// Setup the Parse vector
//
if (!Done)
{vecArgs[kYR_login] = logArgs;
vecArgs[kYR_chmod] = fwdArgA;
vecArgs[kYR_locate] = locArgs;
vecArgs[kYR_mkdir] = fwdArgA;
vecArgs[kYR_mkpath] = fwdArgA;
vecArgs[kYR_mv] = fwdArgB;
vecArgs[kYR_prepadd] = padArgs;
vecArgs[kYR_prepdel] = pdlArgs;
vecArgs[kYR_rm] = fwdArgC;
vecArgs[kYR_rmdir] = fwdArgC;
vecArgs[kYR_select] = locArgs;
vecArgs[kYR_rm] = fwdArgC;
vecArgs[kYR_statfs] = pthArgs;
vecArgs[kYR_avail] = avlArgs;
vecArgs[kYR_gone] = pthArgs;
vecArgs[kYR_trunc] = fwdArgA;
vecArgs[kYR_try] = pthArgs;
vecArgs[kYR_have] = pthArgs;
vecArgs[kYR_load] = lodArgs;
vecArgs[kYR_state] = pthArgs;
Done = 1;
}
}
XrdCms::kYR_select
@ kYR_select
Definition YProtocol.hh:100
XrdCms::kYR_mkpath
@ kYR_mkpath
Definition YProtocol.hh:94
XrdCms::kYR_prepdel
@ kYR_prepdel
Definition YProtocol.hh:97
XrdCms::kYR_statfs
@ kYR_statfs
Definition YProtocol.hh:111
XrdCms::kYR_login
@ kYR_login
Definition YProtocol.hh:90
XrdCms::kYR_prepadd
@ kYR_prepadd
Definition YProtocol.hh:96
XrdCms::kYR_chmod
@ kYR_chmod
Definition YProtocol.hh:91
XrdCms::kYR_try
@ kYR_try
Definition YProtocol.hh:114
XrdCms::kYR_rmdir
@ kYR_rmdir
Definition YProtocol.hh:99
XrdCms::kYR_mkdir
@ kYR_mkdir
Definition YProtocol.hh:93
XrdCms::kYR_state
@ kYR_state
Definition YProtocol.hh:110
XrdCms::kYR_locate
@ kYR_locate
Definition YProtocol.hh:92
XrdCms::kYR_have
@ kYR_have
Definition YProtocol.hh:105
XrdCms::kYR_rm
@ kYR_rm
Definition YProtocol.hh:98
XrdCms::kYR_gone
@ kYR_gone
Definition YProtocol.hh:104
XrdCms::kYR_trunc
@ kYR_trunc
Definition YProtocol.hh:113
XrdCms::kYR_mv
@ kYR_mv
Definition YProtocol.hh:95
XrdCms::kYR_load
@ kYR_load
Definition YProtocol.hh:106
XrdCms::kYR_avail
@ kYR_avail
Definition YProtocol.hh:102

References XrdCms::kYR_avail, XrdCms::kYR_chmod, XrdCms::kYR_gone, XrdCms::kYR_have, XrdCms::kYR_load, XrdCms::kYR_locate, XrdCms::kYR_login, XrdCms::kYR_mkdir, XrdCms::kYR_mkpath, XrdCms::kYR_mv, XrdCms::kYR_prepadd, XrdCms::kYR_prepdel, XrdCms::kYR_rm, XrdCms::kYR_rmdir, XrdCms::kYR_select, XrdCms::kYR_state, XrdCms::kYR_statfs, XrdCms::kYR_trunc, and XrdCms::kYR_try.

## ~XrdCmsParser()

XrdCmsParser::~XrdCmsParser | ( |  | ) |

inline

Definition at line 81 of file XrdCmsParser.hh.

{}

## Member Function Documentation

## Decode()

int XrdCmsParser::Decode | ( | const char * | Man,
|  | XrdCms::CmsRRHdr & | hdr,
|  | XrdOucBuffer * | dBuff,
|  | XrdOucErrInfo * | eInfo )

static

Definition at line 291 of file XrdCmsParser.cc.

{
EPNAME("Decode");
static const int mvsz = static_cast<int>(sizeof(kXR_unt32));
kXR_unt32 uval;
int Result, msgval, msglen, dlen = dBuff->DataLen();
const char *Path = eInfo->getErrData(), *User = eInfo->getErrUser();
const char *Mgr = (Man ? Man : "?");
char *msg, *data = dBuff->Buffer();
// Path may be null here, fix it
//
if (!Path) Path = "";
// Responses are always in the form of <int><string>
//
if (dlen < mvsz) {msgval = 0; msg = (char *)""; msglen = 0;}
else {memcpy(&uval, data, mvsz);
msgval = static_cast<int>(ntohl(uval));
if (dlen == mvsz) {msg = (char *)""; msglen = 0;}
else {msg = data+mvsz; msglen = dlen - mvsz;}
}
// Now decode the response code
//
switch(hdr.rrCode)
{case kYR_redirect: Result = SFS_REDIRECT;
TRACE(Redirect, Mgr <<" redirects " <<User <<" to "
<<msg <<':' <<msgval <<' ' <<Path);
break;
case kYR_wait: Result = SFS_STALL;
TRACE(Redirect, Mgr <<" delays " <<User <<' ' <<msgval <<' ' <<Path);
break;
case kYR_waitresp: Result = SFS_STARTED;
TRACE(Redirect, Mgr <<" idles " <<User <<' ' <<msgval <<' ' <<Path);
break;
case kYR_data: Result = SFS_DATA; msgval = msglen;
TRACE(Redirect, Mgr <<" sent " <<User <<" '" <<msg <<"' " <<Path);
if (msglen > (int)XrdOucEI::Max_Error_Len)
{XrdOucBuffer *myBuff=dBuff->Highjack(XrdOucEI::Max_Error_Len);
if (myBuff)
{myBuff->SetLen(msglen, (msglen ? mvsz : 0));
eInfo->setErrInfo(msglen, myBuff);
return Result;
}
}
break;
case kYR_error: Result = SFS_ERROR;
if (msgval) msgval = -mapError(msgval);
TRACE(Redirect, Mgr <<" gave " <<User <<" err " <<msgval
<<" '" <<msg <<"' " <<Path);
break;
default: msgval=0; Result = SFS_ERROR;
msg = (char *)"Redirector protocol error";
TRACE(Redirect, User <<" given error msg '"
<<msg <<"' due to " << Mgr <<' ' <<Path);
}
// Insert the information into the error object
//
eInfo->setErrInfo(msgval, msg);
return Result;
}
kXR_unt32
unsigned int kXR_unt32
Definition XPtypes.hh:90
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
SFS_DATA
#define SFS_DATA
Definition XrdSfsInterface.hh:112
SFS_ERROR
#define SFS_ERROR
Definition XrdSfsInterface.hh:109
SFS_REDIRECT
#define SFS_REDIRECT
Definition XrdSfsInterface.hh:110
SFS_STALL
#define SFS_STALL
Definition XrdSfsInterface.hh:107
SFS_STARTED
#define SFS_STARTED
Definition XrdSfsInterface.hh:111
TRACE
#define TRACE(act, x)
Definition XrdTrace.hh:63
XrdCmsParser::mapError
static int mapError(const char *ecode)
Definition XrdCmsParser.cc:361
XrdOucBuffer::Buffer
char * Buffer() const
Definition XrdOucBuffer.hh:152
XrdOucBuffer::DataLen
int DataLen()
Definition XrdOucBuffer.hh:199
XrdOucBuffer::Highjack
XrdOucBuffer * Highjack(int bPsz=0)
Definition XrdOucBuffer.cc:230
XrdOucBuffer::SetLen
void SetLen(int dataL, int dataO=0)
Definition XrdOucBuffer.hh:241
XrdOucErrInfo::getErrUser
const char * getErrUser()
Definition XrdOucErrInfo.hh:297
XrdOucErrInfo::getErrData
const char * getErrData()
Definition XrdOucErrInfo.hh:333
XrdOucErrInfo::setErrInfo
int setErrInfo(int code, const char *emsg)
Definition XrdOucErrInfo.hh:147
XrdCms::kYR_data
@ kYR_data
Definition YProtocol.hh:141
XrdCms::kYR_redirect
@ kYR_redirect
Definition YProtocol.hh:143
XrdCms::kYR_wait
@ kYR_wait
Definition YProtocol.hh:144
XrdCms::kYR_waitresp
@ kYR_waitresp
Definition YProtocol.hh:145
XrdCms::kYR_error
@ kYR_error
Definition YProtocol.hh:142
XrdCms::CmsRRHdr::rrCode
kXR_char rrCode
Definition YProtocol.hh:84
XrdOucEI::Max_Error_Len
static const size_t Max_Error_Len
Definition XrdOucErrInfo.hh:51

References XrdOucBuffer::Buffer(), XrdOucBuffer::DataLen(), EPNAME, XrdOucErrInfo::getErrData(), XrdOucErrInfo::getErrUser(), XrdOucBuffer::Highjack(), XrdCms::kYR_data, XrdCms::kYR_error, XrdCms::kYR_redirect, XrdCms::kYR_wait, XrdCms::kYR_waitresp, mapError(), XrdOucEI::Max_Error_Len, Path, XrdCms::CmsRRHdr::rrCode, XrdOucErrInfo::setErrInfo(), XrdOucBuffer::SetLen(), SFS_DATA, SFS_ERROR, SFS_REDIRECT, SFS_STALL, SFS_STARTED, and TRACE.

Referenced by XrdCmsClientMsg::Reply().

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

## mapError() [1/2]

int XrdCmsParser::mapError | ( | const char * | ecode | ) |

static

Definition at line 361 of file XrdCmsParser.cc.

{
if (!strcmp("ENOENT", ecode)) return ENOENT;
if (!strcmp("EEXIST", ecode)) return EEXIST;
if (!strcmp("EPERM", ecode)) return EPERM;
if (!strcmp("EACCES", ecode)) return EACCES;
if (!strcmp("EIO", ecode)) return EIO;
if (!strcmp("ENOMEM", ecode)) return ENOMEM;
if (!strcmp("ENOSPC", ecode)) return ENOSPC;
if (!strcmp("ENAMETOOLONG", ecode)) return ENAMETOOLONG;
if (!strcmp("ENETUNREACH", ecode)) return ENETUNREACH;
if (!strcmp("ENOTBLK", ecode)) return ENOTBLK;
if (!strcmp("EISDIR", ecode)) return EISDIR;
return EINVAL;
}

Referenced by Decode().

Here is the caller graph for this function:

## mapError() [2/2]

int XrdCmsParser::mapError | ( | int | ecode | ) |

static

Definition at line 377 of file XrdCmsParser.cc.

{
switch(ecode)
{case kYR_ENOENT: return ENOENT;
case kYR_EPERM: return EPERM;
case kYR_EACCES: return EACCES;
case kYR_EIO: return EIO;
case kYR_ENOMEM: return ENOMEM;
case kYR_ENOSPC: return ENOSPC;
case kYR_ENAMETOOLONG: return ENAMETOOLONG;
case kYR_ENETUNREACH: return ENETUNREACH;
case kYR_ENOTBLK: return ENOTBLK;
case kYR_EISDIR: return EISDIR;
case kYR_FSError: return ENODEV;
case kYR_SrvError: return EFAULT;
case kYR_RWConflict: return EEXIST;
case kYR_noReplicas: return EADDRNOTAVAIL;
default: return EINVAL;
}
}
XrdCms::kYR_ENAMETOOLONG
@ kYR_ENAMETOOLONG
Definition YProtocol.hh:157
XrdCms::kYR_FSError
@ kYR_FSError
Definition YProtocol.hh:161
XrdCms::kYR_ENOSPC
@ kYR_ENOSPC
Definition YProtocol.hh:156
XrdCms::kYR_ENETUNREACH
@ kYR_ENETUNREACH
Definition YProtocol.hh:158
XrdCms::kYR_EACCES
@ kYR_EACCES
Definition YProtocol.hh:152
XrdCms::kYR_noReplicas
@ kYR_noReplicas
Definition YProtocol.hh:164
XrdCms::kYR_EIO
@ kYR_EIO
Definition YProtocol.hh:154
XrdCms::kYR_ENOMEM
@ kYR_ENOMEM
Definition YProtocol.hh:155
XrdCms::kYR_ENOENT
@ kYR_ENOENT
Definition YProtocol.hh:150
XrdCms::kYR_SrvError
@ kYR_SrvError
Definition YProtocol.hh:162
XrdCms::kYR_EISDIR
@ kYR_EISDIR
Definition YProtocol.hh:160
XrdCms::kYR_EPERM
@ kYR_EPERM
Definition YProtocol.hh:151
XrdCms::kYR_ENOTBLK
@ kYR_ENOTBLK
Definition YProtocol.hh:159
XrdCms::kYR_RWConflict
@ kYR_RWConflict
Definition YProtocol.hh:163

References XrdCms::kYR_EACCES, XrdCms::kYR_EIO, XrdCms::kYR_EISDIR, XrdCms::kYR_ENAMETOOLONG, XrdCms::kYR_ENETUNREACH, XrdCms::kYR_ENOENT, XrdCms::kYR_ENOMEM, XrdCms::kYR_ENOSPC, XrdCms::kYR_ENOTBLK, XrdCms::kYR_EPERM, XrdCms::kYR_FSError, XrdCms::kYR_noReplicas, XrdCms::kYR_RWConflict, and XrdCms::kYR_SrvError.

## Pack()

int XrdCmsParser::Pack | ( | int | rnum,
|  | struct iovec * | iovP,
|  | struct iovec * | iovE,
|  | char * | Base,
|  | char * | Work )

static

Definition at line 402 of file XrdCmsParser.cc.

{
XrdOucPupArgs *PArgs;
const char *reason;
char buff[16];
int iovcnt;
// Pack the request
//
if ((PArgs = PupArgs(rnum)))
if ((iovcnt = Pup.Pack(iovP, iovE, PArgs, Base, Work))) return iovcnt;
else reason = "too much data for code";
else reason = "invalid request code -";
// Indicate failure (we don't translate the request code as it drags in too
// many dependent object files, sigh.
//
sprintf(buff, "%d", rnum);
Say.Emsg("Pack", "Unable to pack request;", reason, buff);
return 0;
}
XrdCmsParser::PupArgs
static XrdOucPupArgs * PupArgs(int rnum)
Definition XrdCmsParser.hh:77
XrdCmsParser::Pup
static XrdOucPup Pup
Definition XrdCmsParser.hh:75
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95
XrdCms::Say
XrdSysError Say
Definition XrdCmsManager.cc:62

References Pup, PupArgs(), and XrdCms::Say.

Here is the call graph for this function:

## Parse() [1/2]

int XrdCmsParser::Parse | ( | int | rnum,
|  | const char * | Aps,
|  | const char * | Apt,
|  | XrdCmsRRData * | Data )

inline

Definition at line 66 of file XrdCmsParser.hh.

{Data->Opaque = Data->Opaque2 = Data->Path = 0;
return rnum < XrdCms::kYR_MaxReq
&& vecArgs[rnum] != 0
&& Pup.Unpack(Aps, Apt,
vecArgs[rnum], (char *)Data);
}
XrdCmsRRData::Path
char * Path
Definition XrdCmsRRData.hh:55
XrdCmsRRData::Opaque
char * Opaque
Definition XrdCmsRRData.hh:56
XrdCmsRRData::Opaque2
char * Opaque2
Definition XrdCmsRRData.hh:58
XrdCms::kYR_MaxReq
@ kYR_MaxReq
Definition YProtocol.hh:118

References XrdCms::kYR_MaxReq, XrdCmsRRData::Opaque, XrdCmsRRData::Opaque2, XrdCmsRRData::Path, and Pup.

## Parse() [2/2]

int XrdCmsParser::Parse | ( | XrdCms::CmsLoginData * | Data,
|  | const char * | Aps,
|  | const char * | Apt )

inline

Definition at line 59 of file XrdCmsParser.hh.

{Data->SID = Data->Paths = 0;
return Pup.Unpack(Aps,Apt,vecArgs[XrdCms::kYR_login],
(char *)Data);
}
XrdCms::CmsLoginData::Paths
kXR_char * Paths
Definition YProtocol.hh:289
XrdCms::CmsLoginData::SID
kXR_char * SID
Definition YProtocol.hh:288

References XrdCms::kYR_login, XrdCms::CmsLoginData::Paths, Pup, and XrdCms::CmsLoginData::SID.

## PupArgs()

XrdOucPupArgs * XrdCmsParser::PupArgs | ( | int | rnum | ) |

inline static

Definition at line 77 of file XrdCmsParser.hh.

{return rnum < XrdCms::kYR_MaxReq ? vecArgs[rnum] : 0;}

References XrdCms::kYR_MaxReq.

Referenced by Pack().

Here is the caller graph for this function:

## Member Data Documentation

## Pup

XrdOucPup XrdCmsParser::Pup

static

Definition at line 75 of file XrdCmsParser.hh.

Referenced by Pack(), Parse(), and Parse().

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

- XrdCmsParser.hh
- XrdCmsParser.cc