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 
13 // $Id$
14 
15 #include "XProtocol/YProtocol.hh"
16 
17 #include "XrdCms/XrdCmsRRData.hh"
18 #include "XrdOuc/XrdOucPup.hh"
19 
20 /******************************************************************************/
21 /* C l a s s X r d C m s P a r s e r */
22 /******************************************************************************/
23 
24 class XrdOucErrInfo;
25 
27 {
28 public:
29 
30 static int Decode(const char *Man, XrdCms::CmsRRHdr &hdr,
31  char *data, int dlen, XrdOucErrInfo *eInfo);
32 
33 static int mapError(const char *ecode);
34 
35 static int mapError(int ecode);
36 
37 static int Pack(int rnum, struct iovec *iovP, struct iovec *iovE,
38  char *Base, char *Work);
39 
40 inline int Parse(XrdCms::CmsLoginData *Data,
41  const char *Aps, const char *Apt)
42  {Data->SID = Data->Paths = 0;
43  return Pup.Unpack(Aps,Apt,vecArgs[XrdCms::kYR_login],
44  (char *)Data);
45  }
46 
47 inline int Parse(int rnum, const char *Aps, const char *Apt,
48  XrdCmsRRData *Data)
49  {Data->Opaque = Data->Opaque2 = Data->Path = 0;
50  return rnum < XrdCms::kYR_MaxReq
51  && vecArgs[rnum] != 0
52  && Pup.Unpack(Aps, Apt,
53  vecArgs[rnum], (char *)Data);
54  }
55 
56 static XrdOucPup Pup;
57 
58 static XrdOucPupArgs *PupArgs(int rnum)
59  {return rnum < XrdCms::kYR_MaxReq ? vecArgs[rnum] : 0;}
60 
61  XrdCmsParser();
63 
64 private:
65 
66 static const char **PupNVec;
68 
69 static XrdOucPupArgs fwdArgA[]; // chmod | mkdir | mkpath | trunc
70 static XrdOucPupArgs fwdArgB[]; // mv
71 static XrdOucPupArgs fwdArgC[]; // rm | rmdir
72 static XrdOucPupArgs locArgs[]; // locate | select
73 static XrdOucPupArgs padArgs[]; // prepadd
74 static XrdOucPupArgs pdlArgs[]; // prepdel
75 static XrdOucPupArgs avlArgs[]; // avail
76 static XrdOucPupArgs pthArgs[]; // statfs | try
77 static XrdOucPupArgs lodArgs[]; // load
78 static XrdOucPupArgs logArgs[]; // login
79 
81 };
82 
83 namespace XrdCms
84 {
85 extern XrdCmsParser Parser;
86 }
87 #endif