xrootd
YProtocol.hh
Go to the documentation of this file.
1 #ifndef __YPROTOCOL_H
2 #define __YPROTOCOL_H
3 
4 #ifdef __CINT__
5 #define __attribute__(x)
6 #endif
7 
8 #include "XProtocol/XPtypes.hh"
9 
10 // We need to pack structures sent all over the net!
11 // __attribute__((packed)) assures no padding bytes.
12 //
13 // Note all binary values shall be in network byte order.
14 //
15 // Data is serialized as explained in XrdOucPup.
16 
17 /******************************************************************************/
18 /* C o m m o n R e q u e s t S e c t i o n */
19 /******************************************************************************/
20 
21 namespace XrdCms
22 {
23 
24 static const char kYR_Version = 2;
25 
26 struct CmsRRHdr
27 { kXR_unt32 streamid; // Essentially opaque
28  kXR_char rrCode; // Request or Response code
29  kXR_char modifier; // RR dependent
31 };
32 
33 enum CmsReqCode // Request Codes
34 { kYR_login = 0, // Same as kYR_data
35  kYR_chmod = 1,
37  kYR_mkdir = 3,
39  kYR_mv = 5,
42  kYR_rm = 8,
43  kYR_rmdir = 9,
44  kYR_select = 10,
45  kYR_stats = 11,
46  kYR_avail = 12,
47  kYR_disc = 13,
48  kYR_gone = 14,
49  kYR_have = 15,
50  kYR_load = 16,
51  kYR_ping = 17,
52  kYR_pong = 18,
53  kYR_space = 19,
54  kYR_state = 20,
55  kYR_statfs = 21,
56  kYR_status = 22,
57  kYR_trunc = 23,
58  kYR_try = 24,
59  kYR_update = 25,
60  kYR_usage = 26,
61  kYR_xauth = 27,
62  kYR_MaxReq // Count of request numbers (highest + 1)
63 };
64 
65 // The hopcount is used for forwarded requests. It is incremented upon each
66 // forwarding until it wraps to zero. At this point the forward is not done.
67 // Forwarding applies to: chmod, have, mkdir, mkpath, mv, prepdel, rm, and
68 // rmdir. Any other modifiers must be encoded in the low order 6 bits.
69 //
71 { kYR_hopcount = 0xc0,
72  kYR_hopincr = 0x40
73 };
74 
76 { kYR_raw = 0x20, // Modifier: Unmarshalled data
77  kYR_dnf = 0x10 // Modifier: mv, rm, rmdir (do not forward)
78 };
79 
80 /******************************************************************************/
81 /* C o m m o n R e s p o n s e S e c t i o n */
82 /******************************************************************************/
83 
84 enum CmsRspCode // Response codes
85 { kYR_data = 0, // Same as kYR_login
86  kYR_error = 1,
88  kYR_wait = 3,
91 };
92 
94 { kYR_ENOENT = 1,
105 };
106 
109 
110 enum {kYR_async = 128 // Modifier: Reply to prev waitresp
111  };
112 
113  kXR_unt32 Val; // Port, Wait val, rc, asyncid
114 // kXR_char Data[Hdr.datalen-4];// Target host, more data, or emessage
115 };
116 
117 /******************************************************************************/
118 /* a v a i l R e q u e s t */
119 /******************************************************************************/
120 
121 // Request: avail <diskFree> <diskUtil>
122 // Respond: n/a
123 //
126 // kXR_int32 diskFree;
127 // kXR_int32 diskUtil;
128 };
129 
130 /******************************************************************************/
131 /* c h m o d R e q u e s t */
132 /******************************************************************************/
133 
134 // Request: chmod <ident> <mode> <path>
135 // Respond: n/a
136 //
139 // kXR_string Ident;
140 // kXR_string Mode;
141 // kXR_string Path;
142 };
143 
144 /******************************************************************************/
145 /* d i s c R e q u e s t */
146 /******************************************************************************/
147 
148 // Request: disc
149 // Respond: n/a
150 //
153 };
154 
155 /******************************************************************************/
156 /* g o n e R e q u e s t */
157 /******************************************************************************/
158 
159 // Request: gone <path>
160 // Respond: n/a
161 //
164 // kXR_string Path;
165 };
166 
167 /******************************************************************************/
168 /* h a v e R e q u e s t */
169 /******************************************************************************/
170 
171 // Request: have <path>
172 // Respond: n/a
173 //
176  enum {Online = 1, Pending = 2}; // Modifiers
177 // kXR_string Path;
178 };
179 
180 /******************************************************************************/
181 /* l o c a t e R e q u e s t */
182 /******************************************************************************/
183 
186 // kXR_string Ident;
187 // kXR_unt32 Opts;
188 
189 enum {kYR_refresh = 0x01,
190  kYR_asap = 0x80
191  };
192 // kXR_string Path;
193 
194 static const int RILen = 32; // Max length of each response item
195 };
196 
197 /******************************************************************************/
198 /* l o g i n R e q u e s t */
199 /******************************************************************************/
200 
201 // Request: login <login_data>
202 // Respond: xauth <auth_data>
203 // login <login_data>
204 //
205 
207 { kXR_unt16 Size; // Temp area for packing purposes
209  kXR_unt32 Mode; // From LoginMode
210  kXR_int32 HoldTime; // Hold time in ms(managers)
211  kXR_unt32 tSpace; // Tot Space GB (servers)
212  kXR_unt32 fSpace; // Free Space MB (servers)
213  kXR_unt32 mSpace; // Minf Space MB (servers)
214  kXR_unt16 fsNum; // File Systems (servers /supervisors)
215  kXR_unt16 fsUtil; // FS Utilization (servers /supervisors)
216  kXR_unt16 dPort; // Data port (servers /supervisors)
217  kXR_unt16 sPort; // Subs port (managers/supervisors)
218  kXR_char *SID; // Server ID (servers/ supervisors)
219  kXR_char *Paths; // Exported paths (servers/ supervisors)
220 
222  {kYR_director= 0x00000001,
223  kYR_manager = 0x00000002,
224  kYR_peer = 0x00000004,
225  kYR_server = 0x00000008,
226  kYR_proxy = 0x00000010,
227  kYR_suspend = 0x00000100, // Suspended login
228  kYR_nostage = 0x00000200, // Staging unavailable
229  kYR_trying = 0x00000400, // Extensive login retries
230  kYR_debug = 0x80000000,
231  kYR_share = 0x7f000000, // Mask to isolate share
232  kYR_shift = 24, // Share shift position
233  kYR_tzone = 0x00f80000, // Mask to isolate time zone
234  kYR_shifttz = 19 // TZone shift position
235  };
236 };
237 
241 };
242 
246 };
247 
248 /******************************************************************************/
249 /* l o a d R e q u e s t */
250 /******************************************************************************/
251 
252 // Request: load <cpu> <io> <load> <mem> <pag> <util> <dskfree>
253 // Respond: n/a
254 //
259 // kXR_char theLoad[numload];
260 // kXR_int dskFree;
261 };
262 
263 /******************************************************************************/
264 /* m k d i r R e q u e s t */
265 /******************************************************************************/
266 
267 // Request: mkdir <ident> <mode> <path>
268 // Respond: n/a
269 //
272 // kXR_string Ident;
273 // kXR_string Mode;
274 // kXR_string Path;
275 };
276 
277 /******************************************************************************/
278 /* m k p a t h R e q u e s t */
279 /******************************************************************************/
280 
281 // Request: <id> mkpath <mode> <path>
282 // Respond: n/a
283 //
286 // kXR_string Ident;
287 // kXR_string Mode;
288 // kXR_string Path;
289 };
290 
291 /******************************************************************************/
292 /* m v R e q u e s t */
293 /******************************************************************************/
294 
295 // Request: <id> mv <old_name> <new_name>
296 // Respond: n/a
297 //
298 struct CmsMvRequest {
299  CmsRRHdr Hdr; // Subject to kYR_dnf modifier!
300 // kXR_string Ident;
301 // kXR_string Old_Path;
302 // kXR_string New_Path;
303 };
304 
305 /******************************************************************************/
306 /* p i n g R e q u e s t */
307 /******************************************************************************/
308 
309 // Request: ping
310 // Respond: n/a
311 //
314 };
315 
316 /******************************************************************************/
317 /* p o n g R e q u e s t */
318 /******************************************************************************/
319 
320 // Request: pong
321 // Respond: n/a
322 //
325 };
326 
327 /******************************************************************************/
328 /* p r e p a d d R e q u e s t */
329 /******************************************************************************/
330 
331 // Request: <id> prepadd <reqid> <usr> <prty> <mode> <path>\n
332 // Respond: No response.
333 //
335 { CmsRRHdr Hdr; // Modifier used with following options
336 
337 enum {kYR_stage = 0x0001, // Stage the data
338  kYR_write = 0x0002, // Prepare for writing
339  kYR_coloc = 0x0004, // Prepare for co-location
340  kYR_fresh = 0x0008, // Prepare by time refresh
341  kYR_metaman = 0x0010 // Prepare via meta-manager
342  };
343 // kXR_string Ident;
344 // kXR_string reqid;
345 // kXR_string user;
346 // kXR_string prty;
347 // kXR_string mode;
348 // kXR_string Path;
349 // kXR_string Opaque; // Optional
350 };
351 
352 /******************************************************************************/
353 /* p r e p d e l R e q u e s t */
354 /******************************************************************************/
355 
356 // Request: <id> prepdel <reqid>
357 // Respond: No response.
358 //
361 // kXR_string Ident;
362 // kXR_string reqid;
363 };
364 
365 /******************************************************************************/
366 /* r m R e q u e s t */
367 /******************************************************************************/
368 
369 // Request: <id> rm <path>
370 // Respond: n/a
371 //
373 { CmsRRHdr Hdr; // Subject to kYR_dnf modifier!
374 // kXR_string Ident;
375 // kXR_string Path;
376 };
377 
378 /******************************************************************************/
379 /* r m d i r R e q u e s t */
380 /******************************************************************************/
381 
382 // Request: <id> rmdir <path>
383 // Respond: n/a
384 //
386 { CmsRRHdr Hdr; // Subject to kYR_dnf modifier!
387 // kXR_string Ident;
388 // kXR_string Path;
389 };
390 
391 /******************************************************************************/
392 /* s e l e c t R e q u e s t */
393 /******************************************************************************/
394 
395 // Request: <id> select[s] {c | d | m | r | w | s | t | x} <path> [-host]
396 
397 // Note: selects - requests a cache refresh for <path>
398 // kYR_refresh - refresh file location cache
399 // kYR_create c - file will be created
400 // kYR_delete d - file will be created or truncated
401 // kYR_metaop m - inod will only be modified
402 // kYR_read r - file will only be read
403 // kYR_replica - file will replicated
404 // kYR_write w - file will be read and writen
405 // kYR_stats s - only stat information will be obtained
406 // kYR_online x - consider only online files
407 // may be combined with kYR_stats (file must be resident)
408 // - - the host failed to deliver the file.
409 
410 
413 // kXR_string Ident;
414 // kXR_unt32 Opts;
415 
416 enum {kYR_refresh = 0x0001,
417  kYR_create = 0x0002, // May combine with trunc -> delete
418  kYR_online = 0x0004,
419  kYR_read = 0x0008, // Default
420  kYR_trunc = 0x0010, // -> write
421  kYR_write = 0x0020,
422  kYR_stat = 0x0040, // Exclsuive
423  kYR_metaop = 0x0080,
424  kYR_replica = 0x0100 // Only in combination with create
425  };
426 // kXR_string Path;
427 // kXR_string Opaque; // Optional
428 // kXR_string Host; // Optional
429 };
430 
431 /******************************************************************************/
432 /* s p a c e R e q u e s t */
433 /******************************************************************************/
434 
435 // Request: space
436 //
437 
440 };
441 
442 /******************************************************************************/
443 /* s t a t e R e q u e s t */
444 /******************************************************************************/
445 
446 // Request: state <path>
447 //
448 
451 // kXR_string Path;
452 
453 enum {kYR_refresh = 0x01, // Modifier
454  kYR_noresp = 0x02,
455  kYR_metaman = 0x08
456  };
457 };
458 
459 /******************************************************************************/
460 /* s t a t f s R e q u e s t */
461 /******************************************************************************/
462 
463 // Request: statfs <path>
464 //
465 
468 // kXR_string Path;
469 };
470 
471 /******************************************************************************/
472 /* s t a t s R e q u e s t */
473 /******************************************************************************/
474 
475 // Request: stats or statsz (determined by modifier)
476 //
477 
480 
481 enum {kYR_size = 1 // Modifier
482  };
483 };
484 
485 /******************************************************************************/
486 /* s t a t u s R e q u e s t */
487 /******************************************************************************/
488 
489 // Request: status
490 //
493 
494 enum {kYR_Stage = 0x01, kYR_noStage = 0x02, // Modifier
495  kYR_Resume = 0x04, kYR_Suspend = 0x08,
496  kYR_Reset = 0x10 // Exclusive
497  };
498 };
499 
500 /******************************************************************************/
501 /* t r u n c R e q u e s t */
502 /******************************************************************************/
503 
504 // Request: <id> trunc <path>
505 // Respond: n/a
506 //
509 // kXR_string Ident;
510 // kXR_string Size;
511 // kXR_string Path;
512 };
513 
514 /******************************************************************************/
515 /* t r y R e q u e s t */
516 /******************************************************************************/
517 
518 // Request: try
519 //
522  kXR_unt16 sLen; // This is the string length in PUP format
523 
524 // kYR_string {ipaddr:port}[up to STMax];
525 };
526 
527 /******************************************************************************/
528 /* u p d a t e R e q u e s t */
529 /******************************************************************************/
530 
531 // Request: update
532 //
535 };
536 
537 /******************************************************************************/
538 /* u s a g e R e q u e s t */
539 /******************************************************************************/
540 
541 // Request: usage
542 //
545 };
546 
547 }; // namespace XrdCms
548 #endif