XrdCmsReq.hh

Go to the documentation of this file.
00001 #ifndef __XRDCMSREQ_H__
00002 #define __XRDCMSREQ_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                          X r d C m s R e q . h h                           */
00006 /*                                                                            */
00007 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012   
00013 //         $Id: XrdCmsReq.hh 28902 2009-06-11 12:36:21Z ganis $
00014 
00015 class  XrdCmsRRQInfo;
00016 class  XrdCmsNode;
00017 struct stat;
00018 
00019 class XrdCmsReq
00020 {
00021 public:
00022 
00023 // Use this to determine if the call is advisory in nature
00024 //
00025 inline int Advisory() {return ReqAdv;}
00026 
00027 // Reply with an eror message to the request. An optional length may be given.
00028 //
00029 void       Reply_Error(const char *emsg, int emsglen = 0);
00030 
00031 // Reply with an error code and an error message to the request. The error
00032 // is a string corresponding to an errno.h error code symbol. Valid names are:
00033 // ENOENT, EPERM, EACCES, EIO, ENOMEM, ENOSPC, ENAMETOOLONG, ENETUNREACH,
00034 // ENOTBLK, EISDIR, and ENOTEMPTY. Any other strings are converted to EINVAL.
00035 // This mechanism supports cross platform error number delivery. The second
00036 // takes the errno.h error number directly.
00037 //
00038 void       Reply_Error(const char *ecode, const char *emsg, int emsglen = 0);
00039 
00040 void       Reply_Error(int         ecode, const char *emsg, int emsglen = 0);
00041 
00042 // Reply by telling the client everything was successfully completed. No data
00043 // is to be sent (do not use Reply_OK() with a data length of zero).
00044 //
00045 void       Reply_OK();
00046 
00047 // Reply with success and an ASCII text message to the request. An optional data
00048 // length may be given.
00049 //
00050 void       Reply_OK(const char *data, int datalen = 0);
00051 
00052 // Reply with with success along with file stat information
00053 //
00054 void       Reply_OK(struct stat &buf);
00055 
00056 // Reply by redirecting the client to a different server
00057 //
00058 void       Reply_Redirect(const char *sname,      // DNS name:port of server
00059                           const char *logincgi=0, // CGI tokens for login
00060                           const char *opencgi=0); // CGI tokens for open
00061 
00062 void       Reply_Redirect(const char *sname,      // DNS name of server
00063                                 int   port,       // Server port number
00064                           const char *logincgi=0, // CGI tokens for login
00065                           const char *opencgi=0); // CGI tokens for open
00066 
00067 // Reply by forcing the client to wait the indicated number of seconds
00068 //
00069 void       Reply_Wait(int sec);
00070 
00071 // Reply by telling the client to wait up to "sec" seconds for a response. This
00072 // method returns a new XrdCmsReq object that must be used to actually provide
00073 // the final response. It is automatically deleted when any Reply_xxx() method 
00074 // is called since the object is only valid for a single reply.
00075 //
00076 XrdCmsReq *Reply_WaitResp(int sec=0);
00077 
00078            XrdCmsReq(XrdCmsNode *nP, unsigned int id, char adv=0);
00079            XrdCmsReq(XrdCmsReq  *rP, unsigned int rn);
00080           ~XrdCmsReq() {}
00081 
00082 private:
00083 
00084 int  StatGen(struct stat &sbuf, char *xbuf);
00085 void noReply();
00086 void Reply(int respCode, unsigned int respVal, const char *respData=0,
00087            int respLen=0, struct iovec *iov=0, int iovnum=0);
00088 
00089 XrdCmsNode    *NodeP;
00090 unsigned int   ReqID;
00091 int            ReqNins;  // Node instance
00092 short          ReqNnum;  // Node number
00093 char           ReqAdv;
00094 };
00095 #endif

Generated on Tue Jul 5 14:46:31 2011 for ROOT_528-00b_version by  doxygen 1.5.1