XRootD
Loading...
Searching...
No Matches
XrdCmsProtocol.cc File Reference
#include <unistd.h>
#include <cctype>
#include <cerrno>
#include <signal.h>
#include <cstdlib>
#include <cstring>
#include <strings.h>
#include <cstdio>
#include <netinet/in.h>
#include <sys/param.h>
#include "XProtocol/YProtocol.hh"
#include "XrdVersion.hh"
#include "Xrd/XrdInet.hh"
#include "Xrd/XrdLink.hh"
#include "XrdCms/XrdCmsBaseFS.hh"
#include "XrdCms/XrdCmsCache.hh"
#include "XrdCms/XrdCmsCluster.hh"
#include "XrdCms/XrdCmsConfig.hh"
#include "XrdCms/XrdCmsJob.hh"
#include "XrdCms/XrdCmsLogin.hh"
#include "XrdCms/XrdCmsManager.hh"
#include "XrdCms/XrdCmsManTree.hh"
#include "XrdCms/XrdCmsMeter.hh"
#include "XrdCms/XrdCmsProtocol.hh"
#include "XrdCms/XrdCmsRole.hh"
#include "XrdCms/XrdCmsRouting.hh"
#include "XrdCms/XrdCmsRTable.hh"
#include "XrdCms/XrdCmsState.hh"
#include "XrdCms/XrdCmsTrace.hh"
#include "XrdOuc/XrdOucCRC.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucPup.hh"
#include "XrdOuc/XrdOucTokenizer.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysTimer.hh"
+ Include dependency graph for XrdCmsProtocol.cc:

Go to the source code of this file.

Namespaces

namespace  XrdCms
 

Functions

XrdProtocolXrdgetProtocol (const char *pname, char *parms, XrdProtocol_Config *pi)
 
int XrdgetProtocolPort (const char *pname, char *parms, XrdProtocol_Config *pi)
 
 XrdVERSIONINFO (XrdgetProtocol, cmsd)
 
 XrdVERSIONINFO (XrdgetProtocolPort, cmsd)
 

Function Documentation

◆ XrdgetProtocol()

XrdProtocol * XrdgetProtocol ( const char *  pname,
char *  parms,
XrdProtocol_Config pi 
)

Definition at line 108 of file XrdCmsProtocol.cc.

110{
111// If we failed in Phase 1 initialization, immediately fail Phase 2.
112//
113 if (Config.doWait < 0) return (XrdProtocol *)0;
114
115// Initialize the network interface and get the actual port number assigned
116//
117 Config.PortTCP = pi->NetTCP->Port();
118 Config.NetTCP = pi->NetTCP;
119
120// If we have a connection allow list, add it to the network object. Note that
121// we clear the address because the object is lost in the add process.
122//
124
125// Complete initialization and upon success return a protocol object
126//
127 if (Config.Configure2()) return (XrdProtocol *)0;
128
129// Return a new instance of this object
130//
131 return (XrdProtocol *)new XrdCmsProtocol();
132}
XrdInet * NetTCP
XrdNetSecurity * Police
void Secure(XrdNetSecurity *secp)
Definition XrdInet.cc:244
int Port()
Definition XrdNet.hh:191
XrdCmsConfig Config

◆ XrdgetProtocolPort()

int XrdgetProtocolPort ( const char *  pname,
char *  parms,
XrdProtocol_Config pi 
)

Definition at line 149 of file XrdCmsProtocol.cc.

151{
152 static int thePort = -1;
153 char *cfn = pi->ConfigFN, buff[128];
154
155// Check if we have been here before
156//
157 if (thePort >= 0)
158 {if (pi->Port && pi->Port != thePort)
159 {sprintf(buff, "%d disallowed; only using port %d",pi->Port,thePort);
160 Say.Emsg("Config", "Alternate port", buff);
161 }
162 return thePort;
163 }
164
165// Call the level 0 configurator
166//
167 if (Config.Configure0(pi))
168 {Config.doWait = -1; return 0;}
169
170// The only parameter we accept is the name of an alternate config file
171//
172 if (parms)
173 {while(*parms == ' ') parms++;
174 if (*parms)
175 {char *pp = parms;
176 while(*parms != ' ' && *parms) parms++;
177 cfn = pp;
178 }
179 }
180
181// Put up the banner
182//
183 Say.Say("Copr. 2003-2020 Stanford University/SLAC cmsd.");
184
185// Indicate failure if static init fails
186//
187 if (cfn) cfn = strdup(cfn);
188 if (Config.Configure1(pi->argc, pi->argv, cfn))
189 {Config.doWait = -1; return 0;}
190
191// Return the port number to be used
192//
193 thePort = Config.PortTCP;
194 return thePort;
195}
int Configure1(int argc, char **argv, char *cfn)
int Configure0(XrdProtocol_Config *pi)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
XrdSysError Say

◆ XrdVERSIONINFO() [1/2]

XrdVERSIONINFO ( XrdgetProtocol  ,
cmsd   
)

◆ XrdVERSIONINFO() [2/2]

XrdVERSIONINFO ( XrdgetProtocolPort  ,
cmsd   
)