Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-08 10:33:37

0001 #ifndef __XRDOFSPREPARE_H__
0002 #define __XRDOFSPREPARE_H__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                      X r d O f s P r e p a r e . h h                       */
0006 /*                                                                            */
0007 /* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University  */
0008 /*                            All Rights Reserved                             */
0009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
0010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
0011 /*                                                                            */
0012 /* This file is part of the XRootD software suite.                            */
0013 /*                                                                            */
0014 /* XRootD is free software: you can redistribute it and/or modify it under    */
0015 /* the terms of the GNU Lesser General Public License as published by the     */
0016 /* Free Software Foundation, either version 3 of the License, or (at your     */
0017 /* option) any later version.                                                 */
0018 /*                                                                            */
0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0022 /* License for more details.                                                  */
0023 /*                                                                            */
0024 /* You should have received a copy of the GNU Lesser General Public License   */
0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0027 /*                                                                            */
0028 /* The copyright holder's institutional names and contributor's names may not */
0029 /* be used to endorse or promote products derived from this software without  */
0030 /* specific prior written permission of the institution or contributor.       */
0031 /******************************************************************************/
0032 
0033 #include <string>
0034 #include <vector>
0035 
0036 //! Class XrdOfsPrepare is used to customize the kXR_prepare request. It is an
0037 //! OFS layer plugin and loaded via the ofs.preplib directive.
0038 
0039 class XrdOss;
0040 class XrdOucEnv;
0041 class XrdOucErrInfo;
0042 class XrdSecEntity;
0043 class XrdSfsFileSystem;
0044 struct XrdSfsPrep;
0045   
0046 class XrdOfsPrepare
0047 {
0048 public:
0049 
0050 //------------------------------------------------------------------------------
0051 //! Execute a prepare request.
0052 //!
0053 //! @param  pargs  - The prepare arguments (see XrdSfsInterface.hh).
0054 //! @param  eInfo  - The object where error or data response is to be returned.
0055 //! @param  client - Client's identify (may be null).
0056 //!
0057 //! @return One of SFS_OK, SFS_DATA, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or
0058 //!         SFS_STARTED.
0059 //!
0060 //! @note Special action taken with certain return codes:
0061 //!       - SFS_DATA  The data is sent to the client as the "requestID".
0062 //!       - SFS_OK    The data pointed to by pargs.reqid is sent to the
0063 //!                   client as the "requestID".
0064 //-----------------------------------------------------------------------------
0065 
0066 virtual int            begin(      XrdSfsPrep      &pargs,
0067                                    XrdOucErrInfo   &eInfo,
0068                              const XrdSecEntity    *client = 0) = 0;
0069 
0070 //------------------------------------------------------------------------------
0071 //! Cancel a preveious prepare request.
0072 //!
0073 //! @param  pargs  - The prepare arguments (see XrdSfsInterface.hh). The
0074 //!                  pargs.reqid points to the "requestID" associated with the
0075 //!                  previously issued prepare request.
0076 //! @param  eInfo  - The object where error or data response is to be returned.
0077 //! @param  client - Client's identify (may be null).
0078 //!
0079 //! @return One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or
0080 //!         SFS_STARTED.
0081 //-----------------------------------------------------------------------------
0082 
0083 virtual int            cancel(      XrdSfsPrep      &pargs,
0084                                     XrdOucErrInfo   &eInfo,
0085                               const XrdSecEntity    *client = 0) = 0;
0086 
0087 //------------------------------------------------------------------------------
0088 //! Query a preveious prepare request.
0089 //!
0090 //! @param  pargs  - The prepare arguments (see XrdSfsInterface.hh). The
0091 //!                  pargs.reqid points to the "requestID" associated with the
0092 //!                  previously issued prepare request.
0093 //! @param  eInfo  - The object where error or data response is to be returned.
0094 //! @param  client - Client's identify (may be null).
0095 //!
0096 //! @return One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL.
0097 //-----------------------------------------------------------------------------
0098 
0099 virtual int            query(      XrdSfsPrep      &pargs,
0100                                    XrdOucErrInfo   &eInfo,
0101                              const XrdSecEntity    *client = 0) = 0;
0102 
0103 //------------------------------------------------------------------------------
0104 //! Constructor
0105 //------------------------------------------------------------------------------
0106 
0107              XrdOfsPrepare() {}
0108 
0109 //------------------------------------------------------------------------------
0110 //! Destructor
0111 //------------------------------------------------------------------------------
0112 
0113 virtual     ~XrdOfsPrepare() {}
0114 };
0115 
0116 /******************************************************************************/
0117 /*                      X r d O f s g e t P r e p a r e                       */
0118 /******************************************************************************/
0119   
0120 //------------------------------------------------------------------------------
0121 //! Obtain an instance of the XrdOfsPrepare object.
0122 //!
0123 //! This extern "C" function is called when a shared library plug-in containing
0124 //! implementation of this class is loaded. It must exist in the shared library
0125 //! and must be thread-safe.
0126 //!
0127 //! @param  eDest -> The error object that must be used to print any errors or
0128 //!                  other messages (see XrdSysError.hh).
0129 //! @param  confg -> Name of the configuration file that was used. This pointer
0130 //!                  may be null though that would be impossible.
0131 //! @param  parms -> Argument string specified on the namelib directive. It may
0132 //!                  be null or point to a null string if no parms exist.
0133 //! @param  theSfs-> Pointer to the XrdSfsFileSystem plugin.
0134 //! @param  theOSs-> Pointer to the OSS plugin.
0135 //! @param  envP  -> Pointer to environmental information (may be nil).
0136 //!
0137 //! @return Success: A pointer to an instance of the XrdOfsPrepare object.
0138 //!         Failure: A null pointer which causes initialization to fail.
0139 //------------------------------------------------------------------------------
0140 
0141 class XrdSysError;
0142 
0143 typedef XrdOfsPrepare *(*XrdOfsgetPrepare_t)(XrdSysError *eDest,
0144                                              const char  *confg,
0145                                              const char  *parms,
0146                                              XrdSfsFileSystem
0147                                                          *theSfs,
0148                                              XrdOss      *theOss,
0149                                              XrdOucEnv   *envP
0150                                             );
0151 
0152 #define XrdOfsgetPrepareArguments            XrdSysError *eDest,\
0153                                              const char  *confg,\
0154                                              const char  *parms,\
0155                                              XrdSfsFileSystem\
0156                                                          *theSfs,\
0157                                              XrdOss      *theOss,\
0158                                              XrdOucEnv   *envP
0159 /*
0160 extern "C" XrdOfsPrepare_t *XrdOfsgetPrepare;
0161 */
0162 
0163 /******************************************************************************/
0164 /*                      X r d O f s A d d P r e p a r e                       */
0165 /******************************************************************************/
0166   
0167 //------------------------------------------------------------------------------
0168 //! Obtain an instance of the XrdOfsPrepare wrapper object.
0169 //!
0170 //! This extern "C" function is called when a shared library plug-in containing
0171 //! implementation of this class is loaded. It must exist in the shared library
0172 //! and must be thread-safe.
0173 //!
0174 //! @param  eDest -> The error object that must be used to print any errors or
0175 //!                  other messages (see XrdSysError.hh).
0176 //! @param  confg -> Name of the configuration file that was used. This pointer
0177 //!                  may be null though that would be impossible.
0178 //! @param  parms -> Argument string specified on the namelib directive. It may
0179 //!                  be null or point to a null string if no parms exist.
0180 //! @param  theSfs-> Pointer to the XrdSfsFileSystem plugin.
0181 //! @param  theOss-> Pointer to the OSS plugin.
0182 //! @param  envP  -> Pointer to environmental information (may be nil).
0183 //! @param  prepP -> Pointer to the existing XrdOfsPrepare object that should
0184 //!                  be wrapped by the returned object.
0185 //!
0186 //! @return Success: A pointer to an instance of the XrdOfsPrepare object.
0187 //!         Failure: A null pointer which causes initialization to fail.
0188 //------------------------------------------------------------------------------
0189 
0190 typedef XrdOfsPrepare *(*XrdOfsAddPrepare_t)(XrdSysError *eDest,
0191                                              const char  *confg,
0192                                              const char  *parms,
0193                                              XrdSfsFileSystem
0194                                                          *theSfs,
0195                                              XrdOss      *theOss,
0196                                              XrdOucEnv   *envP,
0197                                           XrdOfsPrepare  *prepP
0198                                             );
0199 
0200 #define XrdOfsAddPrepareArguments            XrdSysError *eDest,\
0201                                              const char  *confg,\
0202                                              const char  *parms,\
0203                                              XrdSfsFileSystem\
0204                                                          *theSfs,\
0205                                              XrdOss      *theOss,\
0206                                              XrdOucEnv   *envP,\
0207                                           XrdOfsPrepare  *prepP
0208 /*
0209 extern "C" XrdOfsPrepare_t *XrdOfsAddPrepare;
0210 */
0211   
0212 //------------------------------------------------------------------------------
0213 //! Declare compilation version.
0214 //!
0215 //! Additionally, you *should* declare the xrootd version you used to compile
0216 //! your plug-in. While not currently required, it is highly recommended to
0217 //! avoid execution issues should the class definition change. Declare it as:
0218 //------------------------------------------------------------------------------
0219 
0220 /*! #include "XrdVersion.hh"
0221     XrdVERSIONINFO(XrdOfsgetPrepare,<name>);
0222 
0223     where <name> is a 1- to 15-character unquoted name identifying your plugin.
0224 */
0225 #endif