loudmouth/inc/loudmouth/lm-ssl.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
       
     2 /*
       
     3  * Copyright (C) 2003-2004 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, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 #ifndef __LM_SSL_H__
       
    22 #define __LM_SSL_H__
       
    23 
       
    24 #include <glib.h>
       
    25 
       
    26 #if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
       
    27 #error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
       
    28 #endif
       
    29 
       
    30 G_BEGIN_DECLS
       
    31 
       
    32 typedef struct _LmSSL LmSSL;
       
    33 
       
    34 typedef enum {
       
    35 	LM_CERT_INVALID,
       
    36 	LM_CERT_ISSUER_NOT_FOUND,
       
    37 	LM_CERT_REVOKED
       
    38 } LmCertificateStatus;
       
    39 
       
    40 typedef enum {
       
    41 	LM_SSL_STATUS_NO_CERT_FOUND,	
       
    42 	LM_SSL_STATUS_UNTRUSTED_CERT,
       
    43 	LM_SSL_STATUS_CERT_EXPIRED,
       
    44 	LM_SSL_STATUS_CERT_NOT_ACTIVATED,
       
    45 	LM_SSL_STATUS_CERT_HOSTNAME_MISMATCH,			
       
    46 	LM_SSL_STATUS_CERT_FINGERPRINT_MISMATCH,			
       
    47 	LM_SSL_STATUS_GENERIC_ERROR
       
    48 } LmSSLStatus;
       
    49 
       
    50 typedef enum {
       
    51 	LM_SSL_RESPONSE_CONTINUE,
       
    52 	LM_SSL_RESPONSE_STOP
       
    53 } LmSSLResponse;
       
    54 
       
    55 typedef LmSSLResponse (* LmSSLFunction)      (LmSSL        *ssl,
       
    56 					      LmSSLStatus   status,
       
    57 					      gpointer      user_data);
       
    58 
       
    59 IMPORT_C LmSSL *               lm_ssl_new             (const gchar *expected_fingerprint,
       
    60 					      LmSSLFunction   ssl_function,
       
    61 					      gpointer        user_data,
       
    62 					      GDestroyNotify  notify);
       
    63 
       
    64 IMPORT_C gboolean              lm_ssl_is_supported    (void);
       
    65 
       
    66 IMPORT_C const gchar *         lm_ssl_get_fingerprint (LmSSL          *ssl);
       
    67 
       
    68 IMPORT_C void                  lm_ssl_use_starttls    (LmSSL *ssl,
       
    69 					      gboolean use_starttls,
       
    70 					      gboolean require);
       
    71 
       
    72 gboolean              lm_ssl_get_use_starttls (LmSSL *ssl);
       
    73 
       
    74 gboolean              lm_ssl_get_require_starttls (LmSSL *ssl);
       
    75 
       
    76 IMPORT_C LmSSL *               lm_ssl_ref             (LmSSL          *ssl);
       
    77 IMPORT_C void                  lm_ssl_unref           (LmSSL          *ssl);
       
    78 
       
    79 G_END_DECLS
       
    80 
       
    81 #endif /* __LM_SSL_H__ */