1 #ifndef __EKG_JABBER_SSL_H 2 #define __EKG_JABBER_SSL_H 5 # define JABBER_HAVE_SSL 1 9 # define JABBER_HAVE_SSL 1 10 # warning "You want to use OpenSSL library as ssl transport layer for jabber, it have bugs and is not well tested.. It's better if you use gnutls" 14 #ifdef JABBER_HAVE_SSL 17 # include <gnutls/gnutls.h> 20 # define SSL_SESSION gnutls_session 22 static int __attribute__((unused)) SSL_SET_FD(SSL_SESSION session,
long int fd) {
23 gnutls_transport_set_ptr(session, (gnutls_transport_ptr)(fd));
27 # define SSL_INIT(session) gnutls_init((&session), GNUTLS_CLIENT) 28 # define SSL_DEINIT(session) gnutls_deinit(session) 29 # define SSL_HELLO(session) gnutls_handshake(session) 30 # define SSL_BYE(session) gnutls_bye(session, GNUTLS_SHUT_RDWR) 31 # define SSL_GLOBAL_INIT() gnutls_global_init() 32 # define SSL_GLOBAL_DEINIT() gnutls_global_deinit() 33 # define SSL_ERROR(retcode) gnutls_strerror(retcode) 34 # define SSL_E_AGAIN(ret) ((ret == GNUTLS_E_INTERRUPTED) || (ret == GNUTLS_E_AGAIN)) 36 # define SSL_SEND(session, str, len) gnutls_record_send(session, str, len) 37 # define SSL_RECV(session, buf, size) gnutls_record_recv(session, buf, size) 39 # define SSL_GET_FD(session, fd) (long int) gnutls_transport_get_ptr(session) 40 # define SSL_WRITE_DIRECTION(session, ret) gnutls_record_get_direction(session) 43 # include <openssl/ssl.h> 44 # include <openssl/err.h> 46 extern SSL_CTX *jabberSslCtx;
48 # define SSL_SESSION SSL * 50 # define SSL_INIT(session) !(session = SSL_new(jabberSslCtx)) 52 # define SSL_HELLO(session) SSL_connect(session) 53 # define SSL_BYE(session) SSL_shutdown(session) 54 # define SSL_DEINIT(session) SSL_free(session) 55 # define SSL_GLOBAL_INIT() SSL_library_init(); jabberSslCtx = SSL_CTX_new(SSLv23_client_method()) 56 # define SSL_GLOBAL_DEINIT() SSL_CTX_free(jabberSslCtx) 57 # define SSL_ERROR(retcode) ERR_error_string(retcode, NULL) 58 # define SSL_E_AGAIN(ret) ((ret == SSL_ERROR_WANT_READ || ret == SSL_ERROR_WANT_WRITE)) 60 # define SSL_SEND(session, str, len) SSL_write(session, str, len) 61 # define SSL_RECV(session, buf, size) SSL_read(session, buf, size) 63 # define SSL_SET_FD(session, fd) SSL_set_fd(session, fd) 64 # define SSL_GET_FD(session, fd) fd 65 # define SSL_WRITE_DIRECTION(session, ret) (ret != SSL_ERROR_WANT_READ) struct _gim_host __attribute__
Definition: commands.c:66