XRootD
XrdXrootdAdmin Class Reference

#include <XrdXrootdAdmin.hh>

+ Collaboration diagram for XrdXrootdAdmin:

Public Member Functions

 XrdXrootdAdmin ()
 
 ~XrdXrootdAdmin ()
 
void Login (int socknum)
 
void * Start (XrdNetSocket *AdminSock)
 

Static Public Member Functions

static void addJob (const char *jname, XrdXrootdJob *jp)
 
static int Init (XrdSysError *erp, XrdNetSocket *asock)
 

Detailed Description

Definition at line 43 of file XrdXrootdAdmin.hh.

Constructor & Destructor Documentation

◆ XrdXrootdAdmin()

XrdXrootdAdmin::XrdXrootdAdmin ( )
inline

Definition at line 55 of file XrdXrootdAdmin.hh.

55 {}

◆ ~XrdXrootdAdmin()

XrdXrootdAdmin::~XrdXrootdAdmin ( )
inline

Definition at line 56 of file XrdXrootdAdmin.hh.

56 {}

Member Function Documentation

◆ addJob()

void XrdXrootdAdmin::addJob ( const char *  jname,
XrdXrootdJob jp 
)
static

Definition at line 79 of file XrdXrootdAdmin.cc.

80 {
81  JobTable *jTabp = new JobTable();
82 
83  jTabp->Jname = strdup(jname);
84  jTabp->Job = jp;
85  jTabp->Next = JobList;
86  JobList = jTabp;
87 }

Referenced by XrdXrootdProtocol::Configure().

+ Here is the caller graph for this function:

◆ Init()

int XrdXrootdAdmin::Init ( XrdSysError erp,
XrdNetSocket asock 
)
static

Definition at line 93 of file XrdXrootdAdmin.cc.

94 {
95  const char *epname = "Init";
96  pthread_t tid;
97 
98  eDest = erp;
99  if (XrdSysThread::Run(&tid, XrdXrootdInitAdmin, (void *)asock,
100  0, "Admin traffic"))
101  {eDest->Emsg(epname, errno, "start admin");
102  return 0;
103  }
104  return 1;
105 }
void * XrdXrootdInitAdmin(void *carg)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)

References XrdSysError::Emsg(), XrdSysThread::Run(), and XrdXrootdInitAdmin().

Referenced by XrdXrootdProtocol::Configure().

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

◆ Login()

void XrdXrootdAdmin::Login ( int  socknum)

Definition at line 111 of file XrdXrootdAdmin.cc.

112 {
113  const char *epname = "Admin";
114  char *tp;
115 
116 // Attach the socket FD to a stream
117 //
118  Stream.SetEroute(eDest);
119  Stream.AttachIO(socknum, socknum);
120 
121 // Get the first request
122 //
123  if (!Stream.GetLine())
124  {eDest->Emsg(epname, "No admin login specified");
125  return;
126  }
127 
128 // The first request better be: <reqid> login <name>
129 //
130  if (getreqID()
131  || !(tp = Stream.GetToken())
132  || strcmp("login", tp)
133  || do_Login())
134  {eDest->Emsg(epname, "Invalid admin login sequence");
135  return;
136  }
137 
138 // Document the login and go process the stream
139 //
140  eDest->Emsg(epname, "Admin", TraceID, "logged in");
141  Xeq();
142 }
char * GetLine()
int AttachIO(int infd, int outfd, int bsz=2047)
void SetEroute(XrdSysError *eroute)
char * GetToken(int lowcase=0)

References XrdOucStream::AttachIO(), XrdSysError::Emsg(), XrdOucStream::GetLine(), XrdOucStream::GetToken(), and XrdOucStream::SetEroute().

+ Here is the call graph for this function:

◆ Start()

void * XrdXrootdAdmin::Start ( XrdNetSocket AdminSock)

Definition at line 148 of file XrdXrootdAdmin.cc.

149 {
150  const char *epname = "Start";
151  int InSock;
152  pthread_t tid;
153 
154 // Accept connections in an endless loop
155 //
156  while(1) if ((InSock = AdminSock->Accept()) >= 0)
157  {if (XrdSysThread::Run(&tid,XrdXrootdLoginAdmin,(void *)&InSock))
158  {eDest->Emsg(epname, errno, "start admin");
159  close(InSock);
160  }
161  } else eDest->Emsg(epname, errno, "accept connection");
162  return (void *)0;
163 }
#define close(a)
Definition: XrdPosix.hh:43
void * XrdXrootdLoginAdmin(void *carg)
int Accept(int ms=-1)
Definition: XrdNetSocket.cc:99

References XrdNetSocket::Accept(), close, XrdSysError::Emsg(), XrdSysThread::Run(), and XrdXrootdLoginAdmin().

+ Here is the call graph for this function:

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