GNU libmicrohttpd
0.9.29
|
public interface to libmicrospdy More...
#include <zlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
Go to the source code of this file.
Typedefs | |
typedef void(* | SPDY_PanicCallback )(void *cls, const char *file, unsigned int line, const char *reason) |
typedef void(* | SPDY_NewSessionCallback )(void *cls, struct SPDY_Session *session) |
typedef void(* | SPDY_SessionClosedCallback )(void *cls, struct SPDY_Session *session, int by_client) |
typedef int(* | SPDY_NameValueIterator )(void *cls, const char *name, const char *const *value, int num_values) |
typedef void(* | SPDY_NewRequestCallback )(void *cls, struct SPDY_Request *request, uint8_t priority, const char *method, const char *path, const char *version, const char *host, const char *scheme, struct SPDY_NameValue *headers, bool more) |
typedef int(* | SPDY_NewDataCallback )(void *cls, struct SPDY_Request *request, const void *buf, size_t size, bool more) |
typedef ssize_t(* | SPDY_ResponseCallback )(void *cls, void *buffer, size_t max, bool *more) |
typedef void(* | SPDY_ResponseResultCallback )(void *cls, struct SPDY_Response *response, struct SPDY_Request *request, enum SPDY_RESPONSE_RESULT status, bool streamopened) |
typedef void(* | SPDY_PingCallback )(void *cls, struct SPDY_Session *session, struct timeval *rtt) |
typedef int(* | SPDY_SettingsIterator )(void *cls, enum SPDY_SETTINGS id, int32_t value, uint8_t flags) |
typedef void(* | SPDY_SettingsReceivedCallback )(struct SPDY_Session *session, struct SPDY_Settings *settings, uint8_t flags,...) |
Functions | |
_MHD_EXTERN int() | SPDY_init (enum SPDY_IO_SUBSYSTEM io_subsystem,...) |
_MHD_EXTERN void | SPDY_deinit (void) |
_MHD_EXTERN void | SPDY_set_panic_func (SPDY_PanicCallback cb, void *cls) |
_MHD_EXTERN struct SPDY_Daemon * | SPDY_start_daemon (uint16_t port, const char *certfile, const char *keyfile, SPDY_NewSessionCallback nscb, SPDY_SessionClosedCallback sccb, SPDY_NewRequestCallback nrcb, SPDY_NewDataCallback npdcb, void *cls,...) |
_MHD_EXTERN void | SPDY_stop_daemon (struct SPDY_Daemon *daemon) |
_MHD_EXTERN int | SPDY_get_fdset (struct SPDY_Daemon *daemon, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *except_fd_set) |
_MHD_EXTERN int | SPDY_get_timeout (struct SPDY_Daemon *daemon, unsigned long long *timeout) |
_MHD_EXTERN void | SPDY_run (struct SPDY_Daemon *daemon) |
_MHD_EXTERN void | SPDY_close_session (struct SPDY_Session *session) |
_MHD_EXTERN void | SPDY_set_cls_to_session (struct SPDY_Session *session, void *cls) |
_MHD_EXTERN void * | SPDY_get_cls_from_session (struct SPDY_Session *session) |
_MHD_EXTERN socklen_t | SPDY_get_remote_addr (struct SPDY_Session *session, struct sockaddr **addr) |
_MHD_EXTERN struct SPDY_NameValue * | SPDY_name_value_create (void) |
_MHD_EXTERN int | SPDY_name_value_add (struct SPDY_NameValue *container, const char *name, const char *value) |
_MHD_EXTERN const char *const * | SPDY_name_value_lookup (struct SPDY_NameValue *container, const char *name, int *num_values) |
_MHD_EXTERN int | SPDY_name_value_iterate (struct SPDY_NameValue *container, SPDY_NameValueIterator iterator, void *iterator_cls) |
_MHD_EXTERN void | SPDY_name_value_destroy (struct SPDY_NameValue *container) |
_MHD_EXTERN struct SPDY_Session * | SPDY_get_session_for_request (const struct SPDY_Request *request) |
_MHD_EXTERN void | SPDY_set_cls_to_request (struct SPDY_Request *request, void *cls) |
_MHD_EXTERN void * | SPDY_get_cls_from_request (struct SPDY_Request *request) |
_MHD_EXTERN struct SPDY_Response * | SPDY_build_response (int status, const char *statustext, const char *version, struct SPDY_NameValue *headers, const void *data, size_t size) |
_MHD_EXTERN struct SPDY_Response * | SPDY_build_response_with_callback (int status, const char *statustext, const char *version, struct SPDY_NameValue *headers, SPDY_ResponseCallback rcb, void *rcb_cls, uint32_t block_size) |
_MHD_EXTERN int | SPDY_queue_response (struct SPDY_Request *request, struct SPDY_Response *response, bool closestream, bool consider_priority, SPDY_ResponseResultCallback rrcb, void *rrcb_cls) |
_MHD_EXTERN void | SPDY_destroy_response (struct SPDY_Response *response) |
_MHD_EXTERN const struct SPDY_Settings * | SPDY_settings_create (void) |
_MHD_EXTERN int | SPDY_settings_add (struct SPDY_Settings *container, enum SPDY_SETTINGS id, enum SPDY_FLAG_SETTINGS flags, int32_t value) |
_MHD_EXTERN int | SPDY_settings_lookup (const struct SPDY_Settings *container, enum SPDY_SETTINGS id, enum SPDY_FLAG_SETTINGS *flags, int32_t *value) |
_MHD_EXTERN int | SPDY_settings_iterate (const struct SPDY_Settings *container, SPDY_SettingsIterator iterator, void *iterator_cls) |
_MHD_EXTERN void | SPDY_settings_destroy (struct SPDY_Settings *container) |
_MHD_EXTERN int | SPDY_send_settings (struct SPDY_Session *session, struct SPDY_Settings *settings, enum SPDY_FLAG_SETTINGS_FRAME flags,...) |
_MHD_EXTERN void | SPDY_destroy_request (struct SPDY_Request *request) |
_MHD_EXTERN int | SPDY_send_ping (struct SPDY_Session *session, SPDY_PingCallback rttcb, void *rttcb_cls) |
public interface to libmicrospdy
All symbols defined in this header start with SPDY_. libmisrospdy is a small SPDY daemon library. The application can start multiple daemons and they are independent.
The header file defines various constants used by the SPDY and the HTTP protocol. This does not mean that the lib actually interprets all of these values. Not everything is implemented. The provided constants are exported as a convenience for users of the library. The lib does not verify that provided HTTP headers and if their values conform to the SPDY protocol, it only checks if the required headers for the SPDY requests and responses are provided.
The library uses just a single thread.
Before including "microspdy.h" you should add the necessary includes to define the types used in this file (which headers are needed may depend on your platform; for possible suggestions consult "platform.h" in the libmicrospdy distribution).
All of the functions returning SPDY_YES/SPDY_NO return SPDY_INPUT_ERROR when any of the parameters are invalid, e.g. required parameter is NULL.
The library does not check if anything at the application layer – requests and responses – is correct. For example, it is up to the user to check if a client is sending HTTP body but the method is GET.
The SPDY flow control is just partially implemented: the receiving window is updated, and the client is notified, to prevent a client from stop sending POST body data, for example.
Definition in file microspdy.h.
#define _MHD_EXTERN extern |
Definition at line 87 of file microspdy.h.
#define SPDY_HTTP_ACCEPTED 202 |
Definition at line 128 of file microspdy.h.
#define SPDY_HTTP_BAD_GATEWAY 502 |
Definition at line 174 of file microspdy.h.
Referenced by run().
#define SPDY_HTTP_BAD_REQUEST 400 |
Definition at line 144 of file microspdy.h.
#define SPDY_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 |
Definition at line 180 of file microspdy.h.
#define SPDY_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450 |
Definition at line 169 of file microspdy.h.
#define SPDY_HTTP_CONFLICT 409 |
Definition at line 153 of file microspdy.h.
#define SPDY_HTTP_CONTINUE 100 |
HTTP response codes.
Definition at line 122 of file microspdy.h.
#define SPDY_HTTP_CREATED 201 |
Definition at line 127 of file microspdy.h.
#define SPDY_HTTP_EXPECTATION_FAILED 417 |
Definition at line 161 of file microspdy.h.
#define SPDY_HTTP_FAILED_DEPENDENCY 424 |
Definition at line 164 of file microspdy.h.
#define SPDY_HTTP_FORBIDDEN 403 |
Definition at line 147 of file microspdy.h.
#define SPDY_HTTP_FOUND 302 |
Definition at line 137 of file microspdy.h.
#define SPDY_HTTP_GATEWAY_TIMEOUT 504 |
Definition at line 176 of file microspdy.h.
#define SPDY_HTTP_GONE 410 |
Definition at line 154 of file microspdy.h.
#define SPDY_HTTP_HEADER_ACCEPT "accept" |
HTTP headers are used in SPDY, but all of them MUST be lowercase. Some are not valid in SPDY and MUST not be used
Definition at line 187 of file microspdy.h.
#define SPDY_HTTP_HEADER_ACCEPT_CHARSET "accept-charset" |
Definition at line 188 of file microspdy.h.
#define SPDY_HTTP_HEADER_ACCEPT_ENCODING "accept-encoding" |
Definition at line 189 of file microspdy.h.
#define SPDY_HTTP_HEADER_ACCEPT_LANGUAGE "accept-language" |
Definition at line 190 of file microspdy.h.
#define SPDY_HTTP_HEADER_ACCEPT_RANGES "accept-ranges" |
Definition at line 191 of file microspdy.h.
#define SPDY_HTTP_HEADER_AGE "age" |
Definition at line 192 of file microspdy.h.
#define SPDY_HTTP_HEADER_ALLOW "allow" |
Definition at line 193 of file microspdy.h.
#define SPDY_HTTP_HEADER_AUTHORIZATION "authorization" |
Definition at line 194 of file microspdy.h.
#define SPDY_HTTP_HEADER_CACHE_CONTROL "cache-control" |
Definition at line 195 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONNECTION "connection" |
Definition at line 197 of file microspdy.h.
Referenced by curl_header_cb().
#define SPDY_HTTP_HEADER_CONTENT_ENCODING "content-encoding" |
Definition at line 198 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONTENT_LANGUAGE "content-language" |
Definition at line 199 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONTENT_LENGTH "content-length" |
Definition at line 200 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONTENT_LOCATION "content-location" |
Definition at line 201 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONTENT_MD5 "content-md5" |
Definition at line 202 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONTENT_RANGE "content-range" |
Definition at line 203 of file microspdy.h.
#define SPDY_HTTP_HEADER_CONTENT_TYPE "content-type" |
Definition at line 204 of file microspdy.h.
#define SPDY_HTTP_HEADER_COOKIE "cookie" |
Definition at line 205 of file microspdy.h.
#define SPDY_HTTP_HEADER_DATE "date" |
Definition at line 206 of file microspdy.h.
#define SPDY_HTTP_HEADER_ETAG "etag" |
Definition at line 207 of file microspdy.h.
#define SPDY_HTTP_HEADER_EXPECT "expect" |
Definition at line 208 of file microspdy.h.
#define SPDY_HTTP_HEADER_EXPIRES "expires" |
Definition at line 209 of file microspdy.h.
#define SPDY_HTTP_HEADER_FROM "from" |
Definition at line 210 of file microspdy.h.
#define SPDY_HTTP_HEADER_HOST "host" |
Definition at line 212 of file microspdy.h.
#define SPDY_HTTP_HEADER_IF_MATCH "if-match" |
Definition at line 213 of file microspdy.h.
#define SPDY_HTTP_HEADER_IF_MODIFIED_SINCE "if-modified-since" |
Definition at line 214 of file microspdy.h.
#define SPDY_HTTP_HEADER_IF_NONE_MATCH "if-none-match" |
Definition at line 215 of file microspdy.h.
#define SPDY_HTTP_HEADER_IF_RANGE "if-range" |
Definition at line 216 of file microspdy.h.
#define SPDY_HTTP_HEADER_IF_UNMODIFIED_SINCE "if-unmodified-since" |
Definition at line 217 of file microspdy.h.
#define SPDY_HTTP_HEADER_KEEP_ALIVE "keep-alive" |
Definition at line 219 of file microspdy.h.
Referenced by curl_header_cb().
#define SPDY_HTTP_HEADER_LAST_MODIFIED "last-modified" |
Definition at line 220 of file microspdy.h.
#define SPDY_HTTP_HEADER_LOCATION "location" |
Definition at line 221 of file microspdy.h.
#define SPDY_HTTP_HEADER_MAX_FORWARDS "max-forwards" |
Definition at line 222 of file microspdy.h.
#define SPDY_HTTP_HEADER_PRAGMA "pragma" |
Definition at line 223 of file microspdy.h.
#define SPDY_HTTP_HEADER_PROXY_AUTHENTICATE "proxy-authenticate" |
Definition at line 224 of file microspdy.h.
#define SPDY_HTTP_HEADER_PROXY_AUTHORIZATION "proxy-authorization" |
Definition at line 225 of file microspdy.h.
#define SPDY_HTTP_HEADER_PROXY_CONNECTION "proxy-connection" |
Definition at line 227 of file microspdy.h.
#define SPDY_HTTP_HEADER_RANGE "range" |
Definition at line 228 of file microspdy.h.
#define SPDY_HTTP_HEADER_REFERER "referer" |
Definition at line 229 of file microspdy.h.
#define SPDY_HTTP_HEADER_RETRY_AFTER "retry-after" |
Definition at line 230 of file microspdy.h.
#define SPDY_HTTP_HEADER_SERVER "server" |
Definition at line 231 of file microspdy.h.
#define SPDY_HTTP_HEADER_SET_COOKIE "set-cookie" |
Definition at line 232 of file microspdy.h.
#define SPDY_HTTP_HEADER_SET_COOKIE2 "set-cookie2" |
Definition at line 233 of file microspdy.h.
#define SPDY_HTTP_HEADER_TE "te" |
Definition at line 234 of file microspdy.h.
#define SPDY_HTTP_HEADER_TRAILER "trailer" |
Definition at line 235 of file microspdy.h.
#define SPDY_HTTP_HEADER_TRANSFER_ENCODING "transfer-encoding" |
Definition at line 237 of file microspdy.h.
Referenced by curl_header_cb().
#define SPDY_HTTP_HEADER_UPGRADE "upgrade" |
Definition at line 238 of file microspdy.h.
#define SPDY_HTTP_HEADER_USER_AGENT "user-agent" |
Definition at line 239 of file microspdy.h.
#define SPDY_HTTP_HEADER_VARY "vary" |
Definition at line 240 of file microspdy.h.
#define SPDY_HTTP_HEADER_VIA "via" |
Definition at line 241 of file microspdy.h.
#define SPDY_HTTP_HEADER_WARNING "warning" |
Definition at line 242 of file microspdy.h.
#define SPDY_HTTP_HEADER_WWW_AUTHENTICATE "www-authenticate" |
Definition at line 243 of file microspdy.h.
#define SPDY_HTTP_HTTP_VERSION_NOT_SUPPORTED 505 |
Definition at line 177 of file microspdy.h.
#define SPDY_HTTP_INSUFFICIENT_STORAGE 507 |
Definition at line 179 of file microspdy.h.
#define SPDY_HTTP_INTERNAL_SERVER_ERROR 500 |
Definition at line 172 of file microspdy.h.
#define SPDY_HTTP_LENGTH_REQUIRED 411 |
Definition at line 155 of file microspdy.h.
#define SPDY_HTTP_LOCKED 423 |
Definition at line 163 of file microspdy.h.
#define SPDY_HTTP_METHOD_CONNECT "CONNECT" |
HTTP methods
Definition at line 254 of file microspdy.h.
#define SPDY_HTTP_METHOD_DELETE "DELETE" |
Definition at line 255 of file microspdy.h.
#define SPDY_HTTP_METHOD_GET "GET" |
Definition at line 256 of file microspdy.h.
#define SPDY_HTTP_METHOD_HEAD "HEAD" |
Definition at line 257 of file microspdy.h.
#define SPDY_HTTP_METHOD_NOT_ACCEPTABLE 406 |
Definition at line 150 of file microspdy.h.
#define SPDY_HTTP_METHOD_NOT_ALLOWED 405 |
Definition at line 149 of file microspdy.h.
#define SPDY_HTTP_METHOD_OPTIONS "OPTIONS" |
Definition at line 258 of file microspdy.h.
#define SPDY_HTTP_METHOD_POST "POST" |
Definition at line 259 of file microspdy.h.
Referenced by standard_request_handler().
#define SPDY_HTTP_METHOD_PUT "PUT" |
Definition at line 260 of file microspdy.h.
#define SPDY_HTTP_METHOD_TRACE "TRACE" |
Definition at line 261 of file microspdy.h.
#define SPDY_HTTP_MOVED_PERMANENTLY 301 |
Definition at line 136 of file microspdy.h.
#define SPDY_HTTP_MULTI_STATUS 207 |
Definition at line 133 of file microspdy.h.
#define SPDY_HTTP_MULTIPLE_CHOICES 300 |
Definition at line 135 of file microspdy.h.
#define SPDY_HTTP_NO_CONTENT 204 |
Definition at line 130 of file microspdy.h.
#define SPDY_HTTP_NO_RESPONSE 444 |
Definition at line 167 of file microspdy.h.
#define SPDY_HTTP_NON_AUTHORITATIVE_INFORMATION 203 |
Definition at line 129 of file microspdy.h.
#define SPDY_HTTP_NOT_EXTENDED 510 |
Definition at line 181 of file microspdy.h.
#define SPDY_HTTP_NOT_FOUND 404 |
Definition at line 148 of file microspdy.h.
#define SPDY_HTTP_NOT_IMPLEMENTED 501 |
Definition at line 173 of file microspdy.h.
#define SPDY_HTTP_NOT_MODIFIED 304 |
Definition at line 139 of file microspdy.h.
#define SPDY_HTTP_OK 200 |
Definition at line 126 of file microspdy.h.
#define SPDY_HTTP_PARTIAL_CONTENT 206 |
Definition at line 132 of file microspdy.h.
#define SPDY_HTTP_PAYMENT_REQUIRED 402 |
Definition at line 146 of file microspdy.h.
#define SPDY_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded" |
HTTP POST encodings, see also http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4
Definition at line 267 of file microspdy.h.
#define SPDY_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data" |
Definition at line 268 of file microspdy.h.
#define SPDY_HTTP_PRECONDITION_FAILED 412 |
Definition at line 156 of file microspdy.h.
#define SPDY_HTTP_PROCESSING 102 |
Definition at line 124 of file microspdy.h.
#define SPDY_HTTP_PROXY_AUTHENTICATION_REQUIRED 407 |
Definition at line 151 of file microspdy.h.
#define SPDY_HTTP_REQUEST_ENTITY_TOO_LARGE 413 |
Definition at line 157 of file microspdy.h.
#define SPDY_HTTP_REQUEST_TIMEOUT 408 |
Definition at line 152 of file microspdy.h.
#define SPDY_HTTP_REQUEST_URI_TOO_LONG 414 |
Definition at line 158 of file microspdy.h.
#define SPDY_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416 |
Definition at line 160 of file microspdy.h.
#define SPDY_HTTP_RESET_CONTENT 205 |
Definition at line 131 of file microspdy.h.
#define SPDY_HTTP_RETRY_WITH 449 |
Definition at line 168 of file microspdy.h.
#define SPDY_HTTP_SEE_OTHER 303 |
Definition at line 138 of file microspdy.h.
#define SPDY_HTTP_SERVICE_UNAVAILABLE 503 |
Definition at line 175 of file microspdy.h.
#define SPDY_HTTP_SWITCH_PROXY 306 |
Definition at line 141 of file microspdy.h.
#define SPDY_HTTP_SWITCHING_PROTOCOLS 101 |
Definition at line 123 of file microspdy.h.
#define SPDY_HTTP_TEMPORARY_REDIRECT 307 |
Definition at line 142 of file microspdy.h.
#define SPDY_HTTP_UNAUTHORIZED 401 |
Definition at line 145 of file microspdy.h.
#define SPDY_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451 |
Definition at line 170 of file microspdy.h.
#define SPDY_HTTP_UNORDERED_COLLECTION 425 |
Definition at line 165 of file microspdy.h.
#define SPDY_HTTP_UNPROCESSABLE_ENTITY 422 |
Definition at line 162 of file microspdy.h.
#define SPDY_HTTP_UNSUPPORTED_MEDIA_TYPE 415 |
Definition at line 159 of file microspdy.h.
#define SPDY_HTTP_UPGRADE_REQUIRED 426 |
Definition at line 166 of file microspdy.h.
#define SPDY_HTTP_USE_PROXY 305 |
Definition at line 140 of file microspdy.h.
#define SPDY_HTTP_VARIANT_ALSO_NEGOTIATES 506 |
Definition at line 178 of file microspdy.h.
#define SPDY_HTTP_VERSION_1_0 "HTTP/1.0" |
HTTP versions (a value must be provided in SPDY requests/responses).
Definition at line 248 of file microspdy.h.
#define SPDY_HTTP_VERSION_1_1 "HTTP/1.1" |
Definition at line 249 of file microspdy.h.
Referenced by run().
#define SPDY_init | ( | ) | SPDY_init (SPDY_IO_SUBSYSTEM_OPENSSL) |
Definition at line 826 of file microspdy.h.
Referenced by run().
#define SPDY_INPUT_ERROR -1 |
return code for error when input parameters are wrong. To be returned only by functions which return int. The others will return NULL on input error.
Definition at line 105 of file microspdy.h.
Referenced by SPDY_get_fdset(), SPDY_get_timeout(), SPDY_name_value_add(), SPDY_name_value_iterate(), SPDY_queue_response(), and SPDYF_name_value_from_stream().
#define SPDY_MAX_SUPPORTED_FRAME_SIZE 8192 |
The maximum allowed size (without 8 byte headers) of SPDY frames (value length) is 8192. The lib will accept and send frames with length at most this value here.
Definition at line 117 of file microspdy.h.
Referenced by SPDY_build_response_with_callback(), SPDY_init(), SPDYF_handler_ignore_frame(), spdyf_handler_read_data(), spdyf_handler_read_goaway(), spdyf_handler_read_syn_stream(), and SPDYF_response_queue_create().
#define SPDY_NO 0 |
return code for "NO".
Definition at line 98 of file microspdy.h.
Referenced by run(), spdy_handler_new_stream(), SPDY_name_value_add(), SPDY_queue_response(), SPDYF_get_timeout(), spdyf_handler_read_syn_stream(), SPDYF_handler_write_data(), SPDYF_handler_write_goaway(), SPDYF_handler_write_rst_stream(), SPDYF_handler_write_syn_reply(), SPDYF_handler_write_window_update(), SPDYF_io_set_daemon(), SPDYF_io_set_session(), SPDYF_name_value_from_stream(), SPDYF_name_value_is_empty(), SPDYF_openssl_init(), SPDYF_openssl_is_pending(), SPDYF_openssl_new_session(), spdyf_parse_options_va(), SPDYF_prepare_goaway(), SPDYF_prepare_rst_stream(), SPDYF_prepare_window_update(), SPDYF_queue_response(), SPDYF_raw_is_pending(), SPDYF_run(), SPDYF_session_accept(), SPDYF_session_close(), SPDYF_session_idle(), SPDYF_session_read(), SPDYF_session_write(), SPDYF_stream_new(), SPDYF_zlib_deflate(), SPDYF_zlib_deflate_init(), SPDYF_zlib_inflate(), and SPDYF_zlib_inflate_init().
#define SPDY_VERSION 3 |
SPDY version supported by the lib.
Definition at line 110 of file microspdy.h.
Referenced by SPDYF_prepare_goaway(), SPDYF_prepare_rst_stream(), SPDYF_prepare_window_update(), SPDYF_response_queue_create(), and SPDYF_session_idle().
#define SPDY_YES 1 |
return code for "YES".
Definition at line 93 of file microspdy.h.
Referenced by curl_header_cb(), iterate_cb(), run(), SPDY_build_response(), spdy_handler_new_stream(), SPDY_init(), SPDY_name_value_add(), SPDY_name_value_iterate(), spdy_post_data_cb(), SPDY_queue_response(), SPDYF_get_fdset(), SPDYF_get_timeout(), spdyf_handler_read_data(), spdyf_handler_read_syn_stream(), SPDYF_handler_write_data(), SPDYF_handler_write_goaway(), SPDYF_handler_write_rst_stream(), SPDYF_handler_write_syn_reply(), SPDYF_handler_write_window_update(), SPDYF_io_set_daemon(), SPDYF_io_set_session(), SPDYF_name_value_from_stream(), SPDYF_name_value_is_empty(), SPDYF_openssl_before_write(), SPDYF_openssl_init(), SPDYF_openssl_is_pending(), SPDYF_openssl_new_session(), spdyf_parse_options_va(), SPDYF_prepare_goaway(), SPDYF_prepare_rst_stream(), SPDYF_prepare_window_update(), SPDYF_queue_response(), SPDYF_raw_after_write(), SPDYF_raw_before_write(), SPDYF_raw_init(), SPDYF_raw_new_session(), SPDYF_session_accept(), SPDYF_session_close(), SPDYF_session_idle(), SPDYF_session_read(), SPDYF_session_write(), SPDYF_start_daemon_va(), SPDYF_stream_new(), SPDYF_zlib_deflate(), SPDYF_zlib_deflate_init(), SPDYF_zlib_inflate(), and SPDYF_zlib_inflate_init().
typedef int(* SPDY_NameValueIterator)(void *cls, const char *name, const char *const *value, int num_values) |
Iterator over name-value pairs.
cls | client-defined closure |
name | of the pair |
value | of the pair |
Definition at line 638 of file microspdy.h.
typedef int(* SPDY_NewDataCallback)(void *cls, struct SPDY_Request *request, const void *buf, size_t size, bool more) |
Callback for received new data chunk (HTTP body) from a given request (e.g. POST data).
cls | client-defined closure |
request | handler |
buf | data chunk from the POST data |
size | the size of the data chunk 'buf' in bytes. Note that it may be 0. |
more | false if this is the last chunk from the data. Note: true does not mean that more data will come, exceptional situation is possible |
Definition at line 698 of file microspdy.h.
typedef void(* SPDY_NewRequestCallback)(void *cls, struct SPDY_Request *request, uint8_t priority, const char *method, const char *path, const char *version, const char *host, const char *scheme, struct SPDY_NameValue *headers, bool more) |
Callback for received SPDY request. The functions is called whenever a reqest comes, but will also be called if more headers/trailers are received.
cls | client-defined closure |
request | handler. The request object is required for sending responses. |
priority | of the SPDY stream which the request was sent over |
method | HTTP method |
path | HTTP path |
version | HTTP version just like in HTTP request/response: "HTTP/1.0" or "HTTP/1.1" currently |
host | called host as in HTTP |
scheme | used ("http" or "https"). In SPDY 3 it is only "https". |
headers | other HTTP headers from the request |
more | a flag saying if more data related to the request is expected to be received. HTTP body may arrive (e.g. POST data); then SPDY_NewDataCallback will be called for the connection. It is also possible that more headers/trailers arrive; then the same callback will be invoked. The user should detect that it is not the first invocation of the function for that request. |
Definition at line 670 of file microspdy.h.
typedef void(* SPDY_NewSessionCallback)(void *cls, struct SPDY_Session *session) |
Callback for new SPDY session established by a client. Called immediately after the TCP connection was established.
cls | client-defined closure |
session | handler for the new SPDY session |
Definition at line 606 of file microspdy.h.
typedef void(* SPDY_PanicCallback)(void *cls, const char *file, unsigned int line, const char *reason) |
Callback for serious error condition. The default action is to print an error message and abort().
cls | user specified value |
file | where the error occured |
line | where the error occured |
reason | error details message, may be NULL |
Definition at line 592 of file microspdy.h.
typedef void(* SPDY_PingCallback)(void *cls, struct SPDY_Session *session, struct timeval *rtt) |
Callback to notify when SPDY ping response is received.
session | handler for which the ping request was sent |
rtt | the timespan between sending ping request and receiving it from the library |
Definition at line 768 of file microspdy.h.
typedef ssize_t(* SPDY_ResponseCallback)(void *cls, void *buffer, size_t max, bool *more) |
Callback to be used with SPDY_build_response_with_callback. The callback will be called when the lib wants to write to the TLS socket. The application should provide the data to be sent.
cls | client-defined closure |
max | maximum number of bytes that are allowed to be written to the buffer. |
more | true if more data will be sent (i.e. the function must be calleed again), false if this is the last chunk, the lib will close the stream |
Definition at line 724 of file microspdy.h.
typedef void(* SPDY_ResponseResultCallback)(void *cls, struct SPDY_Response *response, struct SPDY_Request *request, enum SPDY_RESPONSE_RESULT status, bool streamopened) |
Callback to be called when the last bytes from the response was sent to the client or when the response was discarded from the lib. This callback is a very good place to discard the request and the response objects, if they will not be reused (e.g., sending the same response again). If the stream is closed it is safe to discard the request object.
cls | client-defined closure |
response | handler to the response that was just sent |
request | handler to the request for which the response was sent |
status | shows if actually the response was sent or it was discarded by the lib for any reason (e.g., closing session, closing stream, stopping daemon, etc.). It is possible that status indicates an error but parts of the response headers and/or body (in one or several frames) were already sent to the client. |
streamopened | indicates if the the stream for this request/ response pair is still opened. If yes, the server may want to use SPDY push to send something additional to the client and/or close the stream. |
Definition at line 753 of file microspdy.h.
typedef void(* SPDY_SessionClosedCallback)(void *cls, struct SPDY_Session *session, int by_client) |
Callback for closed session. Called after the TCP connection was closed. In this callback function the user has the last chance to access the SPDY_Session structure. After that the latter will be cleaned!
cls | client-defined closure |
session | handler for the closed SPDY session |
by_client | SPDY_YES if the session close was initiated by the client; SPDY_NO if closed by the server |
Definition at line 623 of file microspdy.h.
typedef int(* SPDY_SettingsIterator)(void *cls, enum SPDY_SETTINGS id, int32_t value, uint8_t flags) |
Iterator over settings ID/Value/Flags tuples.
cls | client-defined closure |
id | SPDY settings ID |
value | value for this setting |
flags | flags for this tuple; use enum SPDY_FLAG_SETTINGS |
Definition at line 785 of file microspdy.h.
typedef void(* SPDY_SettingsReceivedCallback)(struct SPDY_Session *session, struct SPDY_Settings *settings, uint8_t flags,...) |
Callback to notify when SPDY SETTINGS are received from the client.
session | handler for which settings are received |
settings | ID/value/flags tuples of the settings |
flags | for the whole settings frame; use enum SPDY_FLAG_SETTINGS_FRAME |
... | list of options (type-value pairs, terminated with SPDY_SETTINGS_OPTION_END). |
Definition at line 802 of file microspdy.h.
enum SPDY_DAEMON_FLAG |
Flags for starting SPDY daemon. They are used to set some settings for the daemon, which do not require values.
Definition at line 401 of file microspdy.h.
enum SPDY_DAEMON_OPTION |
SPDY daemon options. Passed in the varargs portion of SPDY_start_daemon to customize the daemon. Each option must be followed by a value of a specific type.
The values are used internally as flags, that is why they must be powers of 2.
Definition at line 346 of file microspdy.h.
enum SPDY_FLAG_SETTINGS |
Flags for each individual SPDY setting in the SPDY SETTINGS frame. They affect only one setting to which they are set. Defined in SPDY Protocol - Draft 3.
Enumerator | |
---|---|
SPDY_FLAG_SETTINGS_PERSIST_VALUE |
When set, the sender of this SETTINGS frame is requesting that the recipient persist the ID/Value and return it in future SETTINGS frames sent from the sender to this recipient. Because persistence is only implemented on the client, this flag is only sent by the server. |
SPDY_FLAG_SETTINGS_PERSISTED |
When set, the sender is notifying the recipient that this ID/Value pair was previously sent to the sender by the recipient with the SPDY_FLAG_SETTINGS_PERSIST_VALUE, and the sender is returning it. Because persistence is only implemented on the client, this flag is only sent by the client. |
Definition at line 493 of file microspdy.h.
Flag associated with a whole SPDY SETTINGS frame. Affect all the settings in the frame. Defined in SPDY Protocol - Draft 3.
Enumerator | |
---|---|
SPDY_FLAG_SETTINGS_CLEAR_SETTINGS |
When set, the client should clear any previously persisted SETTINGS ID/Value pairs. If this frame contains ID/Value pairs with the SPDY_FLAG_SETTINGS_PERSIST_VALUE set, then the client will first clear its existing, persisted settings, and then persist the values with the flag set which are contained within this frame. Because persistence is only implemented on the client, this flag can only be used when the sender is the server. |
Definition at line 520 of file microspdy.h.
enum SPDY_IO_SUBSYSTEM |
SPDY IO sybsystem flags used by SPDY_init() and SPDY_deinit().
The values are used internally as flags, that is why they must be powers of 2.
Enumerator | |
---|---|
SPDY_IO_SUBSYSTEM_NONE |
No subsystem. For internal use. |
SPDY_IO_SUBSYSTEM_OPENSSL |
Default TLS implementation provided by openSSL/libssl. |
SPDY_IO_SUBSYSTEM_RAW |
No TLS is used. |
Definition at line 318 of file microspdy.h.
enum SPDY_RESPONSE_RESULT |
Used as a parameter for SPDY_ResponseResultCallback and shows if the response was actually written to the TLS socket or discarded by the lib for any reason (and respectively the reason).
Definition at line 561 of file microspdy.h.
enum SPDY_SETTINGS |
SPDY settings IDs sent by both client and server in SPDY SETTINGS frame. They affect the whole SPDY session. Defined in SPDY Protocol - Draft 3.
Definition at line 427 of file microspdy.h.
enum SPDY_SETTINGS_OPTION |
SPDY settings function options. Passed in the varargs portion of SPDY_SettingsReceivedCallback and SPDY_send_settings to customize more the settings handling. Each option must be followed by a value of a specific type.
The values are used internally as flags, that is why they must be powers of 2.
Enumerator | |
---|---|
SPDY_SETTINGS_OPTION_END |
No more options / last option. This is used to terminate the VARARGs list. |
Definition at line 545 of file microspdy.h.
_MHD_EXTERN struct SPDY_Response* SPDY_build_response | ( | int | status, |
const char * | statustext, | ||
const char * | version, | ||
struct SPDY_NameValue * | headers, | ||
const void * | data, | ||
size_t | size | ||
) |
Create response object containing all needed headers and data. The response object is not bound to a request, so it can be used multiple times with SPDY_queue_response() and schould be destroied by calling the SPDY_destroy_response().
Currently the library does not provide compression of the body data. It is up to the user to pass already compressed data and the appropriate headers to this function when desired.
status | HTTP status code for the response (e.g. 404) |
statustext | HTTP status message for the response, which will be appended to the status code (e.g. "OK"). Can be NULL |
version | HTTP version for the response (e.g. "http/1.1") |
headers | name/value structure containing additional HTTP headers. Can be NULL. Can be used multiple times, it is up to the user to destoy the object when not needed anymore. |
data | the body of the response. The lib will make a copy of it, so it is up to the user to take care of the memory pointed by data |
size | length of data. It can be 0, then the lib will send only headers |
Definition at line 391 of file applicationlayer.c.
References SPDY_Response::data, SPDY_Response::data_size, SPDY_Response::headers, SPDY_Response::headers_size, NULL, SPDY_name_value_add(), SPDY_name_value_create(), SPDY_name_value_destroy(), SPDY_YES, SPDYF_DEBUG, SPDYF_name_value_is_empty(), and SPDYF_name_value_to_stream().
Referenced by run(), and SPDY_build_response_with_callback().
_MHD_EXTERN struct SPDY_Response* SPDY_build_response_with_callback | ( | int | status, |
const char * | statustext, | ||
const char * | version, | ||
struct SPDY_NameValue * | headers, | ||
SPDY_ResponseCallback | rcb, | ||
void * | rcb_cls, | ||
uint32_t | block_size | ||
) |
Create response object containing all needed headers. The data will be provided later when the lib calls the callback function (just before writing it to the TLS socket). The response object is not bound to a request, so it can be used multiple times with SPDY_queue_response() and schould be destroied by calling the SPDY_destroy_response().
Currently the library does not provide compression of the body data. It is up to the user to pass already compressed data and the appropriate headers to this function and the callback when desired.
status | HTTP status code for the response (e.g. 404) |
statustext | HTTP status message for the response, which will be appended to the status code (e.g. "OK"). Can be NULL |
version | HTTP version for the response (e.g. "http/1.1") |
headers | name/value structure containing additional HTTP headers. Can be NULL. Can be used multiple times, it is up to the user to destoy the object when not needed anymore. |
rcb | callback to use to obtain response data |
rcb_cls | extra argument to rcb |
block_size | preferred block size for querying rcb (advisory only, the lib will call rcb specifying the block size); clients should pick a value that is appropriate for IO and memory performance requirements. The function will fail if the value is bigger than the maximum supported value (SPDY_MAX_SUPPORTED_FRAME_SIZE). Can be 0, then the lib will use SPDY_MAX_SUPPORTED_FRAME_SIZE instead. |
Definition at line 480 of file applicationlayer.c.
References NULL, SPDY_Response::rcb, SPDY_Response::rcb_block_size, SPDY_Response::rcb_cls, SPDY_build_response(), SPDY_MAX_SUPPORTED_FRAME_SIZE, and SPDYF_DEBUG.
Referenced by curl_header_cb().
_MHD_EXTERN void SPDY_close_session | ( | struct SPDY_Session * | session | ) |
Closes a SPDY session. SPDY clients and servers are expected to keep sessions opened as long as possible. However, the server may want to close some connections, e.g. if there are too many, to free some resources. The function can also be used to close a specific session if the client is not desired.
session | handler to be closed |
_MHD_EXTERN void SPDY_deinit | ( | void | ) |
Deinit function for the whole lib. It can be called after finishing using the library. It frees and cleans up resources allocated in SPDY_init. Currently the function does not do anything.
Definition at line 260 of file applicationlayer.c.
References SPDY_IO_SUBSYSTEM_NONE, SPDY_IO_SUBSYSTEM_OPENSSL, SPDY_IO_SUBSYSTEM_RAW, SPDYF_ASSERT, spdyf_io_initialized, SPDYF_openssl_global_deinit(), and SPDYF_raw_global_deinit().
Referenced by run().
_MHD_EXTERN void SPDY_destroy_request | ( | struct SPDY_Request * | request | ) |
Destroy a request structure. It should be called for all objects received as a parameter in SPDY_NewRequestCallback to free the memory associated with the request. It is safe to call this function not before being sure that the request will not be used by the lib anymore, this means after the stream, on which this request had been sent, was closed and all SPDY_ResponseResultCallback callbacks were called for all calls to SPDY_queue_response() passing this request object.
request | to destroy |
Definition at line 30 of file alstructures.c.
References SPDY_Request::headers, NULL, SPDY_name_value_destroy(), and SPDYF_DEBUG.
Referenced by response_done_callback(), run(), spdy_callback_response_done(), and spdy_handler_new_stream().
_MHD_EXTERN void SPDY_destroy_response | ( | struct SPDY_Response * | response | ) |
Destroy a response structure. It should be called for all objects returned by SPDY_build_response*() functions to free the memory associated with the prepared response. It is safe to call this function not before being sure that the response will not be used by the lib anymore, this means after SPDY_ResponseResultCallback callbacks were called for all calls to SPDY_queue_response() passing this response.
response | to destroy |
Definition at line 279 of file structures.c.
References SPDY_Response::data, SPDY_Response::headers, and NULL.
Referenced by curl_header_cb(), response_done_callback(), run(), and spdy_callback_response_done().
_MHD_EXTERN void* SPDY_get_cls_from_request | ( | struct SPDY_Request * | request | ) |
Retrieves the pointer associated with the request by SPDY_set_cls_to_request().
request | to get its cls |
Definition at line 725 of file applicationlayer.c.
References NULL, SPDYF_DEBUG, and SPDY_Request::user_cls.
Referenced by spdy_post_data_cb(), and standard_request_handler().
_MHD_EXTERN void* SPDY_get_cls_from_session | ( | struct SPDY_Session * | session | ) |
Retrieves the pointer associated with SPDY_set_cls_to_session().
session | handler to get its cls |
Definition at line 698 of file applicationlayer.c.
References NULL, SPDYF_DEBUG, and SPDY_Session::user_cls.
Referenced by session_closed_cb(), and standard_request_handler().
_MHD_EXTERN int SPDY_get_fdset | ( | struct SPDY_Daemon * | daemon, |
fd_set * | read_fd_set, | ||
fd_set * | write_fd_set, | ||
fd_set * | except_fd_set | ||
) |
Obtain the select sets for this daemon. Only those are retrieved, which some processing should be done for, i.e. not all sockets are added to write_fd_set.
It is possible that there is nothing to be read from a socket but there is data either in the TLS subsystem's read buffers or in libmicrospdy's read buffers, which waits for being processed. In such case the file descriptor will be added to write_fd_set. Since it is very likely for the socket to be ready for writing, the select used in the application's event loop will return with success, SPDY_run will be called, the data will be processed and maybe something will be written to the socket. Without this behaviour, considering a proper event loop, data may stay in the buffers, but run is never called.
daemon | to get sets from |
read_fd_set | read set |
write_fd_set | write set |
except_fd_set | except set |
Definition at line 302 of file applicationlayer.c.
References NULL, SPDY_INPUT_ERROR, SPDYF_DEBUG, and SPDYF_get_fdset().
Referenced by run().
_MHD_EXTERN socklen_t SPDY_get_remote_addr | ( | struct SPDY_Session * | session, |
struct sockaddr ** | addr | ||
) |
Retrieves the remote address of a given session.
session | handler to get its remote address |
addr | out parameter; pointing to remote address |
Definition at line 669 of file applicationlayer.c.
References SPDY_Session::addr, SPDY_Session::addr_len, NULL, and SPDYF_DEBUG.
_MHD_EXTERN struct SPDY_Session* SPDY_get_session_for_request | ( | const struct SPDY_Request * | request | ) |
Gets the session responsible for the given request.
request | for which the session is wanted |
Definition at line 685 of file applicationlayer.c.
References NULL, SPDYF_Stream::session, SPDYF_DEBUG, and SPDY_Request::stream.
Referenced by standard_request_handler().
_MHD_EXTERN int SPDY_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 | to query for timeout |
timeout | will be set to the timeout value (in milliseconds) |
Definition at line 288 of file applicationlayer.c.
References NULL, SPDY_INPUT_ERROR, SPDYF_DEBUG, and SPDYF_get_timeout().
Referenced by run().
_MHD_EXTERN int() SPDY_init | ( | enum SPDY_IO_SUBSYSTEM | io_subsystem, |
... | |||
) |
Init function for the whole library. It MUST be called before any other function of the library to initialize things like TLS context and possibly other stuff needed by the lib. Currently the call always returns SPDY_YES.
io_subsystem | the IO subsystem that will be initialized. Several can be used with bitwise OR. If no parameter is set, the default openssl subsystem will be used. |
Definition at line 232 of file applicationlayer.c.
References SPDY_IO_SUBSYSTEM_NONE, SPDY_IO_SUBSYSTEM_OPENSSL, SPDY_IO_SUBSYSTEM_RAW, SPDY_MAX_SUPPORTED_FRAME_SIZE, SPDY_YES, SPDYF_ASSERT, SPDYF_BUFFER_SIZE, spdyf_io_initialized, SPDYF_openssl_global_init(), and SPDYF_raw_global_init().
_MHD_EXTERN int SPDY_name_value_add | ( | struct SPDY_NameValue * | container, |
const char * | name, | ||
const char * | value | ||
) |
Add name/value pair to a NameValue structure. SPDY_NO will be returned if the name/value pair is already in the structure. It is legal to add different values for the same name.
container | structure to which the new pair is added |
name | for the value. Null-terminated string. |
value | the value itself. Null-terminated string. |
Definition at line 56 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDY_NameValue::prev, SPDY_INPUT_ERROR, SPDY_NO, SPDY_YES, SPDYF_name_value_is_empty(), and SPDY_NameValue::value.
Referenced by curl_header_cb(), SPDY_build_response(), spdy_handler_new_stream(), and SPDYF_name_value_from_stream().
_MHD_EXTERN struct SPDY_NameValue* SPDY_name_value_create | ( | void | ) |
Create a new NameValue structure. It is needed for putting inside the HTTP headers and their values for a response. The user should later destroy alone the structure.
Definition at line 42 of file structures.c.
References NULL.
Referenced by SPDY_build_response(), spdy_handler_new_stream(), SPDYF_name_value_from_stream(), and standard_request_handler().
_MHD_EXTERN void SPDY_name_value_destroy | ( | struct SPDY_NameValue * | container | ) |
Destroy a NameValue structure. Use this function to destroy only objects which, after passed to, will not be destroied by other functions.
Definition at line 218 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, and SPDY_NameValue::value.
Referenced by curl_header_cb(), run(), SPDY_build_response(), SPDY_destroy_request(), spdy_handler_new_stream(), SPDYF_name_value_from_stream(), and SPDYF_stream_destroy().
_MHD_EXTERN int SPDY_name_value_iterate | ( | struct SPDY_NameValue * | container, |
SPDY_NameValueIterator | iterator, | ||
void * | iterator_cls | ||
) |
Iterate over name/value structure.
container | structure which to iterate over |
iterator | callback to call on each name/value pair; maybe NULL (then just count headers) |
iterator_cls | extra argument to iterator |
Definition at line 237 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDY_INPUT_ERROR, SPDY_YES, SPDYF_name_value_is_empty(), and SPDY_NameValue::value.
Referenced by standard_request_handler().
_MHD_EXTERN const char* const* SPDY_name_value_lookup | ( | struct SPDY_NameValue * | container, |
const char * | name, | ||
int * | num_values | ||
) |
Lookup value for a name in a name/value structure.
container | structure in which to lookup |
name | the name to look for |
num_values | length of the returned array with values |
Definition at line 190 of file structures.c.
References SPDY_NameValue::name, SPDY_NameValue::next, NULL, SPDY_NameValue::num_values, SPDYF_name_value_is_empty(), and SPDY_NameValue::value.
Referenced by curl_header_cb().
_MHD_EXTERN int SPDY_queue_response | ( | struct SPDY_Request * | request, |
struct SPDY_Response * | response, | ||
bool | closestream, | ||
bool | consider_priority, | ||
SPDY_ResponseResultCallback | rrcb, | ||
void * | rrcb_cls | ||
) |
Queue response object to be sent to the client. A successfully queued response may never be sent, e.g. when the stream gets closed. The data will be added to the output queue. The call will fail, if the output for this session is closed (i.e. the session is closed, half or full) or the output channel for the stream, on which the request was received, is closed (i.e. the stream is closed, half or full).
request | object identifying the request to which the response is returned |
response | object containg headers and data to be sent |
closestream | TRUE if the server does NOT intend to PUSH something more associated to this request/response later, FALSE otherwise |
consider_priority | if FALSE, the response will be added to the end of the queue. If TRUE, the response will be added after the last previously added response with priority of the request grater or equal to that of the current one. This means that the function should be called with TRUE each time if one wants to be sure that the output queue behaves like a priority queue |
rrcb | callback called when all the data was sent (last frame from response) or when that frame was discarded (e.g. the stream has been closed meanwhile) |
rrcb_cls | extra argument to rrcb |
Definition at line 525 of file applicationlayer.c.
References SPDY_Response::data, SPDY_Response::data_size, SPDYF_Response_Queue::frqcb, SPDYF_Response_Queue::frqcb_cls, SPDY_Response::headers, SPDY_Response::headers_size, SPDYF_Stream::is_out_closed, NULL, SPDY_Response::rcb, SPDYF_Stream::session, spdy_handler_response_queue_result(), SPDY_INPUT_ERROR, SPDY_NO, SPDY_SESSION_STATUS_CLOSING, SPDY_YES, SPDYF_DEBUG, SPDYF_queue_response(), SPDYF_response_queue_create(), SPDYF_response_queue_destroy(), SPDY_Session::status, and SPDY_Request::stream.
Referenced by curl_header_cb(), and run().
_MHD_EXTERN void SPDY_run | ( | struct SPDY_Daemon * | daemon | ) |
Run webserver operations. This method must be called in the client event loop.
daemon | to run |
Definition at line 275 of file applicationlayer.c.
References NULL, SPDYF_DEBUG, and SPDYF_run().
Referenced by run().
_MHD_EXTERN int SPDY_send_ping | ( | struct SPDY_Session * | session, |
SPDY_PingCallback | rttcb, | ||
void * | rttcb_cls | ||
) |
_MHD_EXTERN int SPDY_send_settings | ( | struct SPDY_Session * | session, |
struct SPDY_Settings * | settings, | ||
enum SPDY_FLAG_SETTINGS_FRAME | flags, | ||
... | |||
) |
Send SPDY SETTINGS to the client. The call will return fail if there in invald setting into the settings container (e.g. invalid setting ID).
session | SPDY_Session handler for which settings are being sent |
settings | ID/value pairs of the settings to be sent. Can be used multiple times, it is up to the user to destoy the object when not needed anymore. |
flags | for the whole settings frame. They are valid for all tuples |
... | list of options (type-value pairs, terminated with SPDY_SETTINGS_OPTION_END). |
_MHD_EXTERN void SPDY_set_cls_to_request | ( | struct SPDY_Request * | request, |
void * | cls | ||
) |
Associate a void pointer with a request. The data accessible by the pointer can later be used wherever the request handler is available.
request | with which to associate a pointer |
cls | any data pointed by a pointer to be accessible later |
Definition at line 738 of file applicationlayer.c.
References NULL, SPDYF_DEBUG, and SPDY_Request::user_cls.
Referenced by standard_request_handler().
_MHD_EXTERN void SPDY_set_cls_to_session | ( | struct SPDY_Session * | session, |
void * | cls | ||
) |
Associate a void pointer with a session. The data accessible by the pointer can later be used wherever the session handler is available.
session | handler |
cls | any data pointed by a pointer to be accessible later |
Definition at line 711 of file applicationlayer.c.
References NULL, SPDYF_DEBUG, and SPDY_Session::user_cls.
Referenced by new_session_cb().
_MHD_EXTERN void SPDY_set_panic_func | ( | SPDY_PanicCallback | cb, |
void * | cls | ||
) |
Sets the global error handler to a different implementation. "cb" will only be called in the case of typically fatal, serious internal consistency issues. These issues should only arise in the case of serious memory corruption or similar problems with the architecture as well as failed assertions. While "cb" is allowed to return and the lib will then try to continue, this is never safe.
The default implementation that is used if no panic function is set simply prints an error message and calls "abort". Alternative implementations might call "exit" or other similar functions.
cb | new error handler |
cls | passed to error handler |
Definition at line 161 of file daemon.c.
References spdyf_panic, and spdyf_panic_cls.
_MHD_EXTERN int SPDY_settings_add | ( | struct SPDY_Settings * | container, |
enum SPDY_SETTINGS | id, | ||
enum SPDY_FLAG_SETTINGS | flags, | ||
int32_t | value | ||
) |
Add or update a tuple to a SettingsIDValue structure.
container | structure to which the new tuple is added |
id | SPDY settings ID that will be sent. If this ID already in container, the tupple for it will be updated (value and/or flags). If it is not in the container, a new tupple will be added. |
flags | SPDY settings flags applied only to this setting |
value | of the setting |
_MHD_EXTERN const struct SPDY_Settings* SPDY_settings_create | ( | void | ) |
Create a new SettingsIDValue structure. It is needed for putting inside tuples of SPDY option, flags and value for sending to the client.
_MHD_EXTERN void SPDY_settings_destroy | ( | struct SPDY_Settings * | container | ) |
Destroy a settings ID/value structure. Use this function to destroy only objects which, after passed to, will not be destroied by other functions.
container | structure which to detroy |
_MHD_EXTERN int SPDY_settings_iterate | ( | const struct SPDY_Settings * | container, |
SPDY_SettingsIterator | iterator, | ||
void * | iterator_cls | ||
) |
Iterate over settings ID/value structure.
container | structure which to iterate over |
iterator | callback to call on each ID/value pair; maybe NULL (then just count number of settings) |
iterator_cls | extra argument to iterator |
_MHD_EXTERN int SPDY_settings_lookup | ( | const struct SPDY_Settings * | container, |
enum SPDY_SETTINGS | id, | ||
enum SPDY_FLAG_SETTINGS * | flags, | ||
int32_t * | value | ||
) |
Lookup value and flags for an ID in a settings ID/value structure.
container | structure in which to lookup |
id | SPDY settings ID to search for |
flags | out param for SPDY settings flags for this setting; check it against the flags in enum SPDY_FLAG_SETTINGS |
value | out param for the value of this setting |
_MHD_EXTERN struct SPDY_Daemon* SPDY_start_daemon | ( | uint16_t | port, |
const char * | certfile, | ||
const char * | keyfile, | ||
SPDY_NewSessionCallback | nscb, | ||
SPDY_SessionClosedCallback | sccb, | ||
SPDY_NewRequestCallback | nrcb, | ||
SPDY_NewDataCallback | npdcb, | ||
void * | cls, | ||
... | |||
) |
Start a SPDY webserver on the given port.
port | to bind to. The value is ignored if address structure is passed as daemon option |
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 session is closed |
nrcb | callback called when a client sends request |
npdcb | callback called when HTTP body (POST data) is received after request |
cls | common extra argument to all of the callbacks |
... | list of options (type-value pairs, terminated with SPDY_DAEMON_OPTION_END). |
Definition at line 325 of file applicationlayer.c.
References NULL, spdy_handler_new_data(), spdy_handler_new_stream(), SPDY_IO_SUBSYSTEM_NONE, SPDYF_DEBUG, spdyf_io_initialized, and SPDYF_start_daemon_va().
Referenced by run().
_MHD_EXTERN void SPDY_stop_daemon | ( | struct SPDY_Daemon * | daemon | ) |
Shutdown the daemon. First all sessions are closed. It is NOT safe to call this function in user callbacks.
daemon | to stop |
Definition at line 378 of file applicationlayer.c.
References NULL, SPDYF_DEBUG, and SPDYF_stop_daemon().
Referenced by run().