Packet diagrams in Confluence

A packet diagram shows the layout of a binary message, bit by bit.

Last updated

When to use it

Use a packet diagram in a protocol or file format specification: which bits hold the version, the flags, the length, the payload. Each field is a range of bits with a label, drawn in rows of 32 bits.

Example

This is the code of the Binary header template: the bit layout of a custom binary message header.

packet
  title Binary message header
  0-3: "Version"
  4: "ACK"
  5: "ENC"
  6: "FRAG"
  7: "RSV"
  8-15: "Message type"
  16-31: "Payload length"
  +32: "Device ID"
  +32: "Checksum"

Vellnar Diagrams draws it like this:

Change a line and the diagram changes with it. Nobody needs the original drawing file, because there is none: the code is the diagram.

Add it to a Confluence page

  1. Edit a Confluence page and type /mermaid where the diagram should go.
  2. Select Mermaid diagram. The editor opens with the template list.
  3. Pick a template, or choose Start blank and paste the code above. The preview follows every keystroke.
  4. Choose Save. The diagram appears on the page.

The documentation covers the editor, the settings and the exports.

Templates

The Templates button in the editor has one packet diagram ready to use:

  • Binary header: The bit layout of a custom binary message header.

Syntax

The code of a packet diagram starts with packet. The Mermaid documentation describes every element of the syntax. Vellnar Diagrams draws it with Mermaid 12.3; if a line has an error, the editor marks the line and keeps the last valid diagram on screen.

More

  • Mermaid in Confluence: how diagrams as code work in a page, and every diagram type.
  • Security: the app asks for no permissions and sends nothing outside Atlassian.