xrootd
XrdClPostMaster.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_MASTER_HH__
20 #define __XRD_CL_POST_MASTER_HH__
21 
22 #include <stdint.h>
23 #include <map>
24 #include <vector>
25 
26 #include "XrdCl/XrdClStatus.hh"
27 #include "XrdCl/XrdClURL.hh"
29 
30 #include "XrdSys/XrdSysPthread.hh"
31 
32 namespace XrdCl
33 {
34  class Poller;
35  class TaskManager;
36  class Channel;
37 
38  //----------------------------------------------------------------------------
40  //----------------------------------------------------------------------------
41  class PostMaster
42  {
43  public:
44  //------------------------------------------------------------------------
46  //------------------------------------------------------------------------
47  PostMaster();
48 
49  //------------------------------------------------------------------------
51  //------------------------------------------------------------------------
52  virtual ~PostMaster();
53 
54  //------------------------------------------------------------------------
56  //------------------------------------------------------------------------
57  bool Initialize();
58 
59  //------------------------------------------------------------------------
61  //------------------------------------------------------------------------
62  bool Finalize();
63 
64  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  bool Start();
68 
69  //------------------------------------------------------------------------
71  //------------------------------------------------------------------------
72  bool Stop();
73 
74  //------------------------------------------------------------------------
76  //------------------------------------------------------------------------
77  bool Reinitialize();
78 
79  //------------------------------------------------------------------------
93  //------------------------------------------------------------------------
94  Status Send( const URL &url,
95  Message *msg,
96  bool stateful,
97  time_t expires );
98 
99  //------------------------------------------------------------------------
115  //------------------------------------------------------------------------
116  Status Send( const URL &url,
117  Message *msg,
118  OutgoingMsgHandler *handler,
119  bool stateful,
120  time_t expires );
121 
122  //------------------------------------------------------------------------
133  //------------------------------------------------------------------------
134  Status Receive( const URL &url,
135  Message *&msg,
136  MessageFilter *filter,
137  time_t expires );
138 
139  //------------------------------------------------------------------------
147  //------------------------------------------------------------------------
148  Status Receive( const URL &url,
149  IncomingMsgHandler *handler,
150  time_t expires );
151 
152  //------------------------------------------------------------------------
160  //------------------------------------------------------------------------
161  Status QueryTransport( const URL &url,
162  uint16_t query,
163  AnyObject &result );
164 
165  //------------------------------------------------------------------------
167  //------------------------------------------------------------------------
168  Status RegisterEventHandler( const URL &url,
169  ChannelEventHandler *handler );
170 
171  //------------------------------------------------------------------------
173  //------------------------------------------------------------------------
174  Status RemoveEventHandler( const URL &url,
175  ChannelEventHandler *handler );
176 
177  //------------------------------------------------------------------------
179  //------------------------------------------------------------------------
181  {
182  return pTaskManager;
183  }
184 
185  private:
186  Channel *GetChannel( const URL &url );
187 
188  typedef std::map<std::string, Channel*> ChannelMap;
194  };
195 }
196 
197 #endif // __XRD_CL_POST_MASTER_HH__