XRootD
XrdXrootdConfigMon.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d X r o o t d M o n C o n f . h h */
4 /* */
5 /* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* All Rights Reserved */
7 /* Produced by Andrew Hanushevsky for Stanford University under contract */
8 /* DE-AC02-76-SFO0515 with the Department of Energy */
9 /* */
10 /* This file is part of the XRootD software suite. */
11 /* */
12 /* XRootD is free software: you can redistribute it and/or modify it under */
13 /* the terms of the GNU Lesser General Public License as published by the */
14 /* Free Software Foundation, either version 3 of the License, or (at your */
15 /* option) any later version. */
16 /* */
17 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20 /* License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25 /* */
26 /* The copyright holder's institutional names and contributor's names may not */
27 /* be used to endorse or promote products derived from this software without */
28 /* specific prior written permission of the institution or contributor. */
29 /******************************************************************************/
30 
31 #include <limits>
32 #include <cstdio>
33 #include <cstring>
34 #include <strings.h>
35 
36 #include "XrdNet/XrdNetAddr.hh"
37 
38 #include "XrdOuc/XrdOuca2x.hh"
39 #include "XrdOuc/XrdOucEnv.hh"
40 #include "XrdOuc/XrdOucStream.hh"
41 
46 
47 /******************************************************************************/
48 /* L o c a l S t a t i c s */
49 /******************************************************************************/
50 
51 namespace
52 {
53 struct MonParms
54  {char *monDest[2];
55  int monMode[2];
56  int monFlash;
57  int monFlush;
58  int monGBval;
59  int monMBval;
60  int monRBval;
61  int monWWval;
62  int monFbsz;
63  int monIdent;
64  int monRnums;
65  int monFSint;
66  int monFSopt;
67  int monFSion;
68 
69  void Exported() {monDest[0] = monDest[1] = 0;}
70 
71  MonParms() : monDest{0,0}, monMode{0,0}, monFlash(0), monFlush(0),
72  monGBval(0), monMBval(0), monRBval(0), monWWval(0),
73  monFbsz(0), monIdent(3600),monRnums(0),
74  monFSint(0), monFSopt(0), monFSion(0) {}
75  ~MonParms() {if (monDest[0]) free(monDest[0]);
76  if (monDest[1]) free(monDest[1]);
77  }
78 };
79 
80 MonParms *MP = 0;
81 
82 struct XrdXrootdGSReal::GSParms gsObj[] =
83  {{"ccm", 0, XROOTD_MON_CCM, 0, -1, XROOTD_MON_GSCCM, 0,
85  {"oss", 0, XROOTD_MON_OSS, 0, -1, XROOTD_MON_GSOSS, 0,
87  {"http", 0, XROOTD_MON_HTTP, 0, -1, XROOTD_MON_GSHTP, 0,
89  {"pfc", 0, XROOTD_MON_PFC, 0, -1, XROOTD_MON_GSPFC, 0,
91  {"TcpMon", 0, XROOTD_MON_TCPMO, 0, -1, XROOTD_MON_GSTCP, 0,
93  {"Throttle", 0, XROOTD_MON_THROT, 0, -1, XROOTD_MON_GSTHR, 0,
95  {"Tpc", 0, XROOTD_MON_TPC, 0, -1, XROOTD_MON_GSTPC, 0,
97  };
98 }
99 
100 /******************************************************************************/
101 /* C o n f i g G S t r e a m */
102 /******************************************************************************/
103 
104 bool XrdXrootdProtocol::ConfigGStream(XrdOucEnv &myEnv, XrdOucEnv *urEnv)
105 {
106  XrdXrootdGStream *gs;
107  static const int numgs=sizeof(gsObj)/sizeof(struct XrdXrootdGSReal::GSParms);
108  char vbuff[64];
109  bool aOK, gXrd[numgs] = {false, false, true, false, true, false, true};
110 
111 // For each enabled monitoring provider, allocate a g-stream and put
112 // its address in our environment.
113 //
114  for (int i = 0; i < numgs; i++)
115  {if (gsObj[i].dest || XrdXrootdMonitor::ModeEnabled(gsObj[i].Mode))
116  {if (MP && gsObj[i].maxL <= 0) gsObj[i].maxL = MP->monGBval;
117  gs = new XrdXrootdGSReal(gsObj[i], aOK);
118  if (!aOK) return false;
119  snprintf(vbuff, sizeof(vbuff), "%s.gStream*", gsObj[i].pin);
120  if (!gXrd[i]) myEnv.PutPtr(vbuff, (void *)gs);
121  else if (urEnv) urEnv->PutPtr(vbuff, (void *)gs);
122  }
123  }
124 
125 // Configure the TPC monitor if we have a gStream for it
126 //
127  if (urEnv && (gs = (XrdXrootdGStream*)urEnv->GetPtr("Tpc.gStream*")))
128  {XrdXrootdTpcMon* tpcMon = new XrdXrootdTpcMon("xroot",eDest.logger(),*gs);
129  myEnv.PutPtr("TpcMonitor*", (void*)tpcMon);
130  }
131 
132 // All done
133 //
134  return true;
135 }
136 
137 /******************************************************************************/
138 /* C o n f i g M o n */
139 /******************************************************************************/
140 
141 bool XrdXrootdProtocol::ConfigMon(XrdProtocol_Config *pi, XrdOucEnv &xrootdEnv)
142 {
143  int i, numgs = sizeof(gsObj)/sizeof(struct XrdXrootdGSReal::GSParms);
144 
145 // Check if anything was configured.
146 //
147  for (i = 0; i < numgs && !gsObj[i].dest; i++);
148  if (i < numgs && !MP) MP = new MonParms;
149  else if (!MP) return true;
150 
151 // Set monitor defaults, this has to be done first
152 //
153  XrdXrootdMonitor::Defaults(MP->monMBval, MP->monRBval, MP->monWWval,
154  MP->monFlush, MP->monFlash, MP->monIdent,
155  MP->monRnums, MP->monFbsz,
156  MP->monFSint, MP->monFSopt, MP->monFSion);
157 
158 // Complete destination dependent setup
159 //
160  XrdXrootdMonitor::Defaults(MP->monDest[0], MP->monMode[0],
161  MP->monDest[1], MP->monMode[1]);
162 
163 // Initialize monitoring enough to construct gStream objects.
164 //
166 
167 // Config g-stream objects, as needed. This needs to be done before we
168 // load any plugins but after we initialize phase 1 monitoring.
169 //
170  ConfigGStream(xrootdEnv, pi->theEnv);
171 
172 // Enable monitoring (it won't do anything if it wasn't enabled)
173 //
174  if (!XrdXrootdMonitor::Init()) return false;
175 
176 // Cleanup
177 //
178  if (MP->monDest[0]) MP->Exported();
179  delete MP;
180 
181 // All done
182 //
183  return true;
184 }
185 
186 /******************************************************************************/
187 /* x m o n */
188 /******************************************************************************/
189 
190 /* Function: xmon
191 
192  Purpose: Parse directive: monitor [...] [all] [auth] [flush [io] <sec>]
193  [fstat <sec> [lfn] [ops] [ssq] [xfr <n>]
194  [{fbuff | fbsz} <sz>] [gbuff <sz>]
195  [ident {<sec>|off}] [mbuff <sz>]
196  [rbuff <sz>] [rnums <cnt>] [window <sec>]
197  [dest [Events] <host:port>]
198 
199  Events: [ccm] [files] [fstat] [info] [io] [iov] [pfc] [redir] [tcpmon] [throttle] [user]
200 
201  all enables monitoring for all connections.
202  auth add authentication information to "user".
203  flush [io] <sec> time (seconds, M, H) between auto flushes. When
204  io is given applies only to i/o events.
205  fstat <sec> produces an "f" stream for open & close events
206  <sec> specifies the flush interval (also see xfr)
207  lfn - adds lfn to the open event
208  ops - adds the ops record when the file is closed
209  ssq - computes the sum of squares for the ops rec
210  xfr <n>- inserts i/o stats for open files every
211  <sec>*<n>. Minimum is 1.
212  fbsz <sz> size of message buffer for file stream monitoring.
213  gbuff <sz> size of message buffer for g-stream monitoring.
214  ident {<sec>|off} time (seconds, M, H) between identification records.
215  The keyword "off" turns them off.
216  mbuff <sz> size of message buffer for event trace monitoring.
217  rbuff <sz> size of message buffer for redirection monitoring.
218  rnums <cnt> bumber of redirections monitoring streams.
219  window <sec> time (seconds, M, H) between timing marks.
220  dest specified routing information. Up to two dests
221  may be specified.
222  ccm monitor cache context management
223  files only monitors file open/close events.
224  fstats vectors the "f" stream to the destination
225  info monitors client appid and info requests.
226  io monitors I/O requests, and files open/close events.
227  iov like I/O but also unwinds vector reads.
228  pfc monitor proxy file cache
229  redir monitors request redirections
230  tcpmon monitors tcp connection closes.
231  throttle monitors I/O activity via the throttle plugin
232  tpc Third Party Copy
233  user monitors user login and disconnect events.
234  <host:port> where monitor records are to be sentvia UDP.
235 
236  Output: 0 upon success or !0 upon failure. Ignored by master.
237 */
238 
239 int XrdXrootdProtocol::xmon(XrdOucStream &Config)
240 {
241  char *val = 0;
242  long long tempval;
243  int i, xmode=0, *flushDest;
244  bool haveWord = true;
245 
246 // Check if this is a continuation
247 //
248  if ((val = Config.GetWord()) && !strcmp("...", val)) val = Config.GetWord();
249  else if (MP) {delete MP; MP = 0;}
250 
251 // Allocate a new parameter block if we don't have one
252 //
253  if (!MP) MP = new MonParms;
254 
255 // Make sure we have at least one option here
256 //
257  if (!val)
258  {eDest.Emsg("Config", "no monitor parameters specified");
259  return 1;
260  }
261 
262 // Process all the options
263 //
264  while(haveWord || (val = Config.GetWord()))
265  {haveWord = false;
266  if (!strcmp("all", val)) xmode = XROOTD_MON_ALL;
267  else if (!strcmp("auth", val))
268  MP->monMode[0] = MP->monMode[1] = XROOTD_MON_AUTH;
269  else if (!strcmp("flush", val))
270  {if ((val = Config.GetWord()) && !strcmp("io", val))
271  { flushDest = &MP->monFlash; val = Config.GetWord();}
272  else flushDest = &MP->monFlush;
273  if (!val)
274  {eDest.Emsg("Config", "monitor flush value not specified");
275  return 1;
276  }
277  if (XrdOuca2x::a2tm(eDest,"monitor flush",val,
278  flushDest,1)) return 1;
279  }
280  else if (!strcmp("fstat",val))
281  {if (!(val = Config.GetWord()))
282  {eDest.Emsg("Config", "monitor fstat value not specified");
283  return 1;
284  }
285  if (XrdOuca2x::a2tm(eDest,"monitor fstat",val,
286  &MP->monFSint,0)) return 1;
287  while((val = Config.GetWord()))
288  if (!strcmp("lfn", val)) MP->monFSopt |= XROOTD_MON_FSLFN;
289  else if (!strcmp("ops", val)) MP->monFSopt |= XROOTD_MON_FSOPS;
290  else if (!strcmp("ssq", val)) MP->monFSopt |= XROOTD_MON_FSSSQ;
291  else if (!strcmp("xfr", val))
292  {if (!(val = Config.GetWord()))
293  {eDest.Emsg("Config", "monitor fstat xfr count not specified");
294  return 1;
295  }
296  if (XrdOuca2x::a2i(eDest,"monitor fstat io count",
297  val, &MP->monFSion,1)) return 1;
298  MP->monFSopt |= XROOTD_MON_FSXFR;
299  }
300  else {haveWord = true; break;}
301  }
302  else if (!strcmp("mbuff", val) || !strcmp("rbuff", val) ||
303  !strcmp("gbuff", val) || !strcmp("fbuff", val) ||
304  !strcmp("fbsz", val))
305  {char bName[16], bType = *val;
306  snprintf(bName,sizeof(bName),"monitor %s",val);
307  if (!(val = Config.GetWord()))
308  {eDest.Emsg("Config", "value not specified"); return 1;}
309  if (XrdOuca2x::a2sz(eDest,bName,val,&tempval,1024,65535))
310  return 1;
311  int bVal = static_cast<int>(tempval);
312  switch(bType)
313  {case 'f': MP->monFbsz = bVal; break;
314  case 'g': MP->monGBval = bVal; break;
315  case 'm': MP->monMBval = bVal; break;
316  case 'r': MP->monRBval = bVal; break;
317  default: break;
318  }
319  }
320  else if (!strcmp("ident", val))
321  {if (!(val = Config.GetWord()))
322  {eDest.Emsg("Config", "monitor ident value not specified");
323  return 1;
324  }
325  if (!strcmp("off", val)) MP->monIdent = -1;
326  else if (XrdOuca2x::a2tm(eDest,"monitor ident",val,
327  &MP->monIdent,0)) return 1;
328  }
329  else if (!strcmp("rnums", val))
330  {if (!(val = Config.GetWord()))
331  {eDest.Emsg("Config", "monitor rnums value not specified");
332  return 1;
333  }
334  if (XrdOuca2x::a2i(eDest,"monitor rnums",val, &MP->monRnums,1,
335  XrdXrootdMonitor::rdrMax)) return 1;
336  }
337  else if (!strcmp("window", val))
338  {if (!(val = Config.GetWord()))
339  {eDest.Emsg("Config", "monitor window value not specified");
340  return 1;
341  }
342  if (XrdOuca2x::a2tm(eDest,"monitor window",val,
343  &MP->monWWval,1)) return 1;
344  }
345  else break;
346  }
347 
348  if (!val) return 0;
349 
350  for (i = 0; i < 2; i++)
351  {if (strcmp("dest", val)) break;
352  while((val = Config.GetWord()))
353  if (!strcmp("ccm", val)) MP->monMode[i] |= XROOTD_MON_CCM;
354  else if (!strcmp("files",val)) MP->monMode[i] |= XROOTD_MON_FILE;
355  else if (!strcmp("fstat",val)) MP->monMode[i] |= XROOTD_MON_FSTA;
356  else if (!strcmp("http", val)) MP->monMode[i] |= XROOTD_MON_HTTP;
357  else if (!strcmp("info", val)) MP->monMode[i] |= XROOTD_MON_INFO;
358  else if (!strcmp("io", val)) MP->monMode[i] |= XROOTD_MON_IO;
359  else if (!strcmp("iov", val)) MP->monMode[i] |= (XROOTD_MON_IO
360  |XROOTD_MON_IOV);
361  else if (!strcmp("pfc", val)) MP->monMode[i] |= XROOTD_MON_PFC;
362  else if (!strcmp("redir", val)) MP->monMode[i] |= XROOTD_MON_REDR;
363  else if (!strcmp("tcpmon", val)) MP->monMode[i] |= XROOTD_MON_TCPMO;
364  else if (!strcmp("throttle", val)) MP->monMode[i] |= XROOTD_MON_THROT;
365  else if (!strcmp("tpc", val)) MP->monMode[i] |= XROOTD_MON_TPC;
366  else if (!strcmp("user", val)) MP->monMode[i] |= XROOTD_MON_USER;
367  else break;
368 
369  if (!val) {eDest.Emsg("Config","monitor dest value not specified");
370  return 1;
371  }
372  if (MP->monDest[i]) free(MP->monDest[i]);
373  if (!(MP->monDest[i] = xmondest("monitor dest", val))) return 1;
374  if (!(val = Config.GetWord())) break;
375  }
376 
377  if (val)
378  {if (!strcmp("dest", val))
379  eDest.Emsg("Config", "Warning, a maximum of two dest values allowed.");
380  else eDest.Emsg("Config", "Warning, invalid monitor option", val);
381  }
382 
383 // Make sure dests differ
384 //
385  if (MP->monDest[0] && MP->monDest[1]
386  && !strcmp(MP->monDest[0], MP->monDest[1]))
387  {eDest.Emsg("Config", "Warning, monitor dests are identical.");
388  MP->monMode[0] |= MP->monMode[1]; MP->monMode[1] = 0;
389  free(MP->monDest[1]); MP->monDest[1] = 0;
390  }
391 
392 // Add files option if I/O is enabled
393 //
394  if (MP->monMode[0] & XROOTD_MON_IO) MP->monMode[0] |= XROOTD_MON_FILE;
395  if (MP->monMode[1] & XROOTD_MON_IO) MP->monMode[1] |= XROOTD_MON_FILE;
396 
397 // If ssq was specified, make sure we support IEEE754 floating point
398 //
399 #if !defined(__solaris__) || !defined(_IEEE_754)
400  if (MP->monFSopt & XROOTD_MON_FSSSQ && !(std::numeric_limits<double>::is_iec559))
401  {MP->monFSopt &= ~XROOTD_MON_FSSSQ;
402  eDest.Emsg("Config","Warning, 'fstat ssq' ignored; platform does not "
403  "use IEEE754 floating point.");
404  }
405 #endif
406 
407 // The caller may have deferred setting destinations. If so, don't upset what
408 // if currently set.
409 //
410  if (MP->monDest[0])
411  MP->monMode[0] |= (MP->monMode[0] ? xmode : XROOTD_MON_FILE|xmode);
412  if (MP->monDest[1])
413  MP->monMode[1] |= (MP->monMode[1] ? xmode : XROOTD_MON_FILE|xmode);
414 // All done
415 //
416  return 0;
417 }
418 
419 /******************************************************************************/
420 /* x m o n d e s t */
421 /******************************************************************************/
422 
423 char *XrdXrootdProtocol::xmondest(const char *what, char *val)
424 {
425  XrdNetAddr netdest;
426  const char *eText;
427  char netBuff[288];
428 
429 // Parse the host:port spec
430 //
431  if ((eText = netdest.Set(val)))
432  {eDest.Emsg("Config", what, "endpoint is invalid;", eText);
433  return 0;
434  }
435 
436 // Reformat it to get full host name
437 //
438  if (!netdest.Format(netBuff, sizeof(netBuff), XrdNetAddrInfo::fmtName))
439  {eDest.Emsg("Config", what, "endpoint is unreachable");
440  return 0;
441  }
442 
443 // Return a copy
444 //
445  return strdup(netBuff);
446 }
447 
448 /******************************************************************************/
449 /* x m o n g s */
450 /******************************************************************************/
451 
452 /* Function: xmongs
453 
454  Purpose: Parse directive: mongstream <strm> use <opts>
455 
456  <strm>: {all | ccm | http | oss | pfc | tcpmon | tpc} [<strm>]
457 
458  <opts>: [flust <t>] [maxlen <l>] [send <fmt> [noident] <host:port>]
459 
460  <fmt> {cgi | json} <hdr> | nohdr
461 
462  <hdr> dflthdr | sitehdr | hosthdr | insthdr | fullhdr
463 
464  all applies options to all gstreams.
465  ccm gstream: cache context management
466  http gstream: HTTP requests
467  pfc gstream: proxy file cache
468  tcpmon gstream: tcp connection monitoring
469  throttle gstream: monitors I/O activity via the throttle plugin
470  tpc gstream: Third Party Copy
471 
472  noXXX do not include information.
473 
474  Output: 0 upon success or !0 upon failure. Ignored by master.
475 */
476 
477 int XrdXrootdProtocol::xmongs(XrdOucStream &Config)
478 {
479  static const int isFlush = 0;
480  static const int isMaxL = 1;
481  static const int isSend = 2;
482 
483  struct gsOpts {const char *opname; int opwhat;} gsopts[] =
484  {{"flush", isFlush},
485  {"maxlen", isMaxL},
486  {"send", isSend}
487  };
488  int numopts = sizeof(gsopts)/sizeof(struct gsOpts);
489 
490  int numgs = sizeof(gsObj)/sizeof(struct XrdXrootdGSReal::GSParms);
493  int i, selMon = 0, opt = -1, hdr = -1, fmt = -1, flushVal = -1;
494  long long maxlVal = -1;
495  char *val, *dest = 0;
496 
497 // Make sure we have something here
498 //
499  if (!(val = Config.GetWord()))
500  {eDest.Emsg("config", "gstream parameters not specified"); return 1;}
501 
502 // First tokens are the list of streams, at least one must be specified
503 //
504 do {if (!strcmp("all", val)) selMon = selAll;
505  else {for (i = 0; i < numgs; i++)
506  {if (!strcasecmp(val, gsObj[i].pin))
507  {selMon |= gsObj[i].Mode; break;}
508  }
509  if (i >= numgs) break;
510  }
511  } while((val = Config.GetWord()));
512 
513  if (!selMon)
514  {eDest.Emsg("config", "gstream name not specified"); return 1;}
515 
516 // The next token needs to be 'using' if there is is one.
517 //
518  if (val)
519  {if (strcmp(val, "use"))
520  {eDest.Emsg("config","mongstream expected 'use' not",val); return 1;}
521  if (!(val = Config.GetWord()))
522  {eDest.Emsg("config","gstream parameters not specified after 'use'");
523  return 1;
524  }
525  } else {
526  eDest.Emsg("config","mongstream expected 'use' verb not found");
527  return 1;
528  }
529 
530 // Process all the parameters now
531 //
532 do{for (i = 0; i < numopts; i++)
533  {if (!strcmp(val, gsopts[i].opname))
534  {if (!(val = Config.GetWord()))
535  {eDest.Emsg("Config", "gstream", gsopts[i].opname,
536  "value not specified");
537  return 1;
538  }
539  break;
540  }
541  }
542 
543 // Check if we actually found a keyword
544 //
545  if (i >= numopts)
546  {eDest.Emsg("config", "invalid gstream parameter", val);
547  return 1;
548  }
549 
550 // Handle each specific one
551 //
552  switch(gsopts[i].opwhat)
553  {case isFlush:
554  if (XrdOuca2x::a2tm(eDest, "gstream flush", val, &flushVal, 0))
555  return 1;
556  break;
557  case isMaxL:
558  if (XrdOuca2x::a2sz(eDest, "gstream maxlen",
559  val, &maxlVal, 1024, 65535)) return 1;
560  break;
561  case isSend:
562  if (dest) free(dest);
563  if (!xmongsend(Config, val, dest, opt, fmt, hdr)) return 1;
564  break;
565  default: break;
566  }
567 
568  } while((val = Config.GetWord()));
569 
570 // Set the values
571 //
572  for (i = 0; i < numgs; i++)
573  {if (gsObj[i].Mode & selMon)
574  {if (dest)
575  {if (gsObj[i].dest) free((void *)gsObj[i].dest);
576  gsObj[i].dest = dest;
577  }
578  if (flushVal >= 0) gsObj[i].flsT = flushVal;
579  if (maxlVal >= 0) gsObj[i].maxL = maxlVal;
580  if (opt >= 0) gsObj[i].Opt = opt;
581  if (fmt >= 0) gsObj[i].Fmt = fmt;
582  if (hdr >= 0) gsObj[i].Hdr = hdr;
583  }
584  }
585 
586  return 0;
587 }
588 
589 /******************************************************************************/
590 /* m o n g s e n d */
591 /******************************************************************************/
592 
593 bool XrdXrootdProtocol::xmongsend(XrdOucStream &Config, char *val, char *&dest,
594  int &opt, int &fmt, int &hdr)
595 {
596  struct gsFmts {const char *opname; int opval;} gsfmt[] =
597  {
598  {"cgi", XrdXrootdGSReal::fmtCgi},
599  {"json", XrdXrootdGSReal::fmtJson},
600  {"nohdr", XrdXrootdGSReal::fmtNone}
601  };
602  int numfmts = sizeof(gsfmt)/sizeof(struct gsFmts);
603 
604  struct gsHdrs {const char *opname; int opval;} gshdr[] =
605  {
606  {"dflthdr", XrdXrootdGSReal::hdrNorm},
607  {"sitehdr", XrdXrootdGSReal::hdrSite},
608  {"hosthdr", XrdXrootdGSReal::hdrHost},
609  {"insthdr", XrdXrootdGSReal::hdrInst},
610  {"fullhdr", XrdXrootdGSReal::hdrFull}
611  };
612  int numhdrs = sizeof(gshdr)/sizeof(struct gsHdrs);
613 
614  int i;
615 
616 // First token muxt be the format
617 //
618  for (i = 0; i < numfmts; i++)
619  if (!strcmp(val, gsfmt[i].opname))
620  {fmt = gsfmt[i].opval; break;}
621  if (i >= numfmts)
622  {eDest.Emsg("Config","gstream send format is invalid -", val);
623  return false;
624  }
625 
626 // The next one is the the optional hdr spec
627 //
628  val = Config.GetWord();
630  else if (val)
631  {for (i = 0; i < numhdrs; i++)
632  if (!strcmp(val, gshdr[i].opname))
633  {hdr = gshdr[i].opval;
634  val = Config.GetWord();
635  break;
636  }
637  }
638 
639 // The final token can be "noident"
640 //
641  if (val && !strcmp(val, "noident"))
643  val = Config.GetWord();
644  }
645 
646 // Finally, we must have the host and port
647 //
648  if (!val)
649  {eDest.Emsg("Config", "gstream send endpoint not specified");
650  return false;
651  }
652 
653 // Get the endpoint
654 //
655  dest = xmondest("gstream send", val);
656  return dest != 0;
657 }
#define XROOTD_MON_INFO
int Mode
if(Avsz)
const kXR_char XROOTD_MON_GSTPC
const kXR_char XROOTD_MON_GSTCP
const kXR_char XROOTD_MON_GSHTP
const kXR_char XROOTD_MON_GSOSS
const kXR_char XROOTD_MON_GSCCM
const kXR_char XROOTD_MON_GSTHR
const kXR_char XROOTD_MON_GSPFC
#define XROOTD_MON_IOV
#define XROOTD_MON_FSSSQ
#define XROOTD_MON_TPC
#define XROOTD_MON_ALL
#define XROOTD_MON_AUTH
#define XROOTD_MON_IO
#define XROOTD_MON_TCPMO
#define XROOTD_MON_PFC
#define XROOTD_MON_USER
#define XROOTD_MON_FSLFN
#define XROOTD_MON_OSS
#define XROOTD_MON_CCM
#define XROOTD_MON_FSTA
#define XROOTD_MON_FSOPS
#define XROOTD_MON_FSXFR
#define XROOTD_MON_THROT
#define XROOTD_MON_FILE
#define XROOTD_MON_REDR
#define XROOTD_MON_HTTP
int Format(char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0)
@ fmtName
Hostname if it is resolvable o/w use fmtAddr.
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition: XrdNetAddr.cc:216
void * GetPtr(const char *varname)
Definition: XrdOucEnv.cc:281
void PutPtr(const char *varname, void *value)
Definition: XrdOucEnv.cc:316
static int a2i(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
Definition: XrdOuca2x.cc:45
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
Definition: XrdOuca2x.cc:257
static int a2tm(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
Definition: XrdOuca2x.cc:288
const char * myName
Definition: XrdProtocol.hh:82
XrdOucEnv * theEnv
Definition: XrdProtocol.hh:66
const char * myProg
Definition: XrdProtocol.hh:83
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:116
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:175
static const int hdrNone
Format as JSON info.
const char * dest
Destination for records.
static const int hdrInst
Include site, host, port, inst.
static const int fmtBin
Do not include info.
XrdXrootdGSReal(const GSParms &gsParms, bool &aOK)
static const int fmtJson
Format as CGI info.
int maxL
Maximum packet length (default 32K)
static const int hdrSite
Include site.
const char * pin
the plugin name.
static const int hdrHost
Include site, host.
static const int optNoID
Don't send ident records.
static const int hdrNorm
Include standard header.
static const int fmtNone
static const int fmtCgi
Format as binary info.
static const int hdrFull
Include site, host, port, inst, pgm.
static const int rdrMax
static void Defaults(char *dest1, int m1, char *dest2, int m2)
static bool ModeEnabled(int mode)
static const char * myInst
static XrdSysError & eDest
static XrdScheduler * Sched
XrdCmsConfig Config
XrdXrootdTpcMon * tpcMon
Definition: XrdOfsTPC.cc:84