XRootD
Loading...
Searching...
No Matches
XrdXrootdPlugin.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d X r o o t d P l u g i n . c c */
4/* */
5/* (c) 2014 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* Produced by Andrew Hanushevsky for Stanford University under contract */
7/* DE-AC02-76-SFO0515 with the Department of Energy */
8/* */
9/* This file is part of the XRootD software suite. */
10/* */
11/* XRootD is free software: you can redistribute it and/or modify it under */
12/* the terms of the GNU Lesser General Public License as published by the */
13/* Free Software Foundation, either version 3 of the License, or (at your */
14/* option) any later version. */
15/* */
16/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19/* License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24/* */
25/* The copyright holder's institutional names and contributor's names may not */
26/* be used to endorse or promote products derived from this software without */
27/* specific prior written permission of the institution or contributor. */
28/******************************************************************************/
29
30#include "XrdVersion.hh"
31
33
34/******************************************************************************/
35/* P r o t o c o l L o a d e r */
36/* X r d g e t P r o t o c o l */
37/******************************************************************************/
38
39// This protocol is defined in a shared library. The interface below is used
40// by the protocol driver to obtain a copy of the protocol object that can be
41// used to decide whether or not a link is talking a particular protocol. This
42// definition is used when XRootD is loaded as an ancillary protocol.
43//
45
46extern "C"
47{
48XrdProtocol *XrdgetProtocol(const char *pname, char *parms,
50{
51 XrdProtocol *pp = 0;
52 const char *txt = "completed.";
53
54// Put up the banner
55//
56 pi->eDest->Say("Copr. 2012 Stanford University, xroot protocol "
57 kXR_PROTOCOLVSTRING, " version ", XrdVERSION);
58 pi->eDest->Say("++++++ xroot protocol initialization started.");
59
60// Return the protocol object to be used if static init succeeds
61//
62 if (XrdXrootdProtocol::Configure(parms, pi))
63 pp = (XrdProtocol *)new XrdXrootdProtocol();
64 else txt = "failed.";
65 pi->eDest->Say("------ xroot protocol initialization ", txt);
66 return pp;
67}
68}
69
70/******************************************************************************/
71/* */
72/* P r o t o c o l P o r t D e t e r m i n a t i o n */
73/* X r d g e t P r o t o c o l P o r t */
74/******************************************************************************/
75
76// This function is called early on to determine the port we need to use. The
77// default is ostensibly 1094 but can be overridden; which we allow.
78//
80
81extern "C"
82{
83int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi)
84{
85
86// Figure out what port number we should return. In practice only one port
87// number is allowed. However, we could potentially have a clustered port
88// and several unclustered ports. So, we let this practicality slide.
89//
90 if (pi->Port < 0) return 1094;
91 return pi->Port;
92}
93}
#define kXR_PROTOCOLVSTRING
Definition XProtocol.hh:75
XrdVERSIONINFO(XrdgetProtocol, xrootd)
XrdProtocol * XrdgetProtocol(const char *pname, char *parms, XrdProtocol_Config *pi)
int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi)
XrdSysError * eDest
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)
static int Configure(char *parms, XrdProtocol_Config *pi)