00001 #ifndef _XRDSSIRRINFO_H 00002 #define _XRDSSIRRINFO_H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d S s i R R I n f o . h h */ 00006 /* */ 00007 /* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /* */ 00012 /* This file is part of the XRootD software suite. */ 00013 /* */ 00014 /* XRootD is free software: you can redistribute it and/or modify it under */ 00015 /* the terms of the GNU Lesser General Public License as published by the */ 00016 /* Free Software Foundation, either version 3 of the License, or (at your */ 00017 /* option) any later version. */ 00018 /* */ 00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00022 /* License for more details. */ 00023 /* */ 00024 /* You should have received a copy of the GNU Lesser General Public License */ 00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00027 /* */ 00028 /* The copyright holder's institutional names and contributor's names may not */ 00029 /* be used to endorse or promote products derived from this software without */ 00030 /* specific prior written permission of the institution or contributor. */ 00031 /******************************************************************************/ 00032 00033 #include <arpa/inet.h> 00034 00035 #include "XrdSsi/XrdSsiRespInfo.hh" 00036 00037 class XrdSsiRRInfo 00038 { 00039 public: 00040 00041 static const unsigned int idMax = 16777215; 00042 00043 enum Opc {Rxq = 0, Rwt = 1, Can = 2}; 00044 00045 inline void Cmd(Opc cmd) 00046 {reqCmd = static_cast<unsigned char>(cmd);} 00047 00048 inline Opc Cmd() {return static_cast<Opc>(reqCmd);} 00049 00050 inline const unsigned char *Data() {return &reqCmd;} 00051 00052 inline void Id(unsigned int id) 00053 {unsigned char tmp = reqCmd; 00054 reqId = htonl(id & idMask); 00055 reqCmd = tmp; 00056 } 00057 00058 inline unsigned int Id() {return ntohl(reqId) & idMask;} 00059 00060 inline void Size(unsigned int sz) {reqSize = htonl(sz);} 00061 00062 inline unsigned int Size() {return ntohl(reqSize);} 00063 00064 inline unsigned long long Info() 00065 {return (static_cast<unsigned long long>(reqId & 0xffffffff) <<32LL) 00066 |(static_cast<unsigned long long>(reqSize & 0xffffffff)); 00067 00068 } 00069 00070 XrdSsiRRInfo(unsigned long long ival=0) 00071 : reqId(static_cast<unsigned int>( (ival>>32) & 0xffffffff)), 00072 reqSize(static_cast<unsigned int>(ival & 0xffffffff)) {} 00073 00074 ~XrdSsiRRInfo() {} 00075 00076 private: 00077 static const int idMask = 0x00ffffff; 00078 00079 union {unsigned char reqCmd; 00080 unsigned int reqId; 00081 }; 00082 unsigned int reqSize; 00083 }; 00084 00085 /******************************************************************************/ 00086 /* X r d S s i R R I n f o A t t n */ 00087 /******************************************************************************/ 00088 00089 struct XrdSsiRRInfoAttn 00090 { 00091 static const int alrtResp = '!'; // In tag: response data is an alert 00092 static const int fullResp = ':'; // In tag: response data is present 00093 static const int pendResp = '*'; // In tag: response data is pending 00094 00095 char tag; 00096 char flags; 00097 unsigned short pfxLen; // Length of prefix 00098 unsigned int mdLen; // Length of metadata 00099 int rsvd1; 00100 int rsvd2; 00101 }; 00102 #endif