51 {
const char *sname = getenv(
"XRDSITE");
52 if (!sname || !(*sname)) sname =
"local";
65 const char *hName,
bool isBad)
68 const char *eTxt, *eSfx = (isBad ?
" *** Invalid ***" : 0);
69 int i, n, abLen, numIP = 0;
70 char *abP, aBuff[1024];
79 {
eDest->
Say(
"Config Manager ", hSpec,
" -> ", hName,
" ", eTxt);
82 eDest->
Say(
"Config Manager ", hSpec,
" -> ", hName, eSfx);
87 if (n+64 > (
int)
sizeof(aBuff))
return;
88 memset(aBuff,
int(
' '), n);
89 abP = aBuff+n; abLen =
sizeof(aBuff) - n;
93 for (i = 0; i < numIP; i++)
96 eDest->
Say(
"Config Manager ", aBuff);
110 XrdVersionInfo &urVer)
116 return (perfMon ? *perfMon : 0);
124 char *hSpec,
char *hPort,
int *sPort,
bool hush)
126 static const size_t maxSNLen = 63;
127 XrdOucTList *newMans, *newP, *oldP, *appList = (oldMans ? *oldMans : 0);
130 char *plus, *atsn, *iName = 0;
131 int nPort, maxIP = 1, snum = 0;
136 if (!siteList) siteList = GetLocalSite();
140 if ((atsn = index(hPort,
'@')))
141 {
if (*(atsn+1) ==
'\0')
142 {
eDest->
Emsg(
"Config",
"site name missing for", hSpec);
return 0;}
144 if (strlen(atsn) > maxSNLen)
145 {
eDest->
Emsg(
"Config",
"site name too long for", hSpec);
return 0;}
146 while(sP && strcmp(sP->
text, atsn)) sP = sP->
next;
147 if (sP) snum = sP->val;
149 siteList =
new XrdOucTList(atsn, siteIndex, siteList);
156 if ((iName = index(hPort,
'%')))
157 {
if (*(iName+1) ==
'\0')
158 {
eDest->
Emsg(
"Config",
"instance name missing for", hSpec);
return 0;}
160 const char *xName = getenv(
"XRDNAME");
161 if (!xName || strcmp(xName, iName)) sPort = 0;
166 if (!(plus = index(hSpec,
'+')) || *(plus+1) != 0) plus = 0;
167 else {*plus = 0; maxIP = 8;
169 {
eDest->
Emsg(
"Config",
"Hostname globbing is not supported "
182 {
eDest->
Emsg(
"Config",
"Unable to find tcp service",hPort,
".");
193 if (!urAddr.
Set(hSpec, 0) && myAddr.Same(&urAddr)) *sPort = nPort;
199 snprintf(buff,
sizeof(buff),
"'%s'; %c%s",hSpec,tolower(*eText),eText+1);
200 eDest->
Emsg(
"Config",
"Unable to add host", buff);
208 {
while((newP = newMans)) {newMans = newMans->
next;
delete newP;}
214 while((newP = newMans))
215 {newMans = newMans->
next;
216 newP->ival[1] = snum;
219 {
if (newP->val == oldP->val && !strcmp(newP->
text, oldP->
text))
220 {
eDest->
Say(
"Config warning: duplicate manager ",newP->
text);
227 {
if (!plus || strcmp(hSpec, newP->
text)) isBad =
false;
229 "Cyclic DNS registration for ",newP->
text,
"\n"
230 "Config warning: This cluster will exhibit "
231 "undefined behaviour!!!");
234 appList = SInsert(appList, newP);
235 if (plus && !hush) Display(
eDest, hSpec, newP->
text, isBad);
257 {
if (!(pSpec = index(hSpec,
']')))
258 {
eDest->
Emsg(
"Config",
"Invalid manager specification -",hSpec);
261 }
else pSpec = hSpec;
265 if ((pSpec = index(pSpec,
':')))
266 {
if (!(*(pSpec+1))) pSpec = 0;
267 else *pSpec++ =
'\0';
269 else if (!(pSpec = CFile.
GetWord()) || !strcmp(pSpec,
"if")) pSpec = 0;
273 if (!pSpec) {
eDest->
Emsg(
"Config",
"manager port not specified for", hSpec);
279 return strdup(pSpec);
292 while(oldP && (newP->val < oldP->val || strcmp(newP->
text, oldP->
text) < 0))
293 {preP = oldP; oldP = oldP->
next;}
297 if (preP) preP->
next = newP;
316 while(sP && snum != sP->val) sP = sP->
next;
320 return (sP ? sP->
text :
"anonymous");
static XrdSysError eDest(0,"crypto_")
static const char * SiteName(int snum)
static XrdCmsPerfMon * loadPerfMon(XrdSysError *eDest, const char *libPath, XrdVersionInfo &urVer)
Load the performance monitor plugin.
static char * ParseManPort(XrdSysError *eDest, XrdOucStream &CFile, char *hSpec)
static bool ParseMan(XrdSysError *eDest, XrdOucTList **oldMans, char *hSpec, char *hPort, int *sPort=0, bool hush=false)
static const int noPort
Do not add port number.
@ fmtAddr
Address using suitable ipv4 or ipv6 format.
const char * Set(const char *hSpec, int pNum=PortInSpec)
static const char * GetAddrs(const char *hSpec, XrdNetAddr *aListP[], int &aListN, AddrOpts opts=allIPMap, int pNum=PortInSpec)
static int ServPort(const char *sName, bool isUDP=false, const char **eText=0)
static XrdOucTList * Hosts(const char *hSpec, int hPort=-1, int hWant=8, int *sPort=0, const char **eText=0)
void * Resolve(const char *symbl, int mcnt=1)
char * GetWord(int lowcase=0)
static int a2i(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)