XRootD
Loading...
Searching...
No Matches
XrdSsiRRInfo.hh
Go to the documentation of this file.
1#ifndef _XRDSSIRRINFO_H
2#define _XRDSSIRRINFO_H
3/******************************************************************************/
4/* */
5/* X r d S s i R R I n f o . h h */
6/* */
7/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <arpa/inet.h>
34
36
38{
39public:
40
41static const unsigned int idMax = 16777215;
42
43enum Opc {Rxq = 0, Rwt = 1, Can = 2};
44
45inline void Cmd(Opc cmd)
46 {reqCmd = static_cast<unsigned char>(cmd);}
47
48inline Opc Cmd() {return static_cast<Opc>(reqCmd);}
49
50inline const unsigned char *Data() {return &reqCmd;}
51
52inline void Id(unsigned int id)
53 {unsigned char tmp = reqCmd;
54 reqId = htonl(id & idMask);
55 reqCmd = tmp;
56 }
57
58inline unsigned int Id() {return ntohl(reqId) & idMask;}
59
60inline void Size(unsigned int sz) {reqSize = htonl(sz);}
61
62inline unsigned int Size() {return ntohl(reqSize);}
63
64inline unsigned long long Info()
65 {return (static_cast<unsigned long long>(reqId & 0xffffffff) <<32LL)
66 |(static_cast<unsigned long long>(reqSize & 0xffffffff));
67
68 }
69
70 XrdSsiRRInfo(unsigned long long ival=0)
71 : reqId(static_cast<unsigned int>( (ival>>32) & 0xffffffff)),
72 reqSize(static_cast<unsigned int>(ival & 0xffffffff)) {}
73
75
76private:
77static const int idMask = 0x00ffffff;
78
79union {unsigned char reqCmd;
80 unsigned int reqId;
81 };
82 unsigned int reqSize;
83};
84
85/******************************************************************************/
86/* X r d S s i R R I n f o A t t n */
87/******************************************************************************/
88
90{
91static const int alrtResp = '!'; // In tag: response data is an alert
92static const int fullResp = ':'; // In tag: response data is present
93static const int pendResp = '*'; // In tag: response data is pending
94
95 char tag;
96 char flags;
97unsigned short pfxLen; // Length of prefix
98unsigned int mdLen; // Length of metadata
99 int rsvd1;
100 int rsvd2;
101};
102#endif
unsigned int Id()
void Size(unsigned int sz)
XrdSsiRRInfo(unsigned long long ival=0)
unsigned long long Info()
const unsigned char * Data()
void Cmd(Opc cmd)
unsigned int Size()
void Id(unsigned int id)
static const unsigned int idMax
static const int fullResp
static const int pendResp
unsigned short pfxLen
unsigned int mdLen
static const int alrtResp