XRootD
Loading...
Searching...
No Matches
XrdCmsParser.hh
Go to the documentation of this file.
1#ifndef __XRDCMSPARSER_H__
2#define __XRDCMSPARSER_H__
3/******************************************************************************/
4/* */
5/* X r d C m s P a r s e r . h h */
6/* */
7/* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
34
36#include "XrdOuc/XrdOucPup.hh"
37
38/******************************************************************************/
39/* C l a s s X r d C m s P a r s e r */
40/******************************************************************************/
41
42class XrdOucErrInfo;
43class XrdOucBuffer;
44
46{
47public:
48
49static int Decode(const char *Man, XrdCms::CmsRRHdr &hdr,
50 XrdOucBuffer *dBuff, XrdOucErrInfo *eInfo);
51
52static int mapError(const char *ecode);
53
54static int mapError(int ecode);
55
56static int Pack(int rnum, struct iovec *iovP, struct iovec *iovE,
57 char *Base, char *Work);
58
59inline int Parse(XrdCms::CmsLoginData *Data,
60 const char *Aps, const char *Apt)
61 {Data->SID = Data->Paths = 0;
62 return Pup.Unpack(Aps,Apt,vecArgs[XrdCms::kYR_login],
63 (char *)Data);
64 }
65
66inline int Parse(int rnum, const char *Aps, const char *Apt,
67 XrdCmsRRData *Data)
68 {Data->Opaque = Data->Opaque2 = Data->Path = 0;
69 return rnum < XrdCms::kYR_MaxReq
70 && vecArgs[rnum] != 0
71 && Pup.Unpack(Aps, Apt,
72 vecArgs[rnum], (char *)Data);
73 }
74
76
77static XrdOucPupArgs *PupArgs(int rnum)
78 {return rnum < XrdCms::kYR_MaxReq ? vecArgs[rnum] : 0;}
79
82
83private:
84
85static const char **PupNVec;
86static XrdOucPupNames PupName;
87
88static XrdOucPupArgs fwdArgA[]; // chmod | mkdir | mkpath | trunc
89static XrdOucPupArgs fwdArgB[]; // mv
90static XrdOucPupArgs fwdArgC[]; // rm | rmdir
91static XrdOucPupArgs locArgs[]; // locate | select
92static XrdOucPupArgs padArgs[]; // prepadd
93static XrdOucPupArgs pdlArgs[]; // prepdel
94static XrdOucPupArgs avlArgs[]; // avail
95static XrdOucPupArgs pthArgs[]; // statfs | try
96static XrdOucPupArgs lodArgs[]; // load
97static XrdOucPupArgs logArgs[]; // login
98
99static XrdOucPupArgs *vecArgs[XrdCms::kYR_MaxReq];
100};
101
102namespace XrdCms
103{
104extern XrdCmsParser Parser;
105}
106#endif
static int mapError(const char *ecode)
static XrdOucPupArgs * PupArgs(int rnum)
static int Pack(int rnum, struct iovec *iovP, struct iovec *iovE, char *Base, char *Work)
int Parse(int rnum, const char *Aps, const char *Apt, XrdCmsRRData *Data)
static int Decode(const char *Man, XrdCms::CmsRRHdr &hdr, XrdOucBuffer *dBuff, XrdOucErrInfo *eInfo)
static XrdOucPup Pup
int Parse(XrdCms::CmsLoginData *Data, const char *Aps, const char *Apt)
static int Unpack(char **buff, const char *bend, char **data, int &dlen)
Definition XrdOucPup.cc:250
XrdCmsParser Parser
@ kYR_login
Definition YProtocol.hh:90
@ kYR_MaxReq
Definition YProtocol.hh:118