xrootd
Loading...
Searching...
No Matches
XrdXrootdReqID.hh
Go to the documentation of this file.
1#ifndef __XRDXROOTDREQID_HH_
2#define __XRDXROOTDREQID_HH_
3/******************************************************************************/
4/* */
5/* X r d X r o o t d R e q I D . h h */
6/* */
7/* (c) 2006 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 <cstring>
34
36{
37public:
38
39inline unsigned long long getID() {return Req.ID;}
40
41inline void getID(unsigned char *sid, int &lid,unsigned int &linst)
42 {memcpy(sid, Req.ids.Sid, sizeof(Req.ids.Sid));
43 lid = static_cast<int>(Req.ids.Lid);
44 linst = Req.ids.Linst;
45 }
46
47inline void setID(unsigned long long id) {Req.ID = id;}
48
49inline void setID(const unsigned char *sid,int lid,unsigned int linst)
50 {memcpy(Req.ids.Sid, sid, sizeof(Req.ids.Sid));
51 Req.ids.Lid = static_cast<unsigned short>(lid);
52 Req.ids.Linst = linst;
53 }
54
55inline unsigned long long setID(const unsigned char *sid)
56 {memcpy(Req.ids.Sid, sid, sizeof(Req.ids.Sid));
57 return Req.ID;
58 }
59
60inline unsigned char *Stream() {return Req.ids.Sid;}
61
62 XrdXrootdReqID(unsigned long long id) {setID(id);}
63 XrdXrootdReqID(const unsigned char *sid, int lid, unsigned int linst)
64 {setID(sid ? (unsigned char *)"\0\0" : sid, lid, linst);}
66
67private:
68
69union {unsigned long long ID;
70 struct {unsigned int Linst;
71 unsigned short Lid;
72 unsigned char Sid[2];
73 } ids;
74 } Req;
75};
76#endif
Definition XrdXrootdReqID.hh:36
void setID(unsigned long long id)
Definition XrdXrootdReqID.hh:47
unsigned char * Stream()
Definition XrdXrootdReqID.hh:60
XrdXrootdReqID(unsigned long long id)
Definition XrdXrootdReqID.hh:62
unsigned char Sid[2]
Definition XrdXrootdReqID.hh:72
XrdXrootdReqID()
Definition XrdXrootdReqID.hh:65
unsigned int Linst
Definition XrdXrootdReqID.hh:70
unsigned long long ID
Definition XrdXrootdReqID.hh:69
unsigned short Lid
Definition XrdXrootdReqID.hh:71
void getID(unsigned char *sid, int &lid, unsigned int &linst)
Definition XrdXrootdReqID.hh:41
XrdXrootdReqID(const unsigned char *sid, int lid, unsigned int linst)
Definition XrdXrootdReqID.hh:63
void setID(const unsigned char *sid, int lid, unsigned int linst)
Definition XrdXrootdReqID.hh:49
union XrdXrootdReqID::@179 Req
unsigned long long getID()
Definition XrdXrootdReqID.hh:39
unsigned long long setID(const unsigned char *sid)
Definition XrdXrootdReqID.hh:55
struct XrdXrootdReqID::@179::@180 ids