TCP (Transmission Control Protocol) segment: GraphViz block diagram (.dot) source

TCP is one of the core Internet protocols on transport layer (AKA OSI layer 4), providing stateful connections with error checking, guarantees of delivery, order of segments and avoidance of duplicate delivery.

KS implementation details

License: CC0-1.0

References

This page hosts a formal specification of TCP (Transmission Control Protocol) segment using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

GraphViz block diagram source

tcp_segment.dot

digraph {
	rankdir=LR;
	node [shape=plaintext];
	subgraph cluster__tcp_segment {
		label="TcpSegment";
		graph[style=dotted];

		tcp_segment__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
			<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
			<TR><TD PORT="src_port_pos">0</TD><TD PORT="src_port_size">2</TD><TD>u2be</TD><TD PORT="src_port_type">src_port</TD></TR>
			<TR><TD PORT="dst_port_pos">2</TD><TD PORT="dst_port_size">2</TD><TD>u2be</TD><TD PORT="dst_port_type">dst_port</TD></TR>
			<TR><TD PORT="seq_num_pos">4</TD><TD PORT="seq_num_size">4</TD><TD>u4be</TD><TD PORT="seq_num_type">seq_num</TD></TR>
			<TR><TD PORT="ack_num_pos">8</TD><TD PORT="ack_num_size">4</TD><TD>u4be</TD><TD PORT="ack_num_type">ack_num</TD></TR>
			<TR><TD PORT="b12_pos">12</TD><TD PORT="b12_size">1</TD><TD>u1</TD><TD PORT="b12_type">b12</TD></TR>
			<TR><TD PORT="b13_pos">13</TD><TD PORT="b13_size">1</TD><TD>u1</TD><TD PORT="b13_type">b13</TD></TR>
			<TR><TD PORT="window_size_pos">14</TD><TD PORT="window_size_size">2</TD><TD>u2be</TD><TD PORT="window_size_type">window_size</TD></TR>
			<TR><TD PORT="checksum_pos">16</TD><TD PORT="checksum_size">2</TD><TD>u2be</TD><TD PORT="checksum_type">checksum</TD></TR>
			<TR><TD PORT="urgent_pointer_pos">18</TD><TD PORT="urgent_pointer_size">2</TD><TD>u2be</TD><TD PORT="urgent_pointer_type">urgent_pointer</TD></TR>
			<TR><TD PORT="body_pos">20</TD><TD PORT="body_size">⇲</TD><TD></TD><TD PORT="body_type">body</TD></TR>
		</TABLE>>];
	}
}