conexus logo

nss/utility.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef CONEXUSNSSUTILITY_H
00020 #define CONEXUSNSSUTILITY_H
00021 
00022 #include <string>
00023 
00024 #include <nspr.h>
00025 #include <pk11func.h>
00026 #include <ssl.h>
00027 #include <nss.h>
00028 
00029 #include <sigc++/sigc++.h>
00030 
00031 #include <conexus-nss/enums.h>
00032 
00033 namespace Conexus
00034 {
00035 
00036   namespace NSS
00037   {
00038 
00049     bool init ( bool use_dispatcher_default = false,
00050                     const std::string& nss_config_dir = std::string(),
00051                     EXPORT_POLICY policy = EXPORT_NONE,
00052                     bool read_write = false );
00053 
00054     bool initialized();
00055 
00056     bool set_ssl_default_option ( uint32_t option, bool on=true );
00057 
00058     bool is_ssl_default_option_set( uint32_t option );
00059 
00060     bool enable_default_cipher( uint32_t cipher, bool enabled=true );
00061 
00062     bool is_default_cipher_enabled( uint32_t cipher );
00063 
00064     void clear_session_cache( );
00065 
00066     bool configure_server_session_cache ( int max_cache_entries = 0,
00067                                           uint32_t timeout = 0,
00068                                           uint32_t ssl3_timeout = 0,
00069                                           const char* cache_directory = NULL,
00070                                           bool multi_processor = false );
00071 
00072     bool inherit_server_session_cache( const char* env_string = NULL );
00073 
00074     bool set_export_policy( EXPORT_POLICY export_policy );
00075 
00076     bool set_cipher_policy( uint32_t cipher, POLICY policy );
00077 
00078     POLICY get_cipher_policy( uint32_t cipher );
00079 
00080     long int send_client_hello_cache_hits();
00081 
00082     long int send_client_hello_cache_misses();
00083 
00084     long int send_client_hello_cache_not_ok();
00085 
00086     long int handle_server_hello_cache_hits();
00087 
00088     long int handle_server_hello_cache_misses();
00089 
00090     long int handle_server_hello_cache_not_ok();
00091 
00092     long int handle_client_hello_cache_hits();
00093 
00094     long int handle_client_hello_cache_misses();
00095 
00096     long int handle_client_hello_cache_not_ok();
00097 
00098     void finalize( );
00099 
00100     struct password_accumulator {
00101       typedef std::string result_type;
00102       template<typename T_iterator>
00103           result_type operator()(T_iterator first, T_iterator last) const
00104       {
00105         result_type result;
00106         for (; first != last; ++first)
00107         {
00108           result = *first;
00109           if ( result.size() != 0 ) return result;
00110         }
00111         return NULL;
00112       }
00113     };
00114 
00115     extern sigc::signal<std::string,PK11SlotInfo*,PRBool,void*>::accumulated<password_accumulator> signal_pk11_password_request;
00116 
00117     void disable_all_ssl_ciphers();
00118 
00119 
00120   }
00121 
00122 }
00123 
00124 bool operator<( const SECItem& a, const SECItem& b );
00125 bool operator<=( const SECItem& a, const SECItem& b );
00126 bool operator==( const SECItem& a, const SECItem& b );
00127 bool operator!=( const SECItem& a, const SECItem& b );
00128 bool operator>=( const SECItem& a, const SECItem& b );
00129 bool operator>( const SECItem& a, const SECItem& b );
00130 
00131 #endif

Generated on Wed Jul 8 15:50:08 2009 for conexus by doxygen 1.5.8