daemon functionality More...
#include "platform.h"
Go to the source code of this file.
Functions | |
struct SPDY_Daemon * | SPDYF_start_daemon_va (uint16_t port, const char *certfile, const char *keyfile, SPDY_NewSessionCallback nscb, SPDY_SessionClosedCallback sccb, SPDY_NewRequestCallback nrcb, SPDY_NewDataCallback npdcb, SPDYF_NewStreamCallback fnscb, SPDYF_NewDataCallback fndcb, void *cls, void *fcls, va_list valist) |
void | SPDYF_run (struct SPDY_Daemon *daemon) |
int | SPDYF_get_timeout (struct SPDY_Daemon *daemon, unsigned long long *timeout) |
int | SPDYF_get_fdset (struct SPDY_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set, bool all) |
void | SPDYF_stop_daemon (struct SPDY_Daemon *daemon) |
Variables | |
enum SPDY_IO_SUBSYSTEM | spdyf_io_initialized |
daemon functionality
Definition in file daemon.h.
int SPDYF_get_fdset | ( | struct SPDY_Daemon * | daemon, | |
fd_set * | read_fd_set, | |||
fd_set * | write_fd_set, | |||
fd_set * | except_fd_set, | |||
bool | all | |||
) |
Obtain the select sets for this daemon. The idea of SPDYF_get_fdset is to return such descriptors that the select in the application can return and SPDY_run can be called only when this is really needed. That means not all sockets will be added to write_fd_set.
daemon | daemon to get sets from | |
read_fd_set | read set | |
write_fd_set | write set | |
except_fd_set | except set | |
all | add all session's descriptors to write_fd_set or not |
Definition at line 432 of file daemon.c.
References SPDY_Session::fio_is_pending, SPDY_Session::last_activity, SPDY_Session::next, NULL, SPDY_Session::read_buffer_beginning, SPDY_Session::read_buffer_offset, SPDY_Session::response_queue_head, SPDY_Daemon::session_timeout, SPDY_Daemon::sessions_head, SPDY_Session::socket_fd, SPDY_Daemon::socket_fd, SPDY_SESSION_STATUS_CLOSING, SPDY_YES, SPDYF_monotonic_time(), SPDY_Session::status, and SPDY_Session::write_buffer.
Referenced by SPDY_get_fdset(), and SPDYF_run().
int SPDYF_get_timeout | ( | struct SPDY_Daemon * | daemon, | |
unsigned long long * | timeout | |||
) |
Obtain timeout value for select for this daemon. The returned value is how long select should at most block, not the timeout value set for connections.
daemon | daemon to query for timeout | |
timeout | set to the timeout (in milliseconds) |
Definition at line 392 of file daemon.c.
References SPDY_Session::fio_is_pending, SPDY_Session::last_activity, SPDY_Session::next, NULL, SPDY_Daemon::session_timeout, SPDY_Daemon::sessions_head, SPDY_NO, SPDY_YES, and SPDYF_monotonic_time().
Referenced by SPDY_get_timeout().
void SPDYF_run | ( | struct SPDY_Daemon * | daemon | ) |
Run webserver operations (without blocking unless in client callbacks). This method must be called in the client event loop.
daemon | daemon to run |
Definition at line 474 of file daemon.c.
References SPDY_Session::fio_is_pending, SPDY_Session::next, NULL, SPDY_Daemon::sessions_head, SPDY_Session::socket_fd, SPDY_Daemon::socket_fd, SPDY_NO, spdyf_cleanup_sessions(), SPDYF_get_fdset(), SPDYF_session_accept(), SPDYF_session_idle(), SPDYF_session_read(), and SPDYF_session_write().
Referenced by SPDY_run().
struct SPDY_Daemon* SPDYF_start_daemon_va | ( | uint16_t | port, | |
const char * | certfile, | |||
const char * | keyfile, | |||
SPDY_NewSessionCallback | nscb, | |||
SPDY_SessionClosedCallback | sccb, | |||
SPDY_NewRequestCallback | nrcb, | |||
SPDY_NewDataCallback | npdcb, | |||
SPDYF_NewStreamCallback | fnscb, | |||
SPDYF_NewDataCallback | fndcb, | |||
void * | cls, | |||
void * | fcls, | |||
va_list | valist | |||
) | [read] |
Start a SPDDY webserver on the given port.
port | port to bind to | |
certfile | path to the certificate that will be used by server | |
keyfile | path to the keyfile for the certificate | |
nscb | callback called when a new SPDY session is established by a client | |
sccb | callback called when a client closes the session | |
nrcb | callback called when a client sends request | |
npdcb | callback called when HTTP POST params are received after request | |
fnscb | callback called when new stream is opened by a client | |
fndcb | callback called when new data -- within a data frame -- is received by the server | |
cls | extra argument to all of the callbacks without those specific only for the framing layer | |
fcls | extra argument to all of the callbacks, specific only for the framing layer (those vars starting with 'f'). | |
valist | va_list of options (type-value pairs, terminated with SPDY_DAEMON_OPTION_END). |
Definition at line 170 of file daemon.c.
References SPDY_Daemon::address, SPDY_Daemon::certfile, SPDY_Daemon::cls, SPDY_Daemon::fcls, SPDY_Daemon::fio_init, SPDY_Daemon::flags, SPDY_Daemon::fnew_stream_cb, SPDY_Daemon::freceived_data_cb, SPDY_Daemon::io_subsystem, SPDY_Daemon::keyfile, SPDY_Daemon::max_num_frames, SPDY_Daemon::new_request_cb, SPDY_Daemon::new_session_cb, NULL, SPDY_Daemon::port, SPDY_Daemon::received_data_cb, SPDY_Daemon::session_closed_cb, SPDY_Daemon::socket_fd, SPDY_DAEMON_FLAG_ONLY_IPV6, SPDY_IO_SUBSYSTEM_OPENSSL, SPDY_IO_SUBSYSTEM_RAW, SPDY_YES, SPDYF_DEBUG, SPDYF_io_set_daemon(), SPDYF_NUM_SENT_FRAMES_AT_ONCE, and spdyf_parse_options_va().
Referenced by SPDY_start_daemon().
void SPDYF_stop_daemon | ( | struct SPDY_Daemon * | daemon | ) |
Shutdown the daemon.
daemon | daemon to stop |
Definition at line 373 of file daemon.c.
References SPDY_Daemon::address, SPDY_Daemon::certfile, SPDY_Daemon::fio_deinit, SPDY_Daemon::keyfile, SPDY_Daemon::options, SPDY_Daemon::socket_fd, SPDY_DAEMON_OPTION_SOCK_ADDR, and spdyf_close_all_sessions().
Referenced by SPDY_stop_daemon().
Global flags containing the initialized IO subsystems.
Definition at line 34 of file daemon.h.
Referenced by SPDY_deinit(), SPDY_init(), and SPDY_start_daemon().