00001 #ifndef XRD_CLI_MSTREAM 00002 #define XRD_CLI_MSTREAM 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C l i e n t M S t r e a m . 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 code for XrdClient to handle multistream behavior // 00033 // // 00035 00036 #include "XrdClient/XrdClientConn.hh" 00037 00038 class XrdClientMStream { 00039 public: 00040 00041 // Compute the parameters to split blocks 00042 static void GetGoodSplitParameters(XrdClientConn *cliconn, 00043 int &spltsize, int &reqsperstream, 00044 kXR_int32 len); 00045 00046 // Establish all the parallel streams, stop 00047 // adding streams at the first creation refusal/failure 00048 static int EstablishParallelStreams(XrdClientConn *cliconn); 00049 00050 // Add a parallel stream to the pool used by the given client inst 00051 static int AddParallelStream(XrdClientConn *cliconn, int port, int windowsz, int tempid); 00052 00053 // Remove a parallel stream to the pool used by the given client inst 00054 static int RemoveParallelStream(XrdClientConn *cliconn, int substream); 00055 00056 // Binds the pending temporary parallel stream to the current session 00057 // Returns into newid the substreamid assigned by the server 00058 static bool BindPendingStream(XrdClientConn *cliconn, int substreamid, int &newid); 00059 00060 struct ReadChunk { 00061 kXR_int64 offset; 00062 kXR_int32 len; 00063 int streamtosend; 00064 }; 00065 00066 00067 // This splits a long requests into many smaller requests, to be sent in parallel 00068 // through multiple streams 00069 // Returns false if the chunk is not worth splitting 00070 static bool SplitReadRequest(XrdClientConn *cliconn, kXR_int64 offset, kXR_int32 len, 00071 XrdClientVector<ReadChunk> &reqlists); 00072 00073 00074 }; 00075 #endif