Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef __SFS_GPFILE_H__
0002 #define __SFS_GPFILE_H__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                       X r d S f s G P F i l e . h h                        */
0006 /*                                                                            */
0007 /* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University  */
0008 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
0009 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
0010 /*                                                                            */
0011 /* This file is part of the XRootD software suite.                            */
0012 /*                                                                            */
0013 /* XRootD is free software: you can redistribute it and/or modify it under    */
0014 /* the terms of the GNU Lesser General Public License as published by the     */
0015 /* Free Software Foundation, either version 3 of the License, or (at your     */
0016 /* option) any later version.                                                 */
0017 /*                                                                            */
0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
0020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
0021 /* License for more details.                                                  */
0022 /*                                                                            */
0023 /* You should have received a copy of the GNU Lesser General Public License   */
0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
0025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
0026 /*                                                                            */
0027 /* The copyright holder's institutional names and contributor's names may not */
0028 /* be used to endorse or promote products derived from this software without  */
0029 /* specific prior written permission of the institution or contributor.       */
0030 /******************************************************************************/
0031 
0032 #include <cstdint>
0033 
0034 class XrdSfsGPInfo;
0035 
0036 class XrdSfsGPFile
0037 {
0038 public:
0039 
0040 uint16_t      opts;    //!< Options as defined below
0041 static const  uint16_t delegate = 0x0008; //!< Use delegation
0042 static const  uint16_t keepErr  = 0x0004; //!< Keep file after request failure
0043 static const  uint16_t mkPath   = 0x0002; //!< Create destination path.
0044 static const  uint16_t replace  = 0x0001; //!< Replace existing file
0045 static const  uint16_t useTLS   = 0x0080; //!< Use TLS for the data path
0046 static const  uint16_t verCKS   = 0x0040; //!< Verify checksum after transfer
0047 
0048 uint16_t      rsvd1;
0049 uint8_t       pingsec; //!< Seconds between calls to Update() (0 -> no calls)
0050 uint8_t       sources; //!< Number of parallel sources (0 -> default)
0051 uint8_t       streams; //!< Number of parallel streams (0 -> default)
0052 uint8_t       rsvd2;
0053 
0054 union {
0055 XrdSfsGPInfo *gpfInfo; //!< Can be used by the implementation
0056 uint32_t      gpfID;   //!< Can be used by the implementation
0057       };
0058 
0059 const char   *src;     //!< get: full URL,      put: local path
0060 const char   *dst;     //!< get: local path,    put: full URL
0061 const char   *lclCGI;  //!< The CGI, if any, for the local path.
0062 const char   *csType;  //!< Checksum type
0063 const char   *csVal;   //!< Checksum value as a hex string
0064 const char   *tident;  //!< Trace identifier
0065 
0066 void         *rsvd3;   //!< Reserved field
0067 
0068 //-----------------------------------------------------------------------------
0069 //! Indicate the request has finished.
0070 //!
0071 //! @param rc   - the final return code. A value of zero indicates success.
0072 //!               A non-zero value should be the errno value corresponding
0073 //!               to the reason for the failure.
0074 //! @param emsg - An optional message further explaining the reason for the
0075 //!               failure (highly recommended).
0076 //!
0077 //! No value is returned but this object is deleted and no references
0078 //! to the object should exist after return is made.
0079 //-----------------------------------------------------------------------------
0080 
0081 virtual void Finished(int rc, const char *emsg=0) = 0;
0082 
0083 //-----------------------------------------------------------------------------
0084 //! Provide request status. Only recursive locks should be held, if any.
0085 //!
0086 //! @param state - One of the enums listed indicating the request state.
0087 //! @param cpct  - Percentage (0 to 100) of completion.
0088 //! @param bytes - Number of bytes processed in the indicated state.
0089 //-----------------------------------------------------------------------------
0090 
0091 enum GPFState {gpfPend = 0,  //!< Request is pending
0092                gpfXfr,       //!< Request is transfering data
0093                gpfCSV        //!< Request is doing checksum validation
0094               };
0095 
0096 virtual void Status(GPFState state, uint32_t cpct, uint64_t bytes) = 0;
0097 
0098 //-----------------------------------------------------------------------------
0099 //! Constructor and Destructor
0100 //-----------------------------------------------------------------------------
0101 
0102              XrdSfsGPFile(const char *tid="")
0103                          : opts(0),    rsvd1(0),
0104                            pingsec(0), sources(0), streams(0),  rsvd2(0),
0105                            gpfInfo(0), src(0),     dst(0),      lclCGI(0),
0106                            csType(0),  csVal(0),   tident(tid), rsvd3(0) {}
0107 virtual     ~XrdSfsGPFile() {}
0108 };
0109 #endif