00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // XRootD is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // XRootD is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00017 //------------------------------------------------------------------------------ 00018 00019 #ifndef __XRD_CL_XROOTD_RESPONSES_HH__ 00020 #define __XRD_CL_XROOTD_RESPONSES_HH__ 00021 00022 #include "XrdCl/XrdClBuffer.hh" 00023 #include "XrdCl/XrdClStatus.hh" 00024 #include "XrdCl/XrdClURL.hh" 00025 #include "XrdCl/XrdClAnyObject.hh" 00026 #include "XProtocol/XProtocol.hh" 00027 #include <string> 00028 #include <vector> 00029 #include <list> 00030 #include <ctime> 00031 #include <tuple> 00032 #include <memory> 00033 00034 namespace XrdCl 00035 { 00036 //---------------------------------------------------------------------------- 00038 //---------------------------------------------------------------------------- 00039 class LocationInfo 00040 { 00041 public: 00042 //------------------------------------------------------------------------ 00044 //------------------------------------------------------------------------ 00045 enum LocationType 00046 { 00047 ManagerOnline, 00048 ManagerPending, 00049 ServerOnline, 00050 ServerPending 00051 }; 00052 00053 //------------------------------------------------------------------------ 00055 //------------------------------------------------------------------------ 00056 enum AccessType 00057 { 00058 Read, 00059 ReadWrite 00060 }; 00061 00062 //------------------------------------------------------------------------ 00064 //------------------------------------------------------------------------ 00065 class Location 00066 { 00067 public: 00068 00069 //-------------------------------------------------------------------- 00071 //-------------------------------------------------------------------- 00072 Location( const std::string &address, 00073 LocationType type, 00074 AccessType access ): 00075 pAddress( address ), 00076 pType( type ), 00077 pAccess( access ) {} 00078 00079 //-------------------------------------------------------------------- 00081 //-------------------------------------------------------------------- 00082 const std::string &GetAddress() const 00083 { 00084 return pAddress; 00085 } 00086 00087 //-------------------------------------------------------------------- 00089 //-------------------------------------------------------------------- 00090 LocationType GetType() const 00091 { 00092 return pType; 00093 } 00094 00095 //-------------------------------------------------------------------- 00097 //-------------------------------------------------------------------- 00098 AccessType GetAccessType() const 00099 { 00100 return pAccess; 00101 } 00102 00103 //-------------------------------------------------------------------- 00105 //-------------------------------------------------------------------- 00106 bool IsServer() const 00107 { 00108 return pType == ServerOnline || pType == ServerPending; 00109 } 00110 00111 //-------------------------------------------------------------------- 00113 //-------------------------------------------------------------------- 00114 bool IsManager() const 00115 { 00116 return pType == ManagerOnline || pType == ManagerPending; 00117 } 00118 00119 private: 00120 std::string pAddress; 00121 LocationType pType; 00122 AccessType pAccess; 00123 }; 00124 00125 //------------------------------------------------------------------------ 00127 //------------------------------------------------------------------------ 00128 typedef std::vector<Location> LocationList; 00129 00130 //------------------------------------------------------------------------ 00132 //------------------------------------------------------------------------ 00133 typedef LocationList::iterator Iterator; 00134 00135 //------------------------------------------------------------------------ 00137 //------------------------------------------------------------------------ 00138 typedef LocationList::const_iterator ConstIterator; 00139 00140 //------------------------------------------------------------------------ 00142 //------------------------------------------------------------------------ 00143 LocationInfo(); 00144 00145 //------------------------------------------------------------------------ 00147 //------------------------------------------------------------------------ 00148 uint32_t GetSize() const 00149 { 00150 return pLocations.size(); 00151 } 00152 00153 //------------------------------------------------------------------------ 00155 //------------------------------------------------------------------------ 00156 Location &At( uint32_t index ) 00157 { 00158 return pLocations[index]; 00159 } 00160 00161 //------------------------------------------------------------------------ 00163 //------------------------------------------------------------------------ 00164 Iterator Begin() 00165 { 00166 return pLocations.begin(); 00167 } 00168 00169 //------------------------------------------------------------------------ 00171 //------------------------------------------------------------------------ 00172 ConstIterator Begin() const 00173 { 00174 return pLocations.begin(); 00175 } 00176 00177 //------------------------------------------------------------------------ 00179 //------------------------------------------------------------------------ 00180 Iterator End() 00181 { 00182 return pLocations.end(); 00183 } 00184 00185 //------------------------------------------------------------------------ 00187 //------------------------------------------------------------------------ 00188 ConstIterator End() const 00189 { 00190 return pLocations.end(); 00191 } 00192 00193 //------------------------------------------------------------------------ 00195 //------------------------------------------------------------------------ 00196 void Add( const Location &location ) 00197 { 00198 pLocations.push_back( location ); 00199 } 00200 00201 //------------------------------------------------------------------------ 00203 //------------------------------------------------------------------------ 00204 bool ParseServerResponse( const char *data ); 00205 00206 private: 00207 bool ProcessLocation( std::string &location ); 00208 LocationList pLocations; 00209 }; 00210 00211 //---------------------------------------------------------------------------- 00213 //---------------------------------------------------------------------------- 00214 class XRootDStatus: public Status 00215 { 00216 public: 00217 //------------------------------------------------------------------------ 00219 //------------------------------------------------------------------------ 00220 XRootDStatus( uint16_t st = 0, 00221 uint16_t code = 0, 00222 uint32_t errN = 0, 00223 const std::string &message = "" ): 00224 Status( st, code, errN ), 00225 pMessage( message ) {} 00226 00227 //------------------------------------------------------------------------ 00229 //------------------------------------------------------------------------ 00230 XRootDStatus( const Status &st, 00231 const std::string &message = "" ): 00232 Status( st ), 00233 pMessage( message ) {} 00234 00235 //------------------------------------------------------------------------ 00237 //------------------------------------------------------------------------ 00238 const std::string &GetErrorMessage() const 00239 { 00240 return pMessage; 00241 } 00242 00243 //------------------------------------------------------------------------ 00245 //------------------------------------------------------------------------ 00246 void SetErrorMessage( const std::string &message ) 00247 { 00248 pMessage = message; 00249 } 00250 00251 //------------------------------------------------------------------------ 00253 //------------------------------------------------------------------------ 00254 std::string ToStr() const 00255 { 00256 if( code == errErrorResponse ) 00257 { 00258 std::ostringstream o; 00259 o << "[ERROR] Server responded with an error: [" << errNo << "] "; 00260 o << pMessage << std::endl; 00261 return o.str(); 00262 } 00263 std::string str = ToString(); 00264 if( !pMessage.empty() ) 00265 str += ": " + pMessage; 00266 return str; 00267 } 00268 00269 private: 00270 std::string pMessage; 00271 }; 00272 00273 //---------------------------------------------------------------------------- 00275 //---------------------------------------------------------------------------- 00276 enum 00277 { 00278 xattr_name = 0, 00279 xattr_value = 1 00280 }; 00281 00282 //---------------------------------------------------------------------------- 00284 //---------------------------------------------------------------------------- 00285 typedef std::tuple<std::string, std::string> xattr_t; 00286 00287 //---------------------------------------------------------------------------- 00289 //---------------------------------------------------------------------------- 00290 struct XAttrStatus 00291 { 00292 friend class FileStateHandler; 00293 friend class FileSystem; 00294 00295 XAttrStatus( const std::string &name, const XRootDStatus &status ) : 00296 name( name ), status( status ) 00297 { 00298 00299 } 00300 00301 std::string name; 00302 XRootDStatus status; 00303 }; 00304 00305 //---------------------------------------------------------------------------- 00307 //---------------------------------------------------------------------------- 00308 struct XAttr : public XAttrStatus 00309 { 00310 friend class FileStateHandler; 00311 friend class FileSystem; 00312 00313 XAttr( const std::string &name, const XRootDStatus &status ) : 00314 XAttrStatus( name, status ) 00315 { 00316 00317 } 00318 00319 XAttr( const std::string &name, const std::string &value = "", 00320 const XRootDStatus &status = XRootDStatus() ) : 00321 XAttrStatus( name, status ), value( value ) 00322 { 00323 00324 } 00325 00326 std::string value; 00327 }; 00328 00329 //---------------------------------------------------------------------------- 00331 //---------------------------------------------------------------------------- 00332 typedef Buffer BinaryDataInfo; 00333 00334 //---------------------------------------------------------------------------- 00336 //---------------------------------------------------------------------------- 00337 class ProtocolInfo 00338 { 00339 public: 00340 //------------------------------------------------------------------------ 00342 //------------------------------------------------------------------------ 00343 enum HostTypes 00344 { 00345 IsManager = kXR_isManager, 00346 IsServer = kXR_isServer, 00347 AttrMeta = kXR_attrMeta, 00348 AttrProxy = kXR_attrProxy, 00349 AttrSuper = kXR_attrSuper 00350 }; 00351 00352 //------------------------------------------------------------------------ 00354 //------------------------------------------------------------------------ 00355 ProtocolInfo( uint32_t version, uint32_t hostInfo ): 00356 pVersion( version ), pHostInfo( hostInfo ) {} 00357 00358 //------------------------------------------------------------------------ 00360 //------------------------------------------------------------------------ 00361 uint32_t GetVersion() const 00362 { 00363 return pVersion; 00364 } 00365 00366 //------------------------------------------------------------------------ 00368 //------------------------------------------------------------------------ 00369 uint32_t GetHostInfo() const 00370 { 00371 return pHostInfo; 00372 } 00373 00374 //------------------------------------------------------------------------ 00376 //------------------------------------------------------------------------ 00377 bool TestHostInfo( uint32_t flags ) 00378 { 00379 return pHostInfo & flags; 00380 } 00381 00382 private: 00383 uint32_t pVersion; 00384 uint32_t pHostInfo; 00385 }; 00386 00387 //---------------------------------------------------------------------------- 00389 //---------------------------------------------------------------------------- 00390 struct StatInfoImpl; 00391 00392 //---------------------------------------------------------------------------- 00394 //---------------------------------------------------------------------------- 00395 class StatInfo 00396 { 00397 public: 00398 //------------------------------------------------------------------------ 00400 //------------------------------------------------------------------------ 00401 enum Flags 00402 { 00403 XBitSet = kXR_xset, 00404 IsDir = kXR_isDir, 00405 Other = kXR_other, 00406 Offline = kXR_offline, 00407 POSCPending = kXR_poscpend, 00408 00409 IsReadable = kXR_readable, 00410 IsWritable = kXR_writable, 00411 BackUpExists = kXR_bkpexist 00412 }; 00413 00414 //------------------------------------------------------------------------ 00416 //------------------------------------------------------------------------ 00417 StatInfo(); 00418 00419 //------------------------------------------------------------------------ 00421 //------------------------------------------------------------------------ 00422 StatInfo( const std::string &id, uint64_t size, uint32_t flags, 00423 uint64_t modTime ); 00424 00425 //------------------------------------------------------------------------ 00427 //------------------------------------------------------------------------ 00428 StatInfo( const StatInfo &info ); 00429 00430 //------------------------------------------------------------------------ 00432 //------------------------------------------------------------------------ 00433 ~StatInfo(); 00434 00435 //------------------------------------------------------------------------ 00437 //------------------------------------------------------------------------ 00438 const std::string& GetId() const; 00439 00440 //------------------------------------------------------------------------ 00442 //------------------------------------------------------------------------ 00443 uint64_t GetSize() const; 00444 00445 //------------------------------------------------------------------------ 00447 //------------------------------------------------------------------------ 00448 uint32_t GetFlags() const; 00449 00450 //------------------------------------------------------------------------ 00452 //------------------------------------------------------------------------ 00453 void SetFlags( uint32_t flags ); 00454 00455 //------------------------------------------------------------------------ 00457 //------------------------------------------------------------------------ 00458 bool TestFlags( uint32_t flags ) const; 00459 00460 //------------------------------------------------------------------------ 00462 //------------------------------------------------------------------------ 00463 uint64_t GetModTime() const; 00464 00465 //------------------------------------------------------------------------ 00467 //------------------------------------------------------------------------ 00468 std::string GetModTimeAsString() const; 00469 00470 //------------------------------------------------------------------------ 00472 //------------------------------------------------------------------------ 00473 uint64_t GetChangeTime() const; 00474 00475 //------------------------------------------------------------------------ 00477 //------------------------------------------------------------------------ 00478 std::string GetChangeTimeAsString() const; 00479 00480 //------------------------------------------------------------------------ 00482 //------------------------------------------------------------------------ 00483 uint64_t GetAccessTime() const; 00484 00485 //------------------------------------------------------------------------ 00487 //------------------------------------------------------------------------ 00488 std::string GetAccessTimeAsString() const; 00489 00490 //------------------------------------------------------------------------ 00492 //------------------------------------------------------------------------ 00493 const std::string& GetModeAsString() const; 00494 00495 //------------------------------------------------------------------------ 00497 //------------------------------------------------------------------------ 00498 const std::string GetModeAsOctString() const; 00499 00500 //------------------------------------------------------------------------ 00502 //------------------------------------------------------------------------ 00503 const std::string& GetOwner() const; 00504 00505 //------------------------------------------------------------------------ 00507 //------------------------------------------------------------------------ 00508 const std::string& GetGroup() const; 00509 00510 //------------------------------------------------------------------------ 00512 //------------------------------------------------------------------------ 00513 bool ParseServerResponse( const char *data ); 00514 00515 //------------------------------------------------------------------------ 00517 //------------------------------------------------------------------------ 00518 bool ExtendedFormat() const; 00519 00520 private: 00521 00522 static inline std::string TimeToString( uint64_t time ) 00523 { 00524 char ts[256]; 00525 time_t modTime = time; 00526 tm *t = gmtime( &modTime ); 00527 strftime( ts, 255, "%F %T", t ); 00528 return ts; 00529 } 00530 00531 static inline void OctToString( uint8_t oct, std::string &str ) 00532 { 00533 static const uint8_t r_mask = 0x4; 00534 static const uint8_t w_mask = 0x2; 00535 static const uint8_t x_mask = 0x1; 00536 00537 if( r_mask & oct ) str.push_back( 'r' ); 00538 else str.push_back( '-' ); 00539 00540 if( w_mask & oct ) str.push_back( 'w' ); 00541 else str.push_back( '-' ); 00542 00543 if( x_mask & oct ) str.push_back( 'x' ); 00544 else str.push_back( '-' ); 00545 } 00546 00547 std::unique_ptr<StatInfoImpl> pImpl; 00548 }; 00549 00550 //---------------------------------------------------------------------------- 00552 //---------------------------------------------------------------------------- 00553 class StatInfoVFS 00554 { 00555 public: 00556 //------------------------------------------------------------------------ 00558 //------------------------------------------------------------------------ 00559 StatInfoVFS(); 00560 00561 //------------------------------------------------------------------------ 00563 //------------------------------------------------------------------------ 00564 uint64_t GetNodesRW() const 00565 { 00566 return pNodesRW; 00567 } 00568 00569 //------------------------------------------------------------------------ 00571 //------------------------------------------------------------------------ 00572 uint64_t GetFreeRW() const 00573 { 00574 return pFreeRW; 00575 } 00576 00577 //------------------------------------------------------------------------ 00579 //------------------------------------------------------------------------ 00580 uint8_t GetUtilizationRW() const 00581 { 00582 return pUtilizationRW; 00583 } 00584 00585 //------------------------------------------------------------------------ 00587 //------------------------------------------------------------------------ 00588 uint64_t GetNodesStaging() const 00589 { 00590 return pNodesStaging; 00591 } 00592 00593 //------------------------------------------------------------------------ 00595 //------------------------------------------------------------------------ 00596 uint64_t GetFreeStaging() const 00597 { 00598 return pFreeStaging; 00599 } 00600 00601 //------------------------------------------------------------------------ 00603 //------------------------------------------------------------------------ 00604 uint8_t GetUtilizationStaging() const 00605 { 00606 return pUtilizationStaging; 00607 } 00608 00609 //------------------------------------------------------------------------ 00611 //------------------------------------------------------------------------ 00612 bool ParseServerResponse( const char *data ); 00613 00614 private: 00615 00616 //------------------------------------------------------------------------ 00617 // kXR_vfs stat 00618 //------------------------------------------------------------------------ 00619 uint64_t pNodesRW; 00620 uint64_t pFreeRW; 00621 uint32_t pUtilizationRW; 00622 uint64_t pNodesStaging; 00623 uint64_t pFreeStaging; 00624 uint32_t pUtilizationStaging; 00625 }; 00626 00627 //---------------------------------------------------------------------------- 00629 //---------------------------------------------------------------------------- 00630 class DirectoryList 00631 { 00632 public: 00633 00634 //------------------------------------------------------------------------ 00636 //------------------------------------------------------------------------ 00637 class ListEntry 00638 { 00639 public: 00640 //-------------------------------------------------------------------- 00642 //-------------------------------------------------------------------- 00643 ListEntry( const std::string &hostAddress, 00644 const std::string &name, 00645 StatInfo *statInfo = 0): 00646 pHostAddress( hostAddress ), 00647 pName( name ), 00648 pStatInfo( statInfo ) 00649 {} 00650 00651 //-------------------------------------------------------------------- 00653 //-------------------------------------------------------------------- 00654 ~ListEntry() 00655 { 00656 delete pStatInfo; 00657 } 00658 00659 //-------------------------------------------------------------------- 00661 //-------------------------------------------------------------------- 00662 const std::string &GetHostAddress() const 00663 { 00664 return pHostAddress; 00665 } 00666 00667 //-------------------------------------------------------------------- 00669 //-------------------------------------------------------------------- 00670 const std::string &GetName() const 00671 { 00672 return pName; 00673 } 00674 00675 //-------------------------------------------------------------------- 00677 //-------------------------------------------------------------------- 00678 StatInfo *GetStatInfo() 00679 { 00680 return pStatInfo; 00681 } 00682 00683 //-------------------------------------------------------------------- 00685 //-------------------------------------------------------------------- 00686 const StatInfo *GetStatInfo() const 00687 { 00688 return pStatInfo; 00689 } 00690 00691 //-------------------------------------------------------------------- 00693 //-------------------------------------------------------------------- 00694 void SetStatInfo( StatInfo *info ) 00695 { 00696 pStatInfo = info; 00697 } 00698 00699 private: 00700 std::string pHostAddress; 00701 std::string pName; 00702 StatInfo *pStatInfo; 00703 }; 00704 00705 //------------------------------------------------------------------------ 00707 //------------------------------------------------------------------------ 00708 DirectoryList(); 00709 00710 //------------------------------------------------------------------------ 00712 //------------------------------------------------------------------------ 00713 ~DirectoryList(); 00714 00715 //------------------------------------------------------------------------ 00717 //------------------------------------------------------------------------ 00718 typedef std::vector<ListEntry*> DirList; 00719 00720 //------------------------------------------------------------------------ 00722 //------------------------------------------------------------------------ 00723 typedef DirList::iterator Iterator; 00724 00725 //------------------------------------------------------------------------ 00727 //------------------------------------------------------------------------ 00728 typedef DirList::const_iterator ConstIterator; 00729 00730 //------------------------------------------------------------------------ 00732 //------------------------------------------------------------------------ 00733 void Add( ListEntry *entry ) 00734 { 00735 pDirList.push_back( entry ); 00736 } 00737 00738 //------------------------------------------------------------------------ 00740 //------------------------------------------------------------------------ 00741 ListEntry *At( uint32_t index ) 00742 { 00743 return pDirList[index]; 00744 } 00745 00746 //------------------------------------------------------------------------ 00748 //------------------------------------------------------------------------ 00749 Iterator Begin() 00750 { 00751 return pDirList.begin(); 00752 } 00753 00754 //------------------------------------------------------------------------ 00756 //------------------------------------------------------------------------ 00757 ConstIterator Begin() const 00758 { 00759 return pDirList.begin(); 00760 } 00761 00762 //------------------------------------------------------------------------ 00764 //------------------------------------------------------------------------ 00765 Iterator End() 00766 { 00767 return pDirList.end(); 00768 } 00769 00770 //------------------------------------------------------------------------ 00772 //------------------------------------------------------------------------ 00773 ConstIterator End() const 00774 { 00775 return pDirList.end(); 00776 } 00777 00778 //------------------------------------------------------------------------ 00780 //------------------------------------------------------------------------ 00781 uint32_t GetSize() const 00782 { 00783 return pDirList.size(); 00784 } 00785 00786 //------------------------------------------------------------------------ 00788 //------------------------------------------------------------------------ 00789 const std::string &GetParentName() const 00790 { 00791 return pParent; 00792 } 00793 00794 //------------------------------------------------------------------------ 00796 //------------------------------------------------------------------------ 00797 void SetParentName( const std::string &parent ) 00798 { 00799 size_t pos = parent.find( '?' ); 00800 pParent = pos == std::string::npos ? parent : parent.substr( 0, pos ); 00801 if( !pParent.empty() && pParent[pParent.length()-1] != '/' ) 00802 pParent += "/"; 00803 } 00804 00805 //------------------------------------------------------------------------ 00807 //------------------------------------------------------------------------ 00808 bool ParseServerResponse( const std::string &hostId, 00809 const char *data ); 00810 00811 //------------------------------------------------------------------------ 00813 //------------------------------------------------------------------------ 00814 bool ParseServerResponse( const std::string &hostId, 00815 const char *data, 00816 bool isDStat ); 00817 00818 //------------------------------------------------------------------------ 00820 //------------------------------------------------------------------------ 00821 static bool HasStatInfo( const char *data ); 00822 00823 private: 00824 DirList pDirList; 00825 std::string pParent; 00826 00827 static const std::string dStatPrefix; 00828 }; 00829 00830 //---------------------------------------------------------------------------- 00832 //---------------------------------------------------------------------------- 00833 class OpenInfo 00834 { 00835 public: 00836 //------------------------------------------------------------------------ 00838 //------------------------------------------------------------------------ 00839 OpenInfo( const uint8_t *fileHandle, 00840 uint64_t sessionId, 00841 StatInfo *statInfo = 0 ): 00842 pSessionId(sessionId), pStatInfo( statInfo ) 00843 { 00844 memcpy( pFileHandle, fileHandle, 4 ); 00845 } 00846 00847 //------------------------------------------------------------------------ 00849 //------------------------------------------------------------------------ 00850 ~OpenInfo() 00851 { 00852 delete pStatInfo; 00853 } 00854 00855 //------------------------------------------------------------------------ 00857 //------------------------------------------------------------------------ 00858 void GetFileHandle( uint8_t *fileHandle ) const 00859 { 00860 memcpy( fileHandle, pFileHandle, 4 ); 00861 } 00862 00863 //------------------------------------------------------------------------ 00865 //------------------------------------------------------------------------ 00866 const StatInfo *GetStatInfo() const 00867 { 00868 return pStatInfo; 00869 } 00870 00871 //------------------------------------------------------------------------ 00872 // Get session ID 00873 //------------------------------------------------------------------------ 00874 uint64_t GetSessionId() const 00875 { 00876 return pSessionId; 00877 } 00878 00879 private: 00880 uint8_t pFileHandle[4]; 00881 uint64_t pSessionId; 00882 StatInfo *pStatInfo; 00883 }; 00884 00885 //---------------------------------------------------------------------------- 00887 //---------------------------------------------------------------------------- 00888 struct ChunkInfo 00889 { 00890 //-------------------------------------------------------------------------- 00892 //-------------------------------------------------------------------------- 00893 ChunkInfo( uint64_t off = 0, uint32_t len = 0, void *buff = 0 ): 00894 offset( off ), length( len ), buffer(buff) {} 00895 00896 uint64_t offset; 00897 uint32_t length; 00898 void *buffer; 00899 }; 00900 00901 //---------------------------------------------------------------------------- 00903 //---------------------------------------------------------------------------- 00904 typedef std::vector<ChunkInfo> ChunkList; 00905 00906 //---------------------------------------------------------------------------- 00908 //---------------------------------------------------------------------------- 00909 class VectorReadInfo 00910 { 00911 public: 00912 //------------------------------------------------------------------------ 00914 //------------------------------------------------------------------------ 00915 VectorReadInfo(): pSize( 0 ) {} 00916 00917 //------------------------------------------------------------------------ 00919 //------------------------------------------------------------------------ 00920 uint32_t GetSize() const 00921 { 00922 return pSize; 00923 } 00924 00925 //------------------------------------------------------------------------ 00927 //------------------------------------------------------------------------ 00928 void SetSize( uint32_t size ) 00929 { 00930 pSize = size; 00931 } 00932 00933 //------------------------------------------------------------------------ 00935 //------------------------------------------------------------------------ 00936 ChunkList &GetChunks() 00937 { 00938 return pChunks; 00939 } 00940 00941 //------------------------------------------------------------------------ 00943 //------------------------------------------------------------------------ 00944 const ChunkList &GetChunks() const 00945 { 00946 return pChunks; 00947 } 00948 00949 private: 00950 ChunkList pChunks; 00951 uint32_t pSize; 00952 }; 00953 00954 //---------------------------------------------------------------------------- 00955 // List of URLs 00956 //---------------------------------------------------------------------------- 00957 struct HostInfo 00958 { 00959 HostInfo(): 00960 flags(0), protocol(0), loadBalancer(false) {} 00961 HostInfo( const URL &u, bool lb = false ): 00962 flags(0), protocol(0), loadBalancer(lb), url(u) {} 00963 uint32_t flags; 00964 uint32_t protocol; 00965 bool loadBalancer; 00966 URL url; 00967 }; 00968 00969 typedef std::vector<HostInfo> HostList; 00970 00971 //---------------------------------------------------------------------------- 00973 //---------------------------------------------------------------------------- 00974 class ResponseHandler 00975 { 00976 public: 00977 virtual ~ResponseHandler() {} 00978 00979 //------------------------------------------------------------------------ 00987 //------------------------------------------------------------------------ 00988 virtual void HandleResponseWithHosts( XRootDStatus *status, 00989 AnyObject *response, 00990 HostList *hostList ) 00991 { 00992 delete hostList; 00993 HandleResponse( status, response ); 00994 } 00995 00996 //------------------------------------------------------------------------ 01003 //------------------------------------------------------------------------ 01004 virtual void HandleResponse( XRootDStatus *status, 01005 AnyObject *response ) 01006 { 01007 (void)status; (void)response; 01008 } 01009 }; 01010 } 01011 01012 #endif // __XRD_CL_XROOTD_RESPONSES_HH__