tport_tls.h

00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00025 #ifndef TPORT_TLS_H
00026 
00027 #define TPORT_TLS_H
00028 
00038 #ifndef SU_TYPES_H
00039 #include <sofia-sip/su_types.h>
00040 #endif
00041 
00042 SOFIA_BEGIN_DECLS
00043 
00044 #define TLS_MAX_HOSTS (16)
00045 
00046 typedef struct tls_s tls_t;
00047 
00048 extern char const tls_version[];
00049 
00050 typedef struct tls_issues_s {
00051   int  verify_depth;    /* if 0, then do nothing                      */
00052   int   configured;     /* If non-zero, complain about certificate errors */
00053   char *cert;           /* CERT file name. File format is PEM         */
00054   char *key;            /* Private key file. PEM format               */
00055   char *randFile;       /* Seed file for the PRNG (default: tls_seed.dat) */
00056   char *CAfile;         /* PEM file of CA's                           */
00057   char *CApath;         /* PEM file path of CA's                      */
00058   char *cipher;         /* Should be one of the above defined ciphers *
00059                          * or NULL (default: "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
00060                          */
00061   int   version;        /* For tls1, version is 1. When ssl3/ssl2 is 
00062                          * used, it is 0. */
00063 } tls_issues_t;
00064 
00065 tls_t *tls_init_master(tls_issues_t *tls_issues);
00066 tls_t *tls_init_slave(tls_t *tls_master, int sock);
00067 tls_t *tls_init_client(tls_t *tls_master, int sock);
00068 void tls_free(tls_t *tls);
00069 int tls_get_socket(tls_t *tls);
00070 ssize_t tls_read(tls_t *tls);
00071 void *tls_read_buffer(tls_t *tls, size_t N);
00072 int tls_want_read(tls_t *tls, int events);
00073 int tls_pending(tls_t const *tls);
00074 
00075 ssize_t tls_write(tls_t *tls, void *buf, size_t size);
00076 int tls_want_write(tls_t *tls, int events);
00077 
00078 int tls_check_hosts(tls_t *tls, char const *hosts[TLS_MAX_HOSTS]);
00079 
00080 int tls_events(tls_t const *tls, int flags);
00081 
00082 SOFIA_END_DECLS
00083 
00084 #endif

Sofia-SIP 1.12.7 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.