libevent: event2/bufferevent_ssl.h Source File

libevent 2.1.13 Event notification library

Loading...
Searching...
No Matches
bufferevent_ssl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26#ifndef EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
27#define EVENT2_BUFFEREVENT_SSL_H_INCLUDED_
28
33#include <event2/visibility.h>
34#include <event2/event-config.h>
35#include <event2/bufferevent.h>
36#include <event2/util.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/* This is what openssl's SSL objects are underneath. */
43struct ssl_st;
44
49 enum bufferevent_ssl_state {
50 BUFFEREVENT_SSL_OPEN = 0,
51 BUFFEREVENT_SSL_CONNECTING = 1,
52 BUFFEREVENT_SSL_ACCEPTING = 2
53};
54
55#if defined(EVENT__HAVE_OPENSSL) || defined(EVENT_IN_DOXYGEN_)
67EVENT2_EXPORT_SYMBOL
68struct bufferevent *
69bufferevent_openssl_filter_new(struct event_base *base,
70 struct bufferevent *underlying,
71 struct ssl_st *ssl,
72 enum bufferevent_ssl_state state,
73 int options);
74
85EVENT2_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
108
109EVENT2_EXPORT_SYMBOL
110 int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev);
111EVENT2_EXPORT_SYMBOL
112void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
113 int allow_dirty_shutdown);
114
116EVENT2_EXPORT_SYMBOL
117struct ssl_st *
118bufferevent_openssl_get_ssl(struct bufferevent *bufev);
119
121EVENT2_EXPORT_SYMBOL
122 int bufferevent_ssl_renegotiate(struct bufferevent *bev);
123
125EVENT2_EXPORT_SYMBOL
126 unsigned long bufferevent_get_openssl_error(struct bufferevent *bev);
127
128#endif
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* EVENT2_BUFFEREVENT_SSL_H_INCLUDED_ */
bufferevent.h
Functions for buffering data for network sending or receiving.
bufferevent_get_openssl_error
EVENT2_EXPORT_SYMBOL unsigned long bufferevent_get_openssl_error(struct bufferevent *bev)
Return the most recent OpenSSL error reported on an SSL bufferevent.
bufferevent_openssl_get_ssl
EVENT2_EXPORT_SYMBOL struct ssl_st * bufferevent_openssl_get_ssl(struct bufferevent *bufev)
Return the underlying openssl SSL * object for an SSL bufferevent.
bufferevent_ssl_renegotiate
EVENT2_EXPORT_SYMBOL int bufferevent_ssl_renegotiate(struct bufferevent *bev)
Tells a bufferevent to begin SSL renegotiation.
bufferevent_openssl_socket_new
EVENT2_EXPORT_SYMBOL struct bufferevent * bufferevent_openssl_socket_new(struct event_base *base, evutil_socket_t fd, struct ssl_st *ssl, enum bufferevent_ssl_state state, int options)
Create a new SSL bufferevent to send its data over an SSL * on a socket.
bufferevent_ssl_state
bufferevent_ssl_state
The state of an SSL object to be used when creating a new SSL bufferevent.
Definition bufferevent_ssl.h:49
bufferevent_openssl_get_allow_dirty_shutdown
EVENT2_EXPORT_SYMBOL int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev)
Control how to report dirty SSL shutdowns.
bufferevent_openssl_filter_new
EVENT2_EXPORT_SYMBOL struct bufferevent * bufferevent_openssl_filter_new(struct event_base *base, struct bufferevent *underlying, struct ssl_st *ssl, enum bufferevent_ssl_state state, int options)
Create a new SSL bufferevent to send its data over another bufferevent.
bufferevent
An opaque type for handling buffered IO.
Definition bufferevent.h:115
event_base
Structure to hold information and state for a Libevent dispatch loop.
Definition event.h:219
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition util.h:310