Skip to content

Commit 034a49b

Browse files
committed
Add PTP header format diagram
1 parent 7ead379 commit 034a49b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

scapy/layers/ptp_v2.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,44 @@ class PTPHeader(Packet):
8787
"""
8888
PTP Header based on IEEE 1588-2008 / Section 13.3.
8989
"""
90+
91+
########################################################################################
92+
# IEEE 1588-2008 / Section 13.3 Header / Table 18
93+
########################################################################################
94+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
95+
# | Bits | | |
96+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Octets | Offset |
97+
# | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | | |
98+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
99+
# | transportSpecific | messageType | 1 | 0 |
100+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
101+
# | reserved | versionPTP | 1 | 1 |
102+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
103+
# | messageLength | 2 | 2 |
104+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
105+
# | domainNumber | 1 | 4 |
106+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
107+
# | reserved | 1 | 5 |
108+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
109+
# | flagField | 2 | 6 |
110+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
111+
# | correctionField | 8 | 8 |
112+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
113+
# | reserved | 4 | 16 |
114+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
115+
# | sourcePortIdentity | 10 | 20 |
116+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
117+
# | sequenceId | 2 | 30 |
118+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
119+
# | controlField | 1 | 32 |
120+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
121+
# | logMessageInterval | 1 | 33 |
122+
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
123+
########################################################################################
124+
#
125+
# sourcePortIdentity(10 bytes) contain clockIdentity(8 bytes) and portNumber(2 bytes)
126+
#
127+
90128
name = "PTPHeader"
91129
match_subclass = True
92130
fields_desc = [

0 commit comments

Comments
 (0)