xrootd
Loading...
Searching...
No Matches
XrdSecsssEnt.hh
Go to the documentation of this file.
1#ifndef __SecsssEnt__
2#define __SecsssEnt__
3/******************************************************************************/
4/* */
5/* X r d S e c s s s E n t . h h */
6/* */
7/* (c) 2020 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 <set>
34#include <string>
35#include <cstdlib>
36
39
40class XrdSecEntity;
41
43{
44public:
45
46char *eData; // -> RR
47int iLen; // Length of V1 data
48int tLen; // Length of V1 plus V2 data (follows iLen)
49
50//-----------------------------------------------------------------------------
54//-----------------------------------------------------------------------------
55
56void AddContact(const std::string &hostID);
57
58//-----------------------------------------------------------------------------
60//-----------------------------------------------------------------------------
61
62void Delete();
63
64//-----------------------------------------------------------------------------
75//-----------------------------------------------------------------------------
76
77static const int addExtra = 0x00000001;
78static const int addCreds = 0x00000002;
79static const int v2Client = 0x00000003;
80
81int RR_Data(char *&dP, const char *hostIP, int dataOpts);
82
83
85
86void UnRef()
88 int x = AtomicDec(refCnt);
90 if (x < 1) delete this;
91 }
92
93static void setHostName(const char *hnP);
94
95 XrdSecsssEnt(const XrdSecEntity *entity=0, bool defer=false)
96 : eData(0), iLen(0), tLen(0), eP(entity), refCnt(1)
97 {if (!defer) Serialize();}
98
99//-----------------------------------------------------------------------------
101//-----------------------------------------------------------------------------
102
103private:
104 ~XrdSecsssEnt() {if (eData) free(eData);}
105
107
108#ifndef HAVE_ATOMICS
110#endif
111std::set<std::string> Contacts;
112
113const
117
118static char *myHostName;
119static int myHostNLen;
120};
121#endif
#define AtomicInc(x)
Definition XrdSysAtomics.hh:72
#define AtomicBeg(Mtx)
Definition XrdSysAtomics.hh:63
#define AtomicDec(x)
Definition XrdSysAtomics.hh:68
#define AtomicEnd(Mtx)
Definition XrdSysAtomics.hh:64
Definition XrdSecEntity.hh:65
Definition XrdSecsssEnt.hh:43
void Delete()
Delete this entity object.
static char * myHostName
Definition XrdSecsssEnt.hh:118
short credLen
Definition XrdSecsssEnt.hh:116
void Ref()
Definition XrdSecsssEnt.hh:84
const XrdSecEntity * eP
Definition XrdSecsssEnt.hh:114
void UnRef()
Definition XrdSecsssEnt.hh:86
XrdSecsssEnt(const XrdSecEntity *entity=0, bool defer=false)
Definition XrdSecsssEnt.hh:95
static const int v2Client
Data for a v2 client wanted.
Definition XrdSecsssEnt.hh:79
~XrdSecsssEnt()
Destructor cannot be directly called; use Delete() instead.
Definition XrdSecsssEnt.hh:104
char * eData
Definition XrdSecsssEnt.hh:46
XrdSysMutex eMtx
Definition XrdSecsssEnt.hh:109
static void setHostName(const char *hnP)
static int myHostNLen
Definition XrdSecsssEnt.hh:119
void AddContact(const std::string &hostID)
std::set< std::string > Contacts
Definition XrdSecsssEnt.hh:111
int iLen
Definition XrdSecsssEnt.hh:47
int refCnt
Definition XrdSecsssEnt.hh:115
static const int addExtra
Add v2 data.
Definition XrdSecsssEnt.hh:77
int tLen
Definition XrdSecsssEnt.hh:48
static const int addCreds
Add v2 data plus creds.
Definition XrdSecsssEnt.hh:78
int RR_Data(char *&dP, const char *hostIP, int dataOpts)
bool Serialize()
Definition XrdSysPthread.hh:165