YProtocol.hh

Go to the documentation of this file.
00001 #ifndef __YPROTOCOL_H
00002 #define __YPROTOCOL_H
00003 
00004 #ifdef __CINT__
00005 #define __attribute__(x)
00006 #endif
00007 
00008 //        $Id: YProtocol.hh 38011 2011-02-08 18:35:57Z ganis $
00009 
00010 #include "XProtocol/XPtypes.hh"
00011 
00012 // We need to pack structures sent all over the net!
00013 // __attribute__((packed)) assures no padding bytes.
00014 //
00015 // Note all binary values shall be in network byte order.
00016 //
00017 // Data is serialized as explained in XrdOucPup.
00018   
00019 /******************************************************************************/
00020 /*                C o m m o n   R e q u e s t   S e c t i o n                 */
00021 /******************************************************************************/
00022 
00023 namespace XrdCms
00024 {
00025 
00026 static const char kYR_Version = 2;
00027 
00028 struct CmsRRHdr
00029 {  kXR_unt32  streamid;    // Essentially opaque
00030    kXR_char   rrCode;      // Request or Response code
00031    kXR_char   modifier;    // RR dependent
00032    kXR_unt16  datalen;
00033 };
00034   
00035 enum CmsReqCode            // Request Codes
00036 {    kYR_login   =  0,     // Same as kYR_data
00037      kYR_chmod   =  1,
00038      kYR_locate  =  2,
00039      kYR_mkdir   =  3,
00040      kYR_mkpath  =  4,
00041      kYR_mv      =  5,
00042      kYR_prepadd =  6,
00043      kYR_prepdel =  7,
00044      kYR_rm      =  8,
00045      kYR_rmdir   =  9,
00046      kYR_select  = 10,
00047      kYR_stats   = 11,
00048      kYR_avail   = 12,
00049      kYR_disc    = 13,
00050      kYR_gone    = 14,
00051      kYR_have    = 15,
00052      kYR_load    = 16,
00053      kYR_ping    = 17,
00054      kYR_pong    = 18,
00055      kYR_space   = 19,
00056      kYR_state   = 20,
00057      kYR_statfs  = 21,
00058      kYR_status  = 22,
00059      kYR_trunc   = 23,
00060      kYR_try     = 24,
00061      kYR_update  = 25,
00062      kYR_usage   = 26,
00063      kYR_xauth   = 27,
00064      kYR_MaxReq            // Count of request numbers (highest + 1)
00065 };
00066 
00067 // The hopcount is used for forwarded requests. It is incremented upon each
00068 // forwarding until it wraps to zero. At this point the forward is not done.
00069 // Forwarding applies to: chmod, have, mkdir, mkpath, mv, prepdel, rm, and 
00070 // rmdir. Any other modifiers must be encoded in the low order 6 bits.
00071 //
00072 enum CmsFwdModifier
00073 {    kYR_hopcount = 0xc0,
00074      kYR_hopincr  = 0x40
00075 };
00076 
00077 enum CmsReqModifier
00078 {    kYR_raw = 0x20,     // Modifier: Unmarshalled data
00079      kYR_dnf = 0x10      // Modifier: mv, rm, rmdir (do not forward)
00080 };
00081 
00082 /******************************************************************************/
00083 /*               C o m m o n   R e s p o n s e   S e c t i o n                */
00084 /******************************************************************************/
00085   
00086 enum CmsRspCode            // Response codes
00087 {    kYR_data    = 0,      // Same as kYR_login
00088      kYR_error   = 1,
00089      kYR_redirect= 2,
00090      kYR_wait    = 3,
00091      kYR_waitresp= 4,
00092      kYR_yauth   = 5
00093 };
00094 
00095 enum YErrorCode
00096 {  kYR_ENOENT = 1,
00097    kYR_EPERM,
00098    kYR_EACCES,
00099    kYR_EINVAL,
00100    kYR_EIO,
00101    kYR_ENOMEM,
00102    kYR_ENOSPC,
00103    kYR_ENAMETOOLONG,
00104    kYR_ENETUNREACH,
00105    kYR_ENOTBLK,
00106    kYR_EISDIR
00107 };
00108 
00109 struct CmsResponse
00110 {      CmsRRHdr      Hdr;
00111 
00112 enum  {kYR_async   = 128                 // Modifier: Reply to prev waitresp
00113       };
00114 
00115        kXR_unt32     Val;                // Port, Wait val, rc, asyncid
00116 //     kXR_char      Data[Hdr.datalen-4];// Target host, more data, or emessage
00117 };
00118 
00119 /******************************************************************************/
00120 /*                         a v a i l   R e q u e s t                          */
00121 /******************************************************************************/
00122   
00123 // Request: avail <diskFree> <diskUtil>
00124 // Respond: n/a
00125 //
00126 struct CmsAvailRequest
00127 {      CmsRRHdr      Hdr;
00128 //     kXR_int32     diskFree;
00129 //     kXR_int32     diskUtil;
00130 };
00131 
00132 /******************************************************************************/
00133 /*                         c h m o d   R e q u e s t                          */
00134 /******************************************************************************/
00135   
00136 // Request: chmod <ident> <mode> <path>
00137 // Respond: n/a
00138 //
00139 struct CmsChmodRequest
00140 {      CmsRRHdr      Hdr;
00141 //     kXR_string    Ident;
00142 //     kXR_string    Mode;
00143 //     kXR_string    Path;
00144 };
00145 
00146 /******************************************************************************/
00147 /*                          d i s c   R e q u e s t                           */
00148 /******************************************************************************/
00149   
00150 // Request: disc
00151 // Respond: n/a
00152 //
00153 struct CmsDiscRequest
00154 {      CmsRRHdr      Hdr;
00155 };
00156 
00157 /******************************************************************************/
00158 /*                          g o n e   R e q u e s t                           */
00159 /******************************************************************************/
00160   
00161 // Request: gone <path>
00162 // Respond: n/a
00163 //
00164 struct CmsGoneRequest
00165 {      CmsRRHdr      Hdr;
00166 //     kXR_string    Path;
00167 };
00168 
00169 /******************************************************************************/
00170 /*                          h a v e   R e q u e s t                           */
00171 /******************************************************************************/
00172   
00173 // Request: have <path>
00174 // Respond: n/a
00175 //
00176 struct CmsHaveRequest
00177 {      CmsRRHdr      Hdr;
00178        enum          {Online = 1, Pending = 2};  // Modifiers
00179 //     kXR_string    Path;
00180 };
00181 
00182 /******************************************************************************/
00183 /*                        l o c a t e   R e q u e s t                         */
00184 /******************************************************************************/
00185 
00186 struct CmsLocateRequest
00187 {      CmsRRHdr      Hdr;
00188 //     kXR_string    Ident;
00189 //     kXR_unt32     Opts;
00190 
00191 enum  {kYR_refresh = 0x01,
00192        kYR_asap    = 0x80
00193       };
00194 //     kXR_string    Path;
00195 
00196 static const int     RILen = 32;  // Max length of each response item
00197 };
00198 
00199 /******************************************************************************/
00200 /*                         l o g i n   R e q u e s t                          */
00201 /******************************************************************************/
00202   
00203 // Request: login  <login_data>
00204 // Respond: xauth  <auth_data>
00205 //          login  <login_data>
00206 //
00207 
00208 struct CmsLoginData
00209 {      kXR_unt16  Size;              // Temp area for packing purposes
00210        kXR_unt16  Version;
00211        kXR_unt32  Mode;              // From LoginMode
00212        kXR_int32  HoldTime;          // Hold time in ms(managers)
00213        kXR_unt32  tSpace;            // Tot  Space  GB (servers)
00214        kXR_unt32  fSpace;            // Free Space  MB (servers)
00215        kXR_unt32  mSpace;            // Minf Space  MB (servers)
00216        kXR_unt16  fsNum;             // File Systems   (servers /supervisors)
00217        kXR_unt16  fsUtil;            // FS Utilization (servers /supervisors)
00218        kXR_unt16  dPort;             // Data port      (servers /supervisors)
00219        kXR_unt16  sPort;             // Subs port      (managers/supervisors)
00220        kXR_char  *SID;               // Server ID      (servers/ supervisors)
00221        kXR_char  *Paths;             // Exported paths (servers/ supervisors)
00222 
00223        enum       LoginMode
00224                  {kYR_director=   0x00000001,
00225                   kYR_manager =   0x00000002,
00226                   kYR_peer    =   0x00000004,
00227                   kYR_server  =   0x00000008,
00228                   kYR_proxy   =   0x00000010,
00229                   kYR_suspend =   0x00000100,   // Suspended login
00230                   kYR_nostage =   0x00000200,   // Staging unavailable
00231                   kYR_trying  =   0x00000400,   // Extensive login retries
00232                   kYR_debug   =   0x80000000
00233                  };
00234 };
00235 
00236 struct CmsLoginRequest
00237 {  CmsRRHdr     Hdr;
00238    CmsLoginData Data;
00239 };
00240 
00241 struct CmsLoginResponse
00242 {  CmsRRHdr     Hdr;
00243    CmsLoginData Data;
00244 };
00245 
00246 /******************************************************************************/
00247 /*                          l o a d   R e q u e s t                           */
00248 /******************************************************************************/
00249   
00250 // Request: load <cpu> <io> <load> <mem> <pag> <util> <dskfree>
00251 // Respond: n/a
00252 //
00253 struct CmsLoadRequest
00254 {      CmsRRHdr      Hdr;
00255        enum         {cpuLoad=0, netLoad, xeqLoad, memLoad, pagLoad, dskLoad,
00256                      numLoad};
00257 //     kXR_char      theLoad[numload];
00258 //     kXR_int       dskFree;
00259 };
00260 
00261 /******************************************************************************/
00262 /*                         m k d i r   R e q u e s t                          */
00263 /******************************************************************************/
00264   
00265 // Request: mkdir <ident> <mode> <path>
00266 // Respond: n/a
00267 //
00268 struct CmsMkdirRequest
00269 {      CmsRRHdr      Hdr;
00270 //     kXR_string    Ident;
00271 //     kXR_string    Mode;
00272 //     kXR_string    Path;
00273 };
00274 
00275 /******************************************************************************/
00276 /*                        m k p a t h   R e q u e s t                         */
00277 /******************************************************************************/
00278   
00279 // Request: <id> mkpath <mode> <path>
00280 // Respond: n/a
00281 //
00282 struct CmsMkpathRequest
00283 {      CmsRRHdr      Hdr;
00284 //     kXR_string    Ident;
00285 //     kXR_string    Mode;
00286 //     kXR_string    Path;
00287 };
00288 
00289 /******************************************************************************/
00290 /*                            m v   R e q u e s t                             */
00291 /******************************************************************************/
00292   
00293 // Request: <id> mv <old_name> <new_name>
00294 // Respond: n/a
00295 //
00296 struct CmsMvRequest {
00297        CmsRRHdr      Hdr;      // Subject to kYR_dnf modifier!
00298 //     kXR_string    Ident;
00299 //     kXR_string    Old_Path;
00300 //     kXR_string    New_Path;
00301 };
00302 
00303 /******************************************************************************/
00304 /*                          p i n g   R e q u e s t                           */
00305 /******************************************************************************/
00306   
00307 // Request: ping
00308 // Respond: n/a
00309 //
00310 struct CmsPingRequest {
00311        CmsRRHdr      Hdr;
00312 };
00313 
00314 /******************************************************************************/
00315 /*                          p o n g   R e q u e s t                           */
00316 /******************************************************************************/
00317   
00318 // Request: pong
00319 // Respond: n/a
00320 //
00321 struct CmsPongRequest {
00322        CmsRRHdr      Hdr;
00323 };
00324 
00325 /******************************************************************************/
00326 /*                       p r e p a d d   R e q u e s t                        */
00327 /******************************************************************************/
00328   
00329 // Request: <id> prepadd <reqid> <usr> <prty> <mode> <path>\n
00330 // Respond: No response.
00331 //
00332 struct CmsPrepAddRequest
00333 {      CmsRRHdr      Hdr;    // Modifier used with following options
00334 
00335 enum  {kYR_stage   = 0x0001, // Stage   the data
00336        kYR_write   = 0x0002, // Prepare for writing
00337        kYR_coloc   = 0x0004, // Prepare for co-location
00338        kYR_fresh   = 0x0008  // Prepare by  time refresh
00339       };
00340 //     kXR_string    Ident;
00341 //     kXR_string    reqid;
00342 //     kXR_string    user;
00343 //     kXR_string    prty;
00344 //     kXR_string    mode;
00345 //     kXR_string    Path;
00346 //     kXR_string    Opaque; // Optional
00347 };
00348 
00349 /******************************************************************************/
00350 /*                       p r e p d e l   R e q u e s t                        */
00351 /******************************************************************************/
00352   
00353 // Request: <id> prepdel <reqid>
00354 // Respond: No response.
00355 //
00356 struct CmsPrepDelRequest
00357 {      CmsRRHdr      Hdr;
00358 //     kXR_string    Ident;
00359 //     kXR_string    reqid;
00360 };
00361 
00362 /******************************************************************************/
00363 /*                            r m   R e q u e s t                             */
00364 /******************************************************************************/
00365   
00366 // Request: <id> rm <path>
00367 // Respond: n/a
00368 //
00369 struct CmsRmRequest
00370 {      CmsRRHdr      Hdr;    // Subject to kYR_dnf modifier!
00371 //     kXR_string    Ident;
00372 //     kXR_string    Path;
00373 };
00374 
00375 /******************************************************************************/
00376 /*                         r m d i r   R e q u e s t                          */
00377 /******************************************************************************/
00378   
00379 // Request: <id> rmdir <path>
00380 // Respond: n/a
00381 //
00382 struct CmsRmdirRequest
00383 {      CmsRRHdr      Hdr;    // Subject to kYR_dnf modifier!
00384 //     kXR_string    Ident;
00385 //     kXR_string    Path;
00386 };
00387 
00388 /******************************************************************************/
00389 /*                        s e l e c t   R e q u e s t                         */
00390 /******************************************************************************/
00391   
00392 // Request: <id> select[s] {c | d | m | r | w | s | t | x} <path> [-host]
00393 
00394 // Note: selects - requests a cache refresh for <path>
00395 // kYR_refresh   - refresh file location cache
00396 // kYR_create  c - file will be created
00397 // kYR_delete  d - file will be created or truncated
00398 // kYR_metaop  m - inod will only be modified
00399 // kYR_read    r - file will only be read
00400 // kYR_replica   - file will replicated
00401 // kYR_write   w - file will be read and writen
00402 // kYR_stats   s - only stat information will be obtained
00403 // kYR_online  x - consider only online files
00404 //                 may be combined with kYR_stats (file must be resident)
00405 //             - - the host failed to deliver the file.
00406 
00407 
00408 struct CmsSelectRequest
00409 {      CmsRRHdr      Hdr;
00410 //     kXR_string    Ident;
00411 //     kXR_unt32     Opts;
00412 
00413 enum  {kYR_refresh = 0x0001,
00414        kYR_create  = 0x0002, // May combine with trunc -> delete
00415        kYR_online  = 0x0004,
00416        kYR_read    = 0x0008, // Default
00417        kYR_trunc   = 0x0010, // -> write
00418        kYR_write   = 0x0020,
00419        kYR_stat    = 0x0040, // Exclsuive
00420        kYR_metaop  = 0x0080,
00421        kYR_replica = 0x0100  // Only in combination with create
00422       };
00423 //     kXR_string    Path;
00424 //     kXR_string    Opaque; // Optional
00425 //     kXR_string    Host;   // Optional
00426 };
00427 
00428 /******************************************************************************/
00429 /*                         s p a c e   R e q u e s t                          */
00430 /******************************************************************************/
00431   
00432 // Request: space
00433 //
00434 
00435 struct CmsSpaceRequest
00436 {      CmsRRHdr      Hdr;
00437 };
00438   
00439 /******************************************************************************/
00440 /*                         s t a t e   R e q u e s t                          */
00441 /******************************************************************************/
00442   
00443 // Request: state <path>
00444 //
00445 
00446 struct CmsStateRequest
00447 {      CmsRRHdr      Hdr;
00448 //     kXR_string    Path;
00449 
00450 enum  {kYR_refresh = 0x01,   // Modifier
00451        kYR_noresp  = 0x02
00452       };
00453 };
00454   
00455 /******************************************************************************/
00456 /*                        s t a t f s   R e q u e s t                         */
00457 /******************************************************************************/
00458   
00459 // Request: statfs <path>
00460 //
00461 
00462 struct CmsStatfsRequest
00463 {      CmsRRHdr      Hdr;
00464 //     kXR_string    Path;
00465 };
00466 
00467 /******************************************************************************/
00468 /*                         s t a t s   R e q u e s t                          */
00469 /******************************************************************************/
00470   
00471 // Request: stats or statsz (determined by modifier)
00472 //
00473 
00474 struct CmsStatsRequest
00475 {      CmsRRHdr      Hdr;
00476 
00477 enum  {kYR_size = 1  // Modifier
00478       };
00479 };
00480 
00481 /******************************************************************************/
00482 /*                        s t a t u s   R e q u e s t                         */
00483 /******************************************************************************/
00484   
00485 // Request: status
00486 //
00487 struct CmsStatusRequest
00488 {      CmsRRHdr      Hdr;
00489 
00490 enum  {kYR_Stage  = 0x01, kYR_noStage = 0x02,  // Modifier
00491        kYR_Resume = 0x04, kYR_Suspend = 0x08,
00492        kYR_Reset  = 0x10                       // Exclusive
00493       };
00494 };
00495 
00496 /******************************************************************************/
00497 /*                         t r u n c   R e q u e s t                          */
00498 /******************************************************************************/
00499   
00500 // Request: <id> trunc <path>
00501 // Respond: n/a
00502 //
00503 struct CmsTruncRequest
00504 {      CmsRRHdr      Hdr;
00505 //     kXR_string    Ident;
00506 //     kXR_string    Size;
00507 //     kXR_string    Path;
00508 };
00509 
00510 /******************************************************************************/
00511 /*                           t r y   R e q u e s t                            */
00512 /******************************************************************************/
00513   
00514 // Request: try
00515 //
00516 struct CmsTryRequest
00517 {      CmsRRHdr      Hdr;
00518        kXR_unt16     sLen;   // This is the string length in PUP format
00519 
00520 //     kYR_string    {ipaddr:port}[up to STMax];
00521 };
00522 
00523 /******************************************************************************/
00524 /*                        u p d a t e   R e q u e s t                         */
00525 /******************************************************************************/
00526   
00527 // Request: update
00528 //
00529 struct CmsUpdateRequest
00530 {      CmsRRHdr      Hdr;
00531 };
00532 
00533 /******************************************************************************/
00534 /*                         u s a g e   R e q u e s t                          */
00535 /******************************************************************************/
00536   
00537 // Request: usage
00538 //
00539 struct CmsUsageRequest
00540 {      CmsRRHdr      Hdr;
00541 };
00542 
00543 }; // namespace XrdCms
00544 #endif

Generated on Tue Jul 5 14:46:14 2011 for ROOT_528-00b_version by  doxygen 1.5.1