src/microspdy/io_openssl.c File Reference

TLS handling using libssl. The current code assumes that blocking I/O is in use. More...

#include "platform.h"
#include "internal.h"
#include "session.h"
#include "io_openssl.h"
Include dependency graph for io_openssl.c:

Go to the source code of this file.

Functions

static int spdyf_next_protos_advertised_cb (SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg)
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 using libssl. The current code assumes that blocking I/O is in use.

Author:
Andrey Uzunov

Definition in file io_openssl.c.


Function Documentation

static int spdyf_next_protos_advertised_cb ( SSL *  ssl,
const unsigned char **  out,
unsigned int *  outlen,
void *  arg 
) [static]

Callback to advertise spdy ver. 3 in Next Protocol Negotiation

Parameters:
ssl openssl context for a connection
out must be set to the raw data that is advertised in NPN
outlen must be set to size of out
arg 
Returns:
SSL_TLSEXT_ERR_OK to do advertising

Definition at line 42 of file io_openssl.c.

Referenced by SPDYF_openssl_init().

Here is the caller graph for this function:

int SPDYF_openssl_after_write ( struct SPDY_Session session,
int  was_written 
)

Nothing.

Parameters:
session 
was_written has 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 276 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 267 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:
session SPDY_Session whose socket is used by openssl

Definition at line 171 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:
daemon SPDY_Daemon which is being stopped

Definition at line 128 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:
daemon SPDY_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:
session which is checked
Returns:
SPDY_YES if data is pending or SPDY_NO otherwise

Definition at line 256 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:
session SPDY_Session whose socket will be used by openssl
Returns:
SPDY_NO if some openssl funcs fail. SPDY_YES otherwise

Definition at line 135 of file io_openssl.c.

References SPDY_Session::daemon, SPDY_Daemon::io_context, SPDY_Session::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:
session for which data is received
buffer where data from the socket will be written to
size of 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 185 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:
session whose context is used
buffer from where data will be written to the socket
size number 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 220 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:


Generated on 15 Oct 2014 for GNU libmicrohttpd by  doxygen 1.6.1