diff --git a/docs/state-machines/allocator.dot b/docs/state-machines/allocator.dot new file mode 100644 index 0000000..eb0b9d3 --- /dev/null +++ b/docs/state-machines/allocator.dot @@ -0,0 +1,25 @@ +digraph { + + start [label="A:\nNameplate\nAllocation" style="dotted"] + {rank=same; start S0A S0B} + start -> S0A [style="invis"] + S0A [label="S0A:\nidle\ndisconnected" color="orange"] + S0A -> S0B [label="connected"] + S0B -> S0A [label="lost"] + S0B [label="S0B:\nidle\nconnected"] + S0A -> S1A [label="allocate" color="orange"] + S0B -> P_allocate [label="allocate"] + P_allocate [shape="box" label="RC.tx_allocate" color="orange"] + P_allocate -> S1B [color="orange"] + S1B [label="S1B:\nallocating" color="orange"] + S1B -> S1A [label="lost"] + S1A [label="S1A:\nallocating\ndisconnected" color="orange"] + S1A -> P_allocate [label="connected" color="orange"] + + S1B -> P_allocated [label="rx_allocated" color="orange"] + P_allocated [shape="box" label="C.allocated" color="orange"] + P_allocated -> S2 [color="orange"] + + S2 [label="S2:\ndone" color="orange"] + +} diff --git a/docs/state-machines/code.dot b/docs/state-machines/code.dot index 53d3cca..35940f8 100644 --- a/docs/state-machines/code.dot +++ b/docs/state-machines/code.dot @@ -1,48 +1,27 @@ digraph { - start [label="Wormhole Code\nMachine" style="dotted"] - {rank=same; start S0A S0B} - start -> S0A [style="invis"] - S0A [label="S0A:\nunknown\ndisconnected"] - S0A -> S0B [label="connected"] - S0B -> S0A [label="lost"] - S0B [label="S0B:\nunknown\nconnected"] - S0A -> P0_got_code [label="set_code"] - S0B -> P0_got_code [label="set_code"] + start [label="C:\nCode\nManagement" style="dotted"] + {rank=same; start S0} + start -> S0 [style="invis"] + S0 [label="S0:\nidle"] + S0 -> P0_got_code [label="set_code"] P0_got_code [shape="box" label="B.got_code"] - P0_got_code -> S5 - S5 [label="S5: known" color="green"] + P0_got_code -> S3 + S3 [label="S3: known" color="green"] - S0A -> P0_list_nameplates [label="input_code"] - S0B -> P0_list_nameplates [label="input_code"] - S2 [label="S2: typing\nnameplate"] + {rank=same; S1_inputting S2_allocating} + S0 -> P_input [label="input_code"] + P_input [shape="box" label="I.start"] + P_input -> S1_inputting + S1_inputting [label="S1:\ninputting"] + S1_inputting -> P0_got_code [label="finished_input"] - S2 -> P0_list_nameplates [label="update_nameplates"] - P0_list_nameplates [shape="box" label="L.refresh_nameplates"] - P0_list_nameplates -> S2 - - S2 -> P2_claim [label="claim_nameplate" color="orange" fontcolor="orange"] - P2_claim [shape="box" label="N.set_nameplate"] - P2_claim -> S3 - S3 [label="S3: typing\ncode\n(no wordlist)"] - S3 -> P3_stash_wordlist [label="got_nameplates" color="orange"] - P3_stash_wordlist [shape="box" label="stash\nwordlist" color="orange"] - P3_stash_wordlist -> S4 [color="orange"] - S3 -> P0_got_code [label="submit_words"] - S4 [label="S4: typing\ncode\n(yes wordlist)" color="orange"] - S4 -> P0_got_code [label="submit_words" color="orange" fontcolor="orange"] - - S0A -> S1A [label="allocate_code"] - S1A [label="S1A:\nconnecting"] - S1A -> P1_allocate [label="connected"] - P1_allocate [shape="box" label="RC.tx_allocate"] - P1_allocate -> S1B - S1B [label="S1B:\nallocating"] - S1B -> P1_generate [label="rx_allocated"] - S1B -> S1A [label="lost"] - P1_generate [shape="box" label="generate\nrandom code"] + S0 -> P_allocate [label="allocate_code"] + P_allocate [shape="box" label="A.allocate"] + P_allocate -> S2_allocating + S2_allocating [label="S2:\nallocating"] + S2_allocating -> P1_generate [label="allocated_nameplate"] + P1_generate [shape="box" label="generate\nrandom words"] P1_generate -> P0_got_code - S0B -> P1_allocate [label="allocate_code"] - } diff --git a/docs/state-machines/input.dot b/docs/state-machines/input.dot new file mode 100644 index 0000000..3a68ac4 --- /dev/null +++ b/docs/state-machines/input.dot @@ -0,0 +1,32 @@ +digraph { + + start [label="I:\nCode\nInput" style="dotted"] + {rank=same; start S0} + start -> S0 [style="invis"] + S0 [label="S0:\nidle"] + + S0 -> P0_list_nameplates [label="start" color="orange"] + P0_list_nameplates [shape="box" label="L.refresh_nameplates" color="orange"] + P0_list_nameplates -> S1 [color="orange"] + S1 [label="S1: typing\nnameplate" color="orange"] + + {rank=same; foo P0_list_nameplates} + S1 -> foo [label="update_nameplates"] + foo [style="dashed" label=""] + foo -> P0_list_nameplates + + S1 -> P1_claim [label="claim_nameplate" color="orange" fontcolor="orange"] + P1_claim [shape="box" label="N.set_nameplate" color="orange"] + P1_claim -> S2 [color="orange"] + S2 [label="S2: typing\ncode\n(no wordlist)" color="orange"] + S2 -> P2_stash_wordlist [label="got_nameplates" color="orange"] + P2_stash_wordlist [shape="box" label="stash\nwordlist" color="orange"] + P2_stash_wordlist -> S3 [color="orange"] + S2 -> P_done [label="submit_words"] + S3 [label="S3: typing\ncode\n(yes wordlist)" color="orange"] + S3 -> P_done [label="submit_words" color="orange" fontcolor="orange"] + P_done [shape="box" label="C.finished_input" color="orange"] + P_done -> S4 [color="orange"] + S4 [label="S4: known" color="green"] + +} diff --git a/docs/state-machines/machines.dot b/docs/state-machines/machines.dot index c1a6b6c..c84e9cb 100644 --- a/docs/state-machines/machines.dot +++ b/docs/state-machines/machines.dot @@ -6,30 +6,38 @@ digraph { Mailbox [shape="box" color="blue" fontcolor="blue"] Connection [label="Rendezvous\nConnector" shape="oval" color="blue" fontcolor="blue"] - websocket [color="blue" fontcolor="blue"] + #websocket [color="blue" fontcolor="blue"] Order [shape="box" label="Ordering" color="blue" fontcolor="blue"] Key [shape="box" label="Key" color="blue" fontcolor="blue"] Send [shape="box" label="Send" color="blue" fontcolor="blue"] Receive [shape="box" label="Receive" color="blue" fontcolor="blue"] Code [shape="box" label="Code" color="blue" fontcolor="blue"] - Lister [shape="box" label="(Nameplate)\nLister" + Lister [shape="box" label="(nameplate)\nLister" color="blue" fontcolor="blue"] + Allocator [shape="box" label="(nameplate)\nAllocator" + color="blue" fontcolor="blue"] + Input [shape="box" label="(code)\nInput helper" + color="blue" fontcolor="blue"] Terminator [shape="box" color="blue" fontcolor="blue"] - Connection -> websocket [color="blue"] + #Connection -> websocket [color="blue"] #Connection -> Order [color="blue"] - Wormhole -> Boss [style="dashed" label="allocate_code\ninput_code\nset_code\nsend\nclose\n(once)"] + Wormhole -> Boss [style="dashed" + label="allocate_code\ninput_code\nset_code\nsend\nclose\n(once)" + color="red" fontcolor="red"] #Wormhole -> Boss [color="blue"] Boss -> Wormhole [style="dashed" label="got_code\ngot_key\ngot_verifier\ngot_version\nreceived (seq)\nclosed\n(once)"] #Boss -> Connection [color="blue"] - Boss -> Connection [style="dashed" label="start"] + Boss -> Connection [style="dashed" label="start" + color="red" fontcolor="red"] Connection -> Boss [style="dashed" label="rx_welcome\nrx_error\nerror"] - Boss -> Send [style="dashed" label="send"] + Boss -> Send [style="dashed" color="red" fontcolor="red" label="send"] - Boss -> Nameplate [style="dashed" label="set_nameplate"] + Boss -> Nameplate [style="dashed" color="red" fontcolor="red" + label="set_nameplate"] #Boss -> Mailbox [color="blue"] Mailbox -> Order [style="dashed" label="got_message (once)"] Boss -> Key [style="dashed" label="got_code"] @@ -40,7 +48,8 @@ digraph { Key -> Mailbox [style="dashed" label="add_message (pake)\nadd_message (version)"] Receive -> Send [style="dashed" label="got_verified_key"] - Send -> Mailbox [style="dashed" label="add_message (phase)"] + Send -> Mailbox [style="dashed" color="red" fontcolor="red" + label="add_message (phase)"] Key -> Receive [style="dashed" label="got_key"] Receive -> Boss [style="dashed" @@ -52,7 +61,7 @@ digraph { Mailbox -> Nameplate [style="dashed" label="release"] Nameplate -> Mailbox [style="dashed" label="got_mailbox"] - Mailbox -> Connection [style="dashed" + Mailbox -> Connection [style="dashed" color="red" fontcolor="red" label="tx_open\ntx_add\ntx_close" ] Connection -> Mailbox [style="dashed" @@ -66,23 +75,29 @@ digraph { ] #Boss -> Code [color="blue"] - Connection -> Code [style="dashed" - label="connected\nlost\nrx_allocated"] - Code -> Connection [style="dashed" - label="tx_allocate" - ] - Lister -> Code [style="dashed" - label="got_nameplates" - ] + Connection -> Allocator [style="dashed" + label="connected\nlost\nrx_allocated"] + Allocator -> Connection [style="dashed" color="red" fontcolor="red" + label="tx_allocate" + ] + Lister -> Input [style="dashed" + label="got_nameplates" + ] #Code -> Lister [color="blue"] - Code -> Lister [style="dashed" - label="refresh_nameplates" - ] - Boss -> Code [style="dashed" - label="allocate_code\ninput_code\nset_code_code"] + Input -> Lister [style="dashed" color="red" fontcolor="red" + label="refresh_nameplates" + ] + Boss -> Code [style="dashed" color="red" fontcolor="red" + label="allocate_code\ninput_code\nset_code"] Code -> Boss [style="dashed" label="got_code"] + Code -> Input [style="dashed" color="red" fontcolor="red" label="start"] + Input -> Code [style="dashed" label="finished_input"] + Code -> Allocator [style="dashed" color="red" fontcolor="red" + label="allocate"] + Allocator -> Code [style="dashed" label="allocated"] + Nameplate -> Terminator [style="dashed" label="nameplate_done"] Mailbox -> Terminator [style="dashed" label="mailbox_done"] Terminator -> Nameplate [style="dashed" label="close"] @@ -90,5 +105,6 @@ digraph { Terminator -> Connection [style="dashed" label="stop"] Connection -> Terminator [style="dashed" label="stopped"] Terminator -> Boss [style="dashed" label="closed\n(once)"] - Boss -> Terminator [style="dashed" label="close"] + Boss -> Terminator [style="dashed" color="red" fontcolor="red" + label="close"] }