Examples

The following are some examples of protocols contributed by the community.

Mattias Holm (@lorrden)

User Datagram Protocol header (RFC768)

000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1fSource portDestination port0020LengthChecksum
(def column-labels (mapv #(number-as-hex % 2) (range 32)))  ; 00..1f
(def boxes-per-row 32)
(draw-column-headers)
(draw-box "Source port" {:span 16})
(draw-box "Destination port" {:span 16})
(draw-box "Length" {:span 16})
(draw-box "Checksum" {:span 16})

Transmission Control Protocol header (RFC793)

000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1fSource portDestination port0020Sequence number40Acknowledgement number60Data offset0000 (Reserved)CWRECEURGACKPSHRSTSYNFINWindow size80ChecksumUrgent pointera0Options (size set in data offset)c0i+00
(def column-labels (mapv #(number-as-hex % 2) (range 32)))
(def boxes-per-row 32)
(defattrs :vertical [:plain {:writing-mode "vertical-rl"}])
(draw-column-headers)
(draw-box "Source port" {:span 16})
(draw-box "Destination port" {:span 16})
(draw-box "Sequence number" {:span 32})
(draw-box "Acknowledgement number" {:span 32})
(draw-box "Data offset" [{:span 4}, {:next-row-height 60}])
(draw-box (text "0000" :hex [:plain " (Reserved)"]) {:span 4})
(draw-box (text "CWR" :vertical))
(draw-box (text "ECE" :vertical))
(draw-box (text "URG" :vertical))
(draw-box (text "ACK" :vertical))
(draw-box (text "PSH" :vertical))
(draw-box (text "RST" :vertical))
(draw-box (text "SYN" :vertical))
(draw-box (text "FIN" :vertical))
(draw-box "Window size" {:span 16})
(draw-box "Checksum" [{:span 16}, {:next-row-height 40}])
(draw-box "Urgent pointer" {:span 16})
(draw-gap "Options (size set in data offset)")
(draw-bottom)

Internet Protocol Version 4 header (RFC791)

0123456789abcdefVersionIHLDSCPECN0010Total length20Identification30FlagsFragment offset40Time to liveProtocol50Header checksum60Source IP address7080Destination IP address90a0Options (if IHL > 5)b0i+00
(draw-column-headers)
(draw-box "Version" {:span 4})
(draw-box "IHL" {:span 4})
(draw-box "DSCP" {:span 6})
(draw-box "ECN" {:span 2})
(draw-box "Total length" {:span 16})
(draw-box "Identification" {:span 16})
(draw-box "Flags" {:span 3})
(draw-box "Fragment offset" {:span 13})
(draw-box "Time to live" {:span 8})
(draw-box "Protocol" {:span 8})
(draw-box "Header checksum" {:span 16})
(draw-box "Source IP address" [{:span 16}, :box-above])
(draw-box nil [{:span 16}, :box-below])

(draw-box "Destination IP address" [{:span 16}, :box-above])
(draw-box nil [{:span 16}, :box-below])

(draw-gap "Options (if IHL > 5)")
(draw-bottom)

Internet Protocol Version 6 header (RFC2460)

000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1fVersionTraffic classFlow label0020Payload lengthNext headerHop limit40Source address6080a0c0Destination addresse0100120
(defattrs :vertical [:plain {:writing-mode "vertical-rl"}])
(defattrs :box-middle {:borders #{:left :right}})
(def column-labels (mapv #(number-as-hex % 2) (range 32)))

(def boxes-per-row 32)

(draw-column-headers)
(draw-box "Version" {:span 4})
(draw-box "Traffic class" {:span 8})
(draw-box "Flow label" {:span 20})
(draw-box "Payload length" {:span 16})
(draw-box "Next header" {:span 8})
(draw-box "Hop limit" {:span 8})
(draw-box "Source address"  [{:span 32}, :box-above])
(draw-box nil [{:span 32} :box-middle])
(draw-box nil [{:span 32} :box-middle])
(draw-box nil [{:span 32} :box-middle])
(draw-box "Destination address"  [{:span 32}, :box-above])
(draw-box nil [{:span 32} :box-middle])
(draw-box nil [{:span 32} :box-middle])
(draw-box nil [{:span 32} :box-below])

Ethernet II frame (DIX v2.0)

0123456789abcdefDestination MACSource MAC(802.1Q tag)0010EthertypePayload20i+00FCS
(draw-column-headers)
(draw-box "Destination MAC" {:span 6})
(draw-box "Source MAC" {:span 6})
(draw-box "(802.1Q tag)" {:span 4})

(draw-box (text "Ethertype" [:plain {:font-size 16}]) {:span 2})
(draw-gap "Payload")
(draw-bottom)
(draw-box "FCS" {:span 4})

Consultative Committee for Space Data Systems Space Packet Standard - Packet Utilisation Standard A (ECSS-E-70-41A)

0123456789abcdefversiontypedfhapid0010seq. flagssequence count20packet length30shfpusversackservice type40service subtype50i+00packet error control
(defattrs :vertical [:plain {:writing-mode "vertical-rl"}])

(def row-height 60)
(draw-column-headers)
(draw-box "version" {:span 3})
(draw-box (text "type" :vertical) {:span 1})
(draw-box "dfh" {:span 1})
(draw-box "apid" {:span 11})

(draw-box "seq. flags" {:span 2 :next-row-height 30})
(draw-box "sequence count" {:span 14})

(draw-box "packet length" {:span 16})

(draw-box "shf" {:span 1})
(draw-box "pusvers" {:span 3})
(draw-box "ack" {:span 4})
(draw-box "service type" {:span 8})
(draw-box "service subtype" {:span 8})

(draw-gap)

(draw-box "packet error control" {:span 16})