XRootD
XProtocol.hh
Go to the documentation of this file.
1 #ifndef __XPROTOCOL_H
2 #define __XPROTOCOL_H
3 /******************************************************************************/
4 /* */
5 /* X 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 /* The XRoot protocol definition, documented in this file, is distributed */
20 /* under a modified BSD license and may be freely used to reimplement it. */
21 /* Any references to "source" in this license refers to this file or any */
22 /* other file that specifically contains the following license. */
23 /* */
24 /* Redistribution and use in source and binary forms, with or without */
25 /* modification, are permitted provided that the following conditions */
26 /* are met: */
27 /* */
28 /* 1. Redistributions of source code must retain the above copyright notice, */
29 /* this list of conditions and the following disclaimer. */
30 /* */
31 /* 2. Redistributions in binary form must reproduce the above copyright */
32 /* notice, this list of conditions and the following disclaimer in the */
33 /* documentation and/or other materials provided with the distribution. */
34 /* */
35 /* 3. Neither the name of the copyright holder nor the names of its */
36 /* contributors may be used to endorse or promote products derived from */
37 /* this software without specific prior written permission. */
38 /* */
39 /* 4. Derived software may not use the name XRootD or cmsd (regardless of */
40 /* capitilization) in association with the derived work if the protocol */
41 /* documented in this file is changed in any way. */
42 /* */
43 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
44 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
45 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
46 /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
47 /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
48 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
49 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
50 /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
51 /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
52 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
53 /******************************************************************************/
54 
55 #ifdef __CINT__
56 #define __attribute__(x)
57 #endif
58 
59 #include "XProtocol/XPtypes.hh"
60 
61 /******************************************************************************/
62 /* P r o t o c o l V e r s i o n D e f i n i t i o n s */
63 /******************************************************************************/
64 
65 // The following is the binary representation of the protocol version here.
66 // Protocol version is repesented as three base10 digits x.y.z with x having no
67 // upper limit (i.e. n.9.9 + 1 -> n+1.0.0). The kXR_PROTSIGNVERSION defines the
68 // protocol version where request signing became available.
69 //
70 #define kXR_PROTOCOLVERSION 0x00000520
71 #define kXR_PROTXATTVERSION 0x00000500
72 #define kXR_PROTTLSVERSION 0x00000500
73 #define kXR_PROTPGRWVERSION 0x00000511
74 #define kXR_PROTCLONEVERSION 0x00000520
75 #define kXR_PROTSIGNVERSION 0x00000310
76 #define kXR_PROTOCOLVSTRING "5.2.0"
77 
78 /******************************************************************************/
79 /* C l i e n t - S e r v e r H a n d s h a k e */
80 /******************************************************************************/
81 
82 // The fields to be sent as initial handshake
83 //
90 };
91 
92 // The body received after the first handshake's header
93 //
98 };
99 
100 /******************************************************************************/
101 /* C l i e n t R e q u e s t s */
102 /******************************************************************************/
103 
104 // G.Ganis: All the following structures never need padding bytes:
105 // no need of packing options like __attribute__((packed))
106 //
107 // All binary data is sent in network byte order.
108 
109 // Client request codes
110 //
113  kXR_auth = 3000,
114  kXR_query, // 3001
115  kXR_chmod, // 3002
116  kXR_close, // 3003
117  kXR_dirlist, // 3004
118  kXR_gpfile, // 3005 was kXR_getfile
119  kXR_protocol,// 3006
120  kXR_login, // 3007
121  kXR_mkdir, // 3008
122  kXR_mv, // 3009
123  kXR_open, // 3010
124  kXR_ping, // 3011
125  kXR_chkpoint,// 3012 was kXR_putfile
126  kXR_read, // 3013
127  kXR_rm, // 3014
128  kXR_rmdir, // 3015
129  kXR_sync, // 3016
130  kXR_stat, // 3017
131  kXR_set, // 3018
132  kXR_write, // 3019
133  kXR_fattr, // 3020 was kXR_admin
134  kXR_prepare, // 3021
135  kXR_statx, // 3022
136  kXR_endsess, // 3023
137  kXR_bind, // 3024
138  kXR_readv, // 3025
139  kXR_pgwrite, // 3026 was kXR_verifyw
140  kXR_locate, // 3027
141  kXR_truncate,// 3028
142  kXR_sigver, // 3029
143  kXR_pgread, // 3030 was kXR_decrypt
144  kXR_writev, // 3031
145  kXR_clone, // 3032
146  kXR_REQFENCE // Always last valid request code +1
147 };
148 
149 // Virtual client request codes
150 //
152  kXR_virtReadv = 2000
153 };
154 
155 // All client requests use a header with the following format
156 //
162 };
163 
164 /******************************************************************************/
165 /* k X R _ a u t h R e q u e s t */
166 /******************************************************************************/
167 
174 };
175 
176 /******************************************************************************/
177 /* k X R _ b i n d R e q u e s t */
178 /******************************************************************************/
179 
185 };
186 
187 /******************************************************************************/
188 /* k X R _ c h m o d R e q u e s t */
189 /******************************************************************************/
190 
195  kXR_unt16 mode; // See XOpenRequestMode
197 };
198 
199 /******************************************************************************/
200 /* k X R _ c h k p o i n t R e q u e s t */
201 /******************************************************************************/
202 
206  kXR_char fhandle[4]; // For Create, Delete, Query, or Restore
208  kXR_char opcode; // One of kXR_ckpxxxx actions
210 };
211 
212 // Actions
213 //
214 static const int kXR_ckpBegin = 0; // Begin checkpoint
215 static const int kXR_ckpCommit = 1; // Commit changes
216 static const int kXR_ckpQuery = 2; // Query checkpoint limits
217 static const int kXR_ckpRollback= 3; // Rollback changes
218 static const int kXR_ckpXeq = 4; // Execute trunc, write, or writev
219 
220 // The minimum size of a checkpoint data limit
221 //
222 static const int kXR_ckpMinMax = 104857604; // 10 MB
223 
224 /******************************************************************************/
225 /* k X R _ c l o n e R e q u e s t */
226 /******************************************************************************/
227 
231  kXR_char fhandle[4]; // dst handle open for writing
234 // This struct followed by the clone_list
235 };
236 
237 namespace XrdProto // Always use this namespace for new additions
238 {
239 struct clone_list {
240  kXR_char srcFH[4]; // src file handle
241  kXR_char rsvd[4]; // Reserved
242  kXR_unt64 srcOffs; // src offset
243  kXR_unt64 srcLen; // src length
244  kXR_unt64 dstOffs; // dst offset
245 };
246 static const int clItemLen = sizeof(clone_list);
247 static const int maxCloneln = 32768;
248 static const int maxClonesz = maxCloneln/clItemLen;
249 }
250 
251 /******************************************************************************/
252 /* k X R _ c l o s e R e q u e s t */
253 /******************************************************************************/
254 
261 };
262 
263 /******************************************************************************/
264 /* k X R _ d i r l i s t R e q u e s t */
265 /******************************************************************************/
266 
270  kXR_dcksm = 4, // dcksm implies dstat irrespective of dstat setting
271  kXR_dstatx = 8 // Return extended information, if available
272 };
273 
278  kXR_char options[1]; // See XDirlistRequestOption enum
280 };
281 
282 /******************************************************************************/
283 /* k X R _ e n d s e s s R e q u e s t */
284 /******************************************************************************/
285 
291 };
292 
293 /******************************************************************************/
294 /* k X R _ f a t t r R e q u e s t */
295 /******************************************************************************/
296 
297 // kXR_fattr subcodes
298 //
304  kXR_fatrrMaxSC = 3 // Highest valid subcode
305 };
306 
307 // kXR_fattr limits
308 //
309 enum xfaLimits {
310  kXR_faMaxVars = 16, // Maximum variables per request
311  kXR_faMaxNlen = 248, // Maximum length of variable name
312  kXR_faMaxVlen = 65536 // Maximum length of variable value
313 };
314 
319  kXR_char subcode; // See xfaSubCode enum
321  kXR_char options; // See valid options below
324 
325 // Valid options:
326 //
327  static const int isNew = 0x01; // For set, the variable must not exist
328  static const int aData = 0x10; // For list, return attribute value
329 
330 // Add an attribute name to nvec (the buffer has to be sufficiently big)
331 //
332  static char* NVecInsert( const char *name, char *buffer );
333 
334 // Add an attribute name to vvec (the buffer has to be sufficiently big)
335 //
336  static char* VVecInsert( const char *value, char *buffer );
337 
338 // Read error code from nvec
339 //
340  static char* NVecRead( char* buffer, kXR_unt16 &rc );
341 
342 // Read attribute name from nvec, should be deallocated with free()
343 //
344  static char* NVecRead( char* buffer, char *&name );
345 
346 // Read value length from vvec
347 //
348  static char* VVecRead( char* buffer, kXR_int32 &len );
349 
350 // Read attribute value from vvec, should be deallocated with free()
351 //
352  static char* VVecRead( char* buffer, kXR_int32 len, char *&value );
353 
354 };
355 
356 /******************************************************************************/
357 /* k X R _ g p f i l e R e q u e s t */
358 /******************************************************************************/
359 
360 struct ClientGPfileRequest { // ??? This is all wrong; correct when implemented
362  kXR_unt16 requestid; // kXR_gpfile
367 };
368 
369 /******************************************************************************/
370 /* k X R _ l o c a t e R e q u e s t */
371 /******************************************************************************/
372 
376  kXR_unt16 options; // See XOpenRequestOption enum tagged for locate
379 };
380 
381 /******************************************************************************/
382 /* k X R _ l o g i n R e q u e s t */
383 /******************************************************************************/
384 
385 // this is a bitmask
395  kXR_redirflags = 128
396 };
397 
398 // this iss a bitmask
401  kXR_ecredir = 1
402 };
403 
404 // this is a bitmask (note that XLoginVersion resides in lower bits)
408  kXR_asyncap = 128
409 };
410 
411 // this is a single number that is or'd into capver as the version
412 //
414  kXR_ver000 = 0, // Old clients predating history
415  kXR_ver001 = 1, // Generally implemented 2005 protocol
416  kXR_ver002 = 2, // Same as 1 but adds asyncresp recognition
417  kXR_ver003 = 3, // The 2011-2012 rewritten client
418  kXR_ver004 = 4, // The 2016 sign-capable client
419  kXR_ver005 = 5 // The 2019 TLS-capable client
420 };
421 
427  kXR_char ability2; // See XLoginAbility2 enum flags
428  kXR_char ability; // See XLoginAbility enum flags
429  kXR_char capver[1]; // See XLoginCapVer enum flags
432 };
433 
434 /******************************************************************************/
435 /* k X R _ m k d i r R e q u e s t */
436 /******************************************************************************/
437 
440  kXR_mkdirpath = 1
441 };
442 
448  kXR_unt16 mode; // See XOpenRequestMode
450 };
451 
452 /******************************************************************************/
453 /* k X R _ m v R e q u e s t */
454 /******************************************************************************/
455 
462 };
463 
464 /******************************************************************************/
465 /* k X R _ o p e n R e q u e s t */
466 /******************************************************************************/
467 
468 // OPEN MODE FOR A REMOTE FILE
470  kXR_ur = 0x100,
471  kXR_uw = 0x080,
472  kXR_ux = 0x040,
473  kXR_gr = 0x020,
474  kXR_gw = 0x010,
475  kXR_gx = 0x008,
476  kXR_or = 0x004,
477  kXR_ow = 0x002,
478  kXR_ox = 0x001
479 };
480 
482  kXR_compress = 0x0001, // 1 // also locate (return unique hosts)
483  kXR_delete = 0x0002, // 2
484  kXR_force = 0x0004, // 4
485  kXR_new = 0x0008, // 8
486  kXR_open_read= 0x0010, // 16
487  kXR_open_updt= 0x0020, // 32
488  kXR_async = 0x0040, // 64
489  kXR_refresh = 0x0080, // 128 // also locate
490  kXR_mkpath = 0x0100, // 256
491  kXR_prefname = 0x0100, // 256 // only locate
492  kXR_open_apnd= 0x0200, // 512
493  kXR_retstat = 0x0400, // 1024
494  kXR_4dirlist = 0x0400, // 1024 // for locate intending a dirlist
495  kXR_replica = 0x0800, // 2048
496  kXR_posc = 0x1000, // 4096
497  kXR_nowait = 0x2000, // 8192 // also locate
498  kXR_seqio = 0x4000, // 16384
499  kXR_open_wrto= 0x8000 // 32768
500 };
501 
502 enum XOpenRequestOption2 {// Set in optiont
503  kXR_dup = 0x0001, // 1
504  kXR_samefs = 0x0002, // 2
505  kXR_retstatx = 0x0004, // 4 // open: return extended stat -> retstat
506  kXR_directio = 0x0008 // 8
507 };
508 
518 };
519 
520 /******************************************************************************/
521 /* k X R _ p g r e a d R e q u e s t */
522 /******************************************************************************/
523 
524 // The page size for pgread and pgwrite and the maximum transmission size
525 //
526 namespace XrdProto // Always use this namespace for new additions
527 {
528 static const int kXR_pgPageSZ = 4096; // Length of a page
529 static const int kXR_pgPageBL = 12; // log2(page length)
530 static const int kXR_pgUnitSZ = kXR_pgPageSZ + sizeof(kXR_unt32);
531 static const int kXR_pgMaxEpr = 128; // Max checksum errs per request
532 static const int kXR_pgMaxEos = 256; // Max checksum errs outstanding
533 
534 // kXR_pgread/write options
535 //
536 static const kXR_char kXR_AnyPath = 0xff; // In pathid
537 static const int kXR_pgRetry = 0x01; // In reqflags
538 }
539 
546  kXR_int32 dlen; // Request data length must be 0 unless args present
547 };
548 
550  kXR_char pathid; // Request data length must be 1
551  kXR_char reqflags; // Request data length must be 2
552 };
553 
554 namespace
555 {
556 }
557 
558 /******************************************************************************/
559 /* k X R _ p r w r i t e R e q u e s t */
560 /******************************************************************************/
561 
571 // kXR_char data[dlen];
572 };
573 
574 /******************************************************************************/
575 /* k X R _ p i n g R e q u e s t */
576 /******************************************************************************/
577 
583 };
584 
585 /******************************************************************************/
586 /* k X R _ p r o t o c o l R e q u e s t */
587 /******************************************************************************/
588 
592  kXR_int32 clientpv; // 2.9.7 or higher
593  kXR_char flags; // 3.1.0 or higher
594  kXR_char expect; // 4.0.0 or higher
597 
599  kXR_secreqs = 0x01, // Options: Return security requirements
600  kXR_ableTLS = 0x02, // Options: Client is TLS capable
601  kXR_wantTLS = 0x04, // Options: Change connection to use TLS
602  kXR_bifreqs = 0x08 // Options: Return bind interface requirements
603 };
604 
606  kXR_ExpMask = 0x0f, // Isolate the relevant expect enumeration value
607  kXR_ExpNone = 0x00,
608  kXR_ExpBind = 0x01,
609  kXR_ExpGPF = 0x02,
610  kXR_ExpLogin = 0x03,
611  kXR_ExpTPC = 0x04,
612  kXR_ExpGPFA = 0x08
613 };
614 };
615 
616 /******************************************************************************/
617 /* k X R _ p r e p a r e R e q u e s t */
618 /******************************************************************************/
619 
625  kXR_wmode = 16,
626  kXR_coloc = 32,
627  kXR_fresh = 64,
628  kXR_usetcp = 128,
629 
630  kXR_evict = 0x0001 // optionsX: file no longer useful
631 };
632 
638  kXR_unt16 port; // 2.9.9 or higher
639  kXR_unt16 optionX; // Extended options
642 };
643 
644 /******************************************************************************/
645 /* k X R _ q u e r y R e q u e s t */
646 /******************************************************************************/
647 
661  kXR_Qopaqug=64
662 };
663 
667  kXR_unt16 infotype; // See XQueryType enum
672 };
673 
674 /******************************************************************************/
675 /* k X R _ r e a d R e q u e s t */
676 /******************************************************************************/
677 
685 // Optionally followed by read_args
686 };
687 
688 struct read_args {
691 // This struct may be followed by an array of readahead_list
692 };
693 
698 };
699 
700 /******************************************************************************/
701 /* k X R _ r e a d v R e q u e s t */
702 /******************************************************************************/
703 
710 // This struct followed by the read_list
711 };
712 
713 namespace XrdProto // Always use this namespace for new additions
714 {
715 struct read_list {
719 };
720 static const int rlItemLen = sizeof(read_list);
721 static const int maxRvecln = 16384; // Max read vector length
722 static const int maxRvecsz = maxRvecln/rlItemLen; // Max number of elements
723 static const int minRVbsz = 2097152; // 2MB minimum buffer size
724 static const int maxRVdsz = minRVbsz-rlItemLen; // Max amount of data to xfer
725 }
726 
727 /******************************************************************************/
728 /* k X R _ r m R e q u e s t */
729 /******************************************************************************/
730 
736 };
737 
738 /******************************************************************************/
739 /* k X R _ r m d i r R e q u e s t */
740 /******************************************************************************/
741 
747 };
748 
749 /******************************************************************************/
750 /* k X R _ s e t R e q u e s t */
751 /******************************************************************************/
752 
757  kXR_char modifier; // For security purposes, should be zero
759 };
760 
761 /******************************************************************************/
762 /* k X R _ s i g v e r R e q u e s t */
763 /******************************************************************************/
764 
765 // Cryptography used for kXR_sigver SigverRequest::crypto
767  kXR_SHA256 = 0x01, // Hash used
768  kXR_HashMask = 0x0f, // Mak to extract the hash type
769  kXR_rsaKey = 0x80 // The rsa key was used
770 };
771 
772 // Flags for kXR_sigver
773 enum XSecFlags {
774  kXR_nodata = 1 // Request payload was not hashed
775 };
776 
777 // Version number
779  kXR_Ver_00 = 0
780 };
781 
785  kXR_unt16 expectrid; // Request code of subsequent request
786  kXR_char version; // Security version being used (see XSecVersion)
787  kXR_char flags; // One or more flags defined in enum (see XSecFlags)
788  kXR_unt64 seqno; // Monotonically increasing number (part of hash)
789  kXR_char crypto; // Cryptography used (see XSecCrypto)
792 };
793 
794 /******************************************************************************/
795 /* k X R _ s t a t R e q u e s t */
796 /******************************************************************************/
797 
799  kXR_vfs = 1
800 };
801 
803  kXR_Want_btime = 0x00000001
804 };
805 
809  kXR_char options; // See XStatRequestOption
811  kXR_unt32 wants; // Works like stx_mask to ask for extra attributes
814 };
815 
816 /******************************************************************************/
817 /* k X R _ s y n c R e q u e s t */
818 /******************************************************************************/
819 
826 };
827 
828 /******************************************************************************/
829 /* k X R _ t r u n c a t e R e q u e s t */
830 /******************************************************************************/
831 
839 };
840 
841 /******************************************************************************/
842 /* k X R _ w r i t e R e q u e s t */
843 /******************************************************************************/
844 
853 };
854 
855 /******************************************************************************/
856 /* k X R _ w r i t e v R e q u e s t */
857 /******************************************************************************/
858 
862  kXR_char options; // See static const ints below
865 // This struct followed by the write_list
866 
867  static const kXR_int32 doSync = 0x01;
868 };
869 
870 namespace XrdProto // Always use this namespace for new additions
871 {
872 struct write_list {
876 };
877 static const int wlItemLen = sizeof(write_list);
878 static const int maxWvecln = 16384;
879 static const int maxWvecsz = maxWvecln/wlItemLen;
880 }
881 
882 /******************************************************************************/
883 /* U n i o n o f a l l C l i e n t R e q u e s t s */
884 /******************************************************************************/
885 
886 typedef union {
887  struct ClientRequestHdr header;
888  struct ClientAuthRequest auth;
889  struct ClientBindRequest bind;
890  struct ClientChkPointRequest chkpoint;
891  struct ClientChmodRequest chmod;
892  struct ClientCloneRequest clone;
893  struct ClientCloseRequest close;
894  struct ClientDirlistRequest dirlist;
895  struct ClientEndsessRequest endsess;
896  struct ClientFattrRequest fattr;
897  struct ClientGPfileRequest gpfile;
898  struct ClientLocateRequest locate;
899  struct ClientLoginRequest login;
900  struct ClientMkdirRequest mkdir;
901  struct ClientMvRequest mv;
902  struct ClientOpenRequest open;
903  struct ClientPgReadRequest pgread;
904  struct ClientPgWriteRequest pgwrite;
905  struct ClientPingRequest ping;
907  struct ClientProtocolRequest protocol;
908  struct ClientQueryRequest query;
909  struct ClientReadRequest read;
910  struct ClientReadVRequest readv;
911  struct ClientRmRequest rm;
912  struct ClientRmdirRequest rmdir;
913  struct ClientSetRequest set;
914  struct ClientSigverRequest sigver;
915  struct ClientStatRequest stat;
916  struct ClientSyncRequest sync;
918  struct ClientWriteRequest write;
920 } ClientRequest;
921 
922 typedef union {
923  struct ClientRequestHdr header;
924  struct ClientSigverRequest sigver;
926 
927 /******************************************************************************/
928 /* S e r v e r R e s p o n s e s */
929 /******************************************************************************/
930 
931 // Nice header for the server response.
932 // Note that the protocol specifies these values to be in network
933 // byte order when sent
934 //
935 // G.Ganis: The following structures never need padding bytes:
936 // no need of packing options
937 
938 // Server response codes
939 //
941  kXR_ok = 0,
942  kXR_oksofar = 4000,
943  kXR_attn, // 4001
944  kXR_authmore,// 4002
945  kXR_error, // 4003
946  kXR_redirect,// 4004
947  kXR_wait, // 4005
948  kXR_waitresp,// 4006
949  kXR_status, // 4007
950  kXR_noResponsesYet = 10000
951 };
952 
953 // All serer responses start with the same header
954 //
959 };
960 
961 // This is a bit of wierdness held over from the very old days, sigh.
962 //
964  char data[4096];
965 };
966 
967 /******************************************************************************/
968 /* k X R _ a t t n R e s p o n s e */
969 /******************************************************************************/
970 
972  kXR_asyncab = 5000, // No longer supported
973  kXR_asyncdi, // 5001 No longer supported
974  kXR_asyncms = 5002,
975  kXR_asyncrd, // 5003 No longer supported
976  kXR_asyncwt, // 5004 No longer supported
977  kXR_asyncav, // 5005 No longer supported
978  kXR_asynunav, // 5006 No longer supported
979  kXR_asyncgo, // 5007 No longer supported
980  kXR_asynresp= 5008
981 };
982 
984  kXR_int32 actnum; // See XActionCode enum
985  char parms[4096]; // Should be sufficient for every use
986 };
987 
989  kXR_int32 actnum; // XActionCode::kXR_asyncms
990  char reserved[4];
992  char respdata[4096];
993 };
994 
996  kXR_int32 actnum; // XActionCode::kXR_asynresp
997  char reserved[4];
999  char respdata[4096];
1000 };
1001 
1002 /******************************************************************************/
1003 /* k X R _ a u t h m o r e R e s p o n s e */
1004 /******************************************************************************/
1005 
1007  char data[4096];
1008 };
1009 
1010 /******************************************************************************/
1011 /* k X R _ b i n d R e s p o n s e */
1012 /******************************************************************************/
1013 
1016 };
1017 
1018 /******************************************************************************/
1019 /* k X R _ c h k p o i n t R e s p o n s e */
1020 /******************************************************************************/
1021 
1022 struct ServerResponseBody_ChkPoint { // Only for kXR_ckpQMax
1023  kXR_unt32 maxCkpSize; // Maximum number of bytes including overhead
1024  kXR_unt32 useCkpSize; // The number of bytes already being used
1025 };
1026 
1027 /******************************************************************************/
1028 /* k X R _ e r r o r R e s p o n s e */
1029 /******************************************************************************/
1030 
1037  kXR_FSError, // 3005
1039  kXR_IOError, // 3007
1040  kXR_NoMemory, // 3008
1041  kXR_NoSpace, // 3009
1043  kXR_NotFound, // 3011
1046  kXR_noserver, // 3014
1047  kXR_NotFile, // 3015
1049  kXR_Cancelled, // 3017
1050  kXR_ItExists, // 3018
1051  kXR_ChkSumErr, // 3019
1053  kXR_overQuota, // 3021
1054  kXR_SigVerErr, // 3022
1064  kXR_Conflict, // 3032
1068  kXR_ERRFENCE, // Always last valid errcode + 1
1069  kXR_noErrorYet = 10000
1070 };
1071 
1073  kXR_int32 errnum; // See XErrorCode enu
1074  char errmsg[4096]; // Should be sufficient for every use
1075 };
1076 
1077 /******************************************************************************/
1078 /* k X R _ l o g i n R e s p o n s e */
1079 /******************************************************************************/
1080 
1083  kXR_char sec[4096]; // Should be sufficient for every use
1084 };
1085 
1086 /******************************************************************************/
1087 /* k X R _ o p e n R e s p o n s e */
1088 /******************************************************************************/
1089 
1092  kXR_int32 cpsize; // cpsize & cptype returned if kXR_compress *or*
1093  kXR_char cptype[4]; // kXR_retstat is specified
1094 }; // info will follow if kXR_retstat is specified
1095 
1096 /******************************************************************************/
1097 /* k X R _ p g r e a d R e s p o n s e */
1098 /******************************************************************************/
1099 
1101  kXR_int64 offset; // info[]: File offset of data that follows
1102 // kXR_char data[dlen];
1103 };
1104 
1105 /******************************************************************************/
1106 /* k X R _ p g w r i t e R e s p o n s e */
1107 /******************************************************************************/
1108 
1110  kXR_int64 offset; // info[]: File offset of data written
1111 };
1112 
1113 
1114 // The following structure is appended to ServerResponseBody_pgWrite if one or
1115 // more checksum errors occurred and need to be retransmitted.
1116 //
1118  kXR_unt32 cseCRC; // crc32c of all following bits
1119  kXR_int16 dlFirst; // Data length at first offset in list
1120  kXR_int16 dlLast; // Data length at last offset in list
1121 // kXR_int64 bof[(dlen-8)/8]; // List of offsets of pages in error
1122 };
1123 
1124 /******************************************************************************/
1125 /* k X R _ p r o t o c o l R e s p o n s e */
1126 /******************************************************************************/
1127 
1128 // The following information is returned in the response body when kXR_bifreqs
1129 // is set in ClientProtocolRequest::flags. Note that the size of bifInfo is
1130 // is variable. This response will not be returned if there are no bif's.
1131 // Note: This structure is null byte padded to be a multiple of 8 bytes!
1132 //
1134  kXR_char theTag; // Always the character 'B' to identify struct
1135  kXR_char rsvd; // Reserved for the future (always 0 for now)
1136  kXR_unt16 bifILen; // Length of bifInfo including null bytes.
1137 // kXR_char bifInfo[bifILen];
1138 };
1139 
1140 // The following information is returned in the response body when kXR_secreqs
1141 // is set in ClientProtocolRequest::flags. Note that the size of secvec is
1142 // defined by secvsz and will not be present when secvsz == 0.
1143 //
1145  kXR_char reqindx; // Request index
1146  kXR_char reqsreq; // Request signing requirement
1147 };
1148 
1150  kXR_char theTag; // Always the character 'S' to identify struct
1151  kXR_char rsvd; // Reserved for the future (always 0 for now)
1152  kXR_char secver; // Security version
1153  kXR_char secopt; // Security options
1154  kXR_char seclvl; // Security level when secvsz == 0
1155  kXR_char secvsz; // Number of items in secvec (i.e. its length/2)
1157 };
1158 
1159 
1160 namespace XrdProto
1161 {
1162 typedef struct ServerResponseBifs_Protocol bifReqs;
1163 typedef struct ServerResponseReqs_Protocol secReqs;
1164 }
1165 
1166 // Options reflected in protocol response ServerResponseReqs_Protocol::secopt
1167 //
1168 #define kXR_secOData 0x01
1169 #define kXR_secOFrce 0x02
1170 
1171 // Security level definitions (these are predefined but can be over-ridden)
1172 //
1173 #define kXR_secNone 0
1174 #define kXR_secCompatible 1
1175 #define kXR_secStandard 2
1176 #define kXR_secIntense 3
1177 #define kXR_secPedantic 4
1178 
1179 // Requirements one of which set in each ServerResponseReqs_Protocol::secvec
1180 //
1181 #define kXR_signIgnore 0
1182 #define kXR_signLikely 1
1183 #define kXR_signNeeded 2
1184 
1185 // Version used for kXR_sigver and is set in SigverRequest::version,
1186 // ServerResponseReqs_Protocol::secver
1187 //
1188 #define kXR_secver_0 0
1189 
1190 // KINDS of SERVERS (no longer used by new clients)
1191 //
1192 #define kXR_DataServer 1
1193 #define kXR_LBalServer 0
1194 
1195 // The below are defined for protocol version 2.9.7 or higher
1196 // These are the flag values in the kXR_protool response
1197 //
1198 #define kXR_isManager 0x00000002
1199 #define kXR_isServer 0x00000001
1200 #define kXR_attrCache 0x00000080
1201 #define kXR_attrMeta 0x00000100
1202 #define kXR_attrProxy 0x00000200
1203 #define kXR_attrSuper 0x00000400
1204 #define kXR_attrVirtRdr 0x00000800
1205 
1206 // Virtual options set on redirect
1207 //
1208 #define kXR_recoverWrts 0x00001000
1209 #define kXR_collapseRedir 0x00002000
1210 #define kXR_ecRedir 0x00004000
1211 
1212 // Things the server supports
1213 //
1214 #define kXR_anongpf 0x00800000
1215 #define kXR_supgpf 0x00400000
1216 #define kXR_suppgrw 0x00200000
1217 #define kXR_supposc 0x00100000
1218 
1219 // TLS requirements
1220 //
1221 #define kXR_haveTLS 0x80000000
1222 #define kXR_gotoTLS 0x40000000
1223 #define kXR_tlsAny 0x1f000000
1224 #define kXR_tlsData 0x01000000
1225 #define kXR_tlsGPF 0x02000000
1226 #define kXR_tlsLogin 0x04000000
1227 #define kXR_tlsSess 0x08000000
1228 #define kXR_tlsTPC 0x10000000
1229 #define kXR_tlsGPFA 0x20000000
1230 
1231 // Body for the kXR_protocol response... useful
1232 //
1236  ServerResponseReqs_Protocol secreq; // Only for V3.1.0+ && if requested
1237 };
1238 
1239 // Handy definition of the size of the protocol response when the security
1240 // information is not present.
1241 //
1242 #define kXR_ShortProtRespLen sizeof(ServerResponseBody_Protocol)-\
1243  sizeof(ServerResponseReqs_Protocol)
1244 
1245 /******************************************************************************/
1246 /* k X R _ r e d i r e c t R e s p o n s e */
1247 /******************************************************************************/
1248 
1251  char host[4096]; // Should be sufficient for every use
1252 };
1253 
1254 /******************************************************************************/
1255 /* k X R _ s t a t R e s p o n s e */
1256 /******************************************************************************/
1257 
1258 // The following bits are encoded in the "flags" token in the response
1259 //
1270  kXR_cachersp=512
1271 };
1272 
1273 /******************************************************************************/
1274 /* k X R _ s t a t u s R e s p o n s e */
1275 /******************************************************************************/
1276 
1277 struct ServerResponseBody_Status { // Always preceeded by ServerResponseHeader
1278  kXR_unt32 crc32c; // IETF RFC 7143 standard
1279  kXR_char streamID[2]; // Identical to streamid[2] in ServerResponseHeader
1280  kXR_char requestid; // requestcode - kXR_1stRequest
1281  kXR_char resptype; // See RespType enum below
1284 // kXR_char info[ServerResponseHeader::dlen-sizeof(ServerResponseBody_Status)];
1285 // kXR_char data[dlen];
1286 };
1287 
1288 namespace XrdProto
1289 {
1290 enum RespType {
1291 
1294  kXR_ProgressInfo = 0x02
1295 };
1296 
1297  // This is the minimum size of ServerResponseHeader::dlen for kXR_status
1298  //
1299  static const int kXR_statusBodyLen = sizeof(ServerResponseBody_Status);
1300 }
1301 
1303  struct ServerResponseHeader hdr;
1305 };
1306 
1307 /******************************************************************************/
1308 /* k X R _ w a i t R e s p o n s e */
1309 /******************************************************************************/
1310 
1313  char infomsg[4096]; // Should be sufficient for every use
1314 };
1315 
1316 /******************************************************************************/
1317 /* k X R _ w a i t r e s p R e s p o n s e */
1318 /******************************************************************************/
1319 
1322 };
1323 
1324 /******************************************************************************/
1325 /* U n i o n o f a l l S e r v e r R e s p o n s e s */
1326 /******************************************************************************/
1327 
1329 {
1331  union
1332  {
1334  ServerResponseBody_Authmore authmore;
1339  ServerResponseBody_Protocol protocol;
1340  ServerResponseBody_Redirect redirect;
1343  ServerResponseBody_Waitresp waitresp;
1344  } body;
1345 };
1346 
1347 // The pgread and pgwrite do not fit the union above because they are composed
1348 // of three structs not two as all the above. So, we define the exceptions here.
1349 //
1351 {
1352  ServerResponseStatus status; // status.bdy and status.hdr
1353  union
1354  {
1357  } info;
1358 };
1359 
1360 struct ALIGN_CHECK {char chkszreq[25-sizeof(ClientRequest)];
1361  char chkszrsp[ 9-sizeof(ServerResponseHeader)];
1362 };
1363 
1364 /******************************************************************************/
1365 /* X P r o t o c o l U t i l i t i e s */
1366 /******************************************************************************/
1367 
1368 #include <cerrno>
1369 #if defined(WIN32)
1370 #if !defined(ENOTBLK)
1371 # define ENOTBLK 15
1372 #endif
1373 #if !defined(ETXTBSY)
1374 #define ETXTBSY 26
1375 #endif
1376 #if !defined(ENOBUFS)
1377 #define ENOBUFS 105
1378 #endif
1379 #if !defined(ENETUNREACH)
1380 #define ENETUNREACH 114
1381 #endif
1382 #endif
1383 
1384 #ifndef ENOATTR
1385 #define ENOATTR ENODATA
1386 #endif
1387 
1388 #ifndef EBADRQC
1389 #define EBADRQC EBADRPC
1390 #endif
1391 
1392 #ifndef EAUTH
1393 #define EAUTH EBADE
1394 #endif
1395 
1396 struct stat;
1397 
1399 {
1400 public:
1401 
1402 // mapError() is the official mapping from errno to xroot protocol error.
1403 //
1404 static int mapError(int rc)
1405  {if (rc < 0) rc = -rc;
1406  switch(rc)
1407  {case ENOENT: return kXR_NotFound;
1408  case EINVAL: return kXR_ArgInvalid;
1409  case EPERM: return kXR_NotAuthorized;
1410  case EACCES: return kXR_NotAuthorized;
1411  case EIO: return kXR_IOError;
1412  case ENOMEM: return kXR_NoMemory;
1413  case ENOBUFS: return kXR_NoMemory;
1414  case ENOSPC: return kXR_NoSpace;
1415  case ENAMETOOLONG: return kXR_ArgTooLong;
1416  case ENETUNREACH: return kXR_noserver;
1417  case EHOSTUNREACH: return kXR_noserver;
1418  case ECONNREFUSED: return kXR_noserver;
1419  case ENOTBLK: return kXR_NotFile;
1420  case ENOTSUP: return kXR_Unsupported;
1421  case EISDIR: return kXR_isDirectory;
1422  case ENOTEMPTY: [[fallthrough]];
1423  // In the case one tries to delete a non-empty directory
1424  // we have decided that until the next major release
1425  // the kXR_ItExists flag will be returned
1426  case EEXIST:
1427  return kXR_ItExists;
1428  case EBADRQC: return kXR_InvalidRequest;
1429  case ETXTBSY: return kXR_inProgress;
1430  case ENODEV: return kXR_FSError;
1431  case EFAULT: return kXR_ServerError;
1432  case EDOM: return kXR_ChkSumErr;
1433  case EDQUOT: return kXR_overQuota;
1434  case EILSEQ: return kXR_SigVerErr;
1435  case ERANGE: return kXR_DecryptErr;
1436  case EUSERS: return kXR_Overloaded;
1437  case EROFS: return kXR_fsReadOnly;
1438  case ENOATTR: return kXR_AttrNotFound;
1439  case EPROTOTYPE: return kXR_TLSRequired;
1440  case EADDRNOTAVAIL: return kXR_noReplicas;
1441  case EAUTH: return kXR_AuthFailed;
1442  case EIDRM: return kXR_Impossible;
1443  case ENOTTY: return kXR_Conflict;
1444  case ETOOMANYREFS: return kXR_TooManyErrs;
1445  case ETIMEDOUT: return kXR_ReqTimedOut;
1446  case EBADF: return kXR_FileNotOpen;
1447  case ECANCELED: return kXR_Cancelled;
1448  case ETIME: return kXR_TimerExpired;
1449  default: return kXR_FSError;
1450  }
1451  }
1452 
1453 static int toErrno( int xerr )
1454 {
1455  switch(xerr)
1456  {case kXR_ArgInvalid: return EINVAL;
1457  case kXR_ArgMissing: return EINVAL;
1458  case kXR_ArgTooLong: return ENAMETOOLONG;
1459  case kXR_FileLocked: return EDEADLK;
1460  case kXR_FileNotOpen: return EBADF;
1461  case kXR_FSError: return ENODEV;
1462  case kXR_InvalidRequest:return EBADRQC;
1463  case kXR_IOError: return EIO;
1464  case kXR_NoMemory: return ENOMEM;
1465  case kXR_NoSpace: return ENOSPC;
1466  case kXR_NotAuthorized: return EACCES;
1467  case kXR_NotFound: return ENOENT;
1468  case kXR_ServerError: return EFAULT;
1469  case kXR_Unsupported: return ENOTSUP;
1470  case kXR_noserver: return EHOSTUNREACH;
1471  case kXR_NotFile: return ENOTBLK;
1472  case kXR_isDirectory: return EISDIR;
1473  case kXR_Cancelled: return ECANCELED;
1474  case kXR_ItExists: return EEXIST;
1475  case kXR_ChkSumErr: return EDOM;
1476  case kXR_inProgress: return EINPROGRESS;
1477  case kXR_overQuota: return EDQUOT;
1478  case kXR_SigVerErr: return EILSEQ;
1479  case kXR_DecryptErr: return ERANGE;
1480  case kXR_Overloaded: return EUSERS;
1481  case kXR_fsReadOnly: return EROFS;
1482  case kXR_BadPayload: return EINVAL;
1483  case kXR_AttrNotFound: return ENOATTR;
1484  case kXR_TLSRequired: return EPROTOTYPE;
1485  case kXR_noReplicas: return EADDRNOTAVAIL;
1486  case kXR_AuthFailed: return EAUTH;
1487  case kXR_Impossible: return EIDRM;
1488  case kXR_Conflict: return ENOTTY;
1489  case kXR_TooManyErrs: return ETOOMANYREFS;
1490  case kXR_ReqTimedOut: return ETIMEDOUT;
1491  case kXR_TimerExpired: return ETIME; // Used for 504 Gateway timeout in proxy
1492  default: return ENOMSG;
1493  }
1494 }
1495 
1496 static const char *errName(kXR_int32 errCode);
1497 
1498 static const char *reqName(kXR_unt16 reqCode);
1499 
1500 /******************************************************************************/
1501 /* O b s o l e t e D e f i n i t i o n s */
1502 /******************************************************************************/
1503 
1504 struct ServerResponseBody_Attn_asyncdi { // No longer supported
1508 };
1509 
1510 struct ServerResponseBody_Attn_asyncrd { // No longer supported
1513  char host[4092];
1514 };
1515 
1516 struct ServerResponseBody_Attn_asyncwt { // No longer supported
1519 };
1520 
1521 // Kind of error inside a XTNetFile's routine (temporary)
1522 //
1524  kGENERICERR = 0, // Generic error
1525  kREAD, // Error while reading from stream
1526  kWRITE, // Error while writing to stream
1527  kREDIRCONNECT, // Error redirecting to a given host
1528  kOK, // Everything seems ok
1529  kNOMORESTREAMS // No more available stream IDs for
1530  // async processing
1531 };
1532 
1534 
1535 #define kXR_maxReqRetry 10
1536 
1537 }; // XProtocol
1538 #endif
kXR_unt16 requestid
Definition: XProtocol.hh:511
kXR_int32 dlen
Definition: XProtocol.hh:173
kXR_char options[1]
Definition: XProtocol.hh:278
kXR_char reserved[8]
Definition: XProtocol.hh:364
static const int kXR_ckpRollback
Definition: XProtocol.hh:217
XActionCode
Definition: XProtocol.hh:971
@ kXR_asyncgo
Definition: XProtocol.hh:979
@ kXR_asyncwt
Definition: XProtocol.hh:976
@ kXR_asynunav
Definition: XProtocol.hh:978
@ kXR_asynresp
Definition: XProtocol.hh:980
@ kXR_asyncav
Definition: XProtocol.hh:977
@ kXR_asyncms
Definition: XProtocol.hh:974
@ kXR_asyncab
Definition: XProtocol.hh:972
@ kXR_asyncrd
Definition: XProtocol.hh:975
@ kXR_asyncdi
Definition: XProtocol.hh:973
XErrorCode
Definition: XProtocol.hh:1031
@ kXR_ArgInvalid
Definition: XProtocol.hh:1032
@ kXR_InvalidRequest
Definition: XProtocol.hh:1038
@ kXR_ArgMissing
Definition: XProtocol.hh:1033
@ kXR_fsReadOnly
Definition: XProtocol.hh:1057
@ kXR_Impossible
Definition: XProtocol.hh:1063
@ kXR_TLSRequired
Definition: XProtocol.hh:1060
@ kXR_SigVerErr
Definition: XProtocol.hh:1054
@ kXR_TimerExpired
Definition: XProtocol.hh:1067
@ kXR_TooManyErrs
Definition: XProtocol.hh:1065
@ kXR_AttrNotFound
Definition: XProtocol.hh:1059
@ kXR_ItExists
Definition: XProtocol.hh:1050
@ kXR_AuthFailed
Definition: XProtocol.hh:1062
@ kXR_NotAuthorized
Definition: XProtocol.hh:1042
@ kXR_NotFound
Definition: XProtocol.hh:1043
@ kXR_FileLocked
Definition: XProtocol.hh:1035
@ kXR_ERRFENCE
Definition: XProtocol.hh:1068
@ kXR_noErrorYet
Definition: XProtocol.hh:1069
@ kXR_ChkSumErr
Definition: XProtocol.hh:1051
@ kXR_DecryptErr
Definition: XProtocol.hh:1055
@ kXR_overQuota
Definition: XProtocol.hh:1053
@ kXR_BadPayload
Definition: XProtocol.hh:1058
@ kXR_NoSpace
Definition: XProtocol.hh:1041
@ kXR_FileNotOpen
Definition: XProtocol.hh:1036
@ kXR_isDirectory
Definition: XProtocol.hh:1048
@ kXR_noReplicas
Definition: XProtocol.hh:1061
@ kXR_inProgress
Definition: XProtocol.hh:1052
@ kXR_NotFile
Definition: XProtocol.hh:1047
@ kXR_Unsupported
Definition: XProtocol.hh:1045
@ kXR_Cancelled
Definition: XProtocol.hh:1049
@ kXR_Conflict
Definition: XProtocol.hh:1064
@ kXR_ServerError
Definition: XProtocol.hh:1044
@ kXR_Overloaded
Definition: XProtocol.hh:1056
@ kXR_ArgTooLong
Definition: XProtocol.hh:1034
@ kXR_noserver
Definition: XProtocol.hh:1046
@ kXR_ReqTimedOut
Definition: XProtocol.hh:1066
@ kXR_IOError
Definition: XProtocol.hh:1039
@ kXR_FSError
Definition: XProtocol.hh:1037
@ kXR_NoMemory
Definition: XProtocol.hh:1040
kXR_char streamid[2]
Definition: XProtocol.hh:807
kXR_int16 arg1len
Definition: XProtocol.hh:460
kXR_char body[16]
Definition: XProtocol.hh:160
kXR_char streamid[2]
Definition: XProtocol.hh:783
union ServerResponse::@0 body
kXR_unt16 requestid
Definition: XProtocol.hh:666
kXR_unt16 requestid
Definition: XProtocol.hh:847
XLoginAbility2
Definition: XProtocol.hh:399
@ kXR_empty
Definition: XProtocol.hh:400
@ kXR_ecredir
Definition: XProtocol.hh:401
kXR_char reserved[12]
Definition: XProtocol.hh:824
kXR_char reserved[3]
Definition: XProtocol.hh:851
xfaSubCode
Definition: XProtocol.hh:299
@ kXR_fattrDel
Definition: XProtocol.hh:300
@ kXR_fattrSet
Definition: XProtocol.hh:303
@ kXR_fattrList
Definition: XProtocol.hh:302
@ kXR_fattrGet
Definition: XProtocol.hh:301
@ kXR_fatrrMaxSC
Definition: XProtocol.hh:304
kXR_char streamid[2]
Definition: XProtocol.hh:374
kXR_int32 dlen
Definition: XProtocol.hh:184
kXR_char fhandle[4]
Definition: XProtocol.hh:565
static const int kXR_ckpMinMax
Definition: XProtocol.hh:222
kXR_unt16 requestid
Definition: XProtocol.hh:424
kXR_char reserved[12]
Definition: XProtocol.hh:259
ServerResponseStatus status
Definition: XProtocol.hh:1352
kXR_char fhandle[4]
Definition: XProtocol.hh:823
kXR_unt16 requestid
Definition: XProtocol.hh:784
XStatRequestWants
Definition: XProtocol.hh:802
@ kXR_Want_btime
Definition: XProtocol.hh:803
kXR_char reserved1[2]
Definition: XProtocol.hh:668
kXR_char streamid[2]
Definition: XProtocol.hh:181
kXR_unt16 requestid
Definition: XProtocol.hh:362
kXR_char streamid[2]
Definition: XProtocol.hh:457
kXR_unt16 requestid
Definition: XProtocol.hh:580
kXR_char streamid[2]
Definition: XProtocol.hh:563
kXR_char fhandle[4]
Definition: XProtocol.hh:848
kXR_char streamid[2]
Definition: XProtocol.hh:821
kXR_char reserved[2]
Definition: XProtocol.hh:569
kXR_char streamid[2]
Definition: XProtocol.hh:229
kXR_char streamid[2]
Definition: XProtocol.hh:158
kXR_char streamid[2]
Definition: XProtocol.hh:169
#define EAUTH
Definition: XProtocol.hh:1393
kXR_char fhandle[4]
Definition: XProtocol.hh:812
kXR_int32 dlen
Definition: XProtocol.hh:461
kXR_int32 msglen
Definition: XProtocol.hh:95
kXR_int64 offset
Definition: XProtocol.hh:682
kXR_char streamid[2]
Definition: XProtocol.hh:204
kXR_unt16 requestid
Definition: XProtocol.hh:680
XVirtRequestTypes
Definition: XProtocol.hh:151
@ kXR_virtReadv
Definition: XProtocol.hh:152
kXR_char streamid[2]
Definition: XProtocol.hh:956
kXR_char fhtemplt[4]
Definition: XProtocol.hh:516
kXR_unt16 options
Definition: XProtocol.hh:513
kXR_char streamid[2]
Definition: XProtocol.hh:579
static const int kXR_ckpXeq
Definition: XProtocol.hh:218
kXR_char streamid[2]
Definition: XProtocol.hh:361
kXR_unt16 requestid
Definition: XProtocol.hh:257
kXR_char reserved[10]
Definition: XProtocol.hh:640
kXR_char streamid[2]
Definition: XProtocol.hh:679
kXR_char streamid[2]
Definition: XProtocol.hh:256
kXR_char streamid[2]
Definition: XProtocol.hh:541
kXR_char streamid[2]
Definition: XProtocol.hh:423
kXR_char pathid
Definition: XProtocol.hh:689
kXR_char reserved2
Definition: XProtocol.hh:430
kXR_char streamid[2]
Definition: XProtocol.hh:754
kXR_char credtype[4]
Definition: XProtocol.hh:172
#define ENOATTR
Definition: XProtocol.hh:1385
kXR_char username[8]
Definition: XProtocol.hh:426
kXR_int32 dlen
Definition: XProtocol.hh:825
XOpenRequestOption
Definition: XProtocol.hh:481
@ kXR_open_wrto
Definition: XProtocol.hh:499
@ kXR_compress
Definition: XProtocol.hh:482
@ kXR_async
Definition: XProtocol.hh:488
@ kXR_delete
Definition: XProtocol.hh:483
@ kXR_prefname
Definition: XProtocol.hh:491
@ kXR_nowait
Definition: XProtocol.hh:497
@ kXR_open_read
Definition: XProtocol.hh:486
@ kXR_open_updt
Definition: XProtocol.hh:487
@ kXR_mkpath
Definition: XProtocol.hh:490
@ kXR_seqio
Definition: XProtocol.hh:498
@ kXR_replica
Definition: XProtocol.hh:495
@ kXR_posc
Definition: XProtocol.hh:496
@ kXR_refresh
Definition: XProtocol.hh:489
@ kXR_new
Definition: XProtocol.hh:485
@ kXR_force
Definition: XProtocol.hh:484
@ kXR_4dirlist
Definition: XProtocol.hh:494
@ kXR_open_apnd
Definition: XProtocol.hh:492
@ kXR_retstat
Definition: XProtocol.hh:493
kXR_char reserved[12]
Definition: XProtocol.hh:171
kXR_char rsvd2[3]
Definition: XProtocol.hh:790
XResponseType
Definition: XProtocol.hh:940
@ kXR_noResponsesYet
Definition: XProtocol.hh:950
@ kXR_waitresp
Definition: XProtocol.hh:948
@ kXR_redirect
Definition: XProtocol.hh:946
@ kXR_oksofar
Definition: XProtocol.hh:942
@ kXR_status
Definition: XProtocol.hh:949
@ kXR_ok
Definition: XProtocol.hh:941
@ kXR_authmore
Definition: XProtocol.hh:944
@ kXR_attn
Definition: XProtocol.hh:943
@ kXR_wait
Definition: XProtocol.hh:947
@ kXR_error
Definition: XProtocol.hh:945
kXR_unt16 requestid
Definition: XProtocol.hh:375
struct ServerResponseBody_Status bdy
Definition: XProtocol.hh:1304
kXR_char streamid[2]
Definition: XProtocol.hh:846
XDirlistRequestOption
Definition: XProtocol.hh:267
@ kXR_dstat
Definition: XProtocol.hh:269
@ kXR_dstatx
Definition: XProtocol.hh:271
@ kXR_dcksm
Definition: XProtocol.hh:270
@ kXR_online
Definition: XProtocol.hh:268
kXR_unt16 requestid
Definition: XProtocol.hh:170
kXR_char streamid[2]
Definition: XProtocol.hh:275
kXR_char reserved[16]
Definition: XProtocol.hh:734
kXR_unt16 requestid
Definition: XProtocol.hh:458
kXR_char fhandle[4]
Definition: XProtocol.hh:543
kXR_char reserved[14]
Definition: XProtocol.hh:377
kXR_unt16 optiont
Definition: XProtocol.hh:514
kXR_unt16 infotype
Definition: XProtocol.hh:667
ServerResponseHeader resphdr
Definition: XProtocol.hh:991
kXR_int32 fourth
Definition: XProtocol.hh:88
kXR_char reserved2[8]
Definition: XProtocol.hh:670
kXR_char fhandle[4]
Definition: XProtocol.hh:681
kXR_char streamid[2]
Definition: XProtocol.hh:444
kXR_char fhandle[4]
Definition: XProtocol.hh:695
ServerResponseSVec_Protocol secvec
Definition: XProtocol.hh:1156
kXR_char fhandle[4]
Definition: XProtocol.hh:258
kXR_unt16 requestid
Definition: XProtocol.hh:159
kXR_char reserved[14]
Definition: XProtocol.hh:194
kXR_char fhandle[4]
Definition: XProtocol.hh:669
kXR_char sessid[16]
Definition: XProtocol.hh:183
kXR_char reserved[7]
Definition: XProtocol.hh:690
XRequestTypes
Definition: XProtocol.hh:111
@ kXR_read
Definition: XProtocol.hh:126
@ kXR_open
Definition: XProtocol.hh:123
@ kXR_writev
Definition: XProtocol.hh:144
@ kXR_clone
Definition: XProtocol.hh:145
@ kXR_readv
Definition: XProtocol.hh:138
@ kXR_mkdir
Definition: XProtocol.hh:121
@ kXR_sync
Definition: XProtocol.hh:129
@ kXR_REQFENCE
Definition: XProtocol.hh:146
@ kXR_chmod
Definition: XProtocol.hh:115
@ kXR_bind
Definition: XProtocol.hh:137
@ kXR_dirlist
Definition: XProtocol.hh:117
@ kXR_sigver
Definition: XProtocol.hh:142
@ kXR_fattr
Definition: XProtocol.hh:133
@ kXR_rm
Definition: XProtocol.hh:127
@ kXR_query
Definition: XProtocol.hh:114
@ kXR_write
Definition: XProtocol.hh:132
@ kXR_gpfile
Definition: XProtocol.hh:118
@ kXR_login
Definition: XProtocol.hh:120
@ kXR_auth
Definition: XProtocol.hh:113
@ kXR_endsess
Definition: XProtocol.hh:136
@ kXR_set
Definition: XProtocol.hh:131
@ kXR_rmdir
Definition: XProtocol.hh:128
@ kXR_1stRequest
Definition: XProtocol.hh:112
@ kXR_statx
Definition: XProtocol.hh:135
@ kXR_truncate
Definition: XProtocol.hh:141
@ kXR_protocol
Definition: XProtocol.hh:119
@ kXR_mv
Definition: XProtocol.hh:122
@ kXR_ping
Definition: XProtocol.hh:124
@ kXR_stat
Definition: XProtocol.hh:130
@ kXR_pgread
Definition: XProtocol.hh:143
@ kXR_chkpoint
Definition: XProtocol.hh:125
@ kXR_locate
Definition: XProtocol.hh:140
@ kXR_close
Definition: XProtocol.hh:116
@ kXR_pgwrite
Definition: XProtocol.hh:139
@ kXR_prepare
Definition: XProtocol.hh:134
kXR_int32 dlen
Definition: XProtocol.hh:735
kXR_unt16 requestid
Definition: XProtocol.hh:755
XSecVersion
Definition: XProtocol.hh:778
@ kXR_Ver_00
Definition: XProtocol.hh:779
kXR_char streamid[2]
Definition: XProtocol.hh:732
kXR_char reserved[15]
Definition: XProtocol.hh:277
kXR_int32 protover
Definition: XProtocol.hh:96
kXR_int32 dlen
Definition: XProtocol.hh:684
kXR_unt32 wants
Definition: XProtocol.hh:811
kXR_int32 rlen
Definition: XProtocol.hh:696
xfaLimits
Definition: XProtocol.hh:309
@ kXR_faMaxVars
Definition: XProtocol.hh:310
@ kXR_faMaxVlen
Definition: XProtocol.hh:312
@ kXR_faMaxNlen
Definition: XProtocol.hh:311
kXR_unt16 requestid
Definition: XProtocol.hh:182
char chkszreq[25-sizeof(ClientRequest)]
Definition: XProtocol.hh:1360
kXR_char sessid[16]
Definition: XProtocol.hh:289
kXR_unt16 requestid
Definition: XProtocol.hh:808
kXR_int32 dlen
Definition: XProtocol.hh:517
kXR_char reserved[14]
Definition: XProtocol.hh:459
kXR_char fhandle[4]
Definition: XProtocol.hh:835
struct ServerResponseHeader hdr
Definition: XProtocol.hh:1303
kXR_unt16 requestid
Definition: XProtocol.hh:445
kXR_unt16 mode
Definition: XProtocol.hh:512
kXR_unt16 requestid
Definition: XProtocol.hh:542
kXR_char reserved[4]
Definition: XProtocol.hh:837
union ServerResponseV2::@1 info
XLoginCapVer
Definition: XProtocol.hh:405
@ kXR_vermask
Definition: XProtocol.hh:407
@ kXR_asyncap
Definition: XProtocol.hh:408
@ kXR_lcvnone
Definition: XProtocol.hh:406
char chkszrsp[9-sizeof(ServerResponseHeader)]
Definition: XProtocol.hh:1361
kXR_unt16 requestid
Definition: XProtocol.hh:822
kXR_char options[1]
Definition: XProtocol.hh:446
kXR_unt16 requestid
Definition: XProtocol.hh:733
kXR_char streamid[2]
Definition: XProtocol.hh:833
kXR_char streamid[2]
Definition: XProtocol.hh:665
static const int kXR_ckpCommit
Definition: XProtocol.hh:215
kXR_char fhandle[4]
Definition: XProtocol.hh:206
kXR_char reserved[7]
Definition: XProtocol.hh:810
ServerResponseHeader resphdr
Definition: XProtocol.hh:998
kXR_int64 offset
Definition: XProtocol.hh:697
XStatRequestOption
Definition: XProtocol.hh:798
@ kXR_vfs
Definition: XProtocol.hh:799
XMkdirOptions
Definition: XProtocol.hh:438
@ kXR_mkdirpath
Definition: XProtocol.hh:440
@ kXR_mknone
Definition: XProtocol.hh:439
XPrepRequestOption
Definition: XProtocol.hh:620
@ kXR_wmode
Definition: XProtocol.hh:625
@ kXR_evict
Definition: XProtocol.hh:630
@ kXR_usetcp
Definition: XProtocol.hh:628
@ kXR_cancel
Definition: XProtocol.hh:621
@ kXR_fresh
Definition: XProtocol.hh:627
@ kXR_notify
Definition: XProtocol.hh:622
@ kXR_coloc
Definition: XProtocol.hh:626
@ kXR_stage
Definition: XProtocol.hh:624
@ kXR_noerrs
Definition: XProtocol.hh:623
static const int kXR_ckpQuery
Definition: XProtocol.hh:216
#define EBADRQC
Definition: XProtocol.hh:1389
XSecFlags
Definition: XProtocol.hh:773
@ kXR_nodata
Definition: XProtocol.hh:774
kXR_unt16 expectrid
Definition: XProtocol.hh:785
kXR_char reserved[15]
Definition: XProtocol.hh:707
kXR_char streamid[2]
Definition: XProtocol.hh:287
kXR_int32 dlen
Definition: XProtocol.hh:758
kXR_unt16 requestid
Definition: XProtocol.hh:193
kXR_int64 offset
Definition: XProtocol.hh:849
XOpenRequestOption2
Definition: XProtocol.hh:502
@ kXR_dup
Definition: XProtocol.hh:503
@ kXR_samefs
Definition: XProtocol.hh:504
@ kXR_directio
Definition: XProtocol.hh:506
@ kXR_retstatx
Definition: XProtocol.hh:505
ServerResponseReqs_Protocol secreq
Definition: XProtocol.hh:1236
kXR_int32 dlen
Definition: XProtocol.hh:813
kXR_char options
Definition: XProtocol.hh:809
kXR_char capver[1]
Definition: XProtocol.hh:429
kXR_char streamid[2]
Definition: XProtocol.hh:634
kXR_int32 rlen
Definition: XProtocol.hh:683
kXR_unt16 requestid
Definition: XProtocol.hh:706
kXR_char modifier
Definition: XProtocol.hh:757
XOpenRequestMode
Definition: XProtocol.hh:469
@ kXR_gw
Definition: XProtocol.hh:474
@ kXR_ur
Definition: XProtocol.hh:470
@ kXR_uw
Definition: XProtocol.hh:471
@ kXR_gr
Definition: XProtocol.hh:473
@ kXR_ow
Definition: XProtocol.hh:477
@ kXR_gx
Definition: XProtocol.hh:475
@ kXR_or
Definition: XProtocol.hh:476
@ kXR_ox
Definition: XProtocol.hh:478
@ kXR_ux
Definition: XProtocol.hh:472
kXR_char reserved[11]
Definition: XProtocol.hh:207
kXR_char streamid[2]
Definition: XProtocol.hh:705
XStatRespFlags
Definition: XProtocol.hh:1260
@ kXR_readable
Definition: XProtocol.hh:1266
@ kXR_file
Definition: XProtocol.hh:1261
@ kXR_isDir
Definition: XProtocol.hh:1263
@ kXR_offline
Definition: XProtocol.hh:1265
@ kXR_bkpexist
Definition: XProtocol.hh:1269
@ kXR_other
Definition: XProtocol.hh:1264
@ kXR_poscpend
Definition: XProtocol.hh:1268
@ kXR_writable
Definition: XProtocol.hh:1267
@ kXR_cachersp
Definition: XProtocol.hh:1270
@ kXR_xset
Definition: XProtocol.hh:1262
XQueryType
Definition: XProtocol.hh:648
@ kXR_QPrep
Definition: XProtocol.hh:650
@ kXR_Qopaqug
Definition: XProtocol.hh:661
@ kXR_Qconfig
Definition: XProtocol.hh:655
@ kXR_Qopaquf
Definition: XProtocol.hh:660
@ kXR_QFSinfo
Definition: XProtocol.hh:658
@ kXR_Qckscan
Definition: XProtocol.hh:654
@ kXR_Qxattr
Definition: XProtocol.hh:652
@ kXR_Qspace
Definition: XProtocol.hh:653
@ kXR_Qvisa
Definition: XProtocol.hh:656
@ kXR_QStats
Definition: XProtocol.hh:649
@ kXR_Qcksum
Definition: XProtocol.hh:651
@ kXR_QFinfo
Definition: XProtocol.hh:657
@ kXR_Qopaque
Definition: XProtocol.hh:659
kXR_int32 dlen
Definition: XProtocol.hh:582
kXR_char fhandle[4]
Definition: XProtocol.hh:231
XLoginVersion
Definition: XProtocol.hh:413
@ kXR_ver005
Definition: XProtocol.hh:419
@ kXR_ver001
Definition: XProtocol.hh:415
@ kXR_ver003
Definition: XProtocol.hh:417
@ kXR_ver000
Definition: XProtocol.hh:414
@ kXR_ver004
Definition: XProtocol.hh:418
@ kXR_ver002
Definition: XProtocol.hh:416
kXR_int32 msgval
Definition: XProtocol.hh:97
XLoginAbility
Definition: XProtocol.hh:386
@ kXR_readrdok
Definition: XProtocol.hh:390
@ kXR_fullurl
Definition: XProtocol.hh:388
@ kXR_onlyprv4
Definition: XProtocol.hh:392
@ kXR_lclfile
Definition: XProtocol.hh:394
@ kXR_multipr
Definition: XProtocol.hh:389
@ kXR_nothing
Definition: XProtocol.hh:387
@ kXR_redirflags
Definition: XProtocol.hh:395
@ kXR_hasipv64
Definition: XProtocol.hh:391
@ kXR_onlyprv6
Definition: XProtocol.hh:393
kXR_int32 dlen
Definition: XProtocol.hh:161
kXR_char streamid[2]
Definition: XProtocol.hh:743
kXR_char reserved[13]
Definition: XProtocol.hh:447
kXR_unt16 requestid
Definition: XProtocol.hh:744
kXR_char streamid[2]
Definition: XProtocol.hh:192
XSecCrypto
Definition: XProtocol.hh:766
@ kXR_SHA256
Definition: XProtocol.hh:767
@ kXR_HashMask
Definition: XProtocol.hh:768
@ kXR_rsaKey
Definition: XProtocol.hh:769
kXR_char reserved[16]
Definition: XProtocol.hh:581
ServerResponseHeader hdr
Definition: XProtocol.hh:1330
kXR_int32 second
Definition: XProtocol.hh:86
kXR_char streamid[2]
Definition: XProtocol.hh:510
kXR_char reserved[16]
Definition: XProtocol.hh:745
static const int kXR_ckpBegin
Definition: XProtocol.hh:214
kXR_char reserved[15]
Definition: XProtocol.hh:756
kXR_char reserved[12]
Definition: XProtocol.hh:232
kXR_char reserved[6]
Definition: XProtocol.hh:515
kXR_unt16 requestid
Definition: XProtocol.hh:230
unsigned long long kXR_unt64
Definition: XPtypes.hh:99
long long kXR_int64
Definition: XPtypes.hh:98
int kXR_int32
Definition: XPtypes.hh:89
unsigned int kXR_unt32
Definition: XPtypes.hh:90
short kXR_int16
Definition: XPtypes.hh:66
unsigned short kXR_unt16
Definition: XPtypes.hh:67
unsigned char kXR_char
Definition: XPtypes.hh:65
static void prepare()
int mkdir(const char *path, mode_t mode)
ssize_t readv(int fildes, const struct iovec *iov, int iovcnt)
int rmdir(const char *path)
ssize_t read(int fildes, void *buf, size_t nbyte)
#define close(a)
Definition: XrdPosix.hh:48
#define write(a, b, c)
Definition: XrdPosix.hh:123
#define open
Definition: XrdPosix.hh:78
#define writev(a, b, c)
Definition: XrdPosix.hh:125
#define stat(a, b)
Definition: XrdPosix.hh:105
#define truncate(a, b)
Definition: XrdPosix.hh:119
void xerr(int x)
static int toErrno(int xerr)
Definition: XProtocol.hh:1453
@ kNOMORESTREAMS
Definition: XProtocol.hh:1529
kXR_int32 ServerResponseType
Definition: XProtocol.hh:1533
static const char * reqName(kXR_unt16 reqCode)
Definition: XProtocol.cc:153
static const char * errName(kXR_int32 errCode)
Definition: XProtocol.cc:131
static int mapError(int rc)
Definition: XProtocol.hh:1404
static const int maxCloneln
Definition: XProtocol.hh:247
static const int kXR_pgUnitSZ
Definition: XProtocol.hh:530
static const int kXR_statusBodyLen
Definition: XProtocol.hh:1299
static const int kXR_pgPageSZ
Definition: XProtocol.hh:528
static const int wlItemLen
Definition: XProtocol.hh:877
kXR_char fhandle[4]
Definition: XProtocol.hh:873
@ kXR_ProgressInfo
Definition: XProtocol.hh:1294
@ kXR_PartialResult
Definition: XProtocol.hh:1293
@ kXR_FinalResult
Definition: XProtocol.hh:1292
static const int maxRvecln
Definition: XProtocol.hh:721
static const int maxRVdsz
Definition: XProtocol.hh:724
struct ServerResponseBifs_Protocol bifReqs
Definition: XProtocol.hh:1162
static const int maxRvecsz
Definition: XProtocol.hh:722
static const int clItemLen
Definition: XProtocol.hh:246
static const int maxClonesz
Definition: XProtocol.hh:248
static const int minRVbsz
Definition: XProtocol.hh:723
static const kXR_char kXR_AnyPath
Definition: XProtocol.hh:536
static const int kXR_pgMaxEpr
Definition: XProtocol.hh:531
kXR_char srcFH[4]
Definition: XProtocol.hh:240
struct ServerResponseReqs_Protocol secReqs
Definition: XProtocol.hh:1163
static const int maxWvecsz
Definition: XProtocol.hh:879
kXR_char rsvd[4]
Definition: XProtocol.hh:241
static const int maxWvecln
Definition: XProtocol.hh:878
kXR_char fhandle[4]
Definition: XProtocol.hh:716
static const int kXR_pgPageBL
Definition: XProtocol.hh:529
static const int kXR_pgMaxEos
Definition: XProtocol.hh:532
static const int rlItemLen
Definition: XProtocol.hh:720
static const int kXR_pgRetry
Definition: XProtocol.hh:537
static char * VVecInsert(const char *value, char *buffer)
Definition: XProtocol.cc:192
static const int aData
Definition: XProtocol.hh:328
static const int isNew
Definition: XProtocol.hh:327
static char * NVecRead(char *buffer, kXR_unt16 &rc)
Definition: XProtocol.cc:209
kXR_char fhandle[4]
Definition: XProtocol.hh:318
kXR_char reserved[9]
Definition: XProtocol.hh:322
kXR_char streamid[2]
Definition: XProtocol.hh:316
static char * VVecRead(char *buffer, kXR_int32 &len)
Definition: XProtocol.cc:228
kXR_unt16 requestid
Definition: XProtocol.hh:317
static char * NVecInsert(const char *name, char *buffer)
Definition: XProtocol.cc:176
kXR_char reserved[10]
Definition: XProtocol.hh:595
kXR_char streamid[2]
Definition: XProtocol.hh:590
kXR_char streamid[2]
Definition: XProtocol.hh:860
kXR_char reserved[15]
Definition: XProtocol.hh:863
kXR_unt16 requestid
Definition: XProtocol.hh:861
static const kXR_int32 doSync
Definition: XProtocol.hh:867