xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XProtocol
YProtocol.hh
Go to the documentation of this file.
1
#ifndef __YPROTOCOL_H
2
#define __YPROTOCOL_H
3
/******************************************************************************/
4
/* */
5
/* Y P r o t o c o l . h h */
6
/* */
7
/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC02-76-SFO0515 with the Department of Energy */
11
/* */
12
/* This file is part of the XRootD software suite. */
13
/* */
14
/* XRootD is free software: you can redistribute it and/or modify it under */
15
/* the terms of the GNU Lesser General Public License as published by the */
16
/* Free Software Foundation, either version 3 of the License, or (at your */
17
/* option) any later version. */
18
/* */
19
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22
/* License for more details. */
23
/* */
24
/* You should have received a copy of the GNU Lesser General Public License */
25
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27
/* */
28
/* The copyright holder's institutional names and contributor's names may not */
29
/* be used to endorse or promote products derived from this software without */
30
/* specific prior written permission of the institution or contributor. */
31
/******************************************************************************/
32
33
#ifdef __CINT__
34
#define __attribute__(x)
35
#endif
36
37
#include "
XProtocol/XPtypes.hh
"
38
39
// We need to pack structures sent all over the net!
40
// __attribute__((packed)) assures no padding bytes.
41
//
42
// Note all binary values shall be in network byte order.
43
//
44
// Data is serialized as explained in XrdOucPup.
45
46
/******************************************************************************/
47
/* C o m m o n R e q u e s t S e c t i o n */
48
/******************************************************************************/
49
50
namespace
XrdCms
51
{
52
53
static
const
char
kYR_Version
= 2;
54
55
struct
CmsRRHdr
56
{
kXR_unt32
streamid
;
// Essentially opaque
57
kXR_char
rrCode
;
// Request or Response code
58
kXR_char
modifier
;
// RR dependent
59
kXR_unt16
datalen
;
60
};
61
62
enum
CmsReqCode
// Request Codes
63
{
kYR_login
= 0,
// Same as kYR_data
64
kYR_chmod
= 1,
65
kYR_locate
= 2,
66
kYR_mkdir
= 3,
67
kYR_mkpath
= 4,
68
kYR_mv
= 5,
69
kYR_prepadd
= 6,
70
kYR_prepdel
= 7,
71
kYR_rm
= 8,
72
kYR_rmdir
= 9,
73
kYR_select
= 10,
74
kYR_stats
= 11,
75
kYR_avail
= 12,
76
kYR_disc
= 13,
77
kYR_gone
= 14,
78
kYR_have
= 15,
79
kYR_load
= 16,
80
kYR_ping
= 17,
81
kYR_pong
= 18,
82
kYR_space
= 19,
83
kYR_state
= 20,
84
kYR_statfs
= 21,
85
kYR_status
= 22,
86
kYR_trunc
= 23,
87
kYR_try
= 24,
88
kYR_update
= 25,
89
kYR_usage
= 26,
90
kYR_xauth
= 27,
91
kYR_MaxReq
// Count of request numbers (highest + 1)
92
};
93
94
// The hopcount is used for forwarded requests. It is incremented upon each
95
// forwarding until it wraps to zero. At this point the forward is not done.
96
// Forwarding applies to: chmod, have, mkdir, mkpath, mv, prepdel, rm, and
97
// rmdir. Any other modifiers must be encoded in the low order 6 bits.
98
//
99
enum
CmsFwdModifier
100
{
kYR_hopcount
= 0xc0,
101
kYR_hopincr
= 0x40
102
};
103
104
enum
CmsReqModifier
105
{
kYR_raw
= 0x20,
// Modifier: Unmarshalled data
106
kYR_dnf
= 0x10
// Modifier: mv, rm, rmdir (do not forward)
107
};
108
109
/******************************************************************************/
110
/* C o m m o n R e s p o n s e S e c t i o n */
111
/******************************************************************************/
112
113
enum
CmsRspCode
// Response codes
114
{
kYR_data
= 0,
// Same as kYR_login
115
kYR_error
= 1,
116
kYR_redirect
= 2,
117
kYR_wait
= 3,
118
kYR_waitresp
= 4,
119
kYR_yauth
= 5
120
};
121
122
enum
YErrorCode
123
{
kYR_ENOENT
= 1,
124
kYR_EPERM
,
125
kYR_EACCES
,
126
kYR_EINVAL
,
127
kYR_EIO
,
128
kYR_ENOMEM
,
129
kYR_ENOSPC
,
130
kYR_ENAMETOOLONG
,
131
kYR_ENETUNREACH
,
132
kYR_ENOTBLK
,
133
kYR_EISDIR
134
};
135
136
struct
CmsResponse
137
{
CmsRRHdr
Hdr
;
138
139
enum
{
kYR_async
= 128
// Modifier: Reply to prev waitresp
140
};
141
142
kXR_unt32
Val
;
// Port, Wait val, rc, asyncid
143
// kXR_char Data[Hdr.datalen-4];// Target host, more data, or emessage
144
};
145
146
/******************************************************************************/
147
/* a v a i l R e q u e s t */
148
/******************************************************************************/
149
150
// Request: avail <diskFree> <diskUtil>
151
// Respond: n/a
152
//
153
struct
CmsAvailRequest
154
{
CmsRRHdr
Hdr
;
155
// kXR_int32 diskFree;
156
// kXR_int32 diskUtil;
157
};
158
159
/******************************************************************************/
160
/* c h m o d R e q u e s t */
161
/******************************************************************************/
162
163
// Request: chmod <ident> <mode> <path>
164
// Respond: n/a
165
//
166
struct
CmsChmodRequest
167
{
CmsRRHdr
Hdr
;
168
// kXR_string Ident;
169
// kXR_string Mode;
170
// kXR_string Path;
171
};
172
173
/******************************************************************************/
174
/* d i s c R e q u e s t */
175
/******************************************************************************/
176
177
// Request: disc
178
// Respond: n/a
179
//
180
struct
CmsDiscRequest
181
{
CmsRRHdr
Hdr
;
182
};
183
184
/******************************************************************************/
185
/* g o n e R e q u e s t */
186
/******************************************************************************/
187
188
// Request: gone <path>
189
// Respond: n/a
190
//
191
struct
CmsGoneRequest
192
{
CmsRRHdr
Hdr
;
193
// kXR_string Path;
194
};
195
196
/******************************************************************************/
197
/* h a v e R e q u e s t */
198
/******************************************************************************/
199
200
// Request: have <path>
201
// Respond: n/a
202
//
203
struct
CmsHaveRequest
204
{
CmsRRHdr
Hdr
;
205
enum
{
Online
= 1,
Pending
= 2};
// Modifiers
206
// kXR_string Path;
207
};
208
209
/******************************************************************************/
210
/* l o c a t e R e q u e s t */
211
/******************************************************************************/
212
213
struct
CmsLocateRequest
214
{
CmsRRHdr
Hdr
;
215
// kXR_string Ident;
216
// kXR_unt32 Opts;
217
218
enum
{
kYR_refresh
= 0x01,
219
kYR_asap
= 0x80
220
};
221
// kXR_string Path;
222
223
static
const
int
RILen
= 32;
// Max length of each response item
224
};
225
226
/******************************************************************************/
227
/* l o g i n R e q u e s t */
228
/******************************************************************************/
229
230
// Request: login <login_data>
231
// Respond: xauth <auth_data>
232
// login <login_data>
233
//
234
235
struct
CmsLoginData
236
{
kXR_unt16
Size
;
// Temp area for packing purposes
237
kXR_unt16
Version
;
238
kXR_unt32
Mode
;
// From LoginMode
239
kXR_int32
HoldTime
;
// Hold time in ms(managers)
240
kXR_unt32
tSpace
;
// Tot Space GB (servers)
241
kXR_unt32
fSpace
;
// Free Space MB (servers)
242
kXR_unt32
mSpace
;
// Minf Space MB (servers)
243
kXR_unt16
fsNum
;
// File Systems (servers /supervisors)
244
kXR_unt16
fsUtil
;
// FS Utilization (servers /supervisors)
245
kXR_unt16
dPort
;
// Data port (servers /supervisors)
246
kXR_unt16
sPort
;
// Subs port (managers/supervisors)
247
kXR_char
*
SID
;
// Server ID (servers/ supervisors)
248
kXR_char
*
Paths
;
// Exported paths (servers/ supervisors)
249
250
enum
LoginMode
251
{
kYR_director
= 0x00000001,
252
kYR_manager
= 0x00000002,
253
kYR_peer
= 0x00000004,
254
kYR_server
= 0x00000008,
255
kYR_proxy
= 0x00000010,
256
kYR_suspend
= 0x00000100,
// Suspended login
257
kYR_nostage
= 0x00000200,
// Staging unavailable
258
kYR_trying
= 0x00000400,
// Extensive login retries
259
kYR_debug
= 0x80000000,
260
kYR_share
= 0x7f000000,
// Mask to isolate share
261
kYR_shift
= 24,
// Share shift position
262
kYR_tzone
= 0x00f80000,
// Mask to isolate time zone
263
kYR_shifttz
= 19
// TZone shift position
264
};
265
};
266
267
struct
CmsLoginRequest
268
{
CmsRRHdr
Hdr
;
269
CmsLoginData
Data
;
270
};
271
272
struct
CmsLoginResponse
273
{
CmsRRHdr
Hdr
;
274
CmsLoginData
Data
;
275
};
276
277
/******************************************************************************/
278
/* l o a d R e q u e s t */
279
/******************************************************************************/
280
281
// Request: load <cpu> <io> <load> <mem> <pag> <util> <dskfree>
282
// Respond: n/a
283
//
284
struct
CmsLoadRequest
285
{
CmsRRHdr
Hdr
;
286
enum
{
cpuLoad
=0,
netLoad
,
xeqLoad
,
memLoad
,
pagLoad
,
dskLoad
,
287
numLoad
};
288
// kXR_char theLoad[numload];
289
// kXR_int dskFree;
290
};
291
292
/******************************************************************************/
293
/* m k d i r R e q u e s t */
294
/******************************************************************************/
295
296
// Request: mkdir <ident> <mode> <path>
297
// Respond: n/a
298
//
299
struct
CmsMkdirRequest
300
{
CmsRRHdr
Hdr
;
301
// kXR_string Ident;
302
// kXR_string Mode;
303
// kXR_string Path;
304
};
305
306
/******************************************************************************/
307
/* m k p a t h R e q u e s t */
308
/******************************************************************************/
309
310
// Request: <id> mkpath <mode> <path>
311
// Respond: n/a
312
//
313
struct
CmsMkpathRequest
314
{
CmsRRHdr
Hdr
;
315
// kXR_string Ident;
316
// kXR_string Mode;
317
// kXR_string Path;
318
};
319
320
/******************************************************************************/
321
/* m v R e q u e s t */
322
/******************************************************************************/
323
324
// Request: <id> mv <old_name> <new_name>
325
// Respond: n/a
326
//
327
struct
CmsMvRequest
{
328
CmsRRHdr
Hdr
;
// Subject to kYR_dnf modifier!
329
// kXR_string Ident;
330
// kXR_string Old_Path;
331
// kXR_string New_Path;
332
};
333
334
/******************************************************************************/
335
/* p i n g R e q u e s t */
336
/******************************************************************************/
337
338
// Request: ping
339
// Respond: n/a
340
//
341
struct
CmsPingRequest
{
342
CmsRRHdr
Hdr
;
343
};
344
345
/******************************************************************************/
346
/* p o n g R e q u e s t */
347
/******************************************************************************/
348
349
// Request: pong
350
// Respond: n/a
351
//
352
struct
CmsPongRequest
{
353
CmsRRHdr
Hdr
;
354
};
355
356
/******************************************************************************/
357
/* p r e p a d d R e q u e s t */
358
/******************************************************************************/
359
360
// Request: <id> prepadd <reqid> <usr> <prty> <mode> <path>\n
361
// Respond: No response.
362
//
363
struct
CmsPrepAddRequest
364
{
CmsRRHdr
Hdr
;
// Modifier used with following options
365
366
enum
{
kYR_stage
= 0x0001,
// Stage the data
367
kYR_write
= 0x0002,
// Prepare for writing
368
kYR_coloc
= 0x0004,
// Prepare for co-location
369
kYR_fresh
= 0x0008,
// Prepare by time refresh
370
kYR_metaman
= 0x0010
// Prepare via meta-manager
371
};
372
// kXR_string Ident;
373
// kXR_string reqid;
374
// kXR_string user;
375
// kXR_string prty;
376
// kXR_string mode;
377
// kXR_string Path;
378
// kXR_string Opaque; // Optional
379
};
380
381
/******************************************************************************/
382
/* p r e p d e l R e q u e s t */
383
/******************************************************************************/
384
385
// Request: <id> prepdel <reqid>
386
// Respond: No response.
387
//
388
struct
CmsPrepDelRequest
389
{
CmsRRHdr
Hdr
;
390
// kXR_string Ident;
391
// kXR_string reqid;
392
};
393
394
/******************************************************************************/
395
/* r m R e q u e s t */
396
/******************************************************************************/
397
398
// Request: <id> rm <path>
399
// Respond: n/a
400
//
401
struct
CmsRmRequest
402
{
CmsRRHdr
Hdr
;
// Subject to kYR_dnf modifier!
403
// kXR_string Ident;
404
// kXR_string Path;
405
};
406
407
/******************************************************************************/
408
/* r m d i r R e q u e s t */
409
/******************************************************************************/
410
411
// Request: <id> rmdir <path>
412
// Respond: n/a
413
//
414
struct
CmsRmdirRequest
415
{
CmsRRHdr
Hdr
;
// Subject to kYR_dnf modifier!
416
// kXR_string Ident;
417
// kXR_string Path;
418
};
419
420
/******************************************************************************/
421
/* s e l e c t R e q u e s t */
422
/******************************************************************************/
423
424
// Request: <id> select[s] {c | d | m | r | w | s | t | x} <path> [-host]
425
426
// Note: selects - requests a cache refresh for <path>
427
// kYR_refresh - refresh file location cache
428
// kYR_create c - file will be created
429
// kYR_delete d - file will be created or truncated
430
// kYR_metaop m - inod will only be modified
431
// kYR_read r - file will only be read
432
// kYR_replica - file will replicated
433
// kYR_write w - file will be read and writen
434
// kYR_stats s - only stat information will be obtained
435
// kYR_online x - consider only online files
436
// may be combined with kYR_stats (file must be resident)
437
// - - the host failed to deliver the file.
438
439
440
struct
CmsSelectRequest
441
{
CmsRRHdr
Hdr
;
442
// kXR_string Ident;
443
// kXR_unt32 Opts;
444
445
enum
{
kYR_refresh
= 0x0001,
446
kYR_create
= 0x0002,
// May combine with trunc -> delete
447
kYR_online
= 0x0004,
448
kYR_read
= 0x0008,
// Default
449
kYR_trunc
= 0x0010,
// -> write
450
kYR_write
= 0x0020,
451
kYR_stat
= 0x0040,
// Exclsuive
452
kYR_metaop
= 0x0080,
453
kYR_replica
= 0x0100
// Only in combination with create
454
};
455
// kXR_string Path;
456
// kXR_string Opaque; // Optional
457
// kXR_string Host; // Optional
458
};
459
460
/******************************************************************************/
461
/* s p a c e R e q u e s t */
462
/******************************************************************************/
463
464
// Request: space
465
//
466
467
struct
CmsSpaceRequest
468
{
CmsRRHdr
Hdr
;
469
};
470
471
/******************************************************************************/
472
/* s t a t e R e q u e s t */
473
/******************************************************************************/
474
475
// Request: state <path>
476
//
477
478
struct
CmsStateRequest
479
{
CmsRRHdr
Hdr
;
480
// kXR_string Path;
481
482
enum
{
kYR_refresh
= 0x01,
// Modifier
483
kYR_noresp
= 0x02,
484
kYR_metaman
= 0x08
485
};
486
};
487
488
/******************************************************************************/
489
/* s t a t f s R e q u e s t */
490
/******************************************************************************/
491
492
// Request: statfs <path>
493
//
494
495
struct
CmsStatfsRequest
496
{
CmsRRHdr
Hdr
;
497
// kXR_string Path;
498
};
499
500
/******************************************************************************/
501
/* s t a t s R e q u e s t */
502
/******************************************************************************/
503
504
// Request: stats or statsz (determined by modifier)
505
//
506
507
struct
CmsStatsRequest
508
{
CmsRRHdr
Hdr
;
509
510
enum
{
kYR_size
= 1
// Modifier
511
};
512
};
513
514
/******************************************************************************/
515
/* s t a t u s R e q u e s t */
516
/******************************************************************************/
517
518
// Request: status
519
//
520
struct
CmsStatusRequest
521
{
CmsRRHdr
Hdr
;
522
523
enum
{
kYR_Stage
= 0x01,
kYR_noStage
= 0x02,
// Modifier
524
kYR_Resume
= 0x04,
kYR_Suspend
= 0x08,
525
kYR_Reset
= 0x10
// Exclusive
526
};
527
};
528
529
/******************************************************************************/
530
/* t r u n c R e q u e s t */
531
/******************************************************************************/
532
533
// Request: <id> trunc <path>
534
// Respond: n/a
535
//
536
struct
CmsTruncRequest
537
{
CmsRRHdr
Hdr
;
538
// kXR_string Ident;
539
// kXR_string Size;
540
// kXR_string Path;
541
};
542
543
/******************************************************************************/
544
/* t r y R e q u e s t */
545
/******************************************************************************/
546
547
// Request: try
548
//
549
struct
CmsTryRequest
550
{
CmsRRHdr
Hdr
;
551
kXR_unt16
sLen
;
// This is the string length in PUP format
552
553
// kYR_string {ipaddr:port}[up to STMax];
554
};
555
556
/******************************************************************************/
557
/* u p d a t e R e q u e s t */
558
/******************************************************************************/
559
560
// Request: update
561
//
562
struct
CmsUpdateRequest
563
{
CmsRRHdr
Hdr
;
564
};
565
566
/******************************************************************************/
567
/* u s a g e R e q u e s t */
568
/******************************************************************************/
569
570
// Request: usage
571
//
572
struct
CmsUsageRequest
573
{
CmsRRHdr
Hdr
;
574
};
575
576
};
// namespace XrdCms
577
#endif
Generated by
1.8.3.1