00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // This file is part of the XRootD software suite. 00006 // 00007 // XRootD is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU Lesser General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // XRootD is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public License 00018 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // In applying this licence, CERN does not waive the privileges and immunities 00021 // granted to it by virtue of its status as an Intergovernmental Organization 00022 // or submit itself to any jurisdiction. 00023 //------------------------------------------------------------------------------ 00024 00025 #ifndef __XRD_CL_FILE_HH__ 00026 #define __XRD_CL_FILE_HH__ 00027 00028 #include "XrdCl/XrdClFileSystem.hh" 00029 #include "XrdCl/XrdClXRootDResponses.hh" 00030 #include <stdint.h> 00031 #include <string> 00032 #include <vector> 00033 00034 namespace XrdCl 00035 { 00036 class FileStateHandler; 00037 class FilePlugIn; 00038 00039 //---------------------------------------------------------------------------- 00041 //---------------------------------------------------------------------------- 00042 class File 00043 { 00044 public: 00045 //------------------------------------------------------------------------ 00047 //------------------------------------------------------------------------ 00048 File( bool enablePlugIns = true ); 00049 00050 //------------------------------------------------------------------------ 00052 //------------------------------------------------------------------------ 00053 virtual ~File(); 00054 00055 //------------------------------------------------------------------------ 00065 //------------------------------------------------------------------------ 00066 XRootDStatus Open( const std::string &url, 00067 OpenFlags::Flags flags, 00068 Access::Mode mode, 00069 ResponseHandler *handler, 00070 uint16_t timeout = 0 ); 00071 00072 //------------------------------------------------------------------------ 00081 //------------------------------------------------------------------------ 00082 XRootDStatus Open( const std::string &url, 00083 OpenFlags::Flags flags, 00084 Access::Mode mode = Access::None, 00085 uint16_t timeout = 0 ); 00086 00087 //------------------------------------------------------------------------ 00094 //------------------------------------------------------------------------ 00095 XRootDStatus Close( ResponseHandler *handler, 00096 uint16_t timeout = 0 ); 00097 00098 //------------------------------------------------------------------------ 00104 //------------------------------------------------------------------------ 00105 XRootDStatus Close( uint16_t timeout = 0 ); 00106 00107 //------------------------------------------------------------------------ 00117 //------------------------------------------------------------------------ 00118 XRootDStatus Stat( bool force, 00119 ResponseHandler *handler, 00120 uint16_t timeout = 0 ); 00121 00122 //------------------------------------------------------------------------ 00130 //------------------------------------------------------------------------ 00131 XRootDStatus Stat( bool force, 00132 StatInfo *&response, 00133 uint16_t timeout = 0 ); 00134 00135 00136 //------------------------------------------------------------------------ 00149 //------------------------------------------------------------------------ 00150 XRootDStatus Read( uint64_t offset, 00151 uint32_t size, 00152 void *buffer, 00153 ResponseHandler *handler, 00154 uint16_t timeout = 0 ); 00155 00156 //------------------------------------------------------------------------ 00166 //------------------------------------------------------------------------ 00167 XRootDStatus Read( uint64_t offset, 00168 uint32_t size, 00169 void *buffer, 00170 uint32_t &bytesRead, 00171 uint16_t timeout = 0 ); 00172 00173 //------------------------------------------------------------------------ 00186 //------------------------------------------------------------------------ 00187 XRootDStatus Write( uint64_t offset, 00188 uint32_t size, 00189 const void *buffer, 00190 ResponseHandler *handler, 00191 uint16_t timeout = 0 ); 00192 00193 //------------------------------------------------------------------------ 00206 //------------------------------------------------------------------------ 00207 XRootDStatus Write( uint64_t offset, 00208 uint32_t size, 00209 const void *buffer, 00210 uint16_t timeout = 0 ); 00211 00212 //------------------------------------------------------------------------ 00219 //------------------------------------------------------------------------ 00220 XRootDStatus Sync( ResponseHandler *handler, 00221 uint16_t timeout = 0 ); 00222 00223 00224 //------------------------------------------------------------------------ 00230 //------------------------------------------------------------------------ 00231 XRootDStatus Sync( uint16_t timeout = 0 ); 00232 00233 //------------------------------------------------------------------------ 00241 //------------------------------------------------------------------------ 00242 XRootDStatus Truncate( uint64_t size, 00243 ResponseHandler *handler, 00244 uint16_t timeout = 0 ); 00245 00246 00247 //------------------------------------------------------------------------ 00254 //------------------------------------------------------------------------ 00255 XRootDStatus Truncate( uint64_t size, uint16_t timeout = 0 ); 00256 00257 //------------------------------------------------------------------------ 00273 //------------------------------------------------------------------------ 00274 XRootDStatus VectorRead( const ChunkList &chunks, 00275 void *buffer, 00276 ResponseHandler *handler, 00277 uint16_t timeout = 0 ); 00278 00279 //------------------------------------------------------------------------ 00295 //------------------------------------------------------------------------ 00296 XRootDStatus VectorRead( const ChunkList &chunks, 00297 void *buffer, 00298 VectorReadInfo *&vReadInfo, 00299 uint16_t timeout = 0 ); 00300 00301 //------------------------------------------------------------------------ 00312 //------------------------------------------------------------------------ 00313 XRootDStatus Fcntl( const Buffer &arg, 00314 ResponseHandler *handler, 00315 uint16_t timeout = 0 ); 00316 00317 //------------------------------------------------------------------------ 00326 //------------------------------------------------------------------------ 00327 XRootDStatus Fcntl( const Buffer &arg, 00328 Buffer *&response, 00329 uint16_t timeout = 0 ); 00330 00331 //------------------------------------------------------------------------ 00340 //------------------------------------------------------------------------ 00341 XRootDStatus Visa( ResponseHandler *handler, 00342 uint16_t timeout = 0 ); 00343 00344 //------------------------------------------------------------------------ 00351 //------------------------------------------------------------------------ 00352 XRootDStatus Visa( Buffer *&visa, 00353 uint16_t timeout = 0 ); 00354 00355 //------------------------------------------------------------------------ 00357 //------------------------------------------------------------------------ 00358 bool IsOpen() const; 00359 00360 //------------------------------------------------------------------------ 00367 //------------------------------------------------------------------------ 00368 bool SetProperty( const std::string &name, const std::string &value ); 00369 00370 //------------------------------------------------------------------------ 00378 //------------------------------------------------------------------------ 00379 bool GetProperty( const std::string &name, std::string &value ) const; 00380 00381 private: 00382 FileStateHandler *pStateHandler; 00383 FilePlugIn *pPlugIn; 00384 bool pEnablePlugIns; 00385 }; 00386 } 00387 00388 #endif // __XRD_CL_FILE_HH__