XRootD
Loading...
Searching...
No Matches
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 <cstring>
33#include <sys/types.h>
34
36#include "XrdSfs/XrdSfsXio.hh"
37#include "XrdSsi/XrdSsiBVec.hh"
42
43class XrdOucEnv;
44struct XrdSsiRespInfo;
45
47{
48public:
49
50static XrdSsiFileSess *Alloc(XrdOucErrInfo &einfo, const char *user);
51
52 bool AttnInfo( XrdOucErrInfo &eInfo,
53 const XrdSsiRespInfo *respP,
54 unsigned int reqID);
55
56 XrdOucErrInfo *errInfo() {return eInfo;}
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
77XrdSsiFileResource &Resource() {return fileResource;}
78
79 int SendData(XrdSfsDio *sfDio,
80 XrdSfsFileOffset offset,
81 XrdSfsXferSize size);
82
83static void SetAuthDNS() {authDNS = true;}
84
85 void setXio(XrdSfsXio *xP) {xioP = xP;}
86
87 int truncate(XrdSfsFileOffset fileOffset);
88
90 const char *buffer,
91 XrdSfsXferSize buffer_size);
92
93private:
94
95// Constructor (via Alloc()) and destructor (via Recycle())
96//
97 XrdSsiFileSess(XrdOucErrInfo &einfo, const char *user)
98 {Init(einfo, user, false);}
99 ~XrdSsiFileSess() {} // Recycle() calls Reset()
100
101void Init(XrdOucErrInfo &einfo, const char *user, bool forReuse);
102bool NewRequest(unsigned int reqid, XrdOucBuffer *oP,
103 XrdSfsXioHandle bR, int rSz);
104void Reset();
105XrdSfsXferSize writeAdd(const char *buff, XrdSfsXferSize blen,
106 unsigned int rid);
107
108static XrdSysMutex arMutex; // Alloc and Recycle protector
109static XrdSsiFileSess *freeList;
110static int freeNum;
111static int freeNew;
112static int freeMax;
113static int freeAbs;
114static bool authDNS;
115
116XrdSsiFileResource fileResource;
117char *tident;
118XrdOucErrInfo *eInfo;
119char *gigID;
120char *fsUser;
121XrdSysMutex myMutex;
122XrdSfsXio *xioP;
123XrdOucBuffer *oucBuff;
124XrdSsiFileSess *nextFree;
125int reqSize;
126int reqLeft;
127bool isOpen;
128bool inProg;
129
130XrdSsiBVec eofVec;
132};
133#endif
#define close(a)
Definition XrdPosix.hh:43
#define write(a, b, c)
Definition XrdPosix.hh:110
#define open
Definition XrdPosix.hh:71
#define truncate(a, b)
Definition XrdPosix.hh:106
#define read(a, b, c)
Definition XrdPosix.hh:77
int XrdSfsFileOpenMode
long long XrdSfsFileOffset
int XrdSfsXferSize
class XrdBuffer * XrdSfsXioHandle
Definition XrdSfsXio.hh:46
void setXio(XrdSfsXio *xP)
int fctl(const int cmd, int alen, const char *args, const XrdSecEntity *client)
bool AttnInfo(XrdOucErrInfo &eInfo, const XrdSsiRespInfo *respP, unsigned int reqID)
static void SetAuthDNS()
XrdOucErrInfo * errInfo()
int SendData(XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size)
static XrdSsiFileSess * Alloc(XrdOucErrInfo &einfo, const char *user)
XrdSsiFileResource & Resource()
const char * FName()