/usr/include/loudmouth-1.0/loudmouth/lm-ssl.h is in libloudmouth1-dev 1.5.3-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright (C) 2003-2004 Imendio AB
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <https://www.gnu.org/licenses>
*/
/**
* SECTION:lm-ssl
* @Title: LmSSL
* @Short_description: SSL struct for SSL support in Loudmouth
*
* Use this together with an #LmConnection to get the connection to use SSL. Example of how to use the #LmSSL API.
*
* <informalexample><programlisting><![CDATA[
* LmConnection *connection;
* LmSSL *ssl;
*
* connection = lm_connection_new ("myserver");
* ssl = lm_ssl_new (NULL, my_ssl_func, NULL, NULL);
* lm_connection_set_ssl (connection, ssl);
* ...
* ]]></programlisting></informalexample>
*/
#ifndef __LM_SSL_H__
#define __LM_SSL_H__
#include <glib.h>
#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
#endif
#define LM_FINGERPRINT_PREFIX "SHA256:"
#define LM_FINGERPRINT_LENGTH 72
G_BEGIN_DECLS
/**
* LmSSL:
*
* This should not be accessed directly. Use the accessor functions as described below.
*/
typedef struct _LmSSL LmSSL;
/**
* LmCertificateStatus:
* @LM_CERT_INVALID: The certificate is invalid.
* @LM_CERT_ISSUER_NOT_FOUND: The issuer of the certificate is not found.
* @LM_CERT_REVOKED: The certificate has been revoked.
*
* Provides information of the status of a certain certificate.
*/
typedef enum {
LM_CERT_INVALID,
LM_CERT_ISSUER_NOT_FOUND,
LM_CERT_REVOKED
} LmCertificateStatus;
/**
* LmSSLStatus:
* @LM_SSL_STATUS_NO_CERT_FOUND: The server doesn't provide a certificate.
* @LM_SSL_STATUS_UNTRUSTED_CERT: The certification can not be trusted.
* @LM_SSL_STATUS_CERT_EXPIRED: The certificate has expired.
* @LM_SSL_STATUS_CERT_NOT_ACTIVATED: The certificate has not been activated.
* @LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH: The server hostname doesn't match the one in the certificate.
* @LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH: The fingerprint doesn't match your expected.
* @LM_SSL_STATUS_GENERIC_ERROR: Some other error.
*
* Provides information about something gone wrong when trying to setup the SSL connection.
*/
typedef enum {
LM_SSL_STATUS_NO_CERT_FOUND,
LM_SSL_STATUS_UNTRUSTED_CERT,
LM_SSL_STATUS_CERT_EXPIRED,
LM_SSL_STATUS_CERT_NOT_ACTIVATED,
LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH,
LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH,
LM_SSL_STATUS_GENERIC_ERROR
} LmSSLStatus;
/**
* LmSSLResponse:
* @LM_SSL_RESPONSE_CONTINUE: Continue to connect.
* @LM_SSL_RESPONSE_STOP: Stop the connection.
*
* Used to inform #LmConnection if you want to stop due to an error reported or if you want to continue to connect.
*/
typedef enum {
LM_SSL_RESPONSE_CONTINUE,
LM_SSL_RESPONSE_STOP
} LmSSLResponse;
/**
* LmSSLFunction:
* @ssl: An #LmSSL.
* @status: The status informing what went wrong.
* @user_data: User data provided in the callback.
*
* This function is called if something goes wrong during the connecting phase.
*
* Returns: User should return #LM_SSL_RESPONSE_CONTINUE if connection should proceed and otherwise #LM_SSL_RESPONSE_STOP.
*/
typedef LmSSLResponse (* LmSSLFunction) (LmSSL *ssl,
LmSSLStatus status,
gpointer user_data);
LmSSL * lm_ssl_new (const gchar *expected_fingerprint,
LmSSLFunction ssl_function,
gpointer user_data,
GDestroyNotify notify);
gboolean lm_ssl_is_supported (void);
void lm_ssl_set_cipher_list (LmSSL *ssl,
const gchar *cipher_list);
void lm_ssl_set_ca (LmSSL *ssl,
const gchar *ca_path);
const gchar * lm_ssl_get_fingerprint (LmSSL *ssl);
void lm_ssl_use_starttls (LmSSL *ssl,
gboolean use_starttls,
gboolean require);
gboolean lm_ssl_get_use_starttls (LmSSL *ssl);
gboolean lm_ssl_get_require_starttls (LmSSL *ssl);
LmSSL * lm_ssl_ref (LmSSL *ssl);
void lm_ssl_unref (LmSSL *ssl);
G_END_DECLS
#endif /* __LM_SSL_H__ */
|