xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCl
XrdClPostMasterInterfaces.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_INTERFACES_HH__
20
#define __XRD_CL_POST_MASTER_INTERFACES_HH__
21
22
#include <stdint.h>
23
#include <ctime>
24
25
#include "
XrdCl/XrdClStatus.hh
"
26
#include "
XrdCl/XrdClAnyObject.hh
"
27
#include "
XrdCl/XrdClURL.hh
"
28
29
namespace
XrdCl
30
{
31
class
Channel;
32
class
Message;
33
class
Socket;
34
class
URL;
35
36
//----------------------------------------------------------------------------
38
//----------------------------------------------------------------------------
39
class
MessageFilter
40
{
41
public
:
42
virtual
~MessageFilter
() {}
43
44
//------------------------------------------------------------------------
47
//------------------------------------------------------------------------
48
virtual
bool
Filter
(
const
Message
*msg ) = 0;
49
};
50
51
//----------------------------------------------------------------------------
53
//----------------------------------------------------------------------------
54
class
IncomingMsgHandler
55
{
56
public
:
57
//------------------------------------------------------------------------
59
//------------------------------------------------------------------------
60
enum
Action
61
{
62
Take
= 0x01,
63
Ignore
= 0x02,
64
RemoveHandler
= 0x04
65
66
};
67
68
//------------------------------------------------------------------------
70
//------------------------------------------------------------------------
71
enum
StreamEvent
72
{
73
Ready
= 1,
74
Broken
= 2,
75
Timeout
= 3,
76
FatalError
= 4
77
};
78
79
//------------------------------------------------------------------------
81
//------------------------------------------------------------------------
82
83
virtual
~IncomingMsgHandler
() {}
84
85
//------------------------------------------------------------------------
91
//------------------------------------------------------------------------
92
virtual
uint8_t
OnIncoming
(
Message
*msg ) = 0;
93
94
//------------------------------------------------------------------------
101
//------------------------------------------------------------------------
102
virtual
uint8_t
OnStreamEvent
(
StreamEvent
event,
103
uint16_t streamNum,
104
Status
status )
105
{
106
return
0;
107
};
108
};
109
110
//----------------------------------------------------------------------------
112
//----------------------------------------------------------------------------
113
class
OutgoingMsgHandler
114
{
115
public
:
116
virtual
~OutgoingMsgHandler
() {}
117
118
//------------------------------------------------------------------------
120
//------------------------------------------------------------------------
121
virtual
void
OnStatusReady
(
const
Message
*message,
122
Status
status ) = 0;
123
124
//------------------------------------------------------------------------
132
//------------------------------------------------------------------------
133
virtual
void
OnReadyToSend
(
Message
*msg, uint16_t streamNum ) {};
134
};
135
136
//----------------------------------------------------------------------------
138
//----------------------------------------------------------------------------
139
class
ChannelEventHandler
140
{
141
public
:
142
//------------------------------------------------------------------------
144
//------------------------------------------------------------------------
145
enum
ChannelEvent
146
{
147
StreamReady
= 1,
148
StreamBroken
= 2,
149
FatalError
= 4
150
};
151
152
//------------------------------------------------------------------------
154
//------------------------------------------------------------------------
155
virtual
~ChannelEventHandler
() {};
156
157
//------------------------------------------------------------------------
165
//------------------------------------------------------------------------
166
virtual
bool
OnChannelEvent
(
ChannelEvent
event,
167
Status
status,
168
uint16_t
stream
) = 0;
169
};
170
171
//----------------------------------------------------------------------------
173
//----------------------------------------------------------------------------
174
struct
HandShakeData
175
{
176
//--------------------------------------------------------------------------
178
//--------------------------------------------------------------------------
179
HandShakeData
(
const
URL
*addr, uint16_t
stream
, uint16_t subStream ):
180
step
(0),
out
(0),
in
(0),
url
(addr),
streamId
(stream),
181
subStreamId
( subStream ),
startTime
( time(0) ),
serverAddr
(0)
182
{}
183
uint16_t
step
;
184
Message
*
out
;
185
Message
*
in
;
186
const
URL
*
url
;
187
uint16_t
streamId
;
188
uint16_t
subStreamId
;
189
time_t
startTime
;
190
const
void
*
serverAddr
;
191
std::string
clientName
;
192
std::string
streamName
;
193
};
194
195
//----------------------------------------------------------------------------
198
//----------------------------------------------------------------------------
199
struct
PathID
200
{
201
PathID
( uint16_t u = 0, uint16_t d = 0 ):
up
(u),
down
(d) {}
202
uint16_t
up
;
203
uint16_t
down
;
204
};
205
206
//----------------------------------------------------------------------------
209
//----------------------------------------------------------------------------
210
struct
TransportQuery
211
{
212
static
const
uint16_t
Name
= 1;
213
static
const
uint16_t
Auth
= 2;
214
};
215
216
//----------------------------------------------------------------------------
218
//----------------------------------------------------------------------------
219
class
TransportHandler
220
{
221
public
:
222
virtual
~TransportHandler
() {}
223
224
//------------------------------------------------------------------------
236
//------------------------------------------------------------------------
237
virtual
Status
GetMessage
(
Message
*message,
Socket
*socket ) = 0;
238
239
//------------------------------------------------------------------------
241
//------------------------------------------------------------------------
242
virtual
void
InitializeChannel
(
AnyObject
&channelData ) = 0;
243
244
//------------------------------------------------------------------------
246
//------------------------------------------------------------------------
247
virtual
void
FinalizeChannel
(
AnyObject
&channelData ) = 0;
248
249
//------------------------------------------------------------------------
251
//------------------------------------------------------------------------
252
virtual
Status
HandShake
(
HandShakeData
*handShakeData,
253
AnyObject
&channelData ) = 0;
254
255
//------------------------------------------------------------------------
257
//------------------------------------------------------------------------
258
virtual
bool
IsStreamTTLElapsed
( time_t inactiveTime,
259
AnyObject
&channelData ) = 0;
260
261
//------------------------------------------------------------------------
267
//------------------------------------------------------------------------
268
virtual
PathID
Multiplex
(
Message
*msg,
269
AnyObject
&channelData,
270
PathID
*hint = 0 ) = 0;
271
272
//------------------------------------------------------------------------
278
//------------------------------------------------------------------------
279
virtual
PathID
MultiplexSubStream
(
Message
*msg,
280
AnyObject
&channelData,
281
PathID
*hint = 0 ) = 0;
282
283
//------------------------------------------------------------------------
285
//------------------------------------------------------------------------
286
virtual
uint16_t
StreamNumber
(
AnyObject
&channelData ) = 0;
287
288
//------------------------------------------------------------------------
290
//------------------------------------------------------------------------
291
virtual
uint16_t
SubStreamNumber
(
AnyObject
&channelData ) = 0;
292
293
//------------------------------------------------------------------------
295
//------------------------------------------------------------------------
296
virtual
void
Disconnect
(
AnyObject
&channelData,
297
uint16_t streamId,
298
uint16_t subStreamId ) = 0;
299
300
//------------------------------------------------------------------------
302
//------------------------------------------------------------------------
303
virtual
Status
Query
( uint16_t query,
304
AnyObject
&result,
305
AnyObject
&channelData ) = 0;
306
307
//------------------------------------------------------------------------
309
//------------------------------------------------------------------------
310
virtual
bool
Highjack
(
Message
*msg,
AnyObject
&channelData ) = 0;
311
312
};
313
}
314
315
#endif // __XRD_CL_POST_MASTER_INTERFACES_HH__
Generated by
1.8.3.1