XRootD
Loading...
Searching...
No Matches
XrdMonitor.hh
Go to the documentation of this file.
1#ifndef __XRDMONITOR__
2#define __XRDMONITOR__
3/******************************************************************************/
4/* */
5/* X r d M o n i t o r . h h */
6/* */
7/* (c) 2024 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/******************************************************************************/
31
32#include <map>
33#include <cstring>
34#include <vector>
35
36#include "Xrd/XrdMonRoll.hh"
37
39{
40public:
41
42// Format Options:
43//
44enum Mopts {F_JSON = 0x10000000, X_PLUG = 0x00000001, X_ADON = 0x00000002};
45
46int Format(char* buff, int bsize, int& item, int opts=0);
47
48int Format(char* buff, int bsize, const char* setName, int opts=0);
49
50bool Register(XrdMonRoll::rollType setType, const char* setName,
51 XrdMonRoll::Item itemVec[], int itemCnt);
52
53bool Registered() {return !regVec.empty();}
54
57
58private:
59
60using MRIFam = XrdMonRoll::Item::Family;
61using MRISch = XrdMonRoll::Item::Schema;
62using MRITrt = XrdMonRoll::Item::Trait;
63
64enum sType {isAdon=0x00000001, isPlug=0x00000002};
65
66struct RegInfo
67 {char* typName;
68 char* setName;
69 char* Json_hdr = 0;
70 char* Xml_hdr = 0;
71 char* eTmplt;
72 sType setType;
73 int iCount = 0;
74 XrdMonRoll::Item* iVec = 0;
75
76 RegInfo(const char* sName, const char* tName, sType sTVal);
77
78 ~RegInfo();
79 };
80
81std::vector<RegInfo*> regVec;
82
83RegInfo* FindSet(const char* setName, int sType);
84int FormJSON(RegInfo& regInfo, char* buff, int bsize);
85int FormXML( RegInfo& regInfo, char* buff, int bsize);
86bool RegFail(const char* TName, const char* SName, const char* why);
87int V2S(RegInfo& rI, XrdMonRoll::Item& iR, char* buff, int blen);
88int V2T(RegInfo& rI, XrdMonRoll::Item& iR, char* buff, int blen, bool ij);
89void ValEnd(bool& isBad, XrdMonitor::RegInfo& rI, const char* aoT,
90 const char* begKey, XrdMonRoll::Item* endP);
91bool ValErr(RegInfo& regInfo, int iNum, const char* etxt);
92void ValKey(bool& isBad, RegInfo& rI, XrdMonRoll::Item* itemP);
93bool Validate(RegInfo& regInfo);
94};
95#endif
struct myOpts opts
bool Register(XrdMonRoll::rollType setType, const char *setName, XrdMonRoll::Item itemVec[], int itemCnt)
int Format(char *buff, int bsize, int &item, int opts=0)
bool Registered()
Definition XrdMonitor.hh:53