xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 <stdint.h>
23 #include <vector>
24 #include <ctime>
25 
26 #include "XrdCl/XrdClStatus.hh"
27 #include "XrdCl/XrdClURL.hh"
28 #include "XrdCl/XrdClPoller.hh"
29 #include "XrdCl/XrdClInQueue.hh"
31 #include "XrdCl/XrdClAnyObject.hh"
33 
34 #include "XrdSys/XrdSysPthread.hh"
35 
36 namespace XrdCl
37 {
38  class Stream;
39  class JobManager;
40  class VirtualRedirector;
41  class TickGeneratorTask;
42 
43  //----------------------------------------------------------------------------
45  //----------------------------------------------------------------------------
46  class Channel
47  {
48  public:
49  //------------------------------------------------------------------------
57  //------------------------------------------------------------------------
58  Channel( const URL &url,
59  Poller *poller,
60  TransportHandler *transport,
61  TaskManager *taskManager,
62  JobManager *jobManager );
63 
64  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  ~Channel();
68 
69  //------------------------------------------------------------------------
71  //------------------------------------------------------------------------
72  const URL &GetURL() const
73  {
74  return pUrl;
75  }
76 
77  //------------------------------------------------------------------------
87  //------------------------------------------------------------------------
88  Status Send( Message *msg, bool stateful, time_t expires );
89 
90  //------------------------------------------------------------------------
103  //------------------------------------------------------------------------
104  Status Send( Message *msg,
105  OutgoingMsgHandler *handler,
106  bool stateful,
107  time_t expires );
108 
109  //------------------------------------------------------------------------
119  //------------------------------------------------------------------------
120  Status Receive( Message *&msg, MessageFilter *filter, time_t expires );
121 
122  //------------------------------------------------------------------------
129  //------------------------------------------------------------------------
130  Status Receive( IncomingMsgHandler *handler, time_t expires );
131 
132  //------------------------------------------------------------------------
139  //------------------------------------------------------------------------
140  Status QueryTransport( uint16_t query, AnyObject &result );
141 
142  //------------------------------------------------------------------------
144  //------------------------------------------------------------------------
145  void RegisterEventHandler( ChannelEventHandler *handler );
146 
147  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  void RemoveEventHandler( ChannelEventHandler *handler );
151 
152  //------------------------------------------------------------------------
154  //------------------------------------------------------------------------
155  void Tick( time_t now );
156 
157  //------------------------------------------------------------------------
159  //------------------------------------------------------------------------
161 
162  private:
163 
168  std::vector<Stream *> pStreams;
172  TickGeneratorTask *pTickGenerator;
174  };
175 }
176 
177 #endif // __XRD_CL_POST_CHANNEL_HH__
A synchronized queue.
Definition: XrdClJobManager.hh:50
Definition: XrdClAnyObject.hh:32
Interface for socket pollers.
Definition: XrdClPoller.hh:86
Message filter.
Definition: XrdClPostMasterInterfaces.hh:46
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
Channel(const URL &url, Poller *poller, TransportHandler *transport, TaskManager *taskManager, JobManager *jobManager)
InQueue pIncoming
Definition: XrdClChannel.hh:171
Status QueryTransport(uint16_t query, AnyObject &result)
std::vector< Stream * > pStreams
Definition: XrdClChannel.hh:168
const URL & GetURL() const
Get the URL.
Definition: XrdClChannel.hh:72
JobManager * pJobManager
Definition: XrdClChannel.hh:173
AnyObject pChannelData
Definition: XrdClChannel.hh:170
Procedure execution status.
Definition: XrdClStatus.hh:109
Definition: XrdSysPthread.hh:165
URL pUrl
Definition: XrdClChannel.hh:164
A communication channel between the client and the server.
Definition: XrdClChannel.hh:46
TickGeneratorTask * pTickGenerator
Definition: XrdClChannel.hh:172
Status Send(Message *msg, bool stateful, time_t expires)
Perform the handshake and the authentication for each physical stream.
Definition: XrdClPostMasterInterfaces.hh:302
void RemoveEventHandler(ChannelEventHandler *handler)
Remove a channel event handler.
Channel event handler.
Definition: XrdClPostMasterInterfaces.hh:220
Message handler.
Definition: XrdClPostMasterInterfaces.hh:68
A synchronize queue for incoming data.
Definition: XrdClInQueue.hh:35
TaskManager * pTaskManager
Definition: XrdClChannel.hh:167
Poller * pPoller
Definition: XrdClChannel.hh:165
Status Receive(Message *&msg, MessageFilter *filter, time_t expires)
~Channel()
Destructor.
URL representation.
Definition: XrdClURL.hh:30
Status ForceDisconnect()
Force disconnect of all streams.
Message status handler.
Definition: XrdClPostMasterInterfaces.hh:167
Definition: XrdClTaskManager.hh:75
TransportHandler * pTransport
Definition: XrdClChannel.hh:166
XrdSysMutex pMutex
Definition: XrdClChannel.hh:169