GNU libmicrohttpd  0.9.29
io.h File Reference

Signatures for IO functions. More...

#include "platform.h"
#include "io_openssl.h"
#include "io_raw.h"
Include dependency graph for io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* SPDYF_IOGlobalInit) ()
 
typedef void(* SPDYF_IOGlobalDeinit) ()
 
typedef int(* SPDYF_IOInit) (struct SPDY_Daemon *daemon)
 
typedef void(* SPDYF_IODeinit) (struct SPDY_Daemon *daemon)
 
typedef int(* SPDYF_IONewSession) (struct SPDY_Session *session)
 
typedef void(* SPDYF_IOCloseSession) (struct SPDY_Session *session)
 
typedef int(* SPDYF_IORecv) (struct SPDY_Session *session, void *buffer, size_t size)
 
typedef int(* SPDYF_IOSend) (struct SPDY_Session *session, const void *buffer, size_t size)
 
typedef int(* SPDYF_IOIsPending) (struct SPDY_Session *session)
 
typedef int(* SPDYF_IOBeforeWrite) (struct SPDY_Session *session)
 
typedef int(* SPDYF_IOAfterWrite) (struct SPDY_Session *session, int was_written)
 

Enumerations

enum  SPDY_IO_ERROR { SPDY_IO_ERROR_CLOSED = 0, SPDY_IO_ERROR_ERROR = -2, SPDY_IO_ERROR_AGAIN = -3 }
 

Functions

int SPDYF_io_set_daemon (struct SPDY_Daemon *daemon, enum SPDY_IO_SUBSYSTEM io_subsystem)
 
int SPDYF_io_set_session (struct SPDY_Session *session, enum SPDY_IO_SUBSYSTEM io_subsystem)
 

Detailed Description

Signatures for IO functions.

Author
Andrey Uzunov

Definition in file io.h.

Typedef Documentation

typedef int(* SPDYF_IOAfterWrite) (struct SPDY_Session *session, int was_written)

Called just after frames have been processed and written to the socket.

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 187 of file io.h.

typedef int(* SPDYF_IOBeforeWrite) (struct SPDY_Session *session)

Called just before frames are about to be processed and written to the socket.

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

Definition at line 174 of file io.h.

typedef void(* SPDYF_IOCloseSession) (struct SPDY_Session *session)

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

Parameters
sessionSPDY_Session whose socket is used

Definition at line 115 of file io.h.

typedef void(* SPDYF_IODeinit) (struct SPDY_Daemon *daemon)

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

Parameters
daemonSPDY_Daemon which is being stopped

Definition at line 94 of file io.h.

typedef void(* SPDYF_IOGlobalDeinit) ()

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

Definition at line 72 of file io.h.

typedef void(* SPDYF_IOGlobalInit) ()

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

Definition at line 63 of file io.h.

typedef int(* SPDYF_IOInit) (struct SPDY_Daemon *daemon)

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

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

Definition at line 84 of file io.h.

typedef int(* SPDYF_IOIsPending) (struct SPDY_Session *session)

Checks if there is data staying in the buffers of the underlying system that waits to be read. In case of TLS, this will call something like SSL_pending().

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

Definition at line 162 of file io.h.

typedef int(* SPDYF_IONewSession) (struct SPDY_Session *session)

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

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

Definition at line 105 of file io.h.

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

Reading from session's 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 connection 0 if the other party has closed the connection SPDY_IO_ERROR code on error

Definition at line 130 of file io.h.

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

Writing to session's socket. Writes the data given into the buffer to the 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 connection 0 if the other party has closed the connection SPDY_IO_ERROR code on error

Definition at line 148 of file io.h.

Enumeration Type Documentation

Used for return code when reading and writing to the TLS socket.

Enumerator
SPDY_IO_ERROR_CLOSED 

The connection was closed by the other party.

SPDY_IO_ERROR_ERROR 

Any kind of error ocurred. The session has to be closed.

SPDY_IO_ERROR_AGAIN 

The function had to return without processing any data. The whole cycle of events has to be called again (SPDY_run) as something either has to be written or read or the the syscall was interrupted by a signal.

Definition at line 36 of file io.h.

Function Documentation

int SPDYF_io_set_daemon ( struct SPDY_Daemon daemon,
enum SPDY_IO_SUBSYSTEM  io_subsystem 
)

Sets callbacks for the daemon with regard to the IO subsystem.

Parameters
daemon
io_subsystemthe IO subsystem that will be initialized and used by daemon.
Returns
SPDY_YES on success or SPDY_NO otherwise

Definition at line 32 of file io.c.

References SPDY_Daemon::fio_deinit, SPDY_Daemon::fio_init, SPDY_IO_SUBSYSTEM_NONE, SPDY_IO_SUBSYSTEM_OPENSSL, SPDY_IO_SUBSYSTEM_RAW, SPDY_NO, SPDY_YES, SPDYF_DEBUG, SPDYF_openssl_deinit(), SPDYF_openssl_init(), SPDYF_raw_deinit(), and SPDYF_raw_init().

Referenced by SPDYF_start_daemon_va().

Here is the call graph for this function:

Here is the caller graph for this function:

int SPDYF_io_set_session ( struct SPDY_Session session,
enum SPDY_IO_SUBSYSTEM  io_subsystem 
)