xrootd
Loading...
Searching...
No Matches
XrdCryptoBasic.hh
Go to the documentation of this file.
1#ifndef __CRYPTO_BASIC_H__
2#define __CRYPTO_BASIC_H__
3/******************************************************************************/
4/* */
5/* X r d C r y p t o B a s i c. h h */
6/* */
7/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* Produced by Geri Ganis for CERN */
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
32/* ************************************************************************** */
33/* */
34/* Generic buffer for crypto functions needed in XrdCrypto */
35/* Different crypto implementation (OpenSSL, Botan, ...) available as plug-in */
36/* */
37/* ************************************************************************** */
38
41
42// ---------------------------------------------------------------------------//
43//
44// Basic buffer
45//
46// ---------------------------------------------------------------------------//
48{
49public:
50 // ctor
51 XrdCryptoBasic(const char *t = 0, int l = 0, const char *b = 0);
52 // dtor
53 virtual ~XrdCryptoBasic()
54 { if (type) delete[] type; if (membuf) delete[] membuf; }
55 // getters
57 char *AsHexString();
58 virtual int Length() const { return lenbuf; }
59 virtual char *Buffer() const { return membuf; }
60 virtual char *Type() const { return type; }
61 // setters
62 virtual int FromHex(const char *hex);
63 virtual int SetLength(int l);
64 virtual int SetBuffer(int l, const char *b);
65 virtual int SetType(const char *t);
66 // special setter to avoid buffer re-allocation
67 virtual void UseBuffer(int l, const char *b)
68 { if (membuf) delete[] membuf; membuf = (char *)b; lenbuf = l; }
69
70private:
72 char *membuf;
73 char *type;
74};
75
76#endif
int kXR_int32
Definition XPtypes.hh:89
Definition XrdCryptoBasic.hh:48
virtual char * Type() const
Definition XrdCryptoBasic.hh:60
virtual int SetLength(int l)
virtual int SetBuffer(int l, const char *b)
char * membuf
Definition XrdCryptoBasic.hh:72
virtual ~XrdCryptoBasic()
Definition XrdCryptoBasic.hh:53
char * type
Definition XrdCryptoBasic.hh:73
virtual int FromHex(const char *hex)
virtual int Length() const
Definition XrdCryptoBasic.hh:58
kXR_int32 lenbuf
Definition XrdCryptoBasic.hh:71
virtual int SetType(const char *t)
char * AsHexString()
XrdCryptoBasic(const char *t=0, int l=0, const char *b=0)
virtual char * Buffer() const
Definition XrdCryptoBasic.hh:59
virtual XrdSutBucket * AsBucket()
virtual void UseBuffer(int l, const char *b)
Definition XrdCryptoBasic.hh:67
Definition XrdSutBucket.hh:44