From 8d21ddcf4b5d804565f686ab6577b933a993054f Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 1 Nov 2020 00:59:16 +0300 Subject: [PATCH] Fix bufferevent_ssl_*flags() w/ disabled OpenSSL but enabled mbedTLS --- include/event2/bufferevent_ssl.h | 53 +++++++++++++++++--------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/include/event2/bufferevent_ssl.h b/include/event2/bufferevent_ssl.h index 355b632d..8cc35732 100644 --- a/include/event2/bufferevent_ssl.h +++ b/include/event2/bufferevent_ssl.h @@ -78,6 +78,34 @@ enum bufferevent_ssl_state { */ #define BUFFEREVENT_SSL_BATCH_WRITE 2 +#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT__HAVE_MBEDTLS) +/** + * Get flags of the SSL bufferevent. + * + * @see BUFFEREVENT_SSL_* + * @return flags or SIZE_MAX in case of error (if bufferevent is not SSL). + */ +EVENT2_EXPORT_SYMBOL +ev_uint64_t bufferevent_ssl_get_flags(struct bufferevent *bev); +/** Change the flags that are set for an ssl bufferevent by adding more. + * + * @param bev the ssl bufferevent. + * @param flags One or more BUFFEREVENT_SSL_* options + * @return old flags success, EV_UINT64_MAX on failure. + */ +EVENT2_EXPORT_SYMBOL +ev_uint64_t bufferevent_ssl_set_flags(struct bufferevent *bev, ev_uint64_t flags); +/** Change the flags that are set for an ssl bufferevent by removing some. + * + * @param bev the bufferevent. + * @param flags One or more BUFFEREVENT_SSL_* options + * @return old flags success, EV_UINT64_MAX on failure. + */ +EVENT2_EXPORT_SYMBOL +ev_uint64_t bufferevent_ssl_clear_flags(struct bufferevent *bev, ev_uint64_t flags); + +#endif /* defined(EVENT__HAVE_OPENSSL) || defined(EVENT__HAVE_MBEDTLS) */ + #if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_) /* This is what openssl's SSL objects are underneath. */ struct ssl_st; @@ -139,31 +167,6 @@ EVENT2_EXPORT_SYMBOL void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev, int allow_dirty_shutdown); -/** - * Get flags of the SSL bufferevent. - * - * @see BUFFEREVENT_SSL_* - * @return flags or SIZE_MAX in case of error (if bufferevent is not SSL). - */ -EVENT2_EXPORT_SYMBOL -ev_uint64_t bufferevent_ssl_get_flags(struct bufferevent *bev); -/** Change the flags that are set for an ssl bufferevent by adding more. - * - * @param bev the ssl bufferevent. - * @param flags One or more BUFFEREVENT_SSL_* options - * @return old flags success, EV_UINT64_MAX on failure. - */ -EVENT2_EXPORT_SYMBOL -ev_uint64_t bufferevent_ssl_set_flags(struct bufferevent *bev, ev_uint64_t flags); -/** Change the flags that are set for an ssl bufferevent by removing some. - * - * @param bev the bufferevent. - * @param flags One or more BUFFEREVENT_SSL_* options - * @return old flags success, EV_UINT64_MAX on failure. - */ -EVENT2_EXPORT_SYMBOL -ev_uint64_t bufferevent_ssl_clear_flags(struct bufferevent *bev, ev_uint64_t flags); - /** Return the underlying openssl SSL * object for an SSL bufferevent. */ EVENT2_EXPORT_SYMBOL struct ssl_st *