XRootD
Loading...
Searching...
No Matches
XrdSecsssEnt Class Reference

#include <XrdSecsssEnt.hh>

Collaboration diagram for XrdSecsssEnt:

Public Member Functions

 XrdSecsssEnt (const XrdSecEntity *entity=0, bool defer=false)
void AddContact (const std::string &hostID)
void Delete ()
 Delete this entity object.
void Ref ()
int RR_Data (char *&dP, const char *hostIP, int dataOpts)
void UnRef ()

Static Public Member Functions

static void setHostName (const char *hnP)

Public Attributes

char * eData
int iLen
int tLen

Static Public Attributes

static const int addCreds = 0x00000002
 Add v2 data plus creds.
static const int addExtra = 0x00000001
 Add v2 data.
static const int v2Client = 0x00000003
 Data for a v2 client wanted.

Detailed Description

Definition at line 42 of file XrdSecsssEnt.hh.

Constructor & Destructor Documentation

◆ XrdSecsssEnt()

XrdSecsssEnt::XrdSecsssEnt ( const XrdSecEntity * entity = 0,
bool defer = false )
inline

Definition at line 95 of file XrdSecsssEnt.hh.

96 : eData(0), iLen(0), tLen(0), eP(entity), refCnt(1)
97 {if (!defer) Serialize();}

References eData, iLen, and tLen.

Member Function Documentation

◆ AddContact()

void XrdSecsssEnt::AddContact ( const std::string & hostID)

Add a new connection created by this entity.

Parameters
hostID- The hostID (i.e. user[:pswd]@host:port).

Definition at line 85 of file XrdSecsssEnt.cc.

86{
87// If we are tracking connections then add this one to the set. We use the
88// fact that a set can only have one instance of a member and ignores dups.
89//
90 if (conTrack) Contacts.insert(hostID);
91}
XrdSecsssCon * conTrack

References XrdSecsssMap::conTrack.

◆ Delete()

void XrdSecsssEnt::Delete ( )

Delete this entity object.

Definition at line 97 of file XrdSecsssEnt.cc.

98{
99// Invoke the cleanup call back if there is something to clean up
100//
101 if (conTrack && Contacts.size()) conTrack->Cleanup(Contacts, *eP);
102
103// Now we can delete ourselves
104//
105 delete this;
106}
virtual void Cleanup(const std::set< std::string > &Contacts, const XrdSecEntity &Entity)=0

References XrdSecsssMap::conTrack.

Referenced by XrdSecsssID::Register().

Here is the caller graph for this function:

◆ Ref()

void XrdSecsssEnt::Ref ( )
inline

Definition at line 84 of file XrdSecsssEnt.hh.

84{AtomicBeg(eMtx); AtomicInc(refCnt); AtomicEnd(eMtx);}
#define AtomicInc(x)
#define AtomicBeg(Mtx)
#define AtomicEnd(Mtx)

References AtomicBeg, AtomicEnd, and AtomicInc.

◆ RR_Data()

int XrdSecsssEnt::RR_Data ( char *& dP,
const char * hostIP,
int dataOpts )

Definition at line 112 of file XrdSecsssEnt.cc.

113{
114 char *bP;
115 int cpyLen, totLen = XrdSecsssRR_Data_HdrLen;
116 int n = 0;
117
118// If we have not yet serialized the data, do so now.
119//
120 if (!eData && !Serialize()) return 0;
121
122// Compute the length we will need for the buffer (it must be exact)
123//
124 if (dataOpts & v2Client)
125 {cpyLen = tLen;
126 if (dataOpts & addCreds) cpyLen += credLen;
127 } else cpyLen = iLen;
128 totLen += cpyLen;
129
130// Add in the hostIP if specified and hostname if available
131//
132 n = strlen(hostIP) + 4;
133 if (hostIP) totLen += n;
134 totLen += myHostNLen;
135
136// Allocate a buffer
137//
138 if (!(dP = (char *)malloc(totLen))) return 0;
139 bP = dP + XrdSecsssRR_Data_HdrLen;
140
141// The first thing in the serialized packet is the host IP
142//
143 if (hostIP)
145 XrdOucPup::Pack(&bP, hostIP);
146 }
147
148// The next thing is to addthe hostname for backward compatibility
149//
150 if (myHostName)
151 {memcpy(bP, myHostName, myHostNLen); bP += myHostNLen;}
152
153// Copy the remaining data
154//
155 memcpy(bP, eData, cpyLen);
156
157// Return length of the whole thing
158//
159 return totLen;
160}
static const int XrdSecsssRR_Data_HdrLen
static int Pack(struct iovec **, const char *, unsigned short &buff)
Definition XrdOucPup.cc:52
static const int v2Client
Data for a v2 client wanted.
static const int addCreds
Add v2 data plus creds.
static const char theHost

References addCreds, eData, iLen, XrdOucPup::Pack(), XrdSecsssRR_Data::theHost, tLen, v2Client, and XrdSecsssRR_Data_HdrLen.

Here is the call graph for this function:

◆ setHostName()

void XrdSecsssEnt::setHostName ( const char * hnP)
static

Definition at line 313 of file XrdSecsssEnt.cc.

314{
315 char *bP;
316 int n = strlen(hnP);
317
318// The host name always goes into the serialized data. So, we prepack it here.
319//
320 if (n)
321 {if (myHostName) free(myHostName);
322 myHostName = bP = (char *)malloc(n+4);
324 myHostNLen = XrdOucPup::Pack(&bP, hnP) + 1;
325 }
326}

References XrdOucPup::Pack(), and XrdSecsssRR_Data::theHost.

Referenced by XrdSecProtocolsss::Load_Client().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UnRef()

void XrdSecsssEnt::UnRef ( )
inline

Definition at line 86 of file XrdSecsssEnt.hh.

87 {AtomicBeg(eMtx);
88 int x = AtomicDec(refCnt);
89 AtomicEnd(eMtx);
90 if (x < 1) delete this;
91 }
#define AtomicDec(x)

References AtomicBeg, AtomicDec, and AtomicEnd.

Member Data Documentation

◆ addCreds

const int XrdSecsssEnt::addCreds = 0x00000002
static

Add v2 data plus creds.

Definition at line 78 of file XrdSecsssEnt.hh.

Referenced by XrdSecProtocolsss::Init_Client(), and RR_Data().

◆ addExtra

const int XrdSecsssEnt::addExtra = 0x00000001
static

Add v2 data.

Return serialized entity infrmation.

Parameters
dP- Reference to a pointer where the serialized ID is returned. The caller is responsible for freeing the storage.
myIP- Pointer to IP address of client.
opts- Options as follows: addExtra - This is a V2 client, include extra info addCreds - This is a V2 client, add credentials to extra
Returns
The length of the structure pointed to by dP; zero if not found.

Definition at line 77 of file XrdSecsssEnt.hh.

Referenced by XrdSecProtocolsss::Init_Client().

◆ eData

char* XrdSecsssEnt::eData

Definition at line 46 of file XrdSecsssEnt.hh.

Referenced by XrdSecsssEnt(), and RR_Data().

◆ iLen

int XrdSecsssEnt::iLen

Definition at line 47 of file XrdSecsssEnt.hh.

Referenced by XrdSecsssEnt(), and RR_Data().

◆ tLen

int XrdSecsssEnt::tLen

Definition at line 48 of file XrdSecsssEnt.hh.

Referenced by XrdSecsssEnt(), and RR_Data().

◆ v2Client

const int XrdSecsssEnt::v2Client = 0x00000003
static

Data for a v2 client wanted.

Definition at line 79 of file XrdSecsssEnt.hh.

Referenced by RR_Data().


The documentation for this class was generated from the following files: