tport
1.13.18
Toggle main menu visibility
Loading...
Searching...
No Matches
tport_tls.h
1
/*
2
* This file is part of the Sofia-SIP package
3
*
4
* Copyright (C) 2005 Nokia Corporation.
5
*
6
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7
*
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public License
10
* as published by the Free Software Foundation; either version 2.1 of
11
* the License, or (at your option) any later version.
12
*
13
* This library is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21
* 02110-1301 USA
22
*
23
*/
24
25
#ifndef TPORT_TLS_H
27
#define TPORT_TLS_H
37
38
#ifndef SU_TYPES_H
39
#include <
sofia-sip/su_types.h
>
40
#endif
41
42
#include "tport_internal.h"
43
44
SOFIA_BEGIN_DECLS
45
46
#define TLS_MAX_HOSTS (16)
47
48
typedef
struct
tls_s tls_t;
49
50
extern
char
const
tls_version[];
51
52
typedef
struct
tls_issues_s {
53
unsigned
policy;
/* refer to tport_tag.h, tport_tls_verify_policy */
54
unsigned
verify_depth;
/* if 0, revert to default (2) */
55
unsigned
verify_date;
/* if 0, notBefore and notAfter dates are ignored */
56
int
configured;
/* If non-zero, complain about certificate errors */
57
char
*cert;
/* CERT file name. File format is PEM */
58
char
*key;
/* Private key file. PEM format */
59
char
*passphrase;
/* Passphrase for password protected private key */
60
char
*randFile;
/* Seed file for the PRNG (default: tls_seed.dat) */
61
char
*CAfile;
/* PEM file of CA's */
62
char
*CApath;
/* PEM file path of CA's */
63
char
*ciphers;
/* Should be one of the above defined ciphers *
64
* or NULL (default: !eNULL:!aNULL:!EXP:!LOW:!MD5:ALL:@STRENGTH)
65
*/
66
int
version;
/* For tls1, version is 1. When ssl3/ssl2 is
67
* used, it is 0. */
68
unsigned
timeout;
/* Maximum session lifetime in seconds */
69
} tls_issues_t;
70
71
typedef
struct
tport_tls_s {
72
tport_t tlstp_tp[1];
73
tls_t *tlstp_context;
74
char
*tlstp_buffer;
75
} tport_tls_t;
76
77
typedef
struct
tport_tls_primary_s {
78
tport_primary_t tlspri_pri[1];
79
tls_t *tlspri_master;
80
} tport_tls_primary_t;
81
82
tls_t *tls_init_master(tls_issues_t *tls_issues);
83
tls_t *tls_init_secondary(tls_t *tls_master,
int
sock,
int
accept);
84
int
tls_reload_cert(tls_t *tls, tls_issues_t *ti);
85
void
tport_tls_free(tls_t *tls);
86
int
tls_get_socket(tls_t *tls);
87
void
tls_log_errors(
unsigned
level,
char
const
*s,
unsigned
long
e);
88
ssize_t tls_read(tls_t *tls);
89
void
*tls_read_buffer(tls_t *tls,
size_t
N);
90
int
tls_want_read(tls_t *tls,
int
events);
91
int
tls_pending(tls_t
const
*tls);
92
93
int
tls_connect(
su_root_magic_t
*magic,
su_wait_t
*w, tport_t *self);
94
ssize_t tls_write(tls_t *tls,
void
*buf,
size_t
size);
95
int
tls_want_write(tls_t *tls,
int
events);
96
97
int
tls_events(tls_t
const
*tls,
int
flags);
98
void
tls_init(
void
);
99
100
SOFIA_END_DECLS
101
102
#endif
su_types.h
su_root_magic_t
SU_ROOT_MAGIC_T su_root_magic_t
su_wait_t
struct pollfd su_wait_t
Sofia-SIP 1.13.18 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.