00001 #ifndef XRD_CLIENT_READV 00002 #define XRD_CLIENT_READV 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C l i e n t R e a d V . h h */ 00006 /* */ 00007 /* Author: Fabrizio Furano (INFN Padova, 2006) */ 00008 /* */ 00009 /* This file is part of the XRootD software suite. */ 00010 /* */ 00011 /* XRootD is free software: you can redistribute it and/or modify it under */ 00012 /* the terms of the GNU Lesser General Public License as published by the */ 00013 /* Free Software Foundation, either version 3 of the License, or (at your */ 00014 /* option) any later version. */ 00015 /* */ 00016 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00017 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00018 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00019 /* License for more details. */ 00020 /* */ 00021 /* You should have received a copy of the GNU Lesser General Public License */ 00022 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00023 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00024 /* */ 00025 /* The copyright holder's institutional names and contributor's names may not */ 00026 /* be used to endorse or promote products derived from this software without */ 00027 /* specific prior written permission of the institution or contributor. */ 00028 /******************************************************************************/ 00029 00031 // // 00032 // Helper functions for the vectored read functionality // 00033 // // 00035 00036 class XrdClientConn; 00037 #include "XProtocol/XPtypes.hh" 00038 #include "XProtocol/XProtocol.hh" 00039 #include "XrdClient/XrdClientVector.hh" 00040 00041 struct XrdClientReadVinfo { 00042 kXR_int64 offset; 00043 kXR_int32 len; 00044 }; 00045 00046 class XrdClientReadV { 00047 public: 00048 00049 // Builds a request and sends it to the server 00050 // If destbuf == 0 the request is sent asynchronously 00051 static kXR_int64 ReqReadV(XrdClientConn *xrdc, char *handle, char *destbuf, 00052 XrdClientVector<XrdClientReadVinfo> &reqvect, 00053 int firstreq, int nreq, int streamtosend); 00054 00055 // Picks a readv response and puts the individual chunks into the dest buffer 00056 static kXR_int32 UnpackReadVResp(char *destbuf, char *respdata, kXR_int32 respdatalen, 00057 readahead_list *buflis, int nbuf); 00058 00059 // Picks a readv response and puts the individual chunks into the cache 00060 static kXR_int32 SubmitToCacheReadVResp(XrdClientConn *xrdc, char *respdata, 00061 kXR_int32 respdatalen); 00062 00063 static void PreProcessChunkRequest(XrdClientVector<XrdClientReadVinfo> &reqvect, 00064 kXR_int64 offs, kXR_int32 len, 00065 kXR_int64 filelen); 00066 00067 static void PreProcessChunkRequest(XrdClientVector<XrdClientReadVinfo> &reqvect, 00068 kXR_int64 offs, kXR_int32 len, 00069 kXR_int64 filelen, 00070 kXR_int32 spltsize); 00071 }; 00072 #endif