1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Copyright (C) 2000-2003, Ximian, Inc. 4 */ 5 6 #ifndef SSL_H 7 #define SSL_H 1 8 9 /** 10 * @file 11 * @brief SSL 12 */ 13 14 #include <glib.h> 15 16 /** 17 * SSLType: 18 * @SSL_TYPE_CLIENT: the client side of an SSL connection 19 * @SSL_TYPE_SERVER: the server side of an SSL connection 20 * 21 * What kind of SSL connection this is. 22 **/ 23 typedef enum { 24 SSL_TYPE_CLIENT = 0, 25 SSL_TYPE_SERVER 26 } SSLType; 27 28 gpointer ssl_get_client_credentials (const char *ca_file); 29 void ssl_free_client_credentials (gpointer creds); 30 gpointer ssl_get_server_credentials (const char *cert_file, 31 const char *key_file); 32 void ssl_free_server_credentials (gpointer creds); 33 34 GIOChannel *ssl_wrap_iochannel (GIOChannel *sock, 35 SSLType type, 36 const char *remote_host, 37 gpointer credentials); 38 39 #define SSL_ERROR ssl_error_quark() 40 41 GQuark ssl_error_quark (void); 42 43 typedef enum { 44 SSL_ERROR_HANDSHAKE_NEEDS_READ, 45 SSL_ERROR_HANDSHAKE_NEEDS_WRITE, 46 SSL_ERROR_CERTIFICATE, 47 } SocketError; 48 49 void ssl_cert_generate(const char *keyfile, const char *certfile, 50 const char *cafile); 51 52 gpointer ssl_create_server_credentials(const char *config_dir, 53 GKeyFile *kf, const char *group); 54 55 #endif /* SSL_H */ 56