loudmouth/lm-ssl-base.h
author Frank Zschockelt <lm@freakysoft.de>
Sat, 11 May 2019 22:25:49 +0200
changeset 738 264fece7ff0d
parent 704 d682ae8d7d3a
permissions -rw-r--r--
Fix getaddrinfo() handling in blocking resolver If getaddrinfo() fails, the first call setting the result will already free the resolver. Trying to access it afterwards will lead to a warning to the console from glib. getaddrinfo() shouldn't return NULL for the result list if it returns successful.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
516
4dd3aa6b83e5 Change the tab width to 4 steps in the emacs headers
Mikael Hallendal <micke@imendio.com>
parents: 515
diff changeset
     1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
137
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     2
/*
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     3
 * Copyright (C) 2003-2006 Imendio AB
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     4
 *
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     6
 * modify it under the terms of the GNU Lesser General Public License as
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     7
 * published by the Free Software Foundation; either version 2 of the
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     8
 * License, or (at your option) any later version.
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
     9
 *
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    13
 * Lesser General Public License for more details.
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    14
 *
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    15
 * You should have received a copy of the GNU Lesser General Public
690
7ccf2113ec5f Update the postal address of the FSF
Frank Zschockelt <lm@freakysoft.de>
parents: 664
diff changeset
    16
 * License along with this program; if not, see <https://www.gnu.org/licenses>
137
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    17
 */
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    18
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    19
#ifndef __LM_SSL_BASE_H__
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    20
#define __LM_SSL_BASE_H__
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    21
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    22
#include "lm-ssl.h"
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    23
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    24
#define LM_SSL_BASE(x) ((LmSSLBase *) x)
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    25
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    26
typedef struct _LmSSLBase LmSSLBase;
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    27
struct _LmSSLBase {
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    28
    LmSSLFunction   func;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    29
    gpointer        func_data;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    30
    GDestroyNotify  data_notify;
650
a51209f570b6 Implemented lm_ssl_set_cipher_list
Frank Zschockelt <lm@freakysoft.de>
parents: 607
diff changeset
    31
    gchar          *cipher_list;
651
2990ee03cfa3 Implemented lm_ssl_set_ca
Frank Zschockelt <lm@freakysoft.de>
parents: 650
diff changeset
    32
    gchar          *ca_path;
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    33
    gchar          *expected_fingerprint;
704
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    34
    char            fingerprint[LM_FINGERPRINT_LENGTH];
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    35
    gboolean        use_starttls;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    36
    gboolean        require_starttls;
137
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    37
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    38
    gint            ref_count;
137
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    39
};
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    40
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 518
diff changeset
    41
void _lm_ssl_base_init         (LmSSLBase      *base,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    42
                                const gchar    *expected_fingerprint,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    43
                                LmSSLFunction   ssl_function,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    44
                                gpointer        user_data,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    45
                                GDestroyNotify  notify);
137
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    46
650
a51209f570b6 Implemented lm_ssl_set_cipher_list
Frank Zschockelt <lm@freakysoft.de>
parents: 607
diff changeset
    47
void _lm_ssl_base_set_cipher_list (LmSSLBase   *base,
a51209f570b6 Implemented lm_ssl_set_cipher_list
Frank Zschockelt <lm@freakysoft.de>
parents: 607
diff changeset
    48
                                   const gchar *cipher_list);
a51209f570b6 Implemented lm_ssl_set_cipher_list
Frank Zschockelt <lm@freakysoft.de>
parents: 607
diff changeset
    49
651
2990ee03cfa3 Implemented lm_ssl_set_ca
Frank Zschockelt <lm@freakysoft.de>
parents: 650
diff changeset
    50
void _lm_ssl_base_set_ca_path (LmSSLBase   *base,
664
f57b1b61e1fe Remove trailing whitespace and mixed indenting
Till Maas <opensource@till.name>
parents: 651
diff changeset
    51
                               const gchar *ca_path);
651
2990ee03cfa3 Implemented lm_ssl_set_ca
Frank Zschockelt <lm@freakysoft.de>
parents: 650
diff changeset
    52
704
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    53
void _lm_ssl_base_set_fingerprint (LmSSLBase    *base,
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    54
                                   const guchar *digest,
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    55
                                   unsigned int  digest_len);
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    56
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    57
int _lm_ssl_base_check_fingerprint( LmSSLBase *base);
d682ae8d7d3a Deprecate MD5 fingerprints for SHA256
Frank Zschockelt <lm@freakysoft.de>
parents: 690
diff changeset
    58
137
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    59
void _lm_ssl_base_free_fields  (LmSSLBase      *base);
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    60
18785575aa7a 2006-04-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents:
diff changeset
    61
#endif /* __LM_SSL_BASE_H__ */