bufferevent_ssl.h (1.1.1.2) | bufferevent_ssl.h (1.1.1.3) |
---|---|
1/* $NetBSD: bufferevent_ssl.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $ */ 2/* $NetBSD: bufferevent_ssl.h,v 1.1.1.2 2015/01/29 06:38:27 spz Exp $ */ | 1/* $NetBSD: bufferevent_ssl.h,v 1.1.1.3 2017/01/31 21:14:53 christos Exp $ */ |
3/* 4 * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ | 2/* 3 * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ |
28#ifndef _EVENT2_BUFFEREVENT_SSL_H_ 29#define _EVENT2_BUFFEREVENT_SSL_H_ | 27#ifndef EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ 28#define EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ |
30 31/** @file event2/bufferevent_ssl.h 32 33 OpenSSL support for bufferevents. 34 */ | 29 30/** @file event2/bufferevent_ssl.h 31 32 OpenSSL support for bufferevents. 33 */ |
35 | 34#include <event2/visibility.h> |
36#include <event2/event-config.h> 37#include <event2/bufferevent.h> 38#include <event2/util.h> 39 40#ifdef __cplusplus 41extern "C" { 42#endif 43 --- 5 unchanged lines hidden (view full) --- 49 SSL bufferevent. 50 */ 51enum bufferevent_ssl_state { 52 BUFFEREVENT_SSL_OPEN = 0, 53 BUFFEREVENT_SSL_CONNECTING = 1, 54 BUFFEREVENT_SSL_ACCEPTING = 2 55}; 56 | 35#include <event2/event-config.h> 36#include <event2/bufferevent.h> 37#include <event2/util.h> 38 39#ifdef __cplusplus 40extern "C" { 41#endif 42 --- 5 unchanged lines hidden (view full) --- 48 SSL bufferevent. 49 */ 50enum bufferevent_ssl_state { 51 BUFFEREVENT_SSL_OPEN = 0, 52 BUFFEREVENT_SSL_CONNECTING = 1, 53 BUFFEREVENT_SSL_ACCEPTING = 2 54}; 55 |
57#if defined(_EVENT_HAVE_OPENSSL) || defined(_EVENT_IN_DOXYGEN) | 56#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_) |
58/** 59 Create a new SSL bufferevent to send its data over another bufferevent. 60 61 @param base An event_base to use to detect reading and writing. It 62 must also be the base for the underlying bufferevent. 63 @param underlying A socket to use for this SSL 64 @param ssl A SSL* object from openssl. 65 @param state The current state of the SSL connection 66 @param options One or more bufferevent_options 67 @return A new bufferevent on success, or NULL on failure 68*/ | 57/** 58 Create a new SSL bufferevent to send its data over another bufferevent. 59 60 @param base An event_base to use to detect reading and writing. It 61 must also be the base for the underlying bufferevent. 62 @param underlying A socket to use for this SSL 63 @param ssl A SSL* object from openssl. 64 @param state The current state of the SSL connection 65 @param options One or more bufferevent_options 66 @return A new bufferevent on success, or NULL on failure 67*/ |
68EVENT2_EXPORT_SYMBOL |
|
69struct bufferevent * 70bufferevent_openssl_filter_new(struct event_base *base, 71 struct bufferevent *underlying, 72 struct ssl_st *ssl, 73 enum bufferevent_ssl_state state, 74 int options); 75 76/** 77 Create a new SSL bufferevent to send its data over an SSL * on a socket. 78 79 @param base An event_base to use to detect reading and writing 80 @param fd A socket to use for this SSL 81 @param ssl A SSL* object from openssl. 82 @param state The current state of the SSL connection 83 @param options One or more bufferevent_options 84 @return A new bufferevent on success, or NULL on failure. 85*/ | 69struct bufferevent * 70bufferevent_openssl_filter_new(struct event_base *base, 71 struct bufferevent *underlying, 72 struct ssl_st *ssl, 73 enum bufferevent_ssl_state state, 74 int options); 75 76/** 77 Create a new SSL bufferevent to send its data over an SSL * on a socket. 78 79 @param base An event_base to use to detect reading and writing 80 @param fd A socket to use for this SSL 81 @param ssl A SSL* object from openssl. 82 @param state The current state of the SSL connection 83 @param options One or more bufferevent_options 84 @return A new bufferevent on success, or NULL on failure. 85*/ |
86EVENT2_EXPORT_SYMBOL |
|
86struct bufferevent * 87bufferevent_openssl_socket_new(struct event_base *base, 88 evutil_socket_t fd, 89 struct ssl_st *ssl, 90 enum bufferevent_ssl_state state, 91 int options); 92 | 87struct bufferevent * 88bufferevent_openssl_socket_new(struct event_base *base, 89 evutil_socket_t fd, 90 struct ssl_st *ssl, 91 enum bufferevent_ssl_state state, 92 int options); 93 |
94/** Control how to report dirty SSL shutdowns. 95 96 If the peer (or the network, or an attacker) closes the TCP 97 connection before closing the SSL channel, and the protocol is SSL >= v3, 98 this is a "dirty" shutdown. If allow_dirty_shutdown is 0 (default), 99 this is reported as BEV_EVENT_ERROR. 100 101 If instead allow_dirty_shutdown=1, a dirty shutdown is reported as 102 BEV_EVENT_EOF. 103 104 (Note that if the protocol is < SSLv3, you will always receive 105 BEV_EVENT_EOF, since SSL 2 and earlier cannot distinguish a secure 106 connection close from a dirty one. This is one reason (among many) 107 not to use SSL 2.) 108*/ 109 110EVENT2_EXPORT_SYMBOL 111int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev); 112EVENT2_EXPORT_SYMBOL 113void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev, 114 int allow_dirty_shutdown); 115 |
|
93/** Return the underlying openssl SSL * object for an SSL bufferevent. */ | 116/** Return the underlying openssl SSL * object for an SSL bufferevent. */ |
117EVENT2_EXPORT_SYMBOL |
|
94struct ssl_st * 95bufferevent_openssl_get_ssl(struct bufferevent *bufev); 96 97/** Tells a bufferevent to begin SSL renegotiation. */ | 118struct ssl_st * 119bufferevent_openssl_get_ssl(struct bufferevent *bufev); 120 121/** Tells a bufferevent to begin SSL renegotiation. */ |
122EVENT2_EXPORT_SYMBOL |
|
98int bufferevent_ssl_renegotiate(struct bufferevent *bev); 99 100/** Return the most recent OpenSSL error reported on an SSL bufferevent. */ | 123int bufferevent_ssl_renegotiate(struct bufferevent *bev); 124 125/** Return the most recent OpenSSL error reported on an SSL bufferevent. */ |
126EVENT2_EXPORT_SYMBOL |
|
101unsigned long bufferevent_get_openssl_error(struct bufferevent *bev); 102 103#endif 104 105#ifdef __cplusplus 106} 107#endif 108 | 127unsigned long bufferevent_get_openssl_error(struct bufferevent *bev); 128 129#endif 130 131#ifdef __cplusplus 132} 133#endif 134 |
109#endif /* _EVENT2_BUFFEREVENT_SSL_H_ */ | 135#endif /* EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ */ |