![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#include "nilorea/n_http2_server.h"#include "nilorea/n_log.h"#include <getopt.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | PEER |
| struct | SEEN |
Macros | |
| #define | RUNT(f) |
Functions | |
| int | main (int argc, char **argv) |
| static int | on_request (void *ud, N_H2_SERVER *srv, const N_H2_REQUEST *req) |
| static size_t | out_count (const PEER *p, int type, size_t *total_payload) |
| static int | out_find (const PEER *p, int type, size_t nth, N_H2_FRAME *out) |
| static void | peer_frame (PEER *p, int type, int flags, uint32_t sid, const unsigned char *payload, size_t len) |
| static void | peer_headers (PEER *p, uint32_t sid, const N_H2_HEADER *h, size_t n, int end_stream) |
| static void | peer_prologue (PEER *p) |
| static void | peer_put (PEER *p, const void *buf, size_t len) |
| static ssize_t | peer_read (void *io, void *buf, size_t len) |
| static void | peer_window_update (PEER *p, uint32_t sid, uint32_t inc) |
| static ssize_t | peer_write (void *io, const void *buf, size_t len) |
| void | process_args (int argc, char **argv) |
| static void | test_callback_stop (void) |
| static void | test_continuation (void) |
| static void | test_dribbled_reads (void) |
| static void | test_get (void) |
| static void | test_guards (void) |
| static void | test_handshake (void) |
| static void | test_handshake_errors (void) |
| static void | test_multiplex (void) |
| static void | test_ping_goaway (void) |
| static void | test_post_body (void) |
| static void | test_rst_stream (void) |
| static void | test_send_flow_control (void) |
| static void | test_send_window_stall (void) |
Variables | |
| static int | failures = 0 |
| struct PEER |
Definition at line 47 of file ex_http2_server.c.
| Data Fields | ||
|---|---|---|
| size_t | chunk | |
| unsigned char | in[65536] | |
| size_t | in_len | |
| size_t | in_off | |
| unsigned char | out[262144] | |
| size_t | out_len | |
| int | read_fail | |
| struct SEEN |
Definition at line 171 of file ex_http2_server.c.
| #define RUNT | ( | f | ) |
Referenced by main().
| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 729 of file ex_http2_server.c.
References failures, LOG_ERR, LOG_NOTICE, n_log, process_args(), RUNT, set_log_level(), test_callback_stop(), test_continuation(), test_dribbled_reads(), test_get(), test_guards(), test_handshake(), test_handshake_errors(), test_multiplex(), test_ping_goaway(), test_post_body(), test_rst_stream(), test_send_flow_control(), and test_send_window_stall().
|
static |
Definition at line 186 of file ex_http2_server.c.
References N_H2_REQUEST::authority, SEEN::authority, N_H2_REQUEST::body, SEEN::body, N_H2_REQUEST::body_len, SEEN::body_len, SEEN::calls, SEEN::expect_send_fail, failures, N_H2_REQUEST::method, SEEN::method, n_http2_server_respond(), N_H2_HEADER::name, N_H2_REQUEST::path, SEEN::path, SEEN::reply, SEEN::reply_len, SEEN::reply_status, N_H2_REQUEST::scheme, SEEN::scheme, SEEN::stop_after, N_H2_REQUEST::stream_id, and N_H2_HEADER::value.
Referenced by main(), n_mock_server_start(), test_callback_stop(), test_continuation(), test_dribbled_reads(), test_get(), test_multiplex(), test_ping_goaway(), test_post_body(), test_rst_stream(), test_send_flow_control(), and test_send_window_stall().
|
static |
Definition at line 130 of file ex_http2_server.c.
References N_H2_FRAME::length, n_http2_frame_parse(), PEER::out, PEER::out_len, N_H2_FRAME::type, and type().
Referenced by test_callback_stop(), test_get(), test_handshake(), test_multiplex(), test_post_body(), test_send_flow_control(), and test_send_window_stall().
|
static |
Definition at line 150 of file ex_http2_server.c.
References n_http2_frame_parse(), PEER::out, PEER::out_len, N_H2_FRAME::type, and type().
Referenced by test_get(), test_handshake(), test_multiplex(), and test_ping_goaway().
|
static |
Definition at line 93 of file ex_http2_server.c.
References N_H2_FRAME_HEADER_LEN, n_http2_frame_build_header(), peer_put(), and type().
Referenced by peer_headers(), peer_prologue(), peer_window_update(), test_continuation(), test_handshake_errors(), test_ping_goaway(), test_post_body(), and test_rst_stream().
|
static |
< HEADERS/PUSH_PROMISE/CONTINUATION: header block complete
< DATA/HEADERS: last frame of the stream
< HEADERS
Definition at line 108 of file ex_http2_server.c.
References failures, N_H2_FLAG_END_HEADERS, N_H2_FLAG_END_STREAM, N_H2_HEADERS, n_http2_hpack_encode(), and peer_frame().
Referenced by test_callback_stop(), test_dribbled_reads(), test_get(), test_multiplex(), test_post_body(), test_rst_stream(), test_send_flow_control(), and test_send_window_stall().
|
static |
< SETTINGS
Definition at line 102 of file ex_http2_server.c.
References N_H2_PREFACE, N_H2_SETTINGS, peer_frame(), and peer_put().
Referenced by test_callback_stop(), test_continuation(), test_dribbled_reads(), test_get(), test_handshake(), test_multiplex(), test_ping_goaway(), test_post_body(), test_rst_stream(), test_send_flow_control(), and test_send_window_stall().
|
static |
Definition at line 83 of file ex_http2_server.c.
References failures, PEER::in, and PEER::in_len.
Referenced by peer_frame(), peer_prologue(), and test_handshake_errors().
|
static |
Definition at line 57 of file ex_http2_server.c.
References PEER::chunk, PEER::in, PEER::in_len, PEER::in_off, and PEER::read_fail.
Referenced by test_callback_stop(), test_continuation(), test_dribbled_reads(), test_get(), test_guards(), test_handshake(), test_handshake_errors(), test_multiplex(), test_ping_goaway(), test_post_body(), test_rst_stream(), test_send_flow_control(), and test_send_window_stall().
|
static |
< WINDOW_UPDATE
Definition at line 120 of file ex_http2_server.c.
References N_H2_WINDOW_UPDATE, and peer_frame().
Referenced by test_send_flow_control().
|
static |
Definition at line 73 of file ex_http2_server.c.
References PEER::out, and PEER::out_len.
Referenced by test_callback_stop(), test_continuation(), test_dribbled_reads(), test_get(), test_guards(), test_handshake(), test_handshake_errors(), test_multiplex(), test_ping_goaway(), test_post_body(), test_rst_stream(), test_send_flow_control(), and test_send_window_stall().
| void process_args | ( | int | argc, |
| char ** | argv ) |
Definition at line 704 of file ex_http2_server.c.
References LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_NOTICE, LOG_NULL, and set_log_level().
|
static |
< GOAWAY
Definition at line 624 of file ex_http2_server.c.
References SEEN::calls, failures, N_H2_GOAWAY, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), out_count(), peer_headers(), peer_prologue(), peer_read(), peer_write(), SEEN::stop_after, and N_H2_HEADER::value.
Referenced by main().
|
static |
< HEADERS
< DATA/HEADERS: last frame of the stream
< CONTINUATION
< HEADERS/PUSH_PROMISE/CONTINUATION: header block complete
< HEADERS
< DATA/HEADERS: last frame of the stream
< PING
< CONTINUATION
< HEADERS/PUSH_PROMISE/CONTINUATION: header block complete
< HEADERS
< DATA/HEADERS: last frame of the stream
< CONTINUATION
< HEADERS/PUSH_PROMISE/CONTINUATION: header block complete
Definition at line 380 of file ex_http2_server.c.
References SEEN::calls, failures, N_H2_CONTINUATION, N_H2_FLAG_END_HEADERS, N_H2_FLAG_END_STREAM, N_H2_HEADERS, N_H2_PING, n_http2_hpack_encode(), n_http2_server_error(), n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), SEEN::path, peer_frame(), peer_prologue(), peer_read(), peer_write(), and N_H2_HEADER::value.
Referenced by main().
|
static |
Definition at line 655 of file ex_http2_server.c.
References SEEN::calls, PEER::chunk, failures, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), SEEN::path, peer_headers(), peer_prologue(), peer_read(), peer_write(), and N_H2_HEADER::value.
Referenced by main().
|
static |
< HEADERS
< HEADERS/PUSH_PROMISE/CONTINUATION: header block complete
< DATA/HEADERS: last frame of the stream
< DATA
< DATA/HEADERS: last frame of the stream
< GOAWAY
Definition at line 277 of file ex_http2_server.c.
References SEEN::authority, SEEN::body_len, SEEN::calls, failures, N_H2_FRAME::flags, N_H2_FRAME::length, SEEN::method, N_H2_DATA, N_H2_FLAG_END_HEADERS, N_H2_FLAG_END_STREAM, N_H2_GOAWAY, N_H2_HEADERS, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_request_count(), n_http2_server_run(), N_H2_HEADER::name, on_request(), out_count(), out_find(), SEEN::path, N_H2_FRAME::payload, peer_headers(), peer_prologue(), peer_read(), peer_write(), SEEN::reply, SEEN::reply_len, SEEN::scheme, N_H2_FRAME::stream_id, and N_H2_HEADER::value.
Referenced by main().
|
static |
Definition at line 683 of file ex_http2_server.c.
References failures, n_http2_server_error(), n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_request_count(), n_http2_server_run(), peer_read(), peer_write(), and PEER::read_fail.
Referenced by main().
|
static |
< SETTINGS
< WINDOW_UPDATE
< SETTINGS
< SETTINGS
< SETTINGS/PING: acknowledgement
< SETTINGS
Definition at line 216 of file ex_http2_server.c.
References failures, N_H2_FRAME::flags, N_H2_FRAME::length, N_H2_FLAG_ACK, N_H2_SETTINGS, N_H2_SETTINGS_INITIAL_WINDOW_SIZE, N_H2_WINDOW_UPDATE, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_settings_parse(), out_count(), out_find(), N_H2_FRAME::payload, peer_prologue(), peer_read(), and peer_write().
Referenced by main().
|
static |
< PING
Definition at line 249 of file ex_http2_server.c.
References failures, N_H2_PING, N_H2_PREFACE, n_http2_server_error(), n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), peer_frame(), peer_put(), peer_read(), and peer_write().
Referenced by main().
|
static |
< HEADERS
< HEADERS
< HEADERS
< HEADERS
Definition at line 442 of file ex_http2_server.c.
References SEEN::calls, failures, N_H2_HEADERS, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), out_count(), out_find(), SEEN::path, peer_headers(), peer_prologue(), peer_read(), peer_write(), N_H2_FRAME::stream_id, and N_H2_HEADER::value.
Referenced by main().
|
static |
< PING
< GOAWAY
< PING
< SETTINGS/PING: acknowledgement
Definition at line 480 of file ex_http2_server.c.
References SEEN::calls, failures, N_H2_FRAME::flags, N_H2_FRAME::length, N_H2_FLAG_ACK, N_H2_GOAWAY, N_H2_PING, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), on_request(), out_find(), N_H2_FRAME::payload, peer_frame(), peer_prologue(), peer_read(), and peer_write().
Referenced by main().
|
static |
< DATA
< DATA
< DATA/HEADERS: last frame of the stream
< WINDOW_UPDATE
< WINDOW_UPDATE
Definition at line 324 of file ex_http2_server.c.
References SEEN::body, SEEN::body_len, SEEN::calls, failures, N_H2_FRAME::length, SEEN::method, N_H2_DATA, N_H2_FLAG_END_STREAM, N_H2_WINDOW_UPDATE, n_http2_frame_parse(), n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), PEER::out, out_count(), PEER::out_len, N_H2_FRAME::payload, peer_frame(), peer_headers(), peer_prologue(), peer_read(), peer_write(), N_H2_FRAME::stream_id, N_H2_FRAME::type, and N_H2_HEADER::value.
Referenced by main().
|
static |
< stream cancelled
< RST_STREAM
< DATA
< DATA/HEADERS: last frame of the stream
Definition at line 593 of file ex_http2_server.c.
References SEEN::calls, failures, N_H2_DATA, N_H2_ERR_CANCEL, N_H2_FLAG_END_STREAM, N_H2_RST_STREAM, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), peer_frame(), peer_headers(), peer_prologue(), peer_read(), peer_write(), and N_H2_HEADER::value.
Referenced by main().
|
static |
< DATA
< DATA
Definition at line 505 of file ex_http2_server.c.
References failures, N_H2_DATA, n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), out_count(), peer_headers(), peer_prologue(), peer_read(), peer_window_update(), peer_write(), SEEN::reply, SEEN::reply_len, and N_H2_HEADER::value.
Referenced by main().
|
static |
< DATA
Definition at line 550 of file ex_http2_server.c.
References SEEN::expect_send_fail, failures, N_H2_DATA, n_http2_server_error(), n_http2_server_free(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_run(), N_H2_HEADER::name, on_request(), out_count(), peer_headers(), peer_prologue(), peer_read(), peer_write(), SEEN::reply, SEEN::reply_len, and N_H2_HEADER::value.
Referenced by main().
|
static |
Definition at line 40 of file ex_http2_server.c.