xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdClChannel.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 
19 #ifndef __XRD_CL_POST_CHANNEL_HH__
20 #define __XRD_CL_POST_CHANNEL_HH__
21 
22 #include <cstdint>
23 #include <vector>
24 #include <ctime>
25 #include <functional>
26 
27 #include "XrdCl/XrdClStatus.hh"
28 #include "XrdCl/XrdClURL.hh"
29 #include "XrdCl/XrdClPoller.hh"
30 #include "XrdCl/XrdClInQueue.hh"
32 #include "XrdCl/XrdClAnyObject.hh"
34 
35 #include "XrdSys/XrdSysPthread.hh"
36 
37 namespace XrdCl
38 {
39  class Stream;
40  class JobManager;
41  class VirtualRedirector;
42  class TickGeneratorTask;
43  class Job;
44 
45  //----------------------------------------------------------------------------
47  //----------------------------------------------------------------------------
48  class Channel
49  {
50  public:
51  //------------------------------------------------------------------------
59  //------------------------------------------------------------------------
60  Channel( const URL &url,
61  Poller *poller,
62  TransportHandler *transport,
63  TaskManager *taskManager,
64  JobManager *jobManager,
65  const URL &prefurl = URL() );
66 
67  //------------------------------------------------------------------------
69  //------------------------------------------------------------------------
70  ~Channel();
71 
72  //------------------------------------------------------------------------
74  //------------------------------------------------------------------------
75  const URL &GetURL() const
76  {
77  return pUrl;
78  }
79 
80  //------------------------------------------------------------------------
93  //------------------------------------------------------------------------
95  MsgHandler *handler,
96  bool stateful,
97  time_t expires );
98 
99  //------------------------------------------------------------------------
106  //------------------------------------------------------------------------
107  Status QueryTransport( uint16_t query, AnyObject &result );
108 
109  //------------------------------------------------------------------------
111  //------------------------------------------------------------------------
112  void RegisterEventHandler( ChannelEventHandler *handler );
113 
114  //------------------------------------------------------------------------
116  //------------------------------------------------------------------------
117  void RemoveEventHandler( ChannelEventHandler *handler );
118 
119  //------------------------------------------------------------------------
121  //------------------------------------------------------------------------
122  void Tick( time_t now );
123 
124  //------------------------------------------------------------------------
126  //------------------------------------------------------------------------
128 
129  //------------------------------------------------------------------------
131  //------------------------------------------------------------------------
132  uint16_t NbConnectedStrm();
133 
134  //------------------------------------------------------------------------
136  //------------------------------------------------------------------------
137  void SetOnDataConnectHandler( std::shared_ptr<Job> &onConnJob );
138 
139  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
143  bool CanCollapse( const URL &url );
144 
145  //------------------------------------------------------------------------
147  //------------------------------------------------------------------------
148  void DecFileInstCnt();
149 
150  private:
151 
160  TickGeneratorTask *pTickGenerator;
162  };
163 }
164 
165 #endif // __XRD_CL_POST_CHANNEL_HH__
A synchronized queue.
Definition: XrdClJobManager.hh:50
Definition: XrdClAnyObject.hh:32
Channel(const URL &url, Poller *poller, TransportHandler *transport, TaskManager *taskManager, JobManager *jobManager, const URL &prefurl=URL())
Interface for socket pollers.
Definition: XrdClPoller.hh:86
void RegisterEventHandler(ChannelEventHandler *handler)
Register channel event handler.
void Tick(time_t now)
Handle a time event.
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
bool CanCollapse(const URL &url)
void SetOnDataConnectHandler(std::shared_ptr< Job > &onConnJob)
Set the on-connect handler for data streams.
InQueue pIncoming
Definition: XrdClChannel.hh:159
Status QueryTransport(uint16_t query, AnyObject &result)
Message handler.
Definition: XrdClPostMasterInterfaces.hh:50
const URL & GetURL() const
Get the URL.
Definition: XrdClChannel.hh:75
JobManager * pJobManager
Definition: XrdClChannel.hh:161
AnyObject pChannelData
Definition: XrdClChannel.hh:158
Procedure execution status.
Definition: XrdClStatus.hh:113
uint16_t NbConnectedStrm()
Get the number of connected data streams.
Definition: XrdSysPthread.hh:164
URL pUrl
Definition: XrdClChannel.hh:152
A communication channel between the client and the server.
Definition: XrdClChannel.hh:48
TickGeneratorTask * pTickGenerator
Definition: XrdClChannel.hh:160
Perform the handshake and the authentication for each physical stream.
Definition: XrdClPostMasterInterfaces.hh:289
void RemoveEventHandler(ChannelEventHandler *handler)
Remove a channel event handler.
Request status.
Definition: XrdClXRootDResponses.hh:218
Channel event handler.
Definition: XrdClPostMasterInterfaces.hh:209
Stream * pStream
Definition: XrdClChannel.hh:156
A synchronize queue for incoming data.
Definition: XrdClInQueue.hh:36
TaskManager * pTaskManager
Definition: XrdClChannel.hh:155
Poller * pPoller
Definition: XrdClChannel.hh:153
~Channel()
Destructor.
URL representation.
Definition: XrdClURL.hh:30
Status ForceDisconnect()
Force disconnect of all streams.
void DecFileInstCnt()
Decrement file object instance count bound to this channel.
Stream.
Definition: XrdClStream.hh:49
Definition: XrdClTaskManager.hh:75
XRootDStatus Send(Message *msg, MsgHandler *handler, bool stateful, time_t expires)
TransportHandler * pTransport
Definition: XrdClChannel.hh:154
XrdSysMutex pMutex
Definition: XrdClChannel.hh:157