XRootD
XrdHttpModule.cc
Go to the documentation of this file.
1 
2 #include "XrdVersion.hh"
3 
4 #include "XrdHttpProtocol.hh"
5 
6 /******************************************************************************/
7 /* P r o t o c o l L o a d e r */
8 /* X r d g e t P r o t o c o l */
9 /******************************************************************************/
10 
11 // This protocol can live in a module. The interface below is used by
12 // the protocol driver to obtain a copy of the protocol object that can be used
13 // to decide whether or not a link is talking a particular protocol.
14 //
16 
17 extern "C" {
18 
19  XrdProtocol *XrdgetProtocol(const char *pname, char *parms,
20  XrdProtocol_Config *pi) {
21  XrdProtocol *pp = 0;
22  const char *txt = "completed.";
23 
24  // Put up the banner
25  //
26  pi->eDest->Say("Copr. 2012 CERN IT, an HTTP implementation for the XRootD framework.");
27  pi->eDest->Say("++++++ HTTP protocol initialization started.");
28 
29  // Return the protocol object to be used if static init succeeds
30  //
31  if (XrdHttpProtocol::Configure(parms, pi))
32  pp = (XrdProtocol *)new XrdHttpProtocol(false);
33  else txt = "failed.";
34  pi->eDest->Say("------ HTTP protocol initialization ", txt);
35  return pp;
36  }
37 }
38 
39 
40 /******************************************************************************/
41 /* */
42 /* 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 */
43 /* X r d g e t P r o t o c o l P o r t */
44 /******************************************************************************/
45 
46 // This function is called early on to determine the port we need to use. The
47 // default is ostensibly 1094 but can be overridden; which we allow.
48 //
50 
51 extern "C" {
52 
53  int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi) {
54 
55  // Figure out what port number we should return. In practice only one port
56  // number is allowed. However, we could potentially have a clustered port
57  // and several unclustered ports. So, we let this practicality slide.
58  //
59  if (pi->Port < 0) return 1094;
60  return pi->Port;
61  }
62 }
63 
XrdProtocol * XrdgetProtocol(const char *pname, char *parms, XrdProtocol_Config *pi)
XrdVERSIONINFO(XrdgetProtocol, xrdhttp)
int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi)
A pragmatic implementation of the HTTP/DAV protocol for the Xrd framework.
static int Configure(char *parms, XrdProtocol_Config *pi)
Read and apply the configuration.
XrdSysError * eDest
Definition: XrdProtocol.hh:61
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