XRootD
XrdProtLoad.cc File Reference
#include <vector>
#include "XrdOuc/XrdOucPinLoader.hh"
#include "XrdSys/XrdSysError.hh"
#include "Xrd/XrdLink.hh"
#include "Xrd/XrdProtLoad.hh"
#include "Xrd/XrdTrace.hh"
#include "XrdVersion.hh"
+ Include dependency graph for XrdProtLoad.cc:

Go to the source code of this file.

Namespaces

 XrdGlobal
 

Functions

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

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 //
123  if (Config.Police) {pi->NetTCP->Secure(Config.Police); Config.Police = 0;}
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
Definition: XrdCmsConfig.hh:99
XrdNetSecurity * Police
void Secure(XrdNetSecurity *secp)
Definition: XrdInet.cc:244
int Port()
Definition: XrdNet.hh:191
XrdCmsConfig Config

References XrdCms::Config, XrdHttpProtocol::Configure(), XrdXrootdProtocol::Configure(), XrdCmsConfig::Configure2(), XrdCmsConfig::doWait, XrdProtocol_Config::eDest, kXR_PROTOCOLVSTRING, XrdProtocol_Config::NetTCP, XrdCmsConfig::NetTCP, XrdCmsConfig::Police, XrdNet::Port(), XrdCmsConfig::PortTCP, XrdSysError::Say(), and XrdInet::Secure().

+ Here is the call graph for this function:

◆ 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)
Definition: XrdSysError.cc:95
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)
Definition: XrdSysError.cc:141
XrdSysError Say

References XrdProtocol_Config::argc, XrdProtocol_Config::argv, XrdCms::Config, XrdProtocol_Config::ConfigFN, XrdCmsConfig::Configure0(), XrdCmsConfig::Configure1(), XrdCmsConfig::doWait, XrdSysError::Emsg(), XrdProtocol_Config::Port, XrdCmsConfig::PortTCP, XrdCms::Say, and XrdSysError::Say().

+ Here is the call graph for this function: