collab/mermaid/docs/syntax/packet.mdblame
View source
6dd74de1> **Warning**
6dd74de2>
6dd74de3> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
6dd74de4>
6dd74de5> ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/packet.md](../../packages/mermaid/src/docs/syntax/packet.md).
6dd74de6
6dd74de7# Packet Diagram (v11.0.0+)
6dd74de8
6dd74de9## Introduction
6dd74de10
6dd74de11A packet diagram is a visual representation used to illustrate the structure and contents of a network packet. Network packets are the fundamental units of data transferred over a network.
6dd74de12
6dd74de13## Usage
6dd74de14
6dd74de15This diagram type is particularly useful for developers, network engineers, educators, and students who require a clear and concise way to represent the structure of network packets.
6dd74de16
6dd74de17## Syntax
6dd74de18
6dd74de19```
6dd74de20packet
6dd74de21start: "Block name" %% Single-bit block
6dd74de22start-end: "Block name" %% Multi-bit blocks
6dd74de23... More Fields ...
6dd74de24```
6dd74de25
6dd74de26### Bits Syntax (v11.7.0+)
6dd74de27
6dd74de28Using start and end bit counts can be difficult, especially when modifying a design. For this we add a bit count field, which starts from the end of the previous field automagically. Use `+<count>` to set the number of bits, thus:
6dd74de29
6dd74de30```
6dd74de31packet
6dd74de32+1: "Block name" %% Single-bit block
6dd74de33+8: "Block name" %% 8-bit block
6dd74de349-15: "Manually set start and end, it's fine to mix and match"
6dd74de35... More Fields ...
6dd74de36```
6dd74de37
6dd74de38## Examples
6dd74de39
6dd74de40```mermaid-example
6dd74de41---
6dd74de42title: "TCP Packet"
6dd74de43---
6dd74de44packet
6dd74de450-15: "Source Port"
6dd74de4616-31: "Destination Port"
6dd74de4732-63: "Sequence Number"
6dd74de4864-95: "Acknowledgment Number"
6dd74de4996-99: "Data Offset"
6dd74de50100-105: "Reserved"
6dd74de51106: "URG"
6dd74de52107: "ACK"
6dd74de53108: "PSH"
6dd74de54109: "RST"
6dd74de55110: "SYN"
6dd74de56111: "FIN"
6dd74de57112-127: "Window"
6dd74de58128-143: "Checksum"
6dd74de59144-159: "Urgent Pointer"
6dd74de60160-191: "(Options and Padding)"
6dd74de61192-255: "Data (variable length)"
6dd74de62```
6dd74de63
6dd74de64```mermaid
6dd74de65---
6dd74de66title: "TCP Packet"
6dd74de67---
6dd74de68packet
6dd74de690-15: "Source Port"
6dd74de7016-31: "Destination Port"
6dd74de7132-63: "Sequence Number"
6dd74de7264-95: "Acknowledgment Number"
6dd74de7396-99: "Data Offset"
6dd74de74100-105: "Reserved"
6dd74de75106: "URG"
6dd74de76107: "ACK"
6dd74de77108: "PSH"
6dd74de78109: "RST"
6dd74de79110: "SYN"
6dd74de80111: "FIN"
6dd74de81112-127: "Window"
6dd74de82128-143: "Checksum"
6dd74de83144-159: "Urgent Pointer"
6dd74de84160-191: "(Options and Padding)"
6dd74de85192-255: "Data (variable length)"
6dd74de86```
6dd74de87
6dd74de88```mermaid-example
6dd74de89packet
6dd74de90title UDP Packet
6dd74de91+16: "Source Port"
6dd74de92+16: "Destination Port"
6dd74de9332-47: "Length"
6dd74de9448-63: "Checksum"
6dd74de9564-95: "Data (variable length)"
6dd74de96```
6dd74de97
6dd74de98```mermaid
6dd74de99packet
6dd74de100title UDP Packet
6dd74de101+16: "Source Port"
6dd74de102+16: "Destination Port"
6dd74de10332-47: "Length"
6dd74de10448-63: "Checksum"
6dd74de10564-95: "Data (variable length)"
6dd74de106```
6dd74de107
6dd74de108## Details of Syntax
6dd74de109
6dd74de110- **Ranges**: Each line after the title represents a different field in the packet. The range (e.g., `0-15`) indicates the bit positions in the packet.
6dd74de111- **Field Description**: A brief description of what the field represents, enclosed in quotes.
6dd74de112
6dd74de113## Configuration
6dd74de114
6dd74de115Please refer to the [configuration](/config/schema-docs/config-defs-packet-diagram-config.html) guide for details.
6dd74de116
6dd74de117<!--
6dd74de118
6dd74de119Theme variables are not currently working due to a mermaid bug. The passed values are not being propagated into styles function.
6dd74de120
6dd74de121## Theme Variables
6dd74de122
6dd74de123| Property | Description | Default Value |
6dd74de124| ---------------- | -------------------------- | ------------- |
6dd74de125| byteFontSize | Font size of the bytes | '10px' |
6dd74de126| startByteColor | Color of the starting byte | 'black' |
6dd74de127| endByteColor | Color of the ending byte | 'black' |
6dd74de128| labelColor | Color of the labels | 'black' |
6dd74de129| labelFontSize | Font size of the labels | '12px' |
6dd74de130| titleColor | Color of the title | 'black' |
6dd74de131| titleFontSize | Font size of the title | '14px' |
6dd74de132| blockStrokeColor | Color of the block stroke | 'black' |
6dd74de133| blockStrokeWidth | Width of the block stroke | '1' |
6dd74de134| blockFillColor | Fill color of the block | '#efefef' |
6dd74de135
6dd74de136## Example on config and theme
6dd74de137
6dd74de138```mermaid-example
6dd74de139---
6dd74de140config:
6dd74de141 packet:
6dd74de142 showBits: true
6dd74de143 themeVariables:
6dd74de144 packet:
6dd74de145 startByteColor: red
6dd74de146---
6dd74de147packet
6dd74de1480-15: "Source Port"
6dd74de14916-31: "Destination Port"
6dd74de15032-63: "Sequence Number"
6dd74de151```
6dd74de152
6dd74de153-->