XrdCryptoBasic.hh

Go to the documentation of this file.
00001 // $Id: XrdCryptoBasic.hh 22437 2008-03-04 14:35:16Z rdm $
00002 #ifndef __CRYPTO_BASIC_H__
00003 #define __CRYPTO_BASIC_H__
00004 /******************************************************************************/
00005 /*                                                                            */
00006 /*                     X r d C r y p t o B a s i c. h h                       */
00007 /*                                                                            */
00008 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University  */
00009 /*       All Rights Reserved. See XrdInfo.cc for complete License Terms       */
00010 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00011 /*              DE-AC03-76-SFO0515 with the Department of Energy              */
00012 /******************************************************************************/
00013 
00014 
00015 /* ************************************************************************** */
00016 /*                                                                            */
00017 /* Generic buffer for crypto functions needed in XrdCrypto                    */
00018 /* Different crypto implementation (OpenSSL, Botan, ...) available as plug-in */
00019 /*                                                                            */
00020 /* ************************************************************************** */
00021 
00022 #include <XProtocol/XProtocol.hh>
00023 #include <XrdSut/XrdSutBucket.hh>
00024 
00025 // ---------------------------------------------------------------------------//
00026 //
00027 // Basic buffer
00028 //
00029 // ---------------------------------------------------------------------------//
00030 class XrdCryptoBasic
00031 {
00032 public:
00033    // ctor
00034    XrdCryptoBasic(const char *t = 0, int l = 0, const char *b = 0);
00035    // dtor
00036    virtual ~XrdCryptoBasic() 
00037           { if (type) delete[] type; if (membuf) delete[] membuf; }
00038    // getters
00039    virtual XrdSutBucket *AsBucket();
00040    char *AsHexString();
00041    virtual int   Length() const { return lenbuf; }
00042    virtual char *Buffer() const { return membuf; }
00043    virtual char *Type() const { return type; }
00044    // setters
00045    virtual int   FromHex(const char *hex);
00046    virtual int   SetLength(int l);
00047    virtual int   SetBuffer(int l, const char *b);
00048    virtual int   SetType(const char *t);
00049    // special setter to avoid buffer re-allocation
00050    virtual void  UseBuffer(int l, const char *b)
00051           { if (membuf) delete[] membuf; membuf = (char *)b; lenbuf = l; }
00052 
00053 private:
00054    kXR_int32  lenbuf;
00055    char      *membuf;
00056    char      *type;
00057 };
00058 
00059 #endif

Generated on Tue Jul 5 14:46:32 2011 for ROOT_528-00b_version by  doxygen 1.5.1