forked from cosmos/ibc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
channel-state-machine.tex
45 lines (38 loc) · 1.77 KB
/
channel-state-machine.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
\documentclass[tikz,10pt,border=10pt]{standalone}
\usepackage{textcomp}
\usepackage{xcolor}
\usetikzlibrary{shapes,arrows}
\begin{document}
\tikzset{%
state/.style = {draw, thick, rectangle, node distance = 6cm}
}
\newcommand{\CA}[1]{\it{A} \textcolor{black}{\textsc{#1}}}
\newcommand{\CB}[1]{\it{B} \textcolor{black}{\textsc{#1}}}
\newcommand{\CS}[2]{\begin{tabular}{l}
\CA{#1} \\
\CB{#2}
\end{tabular}}
\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
\draw
node [state, name=empty, right = 0.5mm] {\CS{Uninitialized}{Uninitialized}}
node [state, below of=empty] (init) {\CS{Init}{Uninitialized}}
node [state, right of=init] (tryopen) {\CS{Init}{TryOpen}}
node [state, right of=tryopen] (tryopen1) {\CS{Open}{TryOpen}}
node [state, right of=tryopen1] (open) {\CS{Open}{Open}}
node [state, below of=open] (tryclose) {\CS{Closed}{Open}}
node [state, left of=tryclose] (tryclose1) {\CS{Closed}{Closed}};
\draw node [state, name = key, right = 18cm, above = 2mm] {\begin{tabular}{l}
\it{Key} \\
\textcolor{blue}{Opening Handshake} \\
\textcolor{green}{Closing Handshake} \\
\end{tabular}};
\draw[->, blue, bend right](empty) edge node[yshift=3mm, xshift=1mm] {\textsc{ChanInit}} (init);
\draw[->, blue](init) edge node {\textsc{ChanOpenTry}} (tryopen);
\draw[->, blue](tryopen) edge node {\textsc{ChanOpenAck}} (tryopen1);
\draw[->, blue](tryopen1) edge node {\textsc{ChanOpenConfirm}} (open);
\draw[->, green, bend right](open) edge node[yshift=3mm, xshift=1mm] {\textsc{ChanCloseInit}} (tryclose);
\draw[->, green](tryclose) edge node {\textsc{ChanCloseConfirm}} (tryclose1);
\draw[color=black,thick](-0.5,-14) rectangle (22,2.8);
\node at (-0.5,1.5) [above=0.5mm, right=5mm] {\huge{\textsc{Channel State Machine}}};
\end{tikzpicture}
\end{document}