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

daemon functionality More...

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

Go to the source code of this file.

Functions

struct SPDY_DaemonSPDYF_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
 

Detailed Description

daemon functionality

Author
Andrey Uzunov

Definition in file daemon.h.

Function Documentation

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.

Parameters
daemondaemon to get sets from
read_fd_setread set
write_fd_setwrite set
except_fd_setexcept set
alladd all session's descriptors to write_fd_set or not
Returns
largest FD added

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
daemondaemon to query for timeout
timeoutset to the timeout (in milliseconds)
Returns
SPDY_YES on success, SPDY_NO if no connections exist that would necessiate the use of a timeout right now

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
daemondaemon 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
portport to bind to
certfilepath to the certificate that will be used by server
keyfilepath to the keyfile for the certificate
nscbcallback called when a new SPDY session is established by a client
sccbcallback called when a client closes the session
nrcbcallback called when a client sends request
npdcbcallback called when HTTP POST params are received after request
fnscbcallback called when new stream is opened by a client
fndcbcallback called when new data – within a data frame – is received by the server
clsextra argument to all of the callbacks without those specific only for the framing layer
fclsextra argument to all of the callbacks, specific only for the framing layer (those vars starting with 'f').
valistva_list of options (type-value pairs, terminated with SPDY_DAEMON_OPTION_END).
Returns
NULL on error, handle to daemon on success

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void SPDYF_stop_daemon ( struct SPDY_Daemon daemon)

Shutdown the daemon.

Parameters
daemondaemon 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().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

enum SPDY_IO_SUBSYSTEM spdyf_io_initialized

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().