Add a Doxyfile and preliminary module-level docs.

This commit is contained in:
2024-02-20 21:41:37 -05:00
parent 17b92126de
commit 450b07fd08
30 changed files with 2868 additions and 0 deletions

View File

@ -1,5 +1,16 @@
#pragma once
/**
** \defgroup http HTTP Server
** This is a HTTP server.
**
** It can listen on multiple ports. It supports IPv4
** and IPv6. It handles websocket connections. Requests can be handled
** immediately or at a later time. It is very bare bones, and that is a
** feature.
** @{
*/
#include <stdbool.h>
#include <stddef.h>
@ -35,7 +46,13 @@ typedef struct _tf_http_request_t
typedef void(tf_http_callback_t)(tf_http_request_t* request);
typedef void(tf_http_cleanup_t)(void* user_data);
/**
** Create an HTTP server using the given libuv loop.
** @param loop A libuv loop to use.
** @return An HTTP server instance.
*/
tf_http_t* tf_http_create(uv_loop_t* loop);
void tf_http_set_trace(tf_http_t* http, tf_trace_t* trace);
int tf_http_listen(tf_http_t* http, int port, tf_tls_context_t* tls, tf_http_cleanup_t* cleanup, void* user_data);
void tf_http_add_handler(tf_http_t* http, const char* pattern, tf_http_callback_t* callback, tf_http_cleanup_t* cleanup, void* user_data);
@ -53,3 +70,5 @@ void tf_http_request_send(tf_http_request_t* request, const void* data, size_t s
void tf_http_request_websocket_upgrade(tf_http_request_t* request);
const char* tf_http_status_text(int status);
/** @} */