xrootd
XrdCmsReq.hh
Go to the documentation of this file.
1#ifndef __XRDCMSREQ_H__
2#define __XRDCMSREQ_H__
3/******************************************************************************/
4/* */
5/* X r d C m s R e q . 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
33class XrdCmsRRQInfo;
34class XrdCmsNode;
35struct stat;
36
38{
39public:
40
41// Use this to determine if the call is advisory in nature
42//
43inline int Advisory() {return ReqAdv;}
44
45// Reply with an eror message to the request. An optional length may be given.
46//
47void Reply_Error(const char *emsg, int emsglen = 0);
48
49// Reply with an error code and an error message to the request. The error
50// is a string corresponding to an errno.h error code symbol. Valid names are:
51// ENOENT, EPERM, EACCES, EIO, ENOMEM, ENOSPC, ENAMETOOLONG, ENETUNREACH,
52// ENOTBLK, EISDIR, and ENOTEMPTY. Any other strings are converted to EINVAL.
53// This mechanism supports cross platform error number delivery. The second
54// takes the errno.h error number directly.
55//
56void Reply_Error(const char *ecode, const char *emsg, int emsglen = 0);
57
58void Reply_Error(int ecode, const char *emsg, int emsglen = 0);
59
60// Reply by telling the client everything was successfully completed. No data
61// is to be sent (do not use Reply_OK() with a data length of zero).
62//
63void Reply_OK();
64
65// Reply with success and an ASCII text message to the request. An optional data
66// length may be given.
67//
68void Reply_OK(const char *data, int datalen = 0);
69
70// Reply with with success along with file stat information
71//
72void Reply_OK(struct stat &buf);
73
74// Reply by redirecting the client to a different server
75//
76void Reply_Redirect(const char *sname, // DNS name:port of server
77 const char *logincgi=0, // CGI tokens for login
78 const char *opencgi=0); // CGI tokens for open
79
80void Reply_Redirect(const char *sname, // DNS name of server
81 int port, // Server port number
82 const char *logincgi=0, // CGI tokens for login
83 const char *opencgi=0); // CGI tokens for open
84
85// Reply by forcing the client to wait the indicated number of seconds
86//
87void Reply_Wait(int sec);
88
89// Reply by telling the client to wait up to "sec" seconds for a response. This
90// method returns a new XrdCmsReq object that must be used to actually provide
91// the final response. It is automatically deleted when any Reply_xxx() method
92// is called since the object is only valid for a single reply.
93//
95
96 XrdCmsReq(XrdCmsNode *nP, unsigned int id, char adv=0);
97 XrdCmsReq(XrdCmsReq *rP, unsigned int rn);
99
100private:
101
102int StatGen(struct stat &sbuf, char *xbuf);
103void noReply();
104void Reply(int respCode, unsigned int respVal, const char *respData=0,
105 int respLen=0, struct iovec *iov=0, int iovnum=0);
106
108unsigned int ReqID;
109int ReqNins; // Node instance
110short ReqNnum; // Node number
112};
113#endif
#define stat(a, b)
Definition: XrdPosix.hh:96
Definition: XrdCmsNode.hh:57
Definition: XrdCmsRRQ.hh:47
Definition: XrdCmsReq.hh:38
void Reply_Error(int ecode, const char *emsg, int emsglen=0)
int ReqNins
Definition: XrdCmsReq.hh:109
void Reply_Redirect(const char *sname, int port, const char *logincgi=0, const char *opencgi=0)
void Reply_Wait(int sec)
XrdCmsReq(XrdCmsReq *rP, unsigned int rn)
void Reply_Error(const char *emsg, int emsglen=0)
XrdCmsReq * Reply_WaitResp(int sec=0)
void Reply_OK()
~XrdCmsReq()
Definition: XrdCmsReq.hh:98
void Reply_OK(const char *data, int datalen=0)
void Reply_OK(struct stat &buf)
int StatGen(struct stat &sbuf, char *xbuf)
char ReqAdv
Definition: XrdCmsReq.hh:111
int Advisory()
Definition: XrdCmsReq.hh:43
void Reply(int respCode, unsigned int respVal, const char *respData=0, int respLen=0, struct iovec *iov=0, int iovnum=0)
XrdCmsReq(XrdCmsNode *nP, unsigned int id, char adv=0)
short ReqNnum
Definition: XrdCmsReq.hh:110
void noReply()
unsigned int ReqID
Definition: XrdCmsReq.hh:108
XrdCmsNode * NodeP
Definition: XrdCmsReq.hh:107
void Reply_Redirect(const char *sname, const char *logincgi=0, const char *opencgi=0)
void Reply_Error(const char *ecode, const char *emsg, int emsglen=0)