00001 #ifndef __XRDOLBREQ_H__ 00002 #define __XRDOLBREQ_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O l b R e q . h h */ 00006 /* */ 00007 /* (c) 2006 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: XrdOlbReq.hh,v 1.1 2006/09/26 07:51:26 abh Exp $ 00014 00015 class XrdOlbRRQInfo; 00016 class XrdOlbServer; 00017 struct stat; 00018 00019 class XrdOlbReq 00020 { 00021 public: 00022 00023 // Reply with an eror message to the request. An optional length may be given. 00024 // 00025 void Reply_Error(const char *emsg, int emsglen = 0); 00026 00027 // Reply with an error code and an error message to the request. The error 00028 // is a string corresponding to an errno.h error code symbol. Valid names are: 00029 // ENOENT, EPERM, EACCES, EIO, ENOMEM, ENOSPC, ENAMETOOLONG, ENETUNREACH, 00030 // ENOTBLK, EISDIR, and ENOTEMPTY. Any other strings are converted to EINVAL. 00031 // This mechanism supports cross platform error number delivery. 00032 // 00033 void Reply_Error(const char *ecode, const char *emsg, int emsglen = 0); 00034 00035 // Reply by telling the client everything was successfully completed. No data 00036 // is to be sent (do not use Reply_OK() with a data length of zero). 00037 // 00038 void Reply_OK(); 00039 00040 // Reply with success and an ASCII text message to the request. An optional data 00041 // length may be given. 00042 // 00043 void Reply_OK(const char *data, int datalen = 0); 00044 00045 // Reply with with success along with file stat information 00046 // 00047 void Reply_OK(struct stat &buf); 00048 00049 // Reply by redirecting the client to a different server 00050 // 00051 void Reply_Redirect(const char *sname, // DNS name:port of server 00052 const char *logincgi=0, // CGI tokens for login 00053 const char *opencgi=0); // CGI tokens for open 00054 00055 // Reply by forcing the client to wait the indicated number of seconds 00056 // 00057 void Reply_Wait(int sec); 00058 00059 // Reply by telling the client to wait up to "sec" seconds for a response. This 00060 // method returns a new XrdOlbReq object that must be used to actually provide 00061 // the final response. It is automatically deleted when any Reply_xxx() method 00062 // is called since the object is only valid for a single reply. 00063 // 00064 XrdOlbReq *Reply_WaitResp(int sec); 00065 00066 XrdOlbReq(XrdOlbServer *sp, XrdOlbRRQInfo *ip); 00067 XrdOlbReq(unsigned int rn, XrdOlbRRQInfo *ip); 00068 ~XrdOlbReq() {} 00069 00070 private: 00071 00072 int StatGen(struct stat &sbuf, char *xbuf); 00073 void noReply(); 00074 void Reply(struct iovec *iov, int iovnum); 00075 00076 XrdOlbServer *ServerP; 00077 XrdOlbRRQInfo *InfoP; 00078 unsigned int ReqNum; // Async request number 00079 int ReqSins; // Server instance 00080 short ReqSnum; // Server number 00081 }; 00082 #endif
1.7.1