src/microspdy/io.h File Reference
Signatures for IO functions.
More...
#include "platform.h"
#include "io_openssl.h"
#include "io_raw.h"
Go to the source code of this file.
Detailed Description
Signatures for IO functions.
- Author:
- Andrey Uzunov
Definition in file io.h.
Typedef Documentation
Called just after frames have been processed and written to the socket.
- 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 187 of file io.h.
Called just before frames are about to be processed and written to the socket.
- Parameters:
-
- Returns:
- SPDY_NO if writing must not happen in the call; SPDY_YES otherwise
Definition at line 174 of file io.h.
Deinitializing io for a specific connection. Should be called closing session's socket.
- Parameters:
-
Definition at line 115 of file io.h.
Deinitializing io context for a daemon. Should be called when the deamon is stopped.
- Parameters:
-
Definition at line 94 of file io.h.
Global deinitializing for the whole program. Should be called at the end of the program.
Definition at line 72 of file io.h.
Global initializing. Must be called only once in the program.
Definition at line 63 of file io.h.
Initializing of io context for a specific daemon. Must be called when the daemon starts.
- Parameters:
-
| daemon | SPDY_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.
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:
-
- Returns:
- SPDY_YES if data is pending or SPDY_NO otherwise
Definition at line 162 of file io.h.
Initializing io for a specific connection. Must be called after the connection has been accepted.
- Parameters:
-
- Returns:
- SPDY_NO if some funcs inside fail. SPDY_YES otherwise
Definition at line 105 of file io.h.
Reading from session's 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 connection 0 if the other party has closed the connection SPDY_IO_ERROR code on error
Definition at line 130 of file io.h.
Writing to session's socket. Writes the data given into the buffer to the 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 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
Sets callbacks for the daemon with regard to the IO subsystem.
- Parameters:
-
| daemon | |
| io_subsystem | the 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().
Sets callbacks for the session with regard to the IO subsystem.
- Parameters:
-
| session | |
| io_subsystem | the IO subsystem that will be initialized and used by session. |
- Returns:
- SPDY_YES on success or SPDY_NO otherwise
Definition at line 58 of file io.c.
References SPDY_Session::fio_after_write, SPDY_Session::fio_before_write, SPDY_Session::fio_close_session, SPDY_Session::fio_is_pending, SPDY_Session::fio_new_session, SPDY_Session::fio_recv, SPDY_Session::fio_send, SPDY_IO_SUBSYSTEM_NONE, SPDY_IO_SUBSYSTEM_OPENSSL, SPDY_IO_SUBSYSTEM_RAW, SPDY_NO, SPDY_YES, SPDYF_DEBUG, SPDYF_openssl_after_write(), SPDYF_openssl_before_write(), SPDYF_openssl_close_session(), SPDYF_openssl_is_pending(), SPDYF_openssl_new_session(), SPDYF_openssl_recv(), SPDYF_openssl_send(), SPDYF_raw_after_write(), SPDYF_raw_before_write(), SPDYF_raw_close_session(), SPDYF_raw_is_pending(), SPDYF_raw_new_session(), SPDYF_raw_recv(), and SPDYF_raw_send().
Referenced by SPDYF_session_accept().