• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

tls_hooks.c

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2007 iptelorg GmbH 
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00013  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00014  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00016  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00017  */
00018 /*
00019  * tls hooks for modules
00020  *
00021  * History:
00022  * --------
00023  *  2007-02-09  created by andrei
00024  */
00025 
00034 #include "tls_hooks.h"
00035 #include "tls_hooks_init.h"
00036 #include "globals.h"
00037 
00038 #ifdef TLS_HOOKS
00039 
00040 struct tls_hooks tls_hook= {0, 0, 0, 0, 0 ,0 ,0};
00041 
00042 static int tls_hooks_loaded=0;
00043 
00044 int register_tls_hooks(struct tls_hooks* h)
00045 {
00046         if (!tls_disable){
00047                 tls_hook=*h;
00048                 tls_hooks_loaded++;
00049                 return 0;
00050         }
00051         return -1;
00052 }
00053 
00054 
00055 int tls_init(struct socket_info* si)
00056 {
00057         if (tls_hook.init_si)
00058                 return tls_hook.init_si(si);
00059                 return -1;
00060 }
00061 
00062 int tls_has_init_si()
00063 {
00064         return (tls_hook.init_si!=0);
00065 }
00066 
00067 int init_tls()
00068 {
00069         if (tls_hook.init)
00070                 return tls_hook.init();
00071         return 0;
00072 }
00073 
00074 void destroy_tls()
00075 {
00076         if (tls_hook.destroy)
00077                 tls_hook.destroy();
00078 }
00079 
00080 int tls_loaded()
00081 {
00082         return tls_hooks_loaded;
00083 }
00084 
00085 #endif /* TLS_HOOKS */

Generated on Tue May 22 2012 13:10:17 for SIP Router by  doxygen 1.7.1