GNU libmicrohttpd  0.9.29
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
io_openssl.h File Reference

TLS handling. openssl with NPN is used, but as long as the functions conform to this interface file, other libraries can be used. More...

#include "platform.h"
#include "io.h"
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/rand.h>
Include dependency graph for io_openssl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void SPDYF_openssl_global_init ()
 
void SPDYF_openssl_global_deinit ()
 
int SPDYF_openssl_init (struct SPDY_Daemon *daemon)
 
void SPDYF_openssl_deinit (struct SPDY_Daemon *daemon)
 
int SPDYF_openssl_new_session (struct SPDY_Session *session)
 
void SPDYF_openssl_close_session (struct SPDY_Session *session)
 
int SPDYF_openssl_recv (struct SPDY_Session *session, void *buffer, size_t size)
 
int SPDYF_openssl_send (struct SPDY_Session *session, const void *buffer, size_t size)
 
int SPDYF_openssl_is_pending (struct SPDY_Session *session)
 
int SPDYF_openssl_before_write (struct SPDY_Session *session)
 
int SPDYF_openssl_after_write (struct SPDY_Session *session, int was_written)
 

Detailed Description

TLS handling. openssl with NPN is used, but as long as the functions conform to this interface file, other libraries can be used.

Author
Andrey Uzunov

Definition in file io_openssl.h.

Function Documentation

int SPDYF_openssl_after_write ( struct SPDY_Session session,
int  was_written 
)

Nothing.

Parameters
session
was_writtenhas the same value as the write function for the session will return
Returns
returned value will be used by the write function to return

Definition at line 275 of file io_openssl.c.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function:

int SPDYF_openssl_before_write ( struct SPDY_Session session)

Nothing.

Parameters
session
Returns
SPDY_NO if writing must not happen in the call; SPDY_YES otherwise

Definition at line 266 of file io_openssl.c.

References SPDY_YES.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function:

void SPDYF_openssl_close_session ( struct SPDY_Session session)

Deinitializing openssl for a specific connection. Should be called closing session's socket.

Parameters
sessionSPDY_Session whose socket is used by openssl

Definition at line 170 of file io_openssl.c.

References SPDY_Session::io_context.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function:

void SPDYF_openssl_deinit ( struct SPDY_Daemon daemon)

Deinitializing openssl for a daemon. Should be called when the deamon is stopped.

Parameters
daemonSPDY_Daemon which is being stopped

Definition at line 127 of file io_openssl.c.

References SPDY_Daemon::io_context.

Referenced by SPDYF_io_set_daemon().

Here is the caller graph for this function:

void SPDYF_openssl_global_deinit ( )

Global deinitializing of openssl for the whole program. Should be called at the end of the program.

Definition at line 68 of file io_openssl.c.

Referenced by SPDY_deinit().

Here is the caller graph for this function:

void SPDYF_openssl_global_init ( )

Global initializing of openssl. Must be called only once in the program.

Definition at line 56 of file io_openssl.c.

Referenced by SPDY_init().

Here is the caller graph for this function:

int SPDYF_openssl_init ( struct SPDY_Daemon daemon)

Initializing of openssl for a specific daemon. Must be called when the daemon starts.

Parameters
daemonSPDY_Daemon for which openssl will be used. Daemon's certificate and key file are used.
Returns
SPDY_YES on success or SPDY_NO on error

Definition at line 78 of file io_openssl.c.

References SPDY_Daemon::certfile, SPDY_Daemon::io_context, SPDY_Daemon::keyfile, NULL, SPDY_NO, SPDY_YES, SPDYF_DEBUG, and spdyf_next_protos_advertised_cb().

Referenced by SPDYF_io_set_daemon().

Here is the call graph for this function:

Here is the caller graph for this function:

int SPDYF_openssl_is_pending ( struct SPDY_Session session)

Checks if there is data staying in the buffers of the underlying system that waits to be read.

Parameters
sessionwhich is checked
Returns
SPDY_YES if data is pending or SPDY_NO otherwise

Definition at line 255 of file io_openssl.c.

References SPDY_Session::io_context, SPDY_NO, and SPDY_YES.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function:

int SPDYF_openssl_new_session ( struct SPDY_Session session)

Initializing openssl for a specific connection. Must be called after the connection has been accepted.

Parameters
sessionSPDY_Session whose socket will be used by openssl
Returns
SPDY_NO if some openssl funcs fail. SPDY_YES otherwise

Definition at line 134 of file io_openssl.c.

References SPDY_Session::daemon, SPDY_Session::io_context, SPDY_Daemon::io_context, NULL, SPDY_Session::socket_fd, SPDY_NO, SPDY_YES, and SPDYF_DEBUG.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function:

int SPDYF_openssl_recv ( struct SPDY_Session session,
void *  buffer,
size_t  size 
)

Reading from a TLS socket. Reads available data and put it to the buffer.

Parameters
sessionfor which data is received
bufferwhere data from the socket will be written to
sizeof the buffer
Returns
number of bytes (at most size) read from the TLS connection 0 if the other party has closed the connection SPDY_IO_ERROR code on error

Definition at line 184 of file io_openssl.c.

References SPDY_Session::io_context, SPDY_IO_ERROR_AGAIN, and SPDY_IO_ERROR_ERROR.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function:

int SPDYF_openssl_send ( struct SPDY_Session session,
const void *  buffer,
size_t  size 
)

Writing to a TLS socket. Writes the data given into the buffer to the TLS socket.

Parameters
sessionwhose context is used
bufferfrom where data will be written to the socket
sizenumber of bytes to be taken from the buffer
Returns
number of bytes (at most size) from the buffer that has been written to the TLS connection 0 if the other party has closed the connection SPDY_IO_ERROR code on error

Definition at line 219 of file io_openssl.c.

References SPDY_Session::io_context, SPDY_IO_ERROR_AGAIN, and SPDY_IO_ERROR_ERROR.

Referenced by SPDYF_io_set_session().

Here is the caller graph for this function: