XRootD
Loading...
Searching...
No Matches
XrdClZipListHandler.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
3// Author: Michal Simon <michal.simon@cern.ch>
4//------------------------------------------------------------------------------
5// This file is part of the XRootD software suite.
6//
7// XRootD is free software: you can redistribute it and/or modify
8// it under the terms of the GNU Lesser General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// XRootD is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19//
20// In applying this licence, CERN does not waive the privileges and immunities
21// granted to it by virtue of its status as an Intergovernmental Organization
22// or submit itself to any jurisdiction.
23//------------------------------------------------------------------------------
24
25#ifndef SRC_XRDCL_XRDCLZIPLISTHANDLER_HH_
26#define SRC_XRDCL_XRDCLZIPLISTHANDLER_HH_
27
30#include "XrdCl/XrdClFile.hh"
34
35#include <string>
36#include <memory>
37
38namespace XrdCl
39{
40
41 //----------------------------------------------------------------------------
42 // DirList : Handle not a directory error
43 //----------------------------------------------------------------------------
45 {
46
47 //------------------------------------------------------------------------
52 //1 - DONE : we are done
53 //------------------------------------------------------------------------
54 enum Steps
55 {
56 STAT = 0,
57 OPEN = 1,
58 CLOSE = 2,
59 DONE = 4
60 };
61
62 public:
63
64 //------------------------------------------------------------------------
72 //------------------------------------------------------------------------
73 ZipListHandler( const URL &url,
74 const std::string &path,
76 ResponseHandler *handler,
77 time_t timeout = 0 ) :
78 pUrl( url ), pFlags( flags ), pHandler( handler ),
79 pTimeout( timeout ), pStartTime( time( 0 ) ), pStep( STAT )
80 {
81 if( !pTimeout )
82 {
83 int val = DefaultRequestTimeout;
84 DefaultEnv::GetEnv()->GetInt( "RequestTimeout", val );
85 pTimeout = val;
86 }
87
88 pUrl.SetPath( path );
89 }
90
91 //------------------------------------------------------------------------
93 //------------------------------------------------------------------------
95 {
96
97 }
98
99 //------------------------------------------------------------------------
101 //------------------------------------------------------------------------
102 virtual void HandleResponse( XrdCl::XRootDStatus *statusptr,
103 XrdCl::AnyObject *responseptr );
104 private:
105
106 //------------------------------------------------------------------------
108 //------------------------------------------------------------------------
109 void DoDirList( time_t timeLeft );
110
111 //------------------------------------------------------------------------
116 //------------------------------------------------------------------------
117 bool DoZipOpen( time_t timeLeft );
118
119 //------------------------------------------------------------------------
125 //------------------------------------------------------------------------
126 bool DoZipClose( time_t timeLeft, int next = CLOSE );
127
128 URL pUrl;
129 DirListFlags::Flags pFlags;
130 ResponseHandler *pHandler;
131 time_t pTimeout;
132
133 std::unique_ptr<DirectoryList> pDirList;
134 time_t pStartTime;
135
136 File pFile;
137 ZipArchive pZip;
138
139 int pStep;
140
141 };
142
143} /* namespace XrdCl */
144
145#endif /* SRC_XRDCL_XRDCLZIPLISTHANDLER_HH_ */
static Env * GetEnv()
Get default client environment.
bool GetInt(const std::string &key, int &value)
Definition XrdClEnv.cc:115
A file.
Definition XrdClFile.hh:52
Handle an async response.
URL representation.
Definition XrdClURL.hh:31
ZipListHandler(const URL &url, const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, time_t timeout=0)
virtual void HandleResponse(XrdCl::XRootDStatus *statusptr, XrdCl::AnyObject *responseptr)
Handle the server response.
const int DefaultRequestTimeout