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
Definition XrdSsiRRInfo.hh:38
Opc
Definition XrdSsiRRInfo.hh:43
@ Rxq
Definition XrdSsiRRInfo.hh:43
@ Can
Definition XrdSsiRRInfo.hh:43
@ Rwt
Definition XrdSsiRRInfo.hh:43
unsigned int Id()
Definition XrdSsiRRInfo.hh:58
void Size(unsigned int sz)
Definition XrdSsiRRInfo.hh:60
~XrdSsiRRInfo()
Definition XrdSsiRRInfo.hh:74
XrdSsiRRInfo(unsigned long long ival=0)
Definition XrdSsiRRInfo.hh:70
Opc Cmd()
Definition XrdSsiRRInfo.hh:48
unsigned int reqSize
Definition XrdSsiRRInfo.hh:82
unsigned char reqCmd
Definition XrdSsiRRInfo.hh:79
static const int idMask
Definition XrdSsiRRInfo.hh:77
unsigned long long Info()
Definition XrdSsiRRInfo.hh:64
const unsigned char * Data()
Definition XrdSsiRRInfo.hh:50
void Cmd(Opc cmd)
Definition XrdSsiRRInfo.hh:45
unsigned int reqId
Definition XrdSsiRRInfo.hh:80
unsigned int Size()
Definition XrdSsiRRInfo.hh:62
void Id(unsigned int id)
Definition XrdSsiRRInfo.hh:52
static const unsigned int idMax
Definition XrdSsiRRInfo.hh:41
Definition XrdSsiRRInfo.hh:90
int rsvd1
Definition XrdSsiRRInfo.hh:99
int rsvd2
Definition XrdSsiRRInfo.hh:100
static const int fullResp
Definition XrdSsiRRInfo.hh:92
static const int pendResp
Definition XrdSsiRRInfo.hh:93
char flags
Definition XrdSsiRRInfo.hh:96
unsigned short pfxLen
Definition XrdSsiRRInfo.hh:97
unsigned int mdLen
Definition XrdSsiRRInfo.hh:98
static const int alrtResp
Definition XrdSsiRRInfo.hh:91
char tag
Definition XrdSsiRRInfo.hh:95