![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#include "nilorea/n_list.h"#include "nilorea/n_str.h"#include "nilorea/n_log.h"#include "nilorea/n_network.h"#include "nilorea/n_thread_pool.h"#include "nilorea/n_signals.h"#include <sys/stat.h>Go to the source code of this file.
Data Structures | |
| struct | NETWORK_SSL_THREAD_PARAMS |
| structure of a NETWORK_SSL_THREAD_PARAMS More... | |
Functions | |
| void | action_on_sig (int recvd_signal) |
| void | handle_request (NETWORK *netw_ptr, LIST *routes_ptr) |
| int | main (int argc, char *argv[]) |
| void | process_args (int argc_nb, char **argv_ptr, char **addr_ptr, char **port_ptr, char **key_ptr, char **cert_ptr, char **ca_file_ptr, int *ssl_verify_ptr, LIST *routes_ptr, int *ip_version_ptr, int *max_http_request_size_ptr, char **root_dir_ptr) |
| void * | ssl_network_thread (void *params) |
| void | usage (void) |
| Network for managing connections. | |
Variables | |
| int | accept_timeout = 30 |
| char * | addr = NULL |
| char * | ca_file = NULL |
| char * | cert = NULL |
| volatile sig_atomic_t | done = 0 |
| int | ip_version = 0 |
| char * | key = NULL |
| TRUE while the key is held. | |
| volatile sig_atomic_t | killed_by_signal = 0 |
| int | max_connections = 0 |
| int | max_http_request_size = 16384 |
| NETWORK * | netw = NULL |
| Network for server mode, accepting incomming. | |
| char * | port = NULL |
| char * | root_dir = NULL |
| LIST * | routes = NULL |
| NETWORK * | server = NULL |
| int | ssl_verify = 0 |
| struct NETWORK_SSL_THREAD_PARAMS |
structure of a NETWORK_SSL_THREAD_PARAMS
Definition at line 431 of file ex_network_ssl.c.
| Data Fields | ||
|---|---|---|
| NETWORK * | netw | network to use for the receiving thread |
| LIST * | routes | virtual routes for the server |
| void action_on_sig | ( | int | recvd_signal | ) |
Definition at line 205 of file ex_network_ssl.c.
References done, killed_by_signal, LOG_ERR, LOG_NOTICE, and n_log.
Referenced by main().
Definition at line 261 of file ex_network_ssl.c.
References __n_assert, _nstr, _str, Alloca, NETWORK_HTTP_INFO::body, char_to_nstr(), N_STR::data, destroy_ht(), file_to_nstr(), free_nstr, free_split_result(), HT_FOREACH, N_SOCKET::ip, NETWORK::link, list_foreach, LOG_DEBUG, LOG_ERR, LOG_INFO, max_http_request_size, n_log, netw_build_http_response(), netw_extract_http_info(), netw_get_url_from_http_request(), netw_guess_http_content_type(), netw_info_destroy(), netw_parse_post_data(), new_nstr(), nstrprintf, root_dir, send_ssl_data(), N_SOCKET::sock, SOCKET_SIZE_FORMAT, split(), NETWORK::ssl, NETWORK_HTTP_INFO::type, and N_STR::written.
Referenced by ssl_network_thread().
| int main | ( | int | argc, |
| char * | argv[] ) |
Definition at line 447 of file ex_network_ssl.c.
References __n_assert, _str, accept_timeout, action_on_sig(), add_threaded_process(), addr, ca_file, cert, destroy_threaded_pool(), DIRECT_PROC, done, FreeNoLog, get_msec(), get_nb_cpu_cores(), ip_version, key, killed_by_signal, list_destroy(), LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_NOTICE, Malloc, max_connections, max_http_request_size, MAX_LIST_ITEMS, n_log, netw, NETWORK_SSL_THREAD_PARAMS::netw, netw_accept_from_ex(), netw_close(), netw_make_listening(), netw_set_crypto(), netw_set_crypto_chain(), netw_ssl_set_verify(), new_generic_list(), new_thread_pool(), port, process_args(), root_dir, NETWORK_SSL_THREAD_PARAMS::routes, routes, server, ssl_network_thread(), ssl_verify, start_HiTimer(), thread_pool, u_sleep(), and wait_for_threaded_pool().
| void process_args | ( | int | argc_nb, |
| char ** | argv_ptr, | ||
| char ** | addr_ptr, | ||
| char ** | port_ptr, | ||
| char ** | key_ptr, | ||
| char ** | cert_ptr, | ||
| char ** | ca_file_ptr, | ||
| int * | ssl_verify_ptr, | ||
| LIST * | routes_ptr, | ||
| int * | ip_version_ptr, | ||
| int * | max_http_request_size_ptr, | ||
| char ** | root_dir_ptr ) |
Definition at line 78 of file ex_network_ssl.c.
References accept_timeout, getoptret, list_push(), LOG_DEBUG, LOG_ERR, LOG_INFO, log_level, LOG_NOTICE, LOG_NULL, max_connections, n_log, NETWORK_IPV4, NETWORK_IPV6, set_log_level(), and usage().
| void * ssl_network_thread | ( | void * | params | ) |
Definition at line 438 of file ex_network_ssl.c.
References __n_assert, Free, handle_request(), NETWORK_SSL_THREAD_PARAMS::netw, netw_close(), and NETWORK_SSL_THREAD_PARAMS::routes.
Referenced by main().
| void usage | ( | void | ) |
Network for managing connections.
Definition at line 59 of file ex_network_ssl.c.
References max_http_request_size.
| int accept_timeout = 30 |
Definition at line 51 of file ex_network_ssl.c.
Referenced by main(), netw_accept_pool_create(), and process_args().
| char* addr = NULL |
Definition at line 38 of file ex_network_ssl.c.
Referenced by addr2line(), draw_scene(), main(), main(), netw_bind_udp(), netw_make_listening(), netw_wait_close_timed(), and run_server().
| char* ca_file = NULL |
Definition at line 41 of file ex_network_ssl.c.
Referenced by main(), netw_set_crypto_chain(), and netw_ssl_set_ca().
| char* cert = NULL |
Definition at line 40 of file ex_network_ssl.c.
Referenced by _ssl_use_pem(), main(), main(), netw_set_crypto_pem(), and netw_ssl_get_verify_result().
| volatile sig_atomic_t done = 0 |
Definition at line 52 of file ex_network_ssl.c.
Referenced by action_on_sig(), h2_client_get(), io_full(), main(), main(), n_open_with_default(), on_quit_click(), and zip_unpack().
| int ip_version = 0 |
Definition at line 44 of file ex_network_ssl.c.
Referenced by main(), netw_bind_udp(), netw_connect(), netw_connect_ex(), netw_connect_ex_to(), netw_connect_nonblock(), netw_connect_to(), netw_connect_udp(), netw_make_listening(), netw_ssl_connect(), netw_ssl_connect_client(), netw_ssl_connect_client_to(), netw_wait_close_timed(), and process_args().
| volatile sig_atomic_t killed_by_signal = 0 |
Definition at line 54 of file ex_network_ssl.c.
Referenced by action_on_sig(), and main().
| int max_connections = 0 |
Definition at line 47 of file ex_network_ssl.c.
Referenced by main(), and process_args().
| int max_http_request_size = 16384 |
Definition at line 45 of file ex_network_ssl.c.
Referenced by handle_request(), main(), and usage().
| NETWORK * netw = NULL |
Network for server mode, accepting incomming.
Definition at line 57 of file ex_network_ssl.c.
| char* port = NULL |
Definition at line 37 of file ex_network_ssl.c.
Referenced by _proxy_tcp_connect(), check_exclusive(), client_connect(), main(), main(), n_http3_parse_url(), n_mock_server_start(), n_proxy_cfg_parse(), n_sse_connect(), n_ws_connect(), netw_adopt_client_fd(), netw_bind_udp(), netw_connect(), netw_connect_ex(), netw_connect_ex_to(), netw_connect_nonblock(), netw_connect_to(), netw_connect_udp(), netw_make_listening(), netw_ssl_connect(), netw_ssl_connect_client(), netw_ssl_connect_client_to(), netw_wait_close_timed(), process_args(), run_client(), run_client(), run_server(), run_server(), and test_parse_url().
| char* root_dir = NULL |
Definition at line 42 of file ex_network_ssl.c.
Referenced by handle_request(), and main().
| LIST* routes = NULL |
Definition at line 43 of file ex_network_ssl.c.
Referenced by main().
| NETWORK* server = NULL |
Definition at line 56 of file ex_network_ssl.c.
Referenced by check_refused(), main(), main(), n_mock_server_free(), n_mock_server_run(), n_mock_server_start(), n_mock_server_stop(), netw_accept_pool_create(), process_args(), and run_client().
| int ssl_verify = 0 |
Definition at line 46 of file ex_network_ssl.c.
Referenced by main().