From 1ae421e876d87a3f9936f5375b7ce29a62aeefe4 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sat, 21 Sep 2024 00:55:25 +0200 Subject: [PATCH] doc: add state diagrams --- doc/hamnet70.adoc | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/doc/hamnet70.adoc b/doc/hamnet70.adoc index 031bd3f..0a05993 100644 --- a/doc/hamnet70.adoc +++ b/doc/hamnet70.adoc @@ -524,6 +524,75 @@ msc { } .... +=== State Diagrams + +This section documents state diagrams for the digipeater and the clients. +They are only informational; different implementations are possible and allowed as long as the procedures defined by the <<_message_sequence_charts,message sequence charts>> are obeyed. +However, the state diagrams shown here reflect the reference implementation. + +==== Connection State Diagram + +[graphviz,format=svg,svg-type=interactive,scale=1.0] +.Connection state diagram +.... +digraph connection { + uninitd [label="Uninitialized"]; + connecting [label="Connecting"]; + wait_client [label="Wait for\nclient"]; + estab [label="Two-way communication\nestablished"]; + closed [label="Closed"]; + + uninitd -> connecting [label="Connection request\nsent [client]"]; + uninitd -> wait_client [label="Connection request\nreceived [digipeater]"]; + + connecting -> estab [label="Connection\nacknowledgement sent"]; + wait_client -> estab [label="Connection\nacknowledged"]; + + connecting -> closed [label="Timeout"]; + wait_client -> closed [label="Timeout"]; + + estab -> closed [label="Disconnect/Timeout"]; + closed -> uninitd [label="State erased"]; +} +.... + +==== Digipeater Connection Multiplexing + +[graphviz,layout=neato,format=svg,svg-type=interactive,scale=1.0] +.Handling of multiple connections at the digipeater +.... +digraph multiclient { + overlap=false; + + idle [label="Idle"]; + send_beacon [label="Send Beacon"]; + accept_new [label="Check for\nnew clients"]; + check_conn [label="Check connection timers"]; + send_to_client [label="Send queued packets\nto client"]; + receive_from_client [label="Receive packets\nfrom client"]; + check_timeout [label="Check connection\ntimeout"]; + reset_timeout [label="Reset connection\ntimeout"]; + close_conn [label="Close\nconnection"]; + + idle -> send_beacon [label="Beacon timeout\nexpired"]; + send_beacon -> accept_new; + accept_new -> idle; + + idle -> check_conn [label="Any contact\ntimer expired"]; + check_conn -> send_to_client [label="Contact timer\nexpired"]; + send_to_client -> receive_from_client; + receive_from_client -> reset_timeout [label="Packets received"]; + reset_timeout -> check_conn; + + receive_from_client -> check_timeout [label="Nothing received"]; + check_timeout -> check_conn [label="No timeout yet"]; + check_timeout -> close_conn [label="Timed out"]; + close_conn -> check_conn; + + check_conn -> idle [label="All expired\nconnections handled"]; +} +.... + == Higher Layer Protocols [appendix]