]> git.sur5r.net Git - openldap/blob - libraries/libldap/ldap-tls.h
b24fd3634ced181509683964811975fd372e8c18
[openldap] / libraries / libldap / ldap-tls.h
1 /*  ldap-tls.h - TLS defines & prototypes internal to the LDAP library */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2008 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16
17 #ifndef _LDAP_TLS_H
18 #define _LDAP_TLS_H 1
19
20 struct tls_impl;
21
22 typedef struct tls_ctx {
23         struct tls_impl *tc_impl;
24 } tls_ctx;
25
26 typedef struct tls_session {
27         struct tls_impl *ts_impl;
28         void *ts_session;
29 } tls_session;
30
31 typedef int (TI_tls_init)(void);
32 typedef void (TI_tls_destroy)(void);
33
34 typedef tls_ctx *(TI_ctx_new)(struct ldapoptions *lo);
35 typedef void (TI_ctx_ref)(tls_ctx *ctx);
36 typedef void (TI_ctx_free)(tls_ctx *ctx);
37 typedef int (TI_ctx_init)(struct ldapoptions *lo, struct ldaptls *lt, int is_server);
38
39 typedef tls_session *(TI_session_new)(tls_ctx *ctx, int is_server);
40 typedef int (TI_session_connect)(LDAP *ld, tls_session *s);
41 typedef int (TI_session_accept)(tls_session *s);
42 typedef int (TI_session_upflags)(Sockbuf *sb, tls_session *s, int rc);
43 typedef char *(TI_session_errmsg)(int rc, char *buf, size_t len );
44 typedef int (TI_session_dn)(tls_session *sess, struct berval *dn);
45 typedef int (TI_session_chkhost)(LDAP *ld, tls_session *s, const char *name_in);
46 typedef int (TI_session_strength)(tls_session *sess);
47
48 typedef void (TI_thr_init)(void);
49
50 typedef struct tls_impl {
51         const char *ti_name;
52
53         TI_tls_init *ti_tls_init;       /* library initialization */
54         TI_tls_destroy *ti_tls_destroy;
55
56         TI_ctx_new *ti_ctx_new;
57         TI_ctx_ref *ti_ctx_ref;
58         TI_ctx_free *ti_ctx_free;
59         TI_ctx_init *ti_ctx_init;
60
61         TI_session_new *ti_session_new;
62         TI_session_connect *ti_session_connect;
63         TI_session_accept *ti_session_accept;
64         TI_session_upflags *ti_session_upflags;
65         TI_session_errmsg *ti_session_errmsg;
66         TI_session_dn *ti_session_my_dn;
67         TI_session_dn *ti_session_peer_dn;
68         TI_session_chkhost *ti_session_chkhost;
69         TI_session_strength *ti_session_strength;
70
71         Sockbuf_IO *ti_sbio;
72
73         TI_thr_init *ti_thr_init;
74
75         int ti_inited;
76 } tls_impl;
77
78 #endif /* _LDAP_TLS_H */