Back to index

openldap  2.4.31
TlsOptions.h
Go to the documentation of this file.
00001 // $OpenLDAP$
00002 /*
00003  * Copyright 2010-2012 The OpenLDAP Foundation, All Rights Reserved.
00004  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
00005  */
00006 #ifndef TLS_OPTIONS_H
00007 #define TLS_OPTIONS_H
00008 #include <string>
00009 #include <ldap.h>
00010 
00021 class TlsOptions {
00022     public:
00023 
00027         enum tls_option {
00028             CACERTFILE=0, 
00029             CACERTDIR,
00030             CERTFILE,
00031             KEYFILE,
00032             REQUIRE_CERT,
00033             PROTOCOL_MIN,
00034             CIPHER_SUITE,
00035             RANDOM_FILE,
00036             CRLCHECK,
00037             DHFILE,
00039             LASTOPT /* dummy */
00041         };
00042 
00046         enum verifyMode {
00047             NEVER=0,
00048             HARD,
00049             DEMAND,
00050             ALLOW,
00051             TRY
00052         };
00053 
00057         enum crlMode {
00058             CRL_NONE=0,
00059             CRL_PEER,
00060             CRL_ALL
00061         };
00062 
00063 
00067         TlsOptions();
00068 
00099         void setOption(tls_option opt, const std::string& value) const;
00100 
00121         void setOption(tls_option opt, int value) const;
00122 
00127         void setOption(tls_option opt, void *value) const;
00128 
00135         int getIntOption(tls_option opt) const;
00136 
00143         std::string getStringOption(tls_option opt) const;
00144 
00152         void getOption(tls_option opt, void *value ) const;
00153         
00154     private:
00155         TlsOptions( LDAP* ld );
00156         void newCtx() const;
00157         LDAP *m_ld;
00158 
00159     friend class LDAPAsynConnection;
00160 };
00161 
00162 #endif /* TLS_OPTIONS_H */