xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCl
XrdClXRootDTransport.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_XROOTD_TRANSPORT_HH__
20
#define __XRD_CL_XROOTD_TRANSPORT_HH__
21
22
#include "
XrdCl/XrdClPostMaster.hh
"
23
#include "
XProtocol/XProtocol.hh
"
24
#include "
XrdSec/XrdSecInterface.hh
"
25
#include "
XrdOuc/XrdOucEnv.hh
"
26
27
namespace
XrdCl
28
{
29
struct
XRootDChannelInfo;
30
31
//----------------------------------------------------------------------------
33
//----------------------------------------------------------------------------
34
struct
XRootDQuery
35
{
36
static
const
uint16_t
SIDManager
= 1001;
37
static
const
uint16_t
ServerFlags
= 1002;
38
static
const
uint16_t
ProtocolVersion
= 1003;
39
};
40
41
//----------------------------------------------------------------------------
43
//----------------------------------------------------------------------------
44
class
XRootDTransport
:
public
TransportHandler
45
{
46
public
:
47
//------------------------------------------------------------------------
49
//------------------------------------------------------------------------
50
XRootDTransport
();
51
52
//------------------------------------------------------------------------
54
//------------------------------------------------------------------------
55
~XRootDTransport
();
56
57
//------------------------------------------------------------------------
69
//------------------------------------------------------------------------
70
virtual
Status
GetMessage
(
Message
*message,
Socket
*socket );
71
72
//------------------------------------------------------------------------
74
//------------------------------------------------------------------------
75
virtual
void
InitializeChannel
(
AnyObject
&channelData );
76
77
//------------------------------------------------------------------------
79
//------------------------------------------------------------------------
80
virtual
void
FinalizeChannel
(
AnyObject
&channelData );
81
82
//------------------------------------------------------------------------
84
//------------------------------------------------------------------------
85
virtual
Status
HandShake
(
HandShakeData
*handShakeData,
86
AnyObject
&channelData );
87
88
//------------------------------------------------------------------------
90
//------------------------------------------------------------------------
91
virtual
bool
IsStreamTTLElapsed
( time_t time,
92
AnyObject
&channelData );
93
94
//------------------------------------------------------------------------
100
//------------------------------------------------------------------------
101
virtual
PathID
Multiplex
(
Message
*msg,
102
AnyObject
&channelData,
103
PathID
*hint = 0 );
104
105
//------------------------------------------------------------------------
111
//------------------------------------------------------------------------
112
virtual
PathID
MultiplexSubStream
(
Message
*msg,
113
AnyObject
&channelData,
114
PathID
*hint = 0 );
115
116
//------------------------------------------------------------------------
118
//------------------------------------------------------------------------
119
virtual
uint16_t
StreamNumber
(
AnyObject
&channelData );
120
121
//------------------------------------------------------------------------
123
//------------------------------------------------------------------------
124
virtual
uint16_t
SubStreamNumber
(
AnyObject
&channelData );
125
126
//------------------------------------------------------------------------
129
//------------------------------------------------------------------------
130
virtual
bool
NeedControlConnection
()
131
{
132
return
true
;
133
}
134
135
//------------------------------------------------------------------------
137
//------------------------------------------------------------------------
138
static
Status
MarshallRequest
(
Message
*msg );
139
140
//------------------------------------------------------------------------
143
//------------------------------------------------------------------------
144
static
Status
UnMarshallRequest
(
Message
*msg );
145
146
//------------------------------------------------------------------------
148
//------------------------------------------------------------------------
149
static
Status
UnMarshallBody
(
Message
*msg, uint16_t reqType );
150
151
//------------------------------------------------------------------------
153
//------------------------------------------------------------------------
154
static
void
UnMarshallHeader
(
Message
*msg );
155
156
//------------------------------------------------------------------------
158
//------------------------------------------------------------------------
159
static
void
LogErrorResponse
(
const
Message
&msg );
160
161
//------------------------------------------------------------------------
163
//------------------------------------------------------------------------
164
virtual
void
Disconnect
(
AnyObject
&channelData,
165
uint16_t streamId,
166
uint16_t subStreamId );
167
168
//------------------------------------------------------------------------
170
//------------------------------------------------------------------------
171
virtual
Status
Query
( uint16_t query,
172
AnyObject
&result,
173
AnyObject
&channelData );
174
175
//------------------------------------------------------------------------
177
//------------------------------------------------------------------------
178
static
void
SetDescription
(
Message
*msg );
179
180
//------------------------------------------------------------------------
182
//------------------------------------------------------------------------
183
virtual
bool
Highjack
(
Message
*msg,
AnyObject
&channelData );
184
185
private
:
186
187
//------------------------------------------------------------------------
188
// Hand shake the main stream
189
//------------------------------------------------------------------------
190
Status
HandShakeMain
(
HandShakeData
*handShakeData,
191
AnyObject
&channelData );
192
193
//------------------------------------------------------------------------
194
// Hand shake a parallel stream
195
//------------------------------------------------------------------------
196
Status
HandShakeParallel
(
HandShakeData
*handShakeData,
197
AnyObject
&channelData );
198
199
//------------------------------------------------------------------------
200
// Generate the message to be sent as an initial handshake
201
//------------------------------------------------------------------------
202
Message
*
GenerateInitialHS
(
HandShakeData
*hsData,
203
XRootDChannelInfo
*info );
204
205
//------------------------------------------------------------------------
206
// Generate the message to be sent as an initial handshake
207
// (handshake + kXR_protocol)
208
//------------------------------------------------------------------------
209
Message
*
GenerateInitialHSProtocol
(
HandShakeData
*hsData,
210
XRootDChannelInfo
*info );
211
212
//------------------------------------------------------------------------
213
// Process the server initial handshake response
214
//------------------------------------------------------------------------
215
Status
ProcessServerHS
(
HandShakeData
*hsData,
216
XRootDChannelInfo
*info );
217
218
//-----------------------------------------------------------------------
219
// Process the protocol response
220
//------------------------------------------------------------------------
221
Status
ProcessProtocolResp
(
HandShakeData
*hsData,
222
XRootDChannelInfo
*info );
223
224
//------------------------------------------------------------------------
225
// Generate the bind message
226
//------------------------------------------------------------------------
227
Message
*
GenerateBind
(
HandShakeData
*hsData,
228
XRootDChannelInfo
*info );
229
230
//------------------------------------------------------------------------
231
// Generate the bind message
232
//------------------------------------------------------------------------
233
Status
ProcessBindResp
(
HandShakeData
*hsData,
234
XRootDChannelInfo
*info );
235
236
//------------------------------------------------------------------------
237
// Generate the login message
238
//------------------------------------------------------------------------
239
Message
*
GenerateLogIn
(
HandShakeData
*hsData,
240
XRootDChannelInfo
*info );
241
242
//------------------------------------------------------------------------
243
// Process the login response
244
//------------------------------------------------------------------------
245
Status
ProcessLogInResp
(
HandShakeData
*hsData,
246
XRootDChannelInfo
*info );
247
248
//------------------------------------------------------------------------
249
// Do the authentication
250
//------------------------------------------------------------------------
251
Status
DoAuthentication
(
HandShakeData
*hsData,
252
XRootDChannelInfo
*info );
253
254
//------------------------------------------------------------------------
255
// Get the initial credentials using one of the protocols
256
//------------------------------------------------------------------------
257
Status
GetCredentials
(
XrdSecCredentials
*&credentials,
258
HandShakeData
*hsData,
259
XRootDChannelInfo
*info );
260
261
//------------------------------------------------------------------------
262
// Clean up the data structures created for the authentication process
263
//------------------------------------------------------------------------
264
Status
CleanUpAuthentication
(
XRootDChannelInfo
*info );
265
266
//------------------------------------------------------------------------
267
// Get the authentication function handle
268
//------------------------------------------------------------------------
269
typedef
XrdSecProtocol
*(*XrdSecGetProt_t)(
const
char
*,
270
const
sockaddr &,
271
const
XrdSecParameters
&,
272
XrdOucErrInfo
* );
273
274
XrdSecGetProt_t
GetAuthHandler
();
275
276
//------------------------------------------------------------------------
277
// Get a string representation of the server flags
278
//------------------------------------------------------------------------
279
static
std::string
ServerFlagsToStr
( uint32_t flags );
280
281
//------------------------------------------------------------------------
282
// Get a string representation of file handle
283
//------------------------------------------------------------------------
284
static
std::string
FileHandleToStr
(
const
unsigned
char
handle[4] );
285
286
void
*
pSecLibHandle
;
287
XrdSecGetProt_t
pAuthHandler
;
288
};
289
}
290
291
#endif // __XRD_CL_XROOTD_TRANSPORT_HANDLER_HH__
Generated by
1.8.3.1