![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Network Engine. More...
#include "n_common.h"#include "n_str.h"#include "n_list.h"#include "n_hash.h"#include <openssl/err.h>#include <openssl/ssl.h>#include <openssl/crypto.h>
Include dependency graph for n_network.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | N_HTTP_MULTIPART_PART |
| a single part of a parsed multipart/form-data body More... | |
| struct | N_HTTP_REQUEST |
| parsed HTTP request for mock server callback More... | |
| struct | N_HTTP_RESPONSE |
| HTTP response to send from mock server callback. More... | |
| struct | N_MOCK_SERVER |
| mock HTTP server handle More... | |
| struct | N_PROXY_CFG |
| Parsed proxy URL components. More... | |
| struct | N_SOCKET |
| Structure of a N_SOCKET. More... | |
| struct | N_SSE_CONN |
| SSE connection handle. More... | |
| struct | N_SSE_EVENT |
| SSE event received from server. More... | |
| struct | N_URL |
| parsed URL components More... | |
| struct | N_URL_PARAM |
| a single query parameter key=value pair More... | |
| struct | N_WS_CONN |
| WebSocket connection. More... | |
| struct | N_WS_FRAME |
| A single parsed WebSocket frame (RFC 6455). More... | |
| struct | N_WS_MESSAGE |
| WebSocket message. More... | |
| struct | NETWORK |
| Structure of a NETWORK. More... | |
| struct | NETWORK_HTTP_INFO |
| structure for splitting HTTP requests More... | |
| struct | NETWORK_POOL |
| structure of a network pool More... | |
Macros | |
| #define | _OPEN_SYS_SOCK_IPV6 1 |
| #define | HEAD_CODE 3 |
| Code of a HEAD message. | |
| #define | HEAD_SIZE 10 |
| Size of a HEAD message. | |
| #define | N_ENUM_netw_code_type(_) |
| Network codes definition. | |
| #define | N_URL_MAX_PARAMS 64 |
| maximum number of parsed query parameters | |
| #define | N_WS_OP_BINARY 0x02 |
| #define | N_WS_OP_CLOSE 0x08 |
| #define | N_WS_OP_PING 0x09 |
| #define | N_WS_OP_PONG 0x0A |
| #define | N_WS_OP_TEXT 0x01 |
| WebSocket opcodes per RFC 6455. | |
| #define | netw_atomic_read_reactor_handle(netw) __atomic_load_n(&(netw)->reactor_handle, __ATOMIC_ACQUIRE) |
| Same contract for the back-pointer to the reactor. | |
| #define | netw_atomic_read_reactor_mode(netw) __atomic_load_n(&(netw)->reactor_mode, __ATOMIC_ACQUIRE) |
| Lock-free atomic read of the reactor_mode flag. | |
| #define | netw_atomic_read_state(netw) __atomic_load_n(&(netw)->state, __ATOMIC_ACQUIRE) |
| Lock-free atomic read of the network state field. | |
| #define | netw_atomic_write_reactor_handle(netw, val) __atomic_store_n(&(netw)->reactor_handle, (val), __ATOMIC_RELEASE) |
| #define | netw_atomic_write_reactor_mode(netw, val) __atomic_store_n(&(netw)->reactor_mode, (val), __ATOMIC_RELEASE) |
| #define | netw_atomic_write_state(netw, val) __atomic_store_n(&(netw)->state, (val), __ATOMIC_RELEASE) |
| Lock-free atomic write of the network state field. | |
| #define | NETW_COMPRESS_MIN_RATIO 10u |
| #define | NETW_COMPRESS_THRESHOLD 256u |
| Opportunistic compression policy. | |
| #define | NETW_COMPRESSED NETW_COMPRESSED_ZLIB |
| Legacy alias, the first compression commit shipped a single NETW_COMPRESSED flag before LZ4 was added. | |
| #define | NETW_IO_WANT_READ -10 |
| single-attempt I/O (send_data_once / recv_data_once): the operation cannot progress until the socket is READABLE. | |
| #define | NETW_IO_WANT_WRITE -11 |
| single-attempt I/O: the operation cannot progress until the socket is WRITABLE. | |
| #define | NETW_MAX_RETRIES 8 |
| Send or recv max number of retries. | |
| #define | NETW_RETRY_DELAY 1000 |
| Send or recv delay between retries in usec. | |
| #define | NETW_SOCKET_DISCONNECTED -2 |
| Code for a disconnected recv. | |
| #define | NETW_SOCKET_ERROR -1 |
| code for a socket error | |
| #define | NETW_THR_EXIT_ERROR 666 |
| Internal DONE value indicating a send/recv thread observed NETW_ERROR without an in-flight local shutdown. | |
| #define | NETW_THR_EXIT_OK 100 |
| Internal DONE value indicating a send/recv thread reached end-of-life cleanly (peer QUIT or local NETW_EXIT_ASKED ack'd). | |
| #define | NETWORK_CONSECUTIVE_SEND_WAIT 2048 |
| Flag to set consecutive send waiting timeout | |
| #define | NETWORK_DEPLETE_QUEUES_TIMEOUT 1024 |
| Flag to set network queues depletion timeout | |
| #define | NETWORK_DEPLETE_SOCKET_TIMEOUT 512 |
| Flag to set send buffer depletion timeout | |
| #define | NETWORK_DISABLE_ZERO_LENGTH_RECV FALSE |
| Enable/disable recv of length 0. | |
| #define | NETWORK_IPALL 0 |
| Flag for auto detection by OS of ip version to use. | |
| #define | NETWORK_IPV4 1 |
| Flag to force IPV4 | |
| #define | NETWORK_IPV6 2 |
| Flag to force IPV6 | |
| #define | NETWORK_TCP 0 |
| Flag for TCP transport (default) | |
| #define | NETWORK_UDP 1 |
| Flag for UDP transport. | |
| #define | NETWORK_WAIT_CLOSE_TIMEOUT 4096 |
| Flag to set network closing wait timeout. | |
| #define | SOCKET_SIZE_FORMAT "%d" |
| socket associated printf style | |
Typedefs | |
| typedef ssize_t(* | netw_func) (void *, char *, uint32_t) |
| send/recv func ptr type | |
| typedef int(* | netw_sni_pick_cb) (const char *sni, N_STR **cert_pem, N_STR **key_pem, void *user_data) |
| SNI cert-pick callback for netw_accept_ssl_with_sni_cb: given the client SNI host (may be NULL), fill *cert_pem and *key_pem with a server certificate and key (newly allocated; n_network frees them). | |
| typedef int | SOCKET |
| default socket declaration | |
Enumerations | |
| enum | __netw_code_type { NETW_CLIENT = 2 , NETW_SERVER = 4 , NETW_RESTART_TIMER = 8 , NETW_EMPTY_SENDBUF = 16 , NETW_EMPTY_RECVBUF = 32 , NETW_RUN = 64 , NETW_EXIT_ASKED = 128 , NETW_EXITED = 256 , NETW_ERROR = 512 , NETW_ENCRYPT_NONE = 1024 , NETW_ENCRYPT_OPENSSL = 2048 , NETW_THR_ENGINE_STARTED = 4096 , NETW_THR_ENGINE_STOPPED = 8192 , NETW_DESTROY_RECVBUF = 16384 , NETW_DESTROY_SENDBUF = 32768 , NETW_COMPRESSED_ZLIB = 65536 , NETW_COMPRESSED_LZ4 = 131072 , ____netw_code_type_UNKNOWN_VALUE__ } |
| Network codes declaration. More... | |
| enum | NETW_COMPRESS_MODE { NETW_COMPRESS_NONE = 0 , NETW_COMPRESS_ZLIB = 1 , NETW_COMPRESS_LZ4 = 2 } |
| Compression mode selector for NETWORK.compress_mode. More... | |
Functions | |
| int | deplete_send_buffer (int fd, int timeout) |
| wait for send buffer to be empty | |
| size_t | htonst (size_t value) |
| host to network size_t | |
| N_STR * | n_http_build_multipart (LIST *parts, const char *boundary) |
| build a multipart/form-data body from a LIST of N_HTTP_MULTIPART_PART* using boundary (without "--"); returns a new N_STR (free with free_nstr) or NULL. | |
| int | n_http_decompress_body (const N_STR *body, const char *encoding, N_STR **out) |
| decompress an HTTP body per its Content-Encoding ("gzip"/"deflate"; identity/NULL/unknown copies through). | |
| int | n_http_multipart_boundary (const char *content_type, char *out, size_t outsz) |
| copy the boundary token from a Content-Type value into out (without the leading "--"). | |
| void | n_http_multipart_free (LIST **parts) |
| free a LIST returned by n_http_parse_multipart and NULL the pointer | |
| LIST * | n_http_parse_multipart (const N_STR *body, const char *boundary) |
| parse a multipart body (boundary given without "--") into a LIST of N_HTTP_MULTIPART_PART*; free with n_http_multipart_free. | |
| int | n_http_status_class (int status_code) |
| leading digit of an HTTP status code (1..5), or 0 when outside 100..599 | |
| int | n_http_status_is_client_error (int status_code) |
| 1 when status_code is a client error (4xx), else 0 | |
| int | n_http_status_is_informational (int status_code) |
| 1 when status_code is informational (1xx), else 0 | |
| int | n_http_status_is_redirect (int status_code) |
| 1 when status_code is a redirect (3xx), else 0 | |
| int | n_http_status_is_server_error (int status_code) |
| 1 when status_code is a server error (5xx), else 0 | |
| int | n_http_status_is_success (int status_code) |
| 1 when status_code is success (2xx), else 0 | |
| void | n_mock_server_free (N_MOCK_SERVER **server) |
| free a mock server and close the listening socket | |
| void | n_mock_server_run (N_MOCK_SERVER *server) |
| run the mock server accept loop (blocks until stop_flag is set) | |
| N_MOCK_SERVER * | n_mock_server_start (int port, void(*on_request)(N_HTTP_REQUEST *, N_HTTP_RESPONSE *, void *), void *user_data) |
| start a mock HTTP server on localhost:port (returns immediately) | |
| void | n_mock_server_stop (N_MOCK_SERVER *server) |
| signal the mock server to stop accepting connections | |
| void | n_netw_clear_connect_errors (void) |
| Clear pre-connection errors on this thread. | |
| void | n_netw_clear_errors (NETWORK *netw) |
| Clear captured errors on a NETWORK handle. | |
| const char * | n_netw_get_connect_error (int index) |
| Get pre-connection error message by index. | |
| int | n_netw_get_connect_error_count (void) |
| Get number of pre-connection errors captured on this thread. | |
| const char * | n_netw_get_error (const NETWORK *netw, int index) |
| Get captured error message by index (0 = oldest). | |
| int | n_netw_get_error_count (const NETWORK *netw) |
| Get number of captured errors on a NETWORK handle. | |
| void | n_proxy_cfg_free (N_PROXY_CFG **cfg) |
| Free an N_PROXY_CFG created by n_proxy_cfg_parse(). | |
| N_PROXY_CFG * | n_proxy_cfg_parse (const char *url) |
| Parse a proxy URL string into an N_PROXY_CFG struct. | |
| int | n_proxy_connect_socks5 (const N_PROXY_CFG *proxy, const char *target_host, int target_port) |
| Open a TCP connection through a SOCKS5 proxy. | |
| int | n_proxy_connect_tunnel (const N_PROXY_CFG *proxy, const char *target_host, int target_port) |
| Open a TCP connection through an HTTP proxy using CONNECT tunneling. | |
| int | n_proxy_connect_tunnel_ssl (const N_PROXY_CFG *proxy, const char *target_host, int target_port) |
| Open a TCP connection through an HTTPS proxy using CONNECT tunneling. | |
| void | n_sse_conn_free (N_SSE_CONN **conn) |
| free an SSE connection | |
| N_SSE_CONN * | n_sse_connect (const char *host, const char *port, const char *path, int use_ssl, const char *user_agent, void(*on_event)(N_SSE_EVENT *, N_SSE_CONN *, void *), void *user_data) |
| connect to an SSE endpoint and start reading events (blocks until stopped). | |
| void | n_sse_event_clean (N_SSE_EVENT *event) |
| free an SSE event's contents (does not free the event struct itself) | |
| void | n_sse_stop (N_SSE_CONN *conn) |
| signal the SSE connection to stop reading | |
| N_STR * | n_url_build (const N_URL *u) |
| build a URL string from parsed components | |
| N_STR * | n_url_canonicalize (const N_URL *u) |
| produce a canonical URL string for dedup (lowercase scheme/host, drop default port, remove . | |
| N_STR * | n_url_canonicalize_string (const char *url) |
| parse and canonicalize a URL string in one call | |
| N_STR * | n_url_decode (const char *str) |
| decode a percent-encoded string (returns N_STR) | |
| N_STR * | n_url_encode (const char *str) |
| percent-encode a string for use in URLs (delegates to n_str_url_encode()) | |
| void | n_url_free (N_URL **u) |
| free a N_URL and all its members | |
| N_URL * | n_url_parse (const char *url) |
| parse a URL string into components | |
| N_STR * | n_url_resolve (const char *base, const char *ref) |
| resolve a (possibly relative) reference against an absolute base URL (RFC 3986 section 5) | |
| void | n_ws_close (N_WS_CONN *conn) |
| send close frame and close the connection | |
| void | n_ws_conn_free (N_WS_CONN **conn) |
| free a WebSocket connection structure | |
| N_WS_CONN * | n_ws_connect (const char *host, const char *port, const char *path, int use_ssl) |
| connect to a WebSocket server (ws:// or wss://) and perform the HTTP/1.1 upgrade handshake | |
| size_t | n_ws_frame_build (int fin, int opcode, int do_mask, const unsigned char *payload, size_t len, const unsigned char mask_key[4], unsigned char *out, size_t out_cap) |
| build a WebSocket frame into out (optionally masking the payload). | |
| int | n_ws_frame_parse (const unsigned char *buf, size_t len, N_WS_FRAME *frame, size_t *consumed) |
| parse one WebSocket frame from a byte buffer (stateless). | |
| int | n_ws_recv (N_WS_CONN *conn, N_WS_MESSAGE *msg_out) |
| receive one WebSocket frame | |
| int | n_ws_send (N_WS_CONN *conn, const char *payload, size_t len, int opcode) |
| send a WebSocket frame (client always masks) | |
| void | n_ws_unmask (unsigned char *dst, const unsigned char *src, size_t len, const unsigned char mask[4]) |
| XOR-unmask len bytes of src into dst using a 4-byte WebSocket mask key. | |
| NETWORK * | netw_accept_from (NETWORK *from) |
| Accepting routine. | |
| NETWORK * | netw_accept_from_ex (NETWORK *from, size_t send_list_limit, size_t recv_list_limit, int blocking, int *retval) |
| Accepting routine extended. | |
| NETWORK * | netw_accept_nonblock_from (NETWORK *from, int blocking) |
| Accepting routine. | |
| NETWORK * | netw_accept_ssl_with_sni_cb (NETWORK *listen, netw_sni_pick_cb pick, void *user_data) |
| accept a TLS connection, selecting the server certificate per client SNI via pick() during the handshake | |
| int | netw_add_msg (NETWORK *netw, N_STR *msg) |
| Add a message to send in aimed NETWORK. | |
| int | netw_add_msg_ex (NETWORK *netw, char *str, unsigned int length) |
| Add a char message to send in the aimed NETWORK. | |
| int | netw_adopt_client_fd (NETWORK **netw, SOCKET fd, const char *host, const char *port) |
| adopt an already-connected socket fd into a fresh client NETWORK (plain send/recv) | |
| int | netw_bind_udp (NETWORK **netw, char *addr, char *port, int ip_version) |
| Create a UDP bound socket. | |
| int | netw_build_http_response (N_STR **http_response, int status_code, const char *server_name, const char *content_type, char *additional_headers, N_STR *body) |
| build HTTP response | |
| size_t | netw_calculate_urlencoded_size (const char *str, size_t len) |
| calculate URL-encoded size | |
| int | netw_close (NETWORK **netw) |
| Closing. | |
| int | netw_connect (NETWORK **netw, char *host, char *port, int ip_version) |
| Connecting. | |
| int | netw_connect_ex (NETWORK **netw, char *host, char *port, size_t send_list_limit, size_t recv_list_limit, int ip_version, char *ssl_key_file, char *ssl_cert_file) |
| Connecting, extended. | |
| int | netw_connect_ex_to (NETWORK **netw, char *host, char *port, size_t send_list_limit, size_t recv_list_limit, int ip_version, char *ssl_key_file, char *ssl_cert_file, int connect_timeout_ms) |
| Connecting, extended, with a bounded connection-establishment time (connect_timeout_ms, 0 = OS default) | |
| int | netw_connect_to (NETWORK **netw, char *host, char *port, int ip_version, int connect_timeout_ms) |
| Connecting, with a bounded connection-establishment time (connect_timeout_ms, 0 = OS default) | |
| int | netw_connect_udp (NETWORK **netw, char *host, char *port, int ip_version) |
| Connect a UDP socket to a remote host. | |
| int | netw_destroy_pool (NETWORK_POOL **netw_pool) |
| destroy pool | |
| NETWORK_HTTP_INFO | netw_extract_http_info (char *request) |
| extract HTTP info from request | |
| char * | netw_extract_http_request_type (const char *request) |
| extract HTTP request type | |
| int | netw_get_http_date (char *buffer, size_t buffer_size) |
| get current HTTP date string | |
| const char * | netw_get_http_status_message (int status_code) |
| get HTTP status message string | |
| N_STR * | netw_get_msg (NETWORK *netw) |
| Get a message from aimed NETWORK. | |
| int | netw_get_queue_status (NETWORK *netw, size_t *nb_to_send, size_t *nb_to_read) |
| get queue status | |
| int | netw_get_state (NETWORK *netw, uint32_t *state, int *thr_engine_status) |
| Get flags from network. | |
| int | netw_get_url_from_http_request (const char *request, char *url, size_t size) |
| get URL from HTTP request | |
| const char * | netw_guess_http_content_type (const char *url) |
| guess HTTP content type from URL | |
| int | netw_info_destroy (NETWORK_HTTP_INFO http_request) |
| destroy HTTP info structure | |
| int | netw_init_openssl (void) |
| init ssl helper | |
| int | netw_init_wsa (int mode, int v1, int v2) |
| Used by Init & Close network. | |
| int | netw_make_listening (NETWORK **netw, char *addr, char *port, int nbpending, int ip_version) |
| Listening network. | |
| NETWORK_POOL * | netw_new_pool (size_t nb_min_element) |
| init pools | |
| HASH_TABLE * | netw_parse_post_data (const char *post_data) |
| parse POST data into hash table | |
| int | netw_pool_add (NETWORK_POOL *netw_pool, NETWORK *netw) |
| add network to pool | |
| int | netw_pool_broadcast (NETWORK_POOL *netw_pool, const NETWORK *from, N_STR *net_msg) |
| broadcast message to pool | |
| size_t | netw_pool_nbclients (NETWORK_POOL *netw_pool) |
| get nb clients | |
| void | netw_pool_netw_close (void *netw_ptr) |
| close pool | |
| int | netw_pool_remove (NETWORK_POOL *netw_pool, NETWORK *netw) |
| remove network from pool | |
| void * | netw_recv_func (void *NET) |
| Thread Receiving management function. | |
| void * | netw_send_func (void *NET) |
| Thread Sending management function. | |
| int | netw_send_ident (NETWORK *netw, int type, int id, N_STR *name, N_STR *passwd) |
| send ident message | |
| int | netw_send_ping (NETWORK *netw, int type, int id_from, int id_to, int time) |
| send ping message | |
| int | netw_send_position (NETWORK *netw, int id, double X, double Y, double vx, double vy, double acc_x, double acc_y, int time_stamp) |
| send position message | |
| int | netw_send_quit (NETWORK *netw) |
| send quit message | |
| int | netw_send_string_to (NETWORK *netw, int id_to, N_STR *name, N_STR *chan, N_STR *txt, int color) |
| send string to a specific target | |
| int | netw_send_string_to_all (NETWORK *netw, N_STR *name, N_STR *chan, N_STR *txt, int color) |
| send string to all targets | |
| int | netw_set (NETWORK *netw, int flag) |
| Set flags on network. | |
| int | netw_set_blocking (NETWORK *netw, unsigned long int is_blocking) |
| set blocking mode | |
| int | netw_set_compression_mode (NETWORK *netw, int mode) |
| Pick send-side compression algorithm for this NETWORK: NETW_COMPRESS_NONE, _ZLIB, _LZ4. | |
| void | netw_set_connect_abort_cb (int(*cb)(void *ctx), void *ctx) |
| register a process-wide callback polled during connect; non-zero aborts the in-progress connect (NULL removes) | |
| int | netw_set_crypto (NETWORK *netw, char *key, char *certificate) |
| set SSL | |
| int | netw_set_crypto_chain (NETWORK *netw, char *key, char *certificate, char *ca_file) |
| set SSL certificate chain from PEM file | |
| int | netw_set_crypto_chain_pem (NETWORK *netw, const char *key_pem, const char *cert_pem, const char *ca_pem) |
| set SSL certificate chain from PEM strings in memory | |
| int | netw_set_crypto_pem (NETWORK *netw, const char *key_pem, const char *cert_pem) |
| set SSL from PEM strings in memory | |
| int | netw_set_crypto_pem_ctx (NETWORK *netw, const N_STR *key_pem, const N_STR *cert_pem) |
| install an in-memory cert/key on THIS connection's SSL only (per-connection, unlike the context-wide netw_set_crypto_pem) | |
| int | netw_set_user_id (NETWORK *netw, int id) |
| set user id on a netw | |
| int | netw_setsockopt (NETWORK *netw, int optname, int value) |
| Set common socket options (disable naggle, send/recv buf, reuse addr) | |
| int | netw_ssl_connect (NETWORK **netw, char *host, char *port, int ip_version, char *ssl_key_file, char *ssl_cert_file) |
| connect ssl helper | |
| int | netw_ssl_connect_client (NETWORK **netw, char *host, char *port, int ip_version) |
| connect as SSL client without client certificate (TCP + SSL_CTX, no handshake yet) | |
| int | netw_ssl_connect_client_to (NETWORK **netw, char *host, char *port, int ip_version, int connect_timeout_ms) |
| like netw_ssl_connect_client but bounds the TCP connect by connect_timeout_ms (0 = OS default) | |
| int | netw_ssl_do_handshake (NETWORK *netw, const char *sni_hostname) |
| complete the SSL handshake on a NETWORK whose ctx was already created | |
| const char * | netw_ssl_get_sni (NETWORK *netw) |
| get the SNI server_name the peer requested in its ClientHello, or NULL | |
| int | netw_ssl_get_verify_result (NETWORK *netw, const char *expected_host, char *errbuf, size_t errsz) |
| evaluate the peer certificate (chain trust + host match) against the system trust store, independently of the connection verify mode | |
| int | netw_ssl_server_handshake (NETWORK *netw, netw_sni_pick_cb pick, void *user_data) |
| upgrade an already-accepted plaintext connection to a TLS server, selecting the cert per client SNI via pick() during the handshake (for proxy CONNECT) | |
| int | netw_ssl_set_ca (NETWORK *netw, const char *ca_file, const char *ca_path) |
| set custom CA verify path or file | |
| int | netw_ssl_set_client_cert (NETWORK *netw, const char *cert_file, const char *key_file) |
| load client certificate and private key for mTLS | |
| int | netw_ssl_set_verify (NETWORK *netw, int enable) |
| enable or disable peer certificate verification | |
| int | netw_ssl_start_client (NETWORK *netw) |
| set up a client SSL_CTX on an already-connected NETWORK (no handshake yet) | |
| int | netw_start_thr_engine (NETWORK *netw) |
| Create the sending and receiving thread of a NETWORK. | |
| int | netw_stop_thr_engine (NETWORK *netw) |
| Stop a NETWORK connection sending and receiving thread. | |
| ssize_t | netw_udp_recvfrom (NETWORK *netw, char *buf, uint32_t n, struct sockaddr *src_addr, socklen_t *src_len) |
| UDP recvfrom with source address capture. | |
| ssize_t | netw_udp_sendto (NETWORK *netw, char *buf, uint32_t n, struct sockaddr *dest_addr, socklen_t dest_len) |
| UDP sendto with explicit destination. | |
| int | netw_unload_openssl (void) |
| unload ssl helper | |
| char * | netw_urldecode (const char *str) |
| URL-decode a string. | |
| char * | netw_urlencode (const char *str, size_t len) |
| URL-encode a string. | |
| int | netw_wait_close (NETWORK **netw) |
| Closing for peer. | |
| int | netw_wait_close_timed (NETWORK **netw, size_t timeout) |
| Closing for peer with timeout. | |
| N_STR * | netw_wait_msg (NETWORK *netw, unsigned int refresh, size_t timeout) |
| Wait a message from aimed NETWORK. | |
| size_t | ntohst (size_t value) |
| network to host size_t | |
| ssize_t | recv_data (void *netw, char *buf, uint32_t n) |
| Reading from a socket. | |
| ssize_t | recv_data_once (void *netw, char *buf, uint32_t n) |
| Single-attempt read (see NETWORK.recv_data_once contract) | |
| ssize_t | recv_php (SOCKET s, int *_code, char **buf) |
| receive from php | |
| ssize_t | recv_ssl_data (void *netw, char *buf, uint32_t n) |
| SSL Reading from a socket. | |
| ssize_t | recv_ssl_data_once (void *netw, char *buf, uint32_t n) |
| SSL single-attempt read (see recv_data_once contract) | |
| ssize_t | recv_udp_data (void *netw, char *buf, uint32_t n) |
| UDP recv data from socket. | |
| ssize_t | send_data (void *netw, char *buf, uint32_t n) |
| Writing to a socket. | |
| ssize_t | send_data_once (void *netw, char *buf, uint32_t n) |
| Single-attempt write (see NETWORK.send_data_once contract) | |
| ssize_t | send_php (SOCKET s, int _code, char *buf, int n) |
| sending to php | |
| ssize_t | send_ssl_data (void *netw, char *buf, uint32_t n) |
| SSL Writing to a socket. | |
| ssize_t | send_ssl_data_once (void *netw, char *buf, uint32_t n) |
| SSL single-attempt write (see send_data_once contract) | |
| ssize_t | send_udp_data (void *netw, char *buf, uint32_t n) |
| UDP send data to connected peer or specified addr. | |