document the DFA

This commit is contained in:
Omar Polo 2021-02-01 20:24:14 +00:00
parent 112802ea31
commit 92da82858b
1 changed files with 17 additions and 0 deletions

17
gmid.h
View File

@ -128,6 +128,23 @@ struct client;
typedef void (*statefn)(struct pollfd*, struct client*);
/*
* DFA: handle_handshake is the initial state, close_conn the final.
*
* handle_handshake -> handle_open_conn
* handle_handshake -> close_conn // on err
*
* handle_open_conn -> handle_cgi // via open_file/dir/...
* handle_open_conn -> send_directory_listing // ...same
* handle_open_conn -> send_file // ...same
* handle_open_conn -> close_conn // on error
*
* handle_cgi -> close_conn
*
* send_directory_listing -> close_conn
*
* send_file -> close_conn
*/
struct client {
struct tls *ctx;
char req[GEMINI_URL_LEN];