ekg2

plugins/irc/irc-ssl.h

Idź do dokumentacji tego pliku.
00001 #ifndef __EKG_IRC_SSL_H
00002 #define __EKG_IRC_SSL_H
00003 
00004 #include <ekg2-config.h>
00005 
00006 #ifdef IRC_HAVE_OPENSSL
00007 # define IRC_HAVE_SSL 1
00008 //# warning "support for ssl (using openssl) in irc plugin is in beta version, be prepared for unpredictable"
00009 #endif
00010 
00011 #ifdef IRC_HAVE_SSL
00012 
00013 # include <openssl/ssl.h>
00014 # include <openssl/err.h>
00015 
00016 extern SSL_CTX *ircSslCtx; /* irc.c */
00017 
00018 # define SSL_SESSION            SSL *
00019 
00020 # define SSL_INIT(session)              !(session = SSL_new(ircSslCtx))
00021 
00022 # define SSL_HELLO(session)             SSL_connect(session)
00023 # define SSL_BYE(session)               SSL_shutdown(session)
00024 # define SSL_DEINIT(session)            SSL_free(session)
00025 # define SSL_GLOBAL_INIT()              SSL_library_init(); ircSslCtx = SSL_CTX_new(SSLv23_client_method())
00026 # define SSL_GLOBAL_DEINIT()            SSL_CTX_free(ircSslCtx)
00027 # define SSL_ERROR(retcode)             ERR_error_string(retcode, NULL)         /* retcode need be value from SSL_get_error(session, res) */
00028 # define SSL_E_AGAIN(ret)               ((ret == SSL_ERROR_WANT_READ || ret == SSL_ERROR_WANT_WRITE))
00029 
00030 # define SSL_SEND(session, str, len)    SSL_write(session, str, len)
00031 # define SSL_RECV(session, buf, size)   SSL_read(session, buf, size)
00032 
00033 # define SSL_SET_FD(session, fd)        SSL_set_fd(session, fd)
00034 # define SSL_GET_FD(session, fd)                fd
00035 # define SSL_WRITE_DIRECTION(session, ret)      (ret != SSL_ERROR_WANT_READ)
00036 
00037 #endif          /* JABBER_HAVE_SSL */
00038 
00039 #endif          /* __EKG_JABBER_SSL_H */
00040 
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje