Loading...
Searching...
No Matches
XrdFrmMonitor Class Reference

`#include <XrdFrmMonitor.hh>`

Collaboration diagram for XrdFrmMonitor:

## Public Member Functions

| XrdFrmMonitor ()
| ~XrdFrmMonitor ()

## Static Public Member Functions

static void | Defaults (char *dest1, int m1, char *dest2, int m2, int iTime)
static void | Ident ()
static int | Init (const char *iHost, const char *iProg, const char *iName)
static kXR_unt32 | Map (char code, const char *uname, const char *path)

## Static Public Attributes

static char | monMIGR = 0
static char | monPURGE = 0
static char | monSTAGE = 0

## Detailed Description

Definition at line 47 of file XrdFrmMonitor.hh.

## Constructor & Destructor Documentation

## XrdFrmMonitor()

XrdFrmMonitor::XrdFrmMonitor | ( |  | ) |

## ~XrdFrmMonitor()

XrdFrmMonitor::~XrdFrmMonitor | ( |  | ) |

## Member Function Documentation

## Defaults()

void XrdFrmMonitor::Defaults | ( | char * | dest1,
|  | int | m1,
|  | char * | dest2,
|  | int | m2,
|  | int | iTime )

static

Definition at line 84 of file XrdFrmMonitor.cc.

{
// Make sure if we have a proper destinations and modes
//
if (dest1 && !mode1) {free(dest1); dest1 = 0; mode1 = 0;}
if (dest2 && !mode2) {free(dest2); dest2 = 0; mode2 = 0;}
// Propogate the destinations
//
if (!dest1)
{mode1 = (dest1 = dest2) ? mode2 : 0;
dest2 = 0; mode2 = 0;
}
// Set the default destinations (caller supplied strdup'd strings)
//
if (Dest1) free(Dest1);
Dest1 = dest1; monMode1 = mode1;
if (Dest2) free(Dest2);
Dest2 = dest2; monMode2 = mode2;
// Set overall monitor mode
//
monMIGR = ((mode1 | mode2) & XROOTD_MON_MIGR ? 1 : 0);
monPURGE = ((mode1 | mode2) & XROOTD_MON_PURGE ? 1 : 0);
monSTAGE = ((mode1 | mode2) & XROOTD_MON_STAGE ? 1 : 0);
// Do final check
//
isEnabled = (Dest1 == 0 && Dest2 == 0 ? 0 : 1);
idTime = iTime;
}
XROOTD_MON_PURGE
#define XROOTD_MON_PURGE
Definition XrdFrmMonitor.hh:43
XROOTD_MON_MIGR
#define XROOTD_MON_MIGR
Definition XrdFrmMonitor.hh:42
XROOTD_MON_STAGE
#define XROOTD_MON_STAGE
Definition XrdFrmMonitor.hh:41
XrdFrmMonitor::monPURGE
static char monPURGE
Definition XrdFrmMonitor.hh:62
XrdFrmMonitor::monMIGR
static char monMIGR
Definition XrdFrmMonitor.hh:61
XrdFrmMonitor::monSTAGE
static char monSTAGE
Definition XrdFrmMonitor.hh:63

References monMIGR, monPURGE, monSTAGE, XROOTD_MON_MIGR, XROOTD_MON_PURGE, and XROOTD_MON_STAGE.

## Ident()

void XrdFrmMonitor::Ident | ( |  | ) |

static

Definition at line 123 of file XrdFrmMonitor.cc.

{
do{Send(-1, idRec, idLen);
XrdSysTimer::Snooze(idTime);
} while(1);
}
XrdSysTimer::Snooze
static void Snooze(int seconds)
Definition XrdSysTimer.cc:168

References XrdSysTimer::Snooze().

Referenced by XrdFrmMonitorID().

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

## Init()

int XrdFrmMonitor::Init | ( | const char * | iHost,
|  | const char * | iProg,
|  | const char * | iName )

static

Definition at line 134 of file XrdFrmMonitor.cc.

{
XrdXrootdMonMap *mP;
long long mySid;
const char *etext = 0;
char iBuff[1024];
bool aOK;
// Generate our server ID
//
sidName = XrdOucUtils::Ident(mySid, iBuff, sizeof(iBuff), iHost, iProg,
(iName ? iName : "anon"), 0);
sidSize = strlen(sidName);
startTime = htonl(time(0));
// There is nothing to do unless we have been enabled via Defaults()
//
if (!isEnabled) return 1;
// Ignore array bounds warning from gcc 12 triggered because the allocated
// memory for the XrdXrootdMonMap is smaller than sizeof(XrdXrootdMonMap)
#if defined(__GNUC__) && __GNUC__ >= 12
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
// Create identification record
//
idLen = strlen(iBuff) + sizeof(XrdXrootdMonHeader) + sizeof(kXR_int32);
idRec = (char *)malloc(idLen+1);
mP = (XrdXrootdMonMap *)idRec;
fillHeader(&(mP->hdr), XROOTD_MON_MAPIDNT, idLen);
mP->hdr.pseq = 0;
mP->dictid = 0;
strcpy(mP->info, iBuff);
#if defined(__GNUC__) && __GNUC__ >= 12
#pragma GCC diagnostic pop
#endif
// Setup the primary destination
//
InetDest1 = new XrdNetMsg(&Say, Dest1, &aOK, true);
if (!aOK)
{Say.Emsg("Monitor", "setup monitor collector;", etext);
return 0;
}
// Do the same for the secondary destination
//
if (Dest2)
{InetDest2 = new XrdNetMsg(&Say, Dest2, &aOK, true);
if (!aOK)
{Say.Emsg("Monitor", "setup monitor collector;", etext);
return 0;
}
}
// Check if we will be producing identification records
//
if (idTime)
{pthread_t tid;
int retc;
if ((retc = XrdSysThread::Run(&tid,XrdFrmMonitorID,0,0,"mon ident")))
{Say.Emsg("Init", retc, "create monitor ident thread"); return 0;}
}
// All done
//
return 1;
}
kXR_int32
int kXR_int32
Definition XPtypes.hh:89
Say
XrdOucPup XrdCmsParser::Pup & Say
Definition XrdCmsParser.cc:124
XrdFrmMonitorID
void * XrdFrmMonitorID(void *parg)
Definition XrdFrmMonitor.cc:73
XrdXrootdMonMap::dictid
kXR_unt32 dictid
Definition XrdXrootdMonData.hh:89
XROOTD_MON_MAPIDNT
const kXR_char XROOTD_MON_MAPIDNT
Definition XrdXrootdMonData.hh:103
XrdXrootdMonMap::info
char info[1024+256]
Definition XrdXrootdMonData.hh:90
XrdXrootdMonHeader::pseq
kXR_char pseq
Definition XrdXrootdMonData.hh:41
XrdXrootdMonMap::hdr
XrdXrootdMonHeader hdr
Definition XrdXrootdMonData.hh:88
XrdOucUtils::Ident
static char * Ident(long long &mySID, char *iBuff, int iBlen, const char *iHost, const char *iProg, const char *iName, int Port)
Definition XrdOucUtils.cc:779
XrdSysThread::Run
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
Definition XrdSysPthread.cc:307

References XrdXrootdMonMap::dictid, XrdXrootdMonMap::hdr, XrdOucUtils::Ident(), XrdXrootdMonMap::info, XrdXrootdMonHeader::pseq, XrdSysThread::Run(), Say, XrdFrmMonitorID(), and XROOTD_MON_MAPIDNT.

Here is the call graph for this function:

## Map()

kXR_unt32 XrdFrmMonitor::Map | ( | char | code,
|  | const char * | uname,
|  | const char * | path )

static

Definition at line 208 of file XrdFrmMonitor.cc.

{
XrdXrootdMonMap map;
const char *colonP, *atP;
char uBuff[1024];
int size, montype;
// Decode the user name as a.b:c@d
//
if ((colonP = index(uname, ':')) && (atP = index(colonP+1, '@')))
{int n = colonP - uname + 1;
strncpy(uBuff, uname, n);
strcpy(uBuff+n, sidName);
strcpy(uBuff+n+sidSize, atP);
} else strcpy(uBuff, uname);
// Copy in the username and path the dictid is always zero for us.
//
map.dictid = 0;
strcpy(map.info, uBuff);
size = strlen(uBuff);
if (path)
{*(map.info+size) = '\n';
strlcpy(map.info+size+1, path, sizeof(map.info)-size-1);
size = size + strlen(path) + 1;
}
// Route the packet to all destinations that need them
//
if (code == XROOTD_MON_MAPSTAG){montype = XROOTD_MON_STAGE;
code = XROOTD_MON_MAPXFER;
}
else if (code == XROOTD_MON_MAPMIGR){montype = XROOTD_MON_MIGR;
code = XROOTD_MON_MAPXFER;
}
else if (code == XROOTD_MON_MAPPURG) montype = XROOTD_MON_PURGE;
else montype = XROOTD_MON_INFO;
// Fill in the header and route the packet
//
size = sizeof(XrdXrootdMonHeader)+sizeof(kXR_int32)+size;
fillHeader(&map.hdr, code, size);
// std::cerr <<"Mon send "<<code <<": " <<map.info <<std::endl;
Send(montype, (void *)&map, size);
// Return the dictionary id
//
return map.dictid;
}
XROOTD_MON_INFO
#define XROOTD_MON_INFO
Definition XrdFrmMonitor.hh:40
strlcpy
size_t strlcpy(char *dst, const char *src, size_t sz)
Definition XrdSysPlatform.cc:60
XROOTD_MON_MAPXFER
const kXR_char XROOTD_MON_MAPXFER
Definition XrdXrootdMonData.hh:116
XROOTD_MON_MAPMIGR
const kXR_char XROOTD_MON_MAPMIGR
Definition XrdXrootdMonData.hh:108
XROOTD_MON_MAPSTAG
const kXR_char XROOTD_MON_MAPSTAG
Definition XrdXrootdMonData.hh:111
XROOTD_MON_MAPPURG
const kXR_char XROOTD_MON_MAPPURG
Definition XrdXrootdMonData.hh:109

References XrdXrootdMonMap::dictid, XrdXrootdMonMap::hdr, XrdXrootdMonMap::info, strlcpy(), XROOTD_MON_INFO, XROOTD_MON_MAPMIGR, XROOTD_MON_MAPPURG, XROOTD_MON_MAPSTAG, XROOTD_MON_MAPXFER, XROOTD_MON_MIGR, XROOTD_MON_PURGE, and XROOTD_MON_STAGE.

Here is the call graph for this function:

## Member Data Documentation

## monMIGR

char XrdFrmMonitor::monMIGR = 0

static

Definition at line 61 of file XrdFrmMonitor.hh.

Referenced by Defaults().

## monPURGE

char XrdFrmMonitor::monPURGE = 0

static

Definition at line 62 of file XrdFrmMonitor.hh.

Referenced by Defaults().

## monSTAGE

char XrdFrmMonitor::monSTAGE = 0

static

Definition at line 63 of file XrdFrmMonitor.hh.

Referenced by Defaults().

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

- XrdFrmMonitor.hh
- XrdFrmMonitor.cc