Packet diagrams: fields and bits
简介 / Introduction
Packet diagrams are used to describe protocol header structures, byte layouts, and field semantics. This article compares PlantUML and Mermaid for drawing Packet diagrams.
PlantUML 版
1 | @startuml |
PlantUML uses the packet keyword to define a block, --- to separate field rows, and square brackets with a bit count for each field.
Mermaid 版
1 | packet-beta |
Mermaid uses packet-beta diagram type, defining fields by byte offset ranges (start-end), with a title keyword for the diagram title.
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Engine keyword | packet |
packet-beta |
| Field definition | [Name] N bits |
start-end: Name |
| Grouping/separator | --- horizontal line |
none (natural line break) |
| Bit offset precision | no offset shown, only width | start and end offset required |
| Annotation support | inline [Name] comment |
title keyword |
小结 / Wrap-up
PlantUML’s Packet diagrams suit abstract-level descriptions and semantic grouping; Mermaid’s packet-beta is better for precise byte-offset layouts. Both can be embedded in docs or blogs — choose based on whether you need “coarse-grained description” or “exact bit layout”.
- Title: Packet diagrams: fields and bits
- Author: puml.online
- Created at : 2026-10-06 09:00:00
- Updated at : 2026-10-06 01:08:06
- Link: https://puml.online/blog/packet-beta-fields-en/
- License: This work is licensed under CC BY-NC-SA 4.0.