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 
40  //----------------------------------------------------------------------------
42  //----------------------------------------------------------------------------
43  class Channel
44  {
45  public:
46  //------------------------------------------------------------------------
53  //------------------------------------------------------------------------
54  Channel( const URL &url,
55  Poller *poller,
56  TransportHandler *transport,
57  TaskManager *taskManager );
58 
59  //------------------------------------------------------------------------
61  //------------------------------------------------------------------------
62  ~Channel();
63 
64  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  const URL &GetURL() const
68  {
69  return pUrl;
70  }
71 
72  //------------------------------------------------------------------------
82  //------------------------------------------------------------------------
83  Status Send( Message *msg, bool stateful, time_t expires );
84 
85  //------------------------------------------------------------------------
97  //------------------------------------------------------------------------
98  Status Send( Message *msg,
99  OutgoingMsgHandler *handler,
100  bool stateful,
101  time_t expires );
102 
103 
104  //------------------------------------------------------------------------
114  //------------------------------------------------------------------------
115  Status Receive( Message *&msg, MessageFilter *filter, time_t expires );
116 
117  //------------------------------------------------------------------------
124  //------------------------------------------------------------------------
125  Status Receive( IncomingMsgHandler *handler, time_t expires );
126 
127  //------------------------------------------------------------------------
134  //------------------------------------------------------------------------
135  Status QueryTransport( uint16_t query, AnyObject &result );
136 
137  //------------------------------------------------------------------------
139  //------------------------------------------------------------------------
140  void RegisterEventHandler( ChannelEventHandler *handler );
141 
142  //------------------------------------------------------------------------
144  //------------------------------------------------------------------------
145  void RemoveEventHandler( ChannelEventHandler *handler );
146 
147  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  void Tick( time_t now );
151 
152  private:
153 
158  std::vector<Stream *> pStreams;
163  };
164 }
165 
166 #endif // __XRD_CL_POST_CHANNEL_HH__