1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * Copyright (C) 2003-2006 Imendio AB
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, see <https://www.gnu.org/licenses>
17  */
18 
19 #ifndef __LM_SSL_BASE_H__
20 #define __LM_SSL_BASE_H__
21 
22 #include "lm-ssl.h"
23 
24 #define LM_SSL_BASE(x) ((LmSSLBase *) x)
25 
26 typedef struct _LmSSLBase LmSSLBase;
27 struct _LmSSLBase {
28     LmSSLFunction   func;
29     gpointer        func_data;
30     GDestroyNotify  data_notify;
31     gchar          *cipher_list;
32     gchar          *ca_path;
33     gchar          *expected_fingerprint;
34     char            fingerprint[LM_FINGERPRINT_LENGTH];
35     gboolean        use_starttls;
36     gboolean        require_starttls;
37 
38     gint            ref_count;
39 };
40 
41 void _lm_ssl_base_init         (LmSSLBase      *base,
42                                 const gchar    *expected_fingerprint,
43                                 LmSSLFunction   ssl_function,
44                                 gpointer        user_data,
45                                 GDestroyNotify  notify);
46 
47 void _lm_ssl_base_set_cipher_list (LmSSLBase   *base,
48                                    const gchar *cipher_list);
49 
50 void _lm_ssl_base_set_ca_path (LmSSLBase   *base,
51                                const gchar *ca_path);
52 
53 void _lm_ssl_base_set_fingerprint (LmSSLBase    *base,
54                                    const guchar *digest,
55                                    unsigned int  digest_len);
56 
57 int _lm_ssl_base_check_fingerprint( LmSSLBase *base);
58 
59 void _lm_ssl_base_free_fields  (LmSSLBase      *base);
60 
61 #endif /* __LM_SSL_BASE_H__ */
62