Go to the documentation of this file.00001 #ifndef __FRMPSTGREQ_H__
00002 #define __FRMPSTGREQ_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 class XrdFrmPstgReq
00016 {
00017 public:
00018
00019 struct Request
00020 {
00021 char LFN[2176];
00022 char User[256];
00023 char ID[64];
00024 char Notify[512];
00025 char Reserved[40];
00026 long long addTOD;
00027 int This;
00028 int Next;
00029 int Opaque;
00030 short Options;
00031 short Prty;
00032 };
00033
00034 static const int msgFail = 0x0001;
00035 static const int msgSucc = 0x0002;
00036 static const int stgRW = 0x0004;
00037
00038 static const int maxPrty = 2;
00039
00040 static const int ReqSize = sizeof(Request);
00041
00042 void Add(Request *rP);
00043
00044 void Can(Request *rP);
00045
00046 void Del(Request *rP);
00047
00048 int Get(Request *rP);
00049
00050 int Init();
00051
00052 enum Item {getLFN=0, getLFNCGI, getMODE, getNOTE, getPRTY, getQWT,
00053 getRID, getTOD, getUSER};
00054
00055 char *List(char *Buff, int bsz, int &Offs, Item *ITList=0, int ITNum=0);
00056
00057 void ListL(XrdFrmPstgReq::Request tmpReq, char *Buff, int bsz,
00058 Item *ITList, int ITNum);
00059
00060 static int Unique(const char *lkfn);
00061
00062 XrdFrmPstgReq(const char *fn);
00063 ~XrdFrmPstgReq() {}
00064
00065 private:
00066 enum LockType {lkNone, lkShare, lkExcl, lkInit};
00067
00068 void FailAdd(char *lfn, int unlk=1);
00069 void FailCan(char *rid, int unlk=1);
00070 void FailDel(char *lfn, int unlk=1);
00071 int FailIni(const char *lfn);
00072 int FileLock(LockType ltype=lkExcl);
00073 int reqRead(void *Buff, int Offs);
00074 int reqWrite(void *Buff, int Offs, int updthdr=1);
00075
00076 struct FileHdr
00077 {
00078 int First;
00079 int Last;
00080 int Free;
00081 } HdrData;
00082
00083 char *lokFN;
00084 int lokFD;
00085 int reqFD;
00086 char *reqFN;
00087
00088 struct recEnt {recEnt *Next;
00089 struct Request reqData;
00090 recEnt(struct Request &reqref) {Next = 0; reqData = reqref;}
00091 };
00092 int ReWrite(recEnt *rP);
00093 };
00094 namespace XrdFrm
00095 {
00096 extern XrdFrmPstgReq *rQueue[XrdFrmPstgReq::maxPrty];
00097 }
00098 #endif