aboutsummaryrefslogtreecommitdiff
path: root/summary/src/ctga/img/parser.tex
blob: dba221b905aa1e9a1b29e43345bc4d47c60190bc (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
\resizebox{\columnwidth}{!}{%
\begin{tikzpicture}[%
  -latex,
  sibling distance=10em,
  level distance=22pt,
  parser/.style = {%
    draw,
    shape=rectangle,
    rounded corners,
    align=center,
    top color=white,
    bottom color=mydblue!20,
  },
  label/.style = {%
    draw=none,
    align=center,
    text=mydblue,
    font=\scriptsize,
  },
  arrow/.style = {%
	  draw,
	  -latex,
	  rounded corners,
  },
]
	
	\node[parser](eth){Ethernet};
	\node[parser,right=of eth](udp){UDP};
	\coordinate(ip) at ($ (eth) !.5! (udp) $);
	\node[parser,above=of ip](ipv4){IPv4};
	\node[parser,below=of ip](ipv6){IPv6};

	\node[parser,right=of udp](dns){DNS};
	\node[parser](dnsp) at ($ (dns) + (1,1.1) $){preamble};
	\node[parser](dnsq) at ($ (dns) + (2.25,.45) $){domain name};
	\node[parser](dnst) at ($ (dns) + (2.25,-.45) $){query type};
	\node[parser](dnsc) at ($ (dns) + (1,-1.1) $){query class};

	\path[arrow] ($ (eth) + (-1.25,0) $) -- node[left,pos=0]{\texttt{pkt\_in}} (eth);

	\path[arrow] (eth) |- node[label,above left,pos=1]{\texttt{type=0x0800}} (ipv4);
	\path[arrow] (eth) |- node[label,below left,pos=1]{\texttt{type=0x86DD}} (ipv6);
	\path[arrow] (ipv4) -| node[label,above right, pos=0]{\texttt{proto=0x17}} (udp);
	\path[arrow] (ipv6) -| node[label,below right, pos=0]{\texttt{proto=0x17}} (udp);
	\path[arrow] (udp) -- node[label,above]{\texttt{sport=53}} (dns);

	\path[arrow,dashed] (dns) |- (dnsp);
	\path[arrow,dashed] (dnsp) -| node[label,above right,pos=0]{\texttt{qd=an=1}} (dnsq);
	\path[arrow,dashed] (dnsq) -- node[label,right]{\texttt{known log}} (dnst);
	\path[arrow,dashed] (dnst) |- node[label,below right,pos=1]{\texttt{TXT}} (dnsc);
	\path[arrow,dashed]
		(dnsq) edge[out=5, in=355, looseness=8]
			node[label,right]{
				\begin{tabular}{c}
					variable \\
					length
				  \end{tabular}
				}
		(dnsq);
	\path[arrow,dashed]
		(dnsc) --
			node[label,below right,pos=.8]{\texttt{IN}}
			node[pos=1.2,rotate=90]{\texttt{clone}}
		($ (dnsc) + (-1.5,0) $);
\end{tikzpicture}
}