XRootD
XrdCryptoLite.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d C r y p t o L i t e . c c */
4 /* */
5 /* (c) 2008 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* All Rights Reserved */
7 /* Produced by Andrew Hanushevsky for Stanford University under contract */
8 /* DE-AC02-76-SFO0515 with the Department of Energy */
9 /* */
10 /* This file is part of the XRootD software suite. */
11 /* */
12 /* XRootD is free software: you can redistribute it and/or modify it under */
13 /* the terms of the GNU Lesser General Public License as published by the */
14 /* Free Software Foundation, either version 3 of the License, or (at your */
15 /* option) any later version. */
16 /* */
17 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20 /* License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25 /* */
26 /* The copyright holder's institutional names and contributor's names may not */
27 /* be used to endorse or promote products derived from this software without */
28 /* specific prior written permission of the institution or contributor. */
29 /******************************************************************************/
30 
31 #include <cerrno>
32 #include <cstring>
33 
35 
36 /******************************************************************************/
37 /* C r e a t e */
38 /******************************************************************************/
39 
40 /* This is simply a landing pattern for all supported crypto methods; to avoid
41  requiring the client to include specific implementation include files. Add
42  your implementation in the following way:
43  1. Define an external function who's signature follows:
44  XrdCryptoLite *XrdCryptoLite_New_xxxx(const char Type)
45  where 'xxxx' corresponds to the passed Name argument.
46  2. Insert the extern to the function.
47  3. Insert the code segment that calls the function.
48 */
49 
50 XrdCryptoLite *XrdCryptoLite::Create(int &rc, const char *Name, const char Type)
51 {
52  extern XrdCryptoLite *XrdCryptoLite_New_bf32(const char Type);
53  XrdCryptoLite *cryptoP = 0;
54 
55  if (!strcmp(Name, "bf32")) cryptoP = XrdCryptoLite_New_bf32(Type);
56 
57 // Return appropriately
58 //
59  rc = (cryptoP ? 0 : EPROTONOSUPPORT);
60  return cryptoP;
61 }
XrdCryptoLite * XrdCryptoLite_New_bf32(const char Type)
virtual char Type()
static XrdCryptoLite * Create(int &rc, const char *Name, const char Type='\0')