xrootd
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 
41  //----------------------------------------------------------------------------
43  //----------------------------------------------------------------------------
44  class Channel
45  {
46  public:
47  //------------------------------------------------------------------------
55  //------------------------------------------------------------------------
56  Channel( const URL &url,
57  Poller *poller,
58  TransportHandler *transport,
59  TaskManager *taskManager,
60  JobManager *jobManager );
61 
62  //------------------------------------------------------------------------
64  //------------------------------------------------------------------------
65  ~Channel();
66 
67  //------------------------------------------------------------------------
69  //------------------------------------------------------------------------
70  const URL &GetURL() const
71  {
72  return pUrl;
73  }
74 
75  //------------------------------------------------------------------------
85  //------------------------------------------------------------------------
86  Status Send( Message *msg, bool stateful, time_t expires );
87 
88  //------------------------------------------------------------------------
100  //------------------------------------------------------------------------
101  Status Send( Message *msg,
102  OutgoingMsgHandler *handler,
103  bool stateful,
104  time_t expires );
105 
106 
107  //------------------------------------------------------------------------
117  //------------------------------------------------------------------------
118  Status Receive( Message *&msg, MessageFilter *filter, time_t expires );
119 
120  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
128  Status Receive( IncomingMsgHandler *handler, time_t expires );
129 
130  //------------------------------------------------------------------------
137  //------------------------------------------------------------------------
138  Status QueryTransport( uint16_t query, AnyObject &result );
139 
140  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
143  void RegisterEventHandler( ChannelEventHandler *handler );
144 
145  //------------------------------------------------------------------------
147  //------------------------------------------------------------------------
148  void RemoveEventHandler( ChannelEventHandler *handler );
149 
150  //------------------------------------------------------------------------
152  //------------------------------------------------------------------------
153  void Tick( time_t now );
154 
155  private:
156 
161  std::vector<Stream *> pStreams;
167  };
168 }
169 
170 #endif // __XRD_CL_POST_CHANNEL_HH__