xrootd
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 
33 #include "XProtocol/YProtocol.hh"
34 
35 #include "XrdCms/XrdCmsRRData.hh"
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 
42 class XrdOucErrInfo;
43 
45 {
46 public:
47 
48 static int Decode(const char *Man, XrdCms::CmsRRHdr &hdr,
49  char *data, int dlen, XrdOucErrInfo *eInfo);
50 
51 static int mapError(const char *ecode);
52 
53 static int mapError(int ecode);
54 
55 static int Pack(int rnum, struct iovec *iovP, struct iovec *iovE,
56  char *Base, char *Work);
57 
58 inline int Parse(XrdCms::CmsLoginData *Data,
59  const char *Aps, const char *Apt)
60  {Data->SID = Data->Paths = 0;
61  return Pup.Unpack(Aps,Apt,vecArgs[XrdCms::kYR_login],
62  (char *)Data);
63  }
64 
65 inline int Parse(int rnum, const char *Aps, const char *Apt,
66  XrdCmsRRData *Data)
67  {Data->Opaque = Data->Opaque2 = Data->Path = 0;
68  return rnum < XrdCms::kYR_MaxReq
69  && vecArgs[rnum] != 0
70  && Pup.Unpack(Aps, Apt,
71  vecArgs[rnum], (char *)Data);
72  }
73 
74 static XrdOucPup Pup;
75 
76 static XrdOucPupArgs *PupArgs(int rnum)
77  {return rnum < XrdCms::kYR_MaxReq ? vecArgs[rnum] : 0;}
78 
79  XrdCmsParser();
81 
82 private:
83 
84 static const char **PupNVec;
86 
87 static XrdOucPupArgs fwdArgA[]; // chmod | mkdir | mkpath | trunc
88 static XrdOucPupArgs fwdArgB[]; // mv
89 static XrdOucPupArgs fwdArgC[]; // rm | rmdir
90 static XrdOucPupArgs locArgs[]; // locate | select
91 static XrdOucPupArgs padArgs[]; // prepadd
92 static XrdOucPupArgs pdlArgs[]; // prepdel
93 static XrdOucPupArgs avlArgs[]; // avail
94 static XrdOucPupArgs pthArgs[]; // statfs | try
95 static XrdOucPupArgs lodArgs[]; // load
96 static XrdOucPupArgs logArgs[]; // login
97 
99 };
100 
101 namespace XrdCms
102 {
103 extern XrdCmsParser Parser;
104 }
105 #endif