Back to index

im-sdk  12.3.91
IMTLS.hh
Go to the documentation of this file.
00001 #ifndef IM_TLS_HH_
00002 #define IM_TLS_HH_
00003 #include <config.h>
00004 #include <basictype.hh>
00005 #include <stdio.h>
00006 
00007 #ifdef HAVE_TLS
00008 
00009 class IMSocketTrans;
00010 
00011 class IMTLS {
00012 
00013     static bool initialized;
00014     static IMTLS *ptls;
00015     
00016   protected:
00017     IMTLS() { ptls = NULL; }
00018 
00019     virtual ~IMTLS();
00020     void register_singleton() {
00021         ptls = this;
00022     }
00023 
00024   public:
00025     static IMTLS* get_instance() {
00026         ASSERT(ptls);
00027         return ptls;
00028     }
00029     static IMTLS* construct();
00030     static void cleanup() {
00031         if(ptls) delete ptls;
00032     }
00033 
00034     virtual bool set_certificate_file(
00035         const string& filename
00036     ) { return false; };
00037     virtual bool set_certificate_key_file(
00038         const string &filename
00039     ) { return false; };
00040     virtual bool set_cacertificate_file(
00041         const string &filename
00042     ) { return false; };
00043     virtual bool set_cacertificate_path(
00044         const string &dirname
00045     ) { return false; };
00046     virtual bool set_verify_client(
00047         const string &value
00048     ) { return false; };
00049 
00050     virtual bool set_verify_depth(
00051         const string &value
00052     ) { return false; };
00053 
00054     virtual bool setup() { return false; };
00055 
00056     virtual IMSocketTrans *create_trans(
00057         int fd,
00058         int trans_type
00059     ){ return NULL; };
00060 };
00061 
00062 #endif /* !HAVE_TLS */
00063 #endif