conexus/nspr_utility.h

00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef CONEXUSNSPRUTILITY_H
00020 #define CONEXUSNSPRUTILITY_H
00021 
00022 #include <nspr.h>
00023 #include <pk11func.h>
00024 #include <ssl.h>
00025 #include <nss.h>
00026 
00027 #include <conexus/ipv4_address.h>
00028 
00029 
00030 namespace Conexus {
00031 
00032   namespace NSPR {
00033 
00034     typedef enum NSS_POLICY {
00035       NSS_POLICY_NONE,
00036       NSS_POLICY_US_DOMESTIC,
00037       NSS_POLICY_US_EXPORTABLE,
00038       NSS_POLICY_FRANCE,
00039     } NSS_POLICY;
00040 
00041     void init( bool use_dispatcher_default = false );
00042 
00043     bool initialized();
00044 
00045     void finalize();
00046 
00047     bool nss_init( bool use_dispatcher_default = false,
00048                    const char* nss_config_dir = NULL,
00049                    NSS_POLICY policy = NSS_POLICY_NONE,
00050                    bool read_write = false );
00051 
00052     void set_nss_password_function( PK11PasswordFunc func );
00053 
00054     char* default_nss_password_function( PK11SlotInfo* slot, PRBool retry, void* arg );
00055 
00056     bool enable_cipher( uint32_t cipher, bool enable = true );
00057 
00058     void clear_session_cache( );
00059 
00060     bool configure_server_session_cache( int max_cache_entries = 0,
00061                                          uint32_t timeout = 0,
00062                                          uint32_t ssl3_timeout = 0,
00063                                          const char* cache_directory = NULL );
00064 
00065   void addr_to_nspr( Address& conexusaddr, PRNetAddr& nspraddr );
00066 
00067 
00068     }
00069 
00070   }
00071 
00072 #endif

Generated on Tue Mar 13 19:54:48 2007 by  doxygen 1.5.1