Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

npssl.h

Go to the documentation of this file.
00001 /************************************************************************
00002 * EPP RTK C++
00003 * Copyright (C) 2001 Global Name Registry 
00004 * 
00005 * This library is free software; you can redistribute it and/or modify it
00006 * under the terms of the GNU Lesser General Public License as published
00007 * by the Free Software Foundation; either version 2.1 of the License, or
00008 * (at your option) any later version.
00009 *
00010 * This library is distributed in the hope that it will be useful, but
00011 * WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 * Lesser General Public License for more details.
00014 *
00015 * You should have received a copy of the GNU Lesser General Public
00016 * License along with this library; if not, write to the Free Software
00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 *
00019 * Contact information:  epprtk@gnr.com
00020 *
00021 *                       EPP RTK
00022 *                       GNR Ltd.
00023 *                       125 High Holborn
00024 *                       London WC1V 6QA
00025 *                       United Kingdom
00026 ************************************************************************/
00027 
00028 #ifndef npssl_h_included
00029 #define npssl_h_included
00030 
00031 // -------------------------------------------------
00032 
00033 #include <openssl/ssl.h>
00034 #include <openssl/err.h>
00035 #include <openssl/x509.h>
00036 #include <string>
00037 
00038 // -------------------------------------------------
00039 
00040 namespace npbase {
00041 
00042   class npssl {
00043     SSL *ssl;
00044     SSL_CTX *ctx;
00045     int bufsiz;
00046     char *buf;
00047     bool server;
00048 
00049     string int_inbuffer;
00050     string int_outbuffer;
00051     string readbuffer;
00052     
00053     void ssl_error(void);
00054 
00055   public:
00056 
00057 
00058     void setVerifyLocations(const string &certname, const string &pathname);
00059     void setClientVerification(int mode,int (*verify_callback)(int, X509_STORE_CTX *));
00060     void setClientVerificationDepth(int depth);
00061     void newConnection(void);
00062     void setExData(int index, void * data);
00063     X509 * getPeerCertificate( void );
00064     long getVerifyResult( void );
00065 
00066     void setCertFile(const string &filename);
00067     bool handShake(int infd, int outfd);
00068 
00069     int get_rfd(void);
00070     int get_wfd(void);
00071 
00072     // get functions
00073     string getS(void);
00074     char getch(void);
00075     string bufferedGetS(void);
00076     char bufferedGetch(void);
00077     void bufferedUnGetch(char c);
00078 
00079     bool hasMore(void);
00080 
00081     // put functions
00082     bool putS(const string &str);
00083     bool putch(char c);
00084     bool bufferedPutS(const string &str);
00085     bool bufferedPutch(char c);
00086 
00087 
00088     bool flush(void);
00089 
00090 
00091     npssl(int bufsiz, bool mode);
00092     ~npssl();
00093   };
00094   
00095 
00096 };
00097 
00098 // -------------------------------------------------
00099 
00100 #endif

Generated on Fri Mar 22 15:45:39 2002 for epprtk c++ by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001