xrootd
XrdSsiFileSess.hh
Go to the documentation of this file.
1 #ifndef __SSI_FILESESS_H__
2 #define __SSI_FILESESS_H__
3 /******************************************************************************/
4 /* */
5 /* X r d S s i F i l e S e s s . h h */
6 /* */
7 /* (c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Department of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 #include <string.h>
33 #include <sys/types.h>
34 
36 #include "XrdSsi/XrdSsiBVec.hh"
37 #include "XrdSsi/XrdSsiFileReq.hh"
39 #include "XrdSsi/XrdSsiRRTable.hh"
40 #include "XrdSys/XrdSysPthread.hh"
41 
42 class XrdOucEnv;
43 class XrdSfsXioHandle;
44 struct XrdSsiRespInfo;
45 
47 {
48 public:
49 
50 static XrdSsiFileSess *Alloc(XrdOucErrInfo &einfo, const char *user);
51 
53  const XrdSsiRespInfo *respP,
54  unsigned int reqID);
55 
57 
58  int close(bool viaDel=false);
59 
60  int fctl(const int cmd,
61  int alen,
62  const char *args,
63  const XrdSecEntity *client);
64 
65  const char *FName() {return gigID;}
66 
67  int open(const char *fileName,
68  XrdOucEnv &theEnv,
69  XrdSfsFileOpenMode openMode);
70 
72  char *buffer,
73  XrdSfsXferSize buffer_size);
74 
75  void Recycle();
76 
78 
79  int SendData(XrdSfsDio *sfDio,
80  XrdSfsFileOffset offset,
81  XrdSfsXferSize size);
82 
83 static void SetAuthDNS() {authDNS = true;}
84 
85 static void SetMaxSz(int mSz) {maxRSZ = mSz;}
86 
87  void setXio(XrdSfsXio *xP) {xioP = xP;}
88 
89  int truncate(XrdSfsFileOffset fileOffset);
90 
92  const char *buffer,
93  XrdSfsXferSize buffer_size);
94 
95 private:
96 
97 // Constructor (via Alloc()) and destructor (via Recycle())
98 //
99  XrdSsiFileSess(XrdOucErrInfo &einfo, const char *user)
100  {Init(einfo, user, false);}
101  ~XrdSsiFileSess() {} // Recycle() calls Reset()
102 
103 void Init(XrdOucErrInfo &einfo, const char *user, bool forReuse);
104 bool NewRequest(unsigned int reqid, XrdOucBuffer *oP,
105  XrdSfsXioHandle *bR, int rSz);
106 void Reset();
107 XrdSfsXferSize writeAdd(const char *buff, XrdSfsXferSize blen,
108  unsigned int rid);
109 
110 static XrdSysMutex arMutex; // Alloc and Recycle protector
112 static int freeNum;
113 static int freeNew;
114 static int freeMax;
115 static int freeAbs;
116 
117 static int maxRSZ;
118 static bool authDNS;
119 
121 char *tident;
123 char *gigID;
124 char *fsUser;
131 bool isOpen;
132 bool inProg;
133 
136 };
137 #endif
XrdSsiFileSess::isOpen
bool isOpen
Definition: XrdSsiFileSess.hh:131
XrdSsiBVec
Definition: XrdSsiBVec.hh:36
XrdSsiFileSess::Alloc
static XrdSsiFileSess * Alloc(XrdOucErrInfo &einfo, const char *user)
XrdSfsInterface.hh
XrdSfsXio
Definition: XrdSfsXio.hh:81
XrdSysMutex
Definition: XrdSysPthread.hh:166
XrdSsiFileSess::truncate
int truncate(XrdSfsFileOffset fileOffset)
XrdSsiFileSess::Recycle
void Recycle()
XrdSsiBVec.hh
XrdSsiFileReq.hh
XrdSysPthread.hh
XrdSsiFileResource
Definition: XrdSsiFileResource.hh:42
XrdSsiFileSess::gigID
char * gigID
Definition: XrdSsiFileSess.hh:123
XrdSsiFileSess::setXio
void setXio(XrdSfsXio *xP)
Definition: XrdSsiFileSess.hh:87
XrdSsiFileResource.hh
XrdSsiFileSess::fctl
int fctl(const int cmd, int alen, const char *args, const XrdSecEntity *client)
XrdSsiFileSess::Reset
void Reset()
XrdSfsXferSize
int XrdSfsXferSize
Definition: XrdSfsInterface.hh:122
XrdSsiFileSess::Init
void Init(XrdOucErrInfo &einfo, const char *user, bool forReuse)
XrdSsiFileSess::fileResource
XrdSsiFileResource fileResource
Definition: XrdSsiFileSess.hh:120
XrdSsiFileSess::reqLeft
int reqLeft
Definition: XrdSsiFileSess.hh:130
XrdSfsFileOffset
long long XrdSfsFileOffset
Definition: XrdSfsInterface.hh:119
XrdSsiFileSess::SendData
int SendData(XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size)
XrdSsiFileSess::nextFree
XrdSsiFileSess * nextFree
Definition: XrdSsiFileSess.hh:128
XrdSsiFileSess::close
int close(bool viaDel=false)
XrdSsiFileSess::tident
char * tident
Definition: XrdSsiFileSess.hh:121
XrdSsiFileSess::freeAbs
static int freeAbs
Definition: XrdSsiFileSess.hh:115
XrdSsiFileSess::NewRequest
bool NewRequest(unsigned int reqid, XrdOucBuffer *oP, XrdSfsXioHandle *bR, int rSz)
XrdSfsXioHandle
Definition: XrdSfsXio.hh:51
XrdSsiFileSess::eInfo
XrdOucErrInfo * eInfo
Definition: XrdSsiFileSess.hh:122
XrdSsiFileSess::freeNum
static int freeNum
Definition: XrdSsiFileSess.hh:112
XrdSsiFileSess::maxRSZ
static int maxRSZ
Definition: XrdSsiFileSess.hh:117
XrdSsiFileSess::errInfo
XrdOucErrInfo * errInfo()
Definition: XrdSsiFileSess.hh:56
XrdSsiFileSess::read
XrdSfsXferSize read(XrdSfsFileOffset fileOffset, char *buffer, XrdSfsXferSize buffer_size)
XrdOucEnv
Definition: XrdOucEnv.hh:42
XrdSsiFileSess::fsUser
char * fsUser
Definition: XrdSsiFileSess.hh:124
XrdSsiFileSess::~XrdSsiFileSess
~XrdSsiFileSess()
Definition: XrdSsiFileSess.hh:101
XrdSsiFileSess::arMutex
static XrdSysMutex arMutex
Definition: XrdSsiFileSess.hh:110
XrdSsiFileSess::freeList
static XrdSsiFileSess * freeList
Definition: XrdSsiFileSess.hh:111
XrdSsiFileSess::myMutex
XrdSysMutex myMutex
Definition: XrdSsiFileSess.hh:125
XrdSsiFileSess::reqSize
int reqSize
Definition: XrdSsiFileSess.hh:129
XrdSsiFileSess
Definition: XrdSsiFileSess.hh:47
XrdSsiFileSess::SetAuthDNS
static void SetAuthDNS()
Definition: XrdSsiFileSess.hh:83
XrdSsiFileSess::inProg
bool inProg
Definition: XrdSsiFileSess.hh:132
XrdSsiFileSess::SetMaxSz
static void SetMaxSz(int mSz)
Definition: XrdSsiFileSess.hh:85
XrdSsiFileSess::authDNS
static bool authDNS
Definition: XrdSsiFileSess.hh:118
XrdSsiRRTable.hh
XrdSsiFileSess::eofVec
XrdSsiBVec eofVec
Definition: XrdSsiFileSess.hh:134
XrdSsiFileSess::Resource
XrdSsiFileResource & Resource()
Definition: XrdSsiFileSess.hh:77
XrdSsiFileSess::FName
const char * FName()
Definition: XrdSsiFileSess.hh:65
XrdSsiFileSess::freeMax
static int freeMax
Definition: XrdSsiFileSess.hh:114
XrdSsiFileSess::AttnInfo
bool AttnInfo(XrdOucErrInfo &eInfo, const XrdSsiRespInfo *respP, unsigned int reqID)
XrdSsiFileSess::rTab
XrdSsiRRTable< XrdSsiFileReq > rTab
Definition: XrdSsiFileSess.hh:135
XrdSfsFileOpenMode
int XrdSfsFileOpenMode
Definition: XrdSfsInterface.hh:120
XrdSfsDio
Definition: XrdSfsDio.hh:47
XrdSsiFileSess::write
XrdSfsXferSize write(XrdSfsFileOffset fileOffset, const char *buffer, XrdSfsXferSize buffer_size)
XrdSecEntity
Definition: XrdSecEntity.hh:52
XrdOucErrInfo
Definition: XrdOucErrInfo.hh:100
XrdSsiFileSess::freeNew
static int freeNew
Definition: XrdSsiFileSess.hh:113
XrdSsiFileSess::writeAdd
XrdSfsXferSize writeAdd(const char *buff, XrdSfsXferSize blen, unsigned int rid)
XrdSsiFileSess::xioP
XrdSfsXio * xioP
Definition: XrdSsiFileSess.hh:126
XrdSsiRespInfo
Definition: XrdSsiRespInfo.hh:44
XrdOucBuffer
Definition: XrdOucBuffer.hh:141
XrdSsiFileSess::XrdSsiFileSess
XrdSsiFileSess(XrdOucErrInfo &einfo, const char *user)
Definition: XrdSsiFileSess.hh:99
XrdSsiRRTable< XrdSsiFileReq >
XrdSsiFileSess::oucBuff
XrdOucBuffer * oucBuff
Definition: XrdSsiFileSess.hh:127
XrdSsiFileSess::open
int open(const char *fileName, XrdOucEnv &theEnv, XrdSfsFileOpenMode openMode)