aboutsummaryrefslogtreecommitdiff
path: root/gmid.h
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-01 20:24:14 +0000
committerOmar Polo <op@omarpolo.com>2021-02-01 20:24:14 +0000
commit92da82858b6b8fe44f34e582967767d7f4d32f4d (patch)
tree5fd72709cf1c890883c653b3be93122ecce6d804 /gmid.h
parent112802ea3116b6e11a70d6060e6e238495498bbc (diff)
document the DFA
Diffstat (limited to 'gmid.h')
-rw-r--r--gmid.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gmid.h b/gmid.h
index e2a5e5e..4cf6266 100644
--- a/gmid.h
+++ b/gmid.h
@@ -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];