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

#include <XrdCmsManList.hh>

+ Collaboration diagram for XrdCmsManList:

Public Member Functions

 XrdCmsManList ()
 
 ~XrdCmsManList ()
 
void Add (const XrdNetAddr *netAddr, char *redList, int manport, int lvl)
 
void Del (const XrdNetAddr *refP)
 
void Del (int ref)
 
int getRef (const XrdNetAddr *refP)
 
int haveAlts ()
 
int Next (int &port, char *buff, int bsz)
 

Detailed Description

Definition at line 39 of file XrdCmsManList.hh.

Constructor & Destructor Documentation

◆ XrdCmsManList()

XrdCmsManList::XrdCmsManList ( )
inline

Definition at line 67 of file XrdCmsManList.hh.

67{allMans = nextMan = 0;}

◆ ~XrdCmsManList()

XrdCmsManList::~XrdCmsManList ( )

Definition at line 66 of file XrdCmsManList.cc.

67{
68 XrdCmsManRef *prp, *mrp = allMans;
69
70 while(mrp) {prp = mrp; mrp = mrp->Next; delete prp;}
71}
XrdCmsManRef * Next

References XrdCmsManRef::Next.

Member Function Documentation

◆ Add()

void XrdCmsManList::Add ( const XrdNetAddr netAddr,
char *  redList,
int  manport,
int  lvl 
)

Definition at line 78 of file XrdCmsManList.cc.

80{
81 XrdOucTokenizer hList((char *)redList);
82 char *hP;
83 int theRef;
84
85// Get the manager's reference number and if exists, delete existing entries
86//
87 if ((theRef = getRef(netAddr)) >= 0) Del(theRef);
88 else theRef = -theRef;
89
90// Add eeach redirect target in the list
91//
92 hP = hList.GetLine();
93 while((hP = hList.GetToken())) Add(theRef, hP, manPort, lvl);
94}
void Del(const XrdNetAddr *refP)
void Add(const XrdNetAddr *netAddr, char *redList, int manport, int lvl)
int getRef(const XrdNetAddr *refP)

References Add(), Del(), XrdOucTokenizer::GetLine(), getRef(), and XrdOucTokenizer::GetToken().

Referenced by Add(), and XrdCmsNode::do_Try().

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

◆ Del() [1/2]

void XrdCmsManList::Del ( const XrdNetAddr refP)
inline

Definition at line 50 of file XrdCmsManList.hh.

50{Del(getRef(refP));}

References Del(), and getRef().

Referenced by Add(), and Del().

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

◆ Del() [2/2]

void XrdCmsManList::Del ( int  ref)

Definition at line 153 of file XrdCmsManList.cc.

154{
155 XrdCmsManRef *nrp, *prp = 0, *mrp;
156
157// If mistakingly called for a newly added reference, do nothing
158//
159 if (ref < 0) return;
160
161// Start up
162//
163 mlMutex.Lock();
164 mrp = allMans;
165
166// Delete all ref entries
167//
168 while(mrp)
169 {if (mrp->ManRef == (unsigned int)ref)
170 {nrp = mrp->Next;
171 if (!prp) allMans = nrp;
172 else {prp->Next = nrp;
173 if (mrp == allMans) allMans = nrp;
174 }
175 if (mrp == nextMan) nextMan = nrp;
176 delete mrp;
177 mrp = nrp;
178 } else {prp = mrp; mrp = mrp->Next;}
179 }
180
181// All done
182//
183 mlMutex.UnLock();
184}

References XrdSysMutex::Lock(), XrdCmsManRef::Next, and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

◆ getRef()

int XrdCmsManList::getRef ( const XrdNetAddr refP)

Definition at line 190 of file XrdCmsManList.cc.

191{
192 static int refNum = 1;
193 XrdNetAddr theAddr = *netAddr;
194 XrdOucTList *tP;
195 char buff[128];
196 int theNum;
197
198// Convert address to text
199//
200 theAddr.Format(buff,sizeof(buff),XrdNetAddr::fmtAdv6,XrdNetAddr::old6Map4);
201
202// Find the entry in this list
203//
204 refMutex.Lock();
205 tP = refList;
206 while(tP && strcmp(buff, tP->text)) tP = tP->next;
207
208// If we didn't find one, add it
209//
210 if (tP) theNum = tP->val;
211 else {refList = new XrdOucTList(buff, refNum, refList);
212 theNum = -refNum++;
213 }
214
215// Return the number
216//
217 refMutex.UnLock();
218 return theNum;
219}
static const int old6Map4
Use deprecated IPV6 mapped format.
int Format(char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0)
XrdOucTList * next

References XrdNetAddrInfo::fmtAdv6, XrdNetAddrInfo::Format(), XrdSysMutex::Lock(), XrdOucTList::next, XrdNetAddrInfo::old6Map4, XrdOucTList::text, and XrdSysMutex::UnLock().

Referenced by Add(), and Del().

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

◆ haveAlts()

int XrdCmsManList::haveAlts ( )
inline

Definition at line 60 of file XrdCmsManList.hh.

60{return allMans != 0;}

◆ Next()

int XrdCmsManList::Next ( int &  port,
char *  buff,
int  bsz 
)

Definition at line 225 of file XrdCmsManList.cc.

226{
227 XrdCmsManRef *np;
228 int lvl;
229
230 mlMutex.Lock();
231 if (!(np = nextMan)) nextMan = allMans;
232 else {strlcpy(buff, np->Manager, bsz);
233 port = np->ManPort;
234 nextMan = np->Next;
235 }
236 lvl = (np ? np->ManLvl : 0);
237 mlMutex.UnLock();
238 return lvl;
239}
size_t strlcpy(char *dst, const char *src, size_t sz)

References XrdSysMutex::Lock(), XrdCmsManRef::Manager, XrdCmsManRef::ManLvl, XrdCmsManRef::ManPort, XrdCmsManRef::Next, strlcpy(), and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

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