Skip to content

Commit

Permalink
Record the protocol being used in the monitor data.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Feb 26, 2014
1 parent 6a25b71 commit 2c01a1d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
27 changes: 18 additions & 9 deletions src/XrdXrootd/XrdXrootdMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,28 @@ void XrdXrootdMonitor::User::Enable()
/* X r d X r o o t d M o n i t o r : : U s e r : : R e g i s t e r */
/******************************************************************************/

void XrdXrootdMonitor::User::Register(const char *Uname, const char *Hname)
void XrdXrootdMonitor::User::Register(const char *Uname,
const char *Hname,
const char *Pname)
{
const char *colonP, *atP;
char uBuff[1024];
char uBuff[1024], *uBP;
int n;

// The identification always starts with the protocol being used
//
n = sprintf(uBuff, "%s/", Pname);
uBP = uBuff + n;

// 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);
n += sidSize; uBuff[n++] = '@';
strcpy(uBuff+n, Hname);
} else strcpy(uBuff, Uname);
{n = colonP - Uname + 1;
strncpy(uBP, Uname, n);
strcpy(uBP+n, sidName);
n += sidSize; *(uBP+n) = '@'; n++;
strcpy(uBP+n, Hname);
} else strcpy(uBP, Uname);

// Generate a monitor identity for this user. We do not assign a dictioary
// identifier unless this entry is reported.
Expand Down Expand Up @@ -548,8 +556,9 @@ int XrdXrootdMonitor::Init(XrdScheduler *sp, XrdSysError *errp,

// Generate our server ID
//
strcpy(iBuff, "=/");
sprintf(iPuff, "%s&ver=%s", iProg, XrdVERSION);
sName = XrdOucUtils::Ident(mySID, iBuff, sizeof(iBuff),
sName = XrdOucUtils::Ident(mySID, iBuff+2, sizeof(iBuff)-2,
iHost, iPuff, iName, Port);
cP = (char *)&mySID; *cP = 0; *(cP+1) = 0;
sidSize = strlen(sName);
Expand Down
3 changes: 2 additions & 1 deletion src/XrdXrootd/XrdXrootdMonitor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ inline kXR_unt32 MapPath(const char *Path)
*this, Path);
}

void Register(const char *Uname, const char *Hname);
void Register(const char *Uname, const char *Hname,
const char *Pname);

void Report(const char *Info)
{Did=XrdXrootdMonitor::Map(XROOTD_MON_MAPUSER,*this,Info);}
Expand Down
2 changes: 1 addition & 1 deletion src/XrdXrootd/XrdXrootdTransit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void XrdXrootdTransit::Init(XrdXrootd::Bridge::Result *respP,
// Allocate a monitoring object, if needed for this connection and record login
//
if (Monitor.Ready())
{Monitor.Register(linkP->ID, linkP->Host());
{Monitor.Register(linkP->ID, linkP->Host(), protP);
if (Monitor.Logins())
{if (Monitor.Auths() && seceP) MonAuth();
else Monitor.Report(Monitor.Auths() ? "" : 0);
Expand Down
2 changes: 1 addition & 1 deletion src/XrdXrootd/XrdXrootdXeq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ int XrdXrootdProtocol::do_Login()
// Allocate a monitoring object, if needed for this connection
//
if (Monitor.Ready())
{Monitor.Register(Link->ID, Link->Host());
{Monitor.Register(Link->ID, Link->Host(), "xrootd");
if (Monitor.Logins() && (!Monitor.Auths() || !(Status & XRD_NEED_AUTH)))
Monitor.Report(Monitor.Auths() ? "" : 0);
}
Expand Down

0 comments on commit 2c01a1d

Please sign in to comment.