NAME
ttypt/axil.h - Public API for axil.
SYNOPSIS
#include <errno.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <ttypt/stele.h>
#include <sys/select.h>
#include <pwd.h>
Data Structures
struct axil_config
struct cmd_slot
Macros
#define ENV_KEY_LEN 128
#define ENV_LEN (BUFSIZ * 2)
#define ENV_VALUE_LEN (ENV_LEN - ENV_KEY_LEN - 2)
#define TELNET_CMD(fd, ...)
Typedefs
typedef int axil_handler_t(socket_t cfd, char *body)
typedef socket_t axil_ws_upstream_t(socket_t client_fd)
Enumerations
enum descr_flags { DF_CONNECTED = 1, DF_WEBSOCKET = 4, DF_TO_CLOSE = 8, DF_ACCEPTED = 16, DF_AUTHENTICATED = 32, DF_TUNNEL = 64, DF_WS_WAITING = 128, DF_WS_PROXY_PENDING = 256, DF_EXTERN = 512, DF_HEAD = 1024, DF_DEFERRED = 2048, DF_AUTH_AUTO = 4096, DF_UNIX = 8192 }
enum axil_srv_flags { AXIL_WAKE = 1, AXIL_SSL = 2, AXIL_ROOT = 4, AXIL_SSL_ONLY = 8, AXIL_DETACH = 16, AXIL_AUTOAUTH = 32, AXIL_LOOPBACK = 64 }
enum axil_req_flags { AXIL_POST = 1, AXIL_PUT = 2, AXIL_DELETE = 4, AXIL_HEAD = 8, AXIL_OPTIONS = 16 }
enum cmd_flags { CF_NOAUTH = 1, CF_NOTRIM = 2 }
Functions
void axil_register (char *name, axil_cb_t *cb, int flags)
int axil_main (void)
void axil_stop (void)
void axil_register_handler (char *path, axil_handler_t handler)
int axil_register_fallback_handler (axil_handler_t handler)
int axil_deny_prefix (const char *prefix)
int axil_proxy_prefix (const char *prefix, const char *host, unsigned short port)
void axil_ws_handler (char *path, axil_ws_upstream_t handler)
int axil_ws_upgrade (socket_t fd)
int axil_ws_write (socket_t fd, const void *data, size_t len)
ssize_t axil_ws_read (socket_t fd, void *buf, size_t len)
int axil_ws_close (socket_t fd)
int axil_ws_printf (socket_t fd, const char *fmt,...)
int axil_post_chroot (void) WEAK
void axil_post_bind (void) WEAK
void axil_update (unsigned long long dt) WEAK
void axil_vim (socket_t fd, int argc, char *argv[]) WEAK
int axil_accept (socket_t fd) WEAK
int axil_connect (socket_t fd) WEAK
void axil_disconnect (socket_t fd) WEAK
void axil_command (socket_t fd, int argc, char *argv[]) WEAK
void axil_flush (socket_t fd, int argc, char *argv[]) WEAK
char * axil_auth_check (socket_t fd) WEAK
int axil_write (socket_t fd, void *data, size_t len)
int axil_dwritef (socket_t fd, const char *fmt, va_list va)
int axil_writef (socket_t fd, const char *fmt,...)
void axil_wall (const char *msg)
int axil_flags (socket_t fd)
unsigned long long axil_generation (socket_t fd)
void axil_close (socket_t fd)
void axil_set_flags (socket_t fd, int flags)
int axil_auth (socket_t fd, char *username)
unsigned axil_env (socket_t fd)
void axil_cert_add (char *str)
void axil_certs_add (char *fname)
ssize_t axil_mmap (char **mapped, char *file)
char * axil_mmap_iter (char *start, size_t *pos)
void axil_env_clear (socket_t fd)
int axil_env_get (socket_t fd, char *target, size_t dest_len, char *key)
int axil_env_put (socket_t fd, char *key, char *value)
int axil_query_parse (char *body)
int axil_query_param (const char *name, char *buf, size_t buf_len)
int axil_param (socket_t fd, const char *name, char *buf, size_t buf_len)
int axil_param_int (socket_t fd, const char *name, int default_val)
int axil_param_bool (socket_t fd, const char *name, int default_val)
int axil_req_param (socket_t fd, const char *body, const char *name, char *buf, size_t buf_len)
int axil_req_param_int (socket_t fd, const char *body, const char *name, int default_val)
int axil_req_param_bool (socket_t fd, const char *body, const char *name, int default_val)
const char * axil_status_text (int code)
int axil_url_encode (const char *in, char *out, size_t outlen)
size_t axil_url_decode (const char *src, size_t src_len, char *out, size_t out_len)
int axil_json_escape (const char *in, char *out, size_t outlen)
int axil_slugify (const char *title, size_t title_len, char *result, size_t result_len)
int axil_get_pw (socket_t fd, struct passwd *out)
void axil_fd_watch (socket_t fd)
void axil_fd_unwatch (socket_t fd)
void axil_fork_child_reset (void)
int axil_peer_cred (socket_t fd, uid_t *uid, gid_t *gid)
int axil_privsep_key (unsigned char out[32])
int axil_drop_ids (uid_t *uid, gid_t *gid)
void axil_header_set (socket_t fd, const char *key, const char *value)
int axil_header_get (socket_t fd, const char *key, char *buf, size_t buf_len)
void axil_respond (socket_t fd, int code, const char *body)
void * axil_respond_defer (socket_t fd, int code)
void axil_respond_defer_finish (void *handle, const char *body)
void axil_respond_defer_done (void *handle)
void axil_respond_defer_abort (void *handle)
int axil_respond_file (socket_t fd, const char *path, const char *allowed_exts)
void axil_sendfile (socket_t fd, const char *path)
void axil_exec (socket_t cfd, char *const args[], cmd_cb_t callback, void *input, size_t input_len)
int axil_exec_loop (socket_t cfd)
Variables
char axil_execbuf [BUFSIZ *64]
Detailed Description
Public API for axil.
axil provides an HTTP(S) + WebSocket(S) server with a modular handler system. POSIX-only features (PTY, autoindex, passwd auth, mmap) are no-ops on Windows.
Author
Generated automatically by Doxygen for axil from the source code.