tls_domain.h

Go to the documentation of this file.
00001 /*
00002  * $Id: tls_domain.h 4680 2008-08-12 07:26:43Z klaus_darilion $
00003  *
00004  * Copyright (C)  2001-2003 FhG Fokus
00005  * Copyright (C)  2004,2005 Free Software Foundation, Inc.
00006  * Copyright (C)  2005,2006 iptelorg GmbH
00007  * Copyright (C)  2006 enum.at
00008  *
00009  * This file is part of Kamailio, a free SIP server.
00010  *
00011  * Kamailio is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version
00015  *
00016  * Kamailio is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License 
00022  * along with this program; if not, write to the Free Software 
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  */
00025 
00026 /*!
00027  * \file
00028  * \brief Kamailio TLS support :: Domains
00029  * \ingroup tls
00030  * Module: \ref tls
00031  */
00032 
00033 #ifndef TLS_DOMAIN_H
00034 #define TLS_DOMAIN_H
00035 
00036 #include "../str.h"
00037 #include "../ip_addr.h"
00038 #include "tls_config.h"
00039 #include <openssl/ssl.h>
00040 
00041 /*! \brief
00042  * TLS configuration domain type
00043  */
00044 enum tls_domain_type {
00045         TLS_DOMAIN_DEF = (1 << 0), /*!< Default domain */
00046         TLS_DOMAIN_SRV = (1 << 1), /*!< Server domain */
00047         TLS_DOMAIN_CLI = (1 << 2), /*!< Client domain */
00048         TLS_DOMAIN_NAME= (1 << 3)  /*!< Name based TLS domain */
00049 };
00050 
00051 /*! \brief
00052  * separate configuration per ip:port 
00053  */
00054 struct tls_domain {
00055    int             type;
00056    struct ip_addr  addr;
00057    unsigned short  port;
00058    SSL_CTX        *ctx;
00059    int             verify_cert;
00060    int             require_client_cert;
00061    char           *cert_file;
00062    char           *pkey_file;
00063    char           *ca_file;
00064    char           *ciphers_list;
00065 #ifndef OPENSSL_NO_TLSEXT
00066    char           *server_name;
00067 #endif
00068    enum tls_method method;
00069    struct tls_domain *next;
00070    str name;
00071 };
00072 
00073 extern struct tls_domain *tls_server_domains;
00074 extern struct tls_domain *tls_client_domains;
00075 extern struct tls_domain *tls_default_server_domain;
00076 extern struct tls_domain *tls_default_client_domain;
00077 
00078 /*
00079  * find server domain with given ip and port 
00080  */
00081 struct tls_domain *tls_find_server_domain(struct ip_addr *ip,
00082                unsigned short port);
00083 
00084 #ifndef OPENSSL_NO_TLSEXT
00085 /*
00086  * find server domain with given ip and port and server_name
00087  */
00088 struct tls_domain *tls_find_server_domain_server_name(struct ip_addr *ip,
00089                unsigned short port, const char *server_name);
00090 #endif
00091 
00092 /*
00093  * find client domain with given ip and port
00094  */
00095 struct tls_domain *tls_find_client_domain(struct ip_addr *ip,
00096                unsigned short port);
00097 
00098 /*
00099  * find client domain with given name 
00100  */
00101 struct tls_domain *tls_find_client_domain_name(str name);
00102 
00103 /*
00104  * create a new server domain (identified by socket)
00105  */
00106 int             tls_new_server_domain(struct ip_addr *ip, unsigned short port);
00107 
00108 /*
00109  * create a new client domain (identified by socket)
00110  */
00111 int             tls_new_client_domain(struct ip_addr *ip, unsigned short port);
00112 
00113 /*
00114  * create a new client domain (identified by string)
00115  */
00116 int             tls_new_client_domain_name(char *s, int len);
00117 
00118 /*
00119  * allocate memory and set default values for
00120  * TLS domain structure
00121  */
00122 struct tls_domain *tls_new_domain(int type);
00123 
00124 /*
00125  * clean up 
00126  */
00127 void            tls_free_domains(void);
00128 
00129 #endif

Generated on Thu May 24 20:00:33 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6