Home | C-Bits Package Documentation | Project Page |
00001 /* ==================================================================== 00002 * The CBITS Software License, Version 1.0 00003 * 00004 * Copyright (c) 2002-2003 Bruce Lowery 00005 * All rights reserved 00006 * 00007 * Redistribution and use of this software, in source and binary forms, 00008 * with or without modification, are permitted provided that the above 00009 * copyright notice, this paragraph, and the following paragraph are 00010 * retained in each source code file. 00011 * 00012 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00013 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00014 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00015 * DISCLAIMED. IN NO EVENT SHALL BRUCE LOWERY OR OTHER CONTRIBUTORS 00016 * TO THE CBITS LIBRARY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00017 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00018 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00019 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00020 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00021 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00022 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00023 * SUCH DAMAGE. 00024 * ==================================================================== 00025 */ 00026 #ifndef __SSLSERVERSOCKET_H__ 00027 #define __SSLSERVERSOCKET_H__ 00028 00029 // CBits 00030 #include <cbits/ServerSocket.h> 00031 #include <cbits/Socket.h> 00032 #include <cbits/SSLSocket.h> 00033 #include <cbits/SSLContext.h> 00034 #include <cbits/SocketException.h> 00035 00036 // OpenSSL 00037 #include <openssl/bio.h> 00038 #include <openssl/err.h> 00039 #include <openssl/rand.h> 00040 #include <openssl/ssl.h> 00041 00042 00043 namespace cbits { 00044 00045 00075 class EXPORT SSLServerSocket : public virtual ServerSocket 00076 { 00077 00078 public: 00079 00094 SSLServerSocket 00095 ( 00096 const int port, 00098 const int qdepth=20, 00102 SSLContext* const ctxt=0 00107 ) 00108 throw( SocketException ); 00109 00110 00132 //virtual SSLSocket *accept( const long int msec ) 00133 //virtual Socket *accept( const long int msec=0 ) 00134 00144 #if defined( __GNUC__ ) 00145 virtual Socket *accept 00146 #else 00147 virtual SSLSocket *accept 00148 #endif 00149 ( 00150 const long int msec=0 00155 ) 00156 throw( SocketException ); 00157 00158 00186 static void setGlobalContext 00187 ( 00188 SSLContext* g_ctxt 00189 ) 00190 throw( SSLContextException ); 00191 00192 00193 private: 00194 00198 BIO* _bio; 00199 00200 00204 SSLContext* _ctxt; 00205 00206 00211 mutable CriticalSection _csect; 00212 00213 00217 static SSLContext* _global_ctxt; 00218 00219 }; 00220 00221 }; 00222 00223 #endif 00224 00225 00226 /* 00227 * $Id: SSLServerSocket.h,v 1.5 2002/10/16 22:32:44 brulow Exp $ 00228 * 00229 * History: (Add nothing manually below) 00230 * ----------------------------------------------------------------------- 00231 * 00232 * $Log: SSLServerSocket.h,v $ 00233 * Revision 1.5 2002/10/16 22:32:44 brulow 00234 * Improve doc, misc 00235 * 00236 * Revision 1.4 2002/10/14 21:07:59 brulow 00237 * *** empty log message *** 00238 * 00239 * Revision 1.3 2002/10/10 01:16:22 brulow 00240 * Improve documentation 00241 * 00242 * Revision 1.2 2002/09/27 22:04:16 brulow 00243 * Add history footer to all .h .cpp files 00244 * 00245 * 00246 */
|
|