00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_XrdProofdResponse
00013 #define ROOT_XrdProofdResponse
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <string.h>
00026 #include <unistd.h>
00027 #include <sys/uio.h>
00028
00029 #ifdef OLDXRDOUC
00030 # include "XrdSysToOuc.h"
00031 # include "XrdOuc/XrdOucPthread.hh"
00032 #else
00033 # include "XrdSys/XrdSysPthread.hh"
00034 #endif
00035 #include "XrdOuc/XrdOucString.hh"
00036 #include "XProofProtocol.h"
00037
00038 class XrdLink;
00039
00040 class XrdProofdResponse
00041 {
00042 public:
00043 XrdProofdResponse() { fLink = 0; *fTrsid = '\0'; fSID = 0; }
00044 virtual ~XrdProofdResponse() {}
00045
00046 inline const char *STRID() { return (const char *)fTrsid;}
00047 inline const char *TraceID() const { return fTraceID.c_str(); }
00048
00049 inline XrdLink *Link() const { return fLink; }
00050
00051 int LinkSend(const char *buff, int len, XrdOucString &e);
00052 int LinkSend(const struct iovec *iov,
00053 int iocnt, int len, XrdOucString &e);
00054
00055 int Send(void);
00056 int Send(const char *msg);
00057 int Send(void *data, int dlen);
00058 int Send(XResponseType rcode);
00059 int Send(XResponseType rcode, void *data, int dlen);
00060 int Send(XErrorCode ecode, const char *msg);
00061 int Send(XPErrorCode ecode, const char *msg);
00062 int Send(XResponseType rcode, int info, char *data = 0);
00063 int Send(XResponseType rcode, XProofActionCode acode, int info);
00064 int Send(XResponseType rcode,
00065 XProofActionCode acode, void *data, int dlen);
00066 int Send(XResponseType rcode, XProofActionCode acode,
00067 kXR_int32 sid, void *data, int dlen);
00068
00069 int SendI(kXR_int32 int1, void *data = 0, int dlen = 0);
00070 int SendI(kXR_int32 int1, kXR_int32 int2, void *data = 0, int dlen = 0);
00071 int SendI(kXR_int32 int1, kXR_int16 int2, kXR_int16 int3,
00072 void *data = 0, int dlen = 0);
00073
00074 void Set(XrdLink *l);
00075 inline void SetTag(const char *tag) { fTag = tag; }
00076 void SetTraceID();
00077 void Set(unsigned char *stream);
00078 void Set(unsigned short streamid);
00079 void Set(ServerResponseHeader *resp);
00080
00081 void GetSID(unsigned short &sid);
00082 void SetTrsid();
00083
00084
00085 XrdSysRecMutex fMutex;
00086
00087 private:
00088
00089 ServerResponseHeader fResp;
00090 XrdLink *fLink;
00091 char fTrsid[8];
00092
00093 unsigned short fSID;
00094
00095 XrdOucString fTraceID;
00096 XrdOucString fTag;
00097 };
00098 #endif