Documentation
¶
Overview ¶
Package esmc decodes the ESMC — Ethernet Synchronization Messaging Channel (ITU-T G.8264) — the control channel of Synchronous Ethernet (SyncE). SyncE distributes a physical-layer frequency reference across an Ethernet network (the way SDH/SONET did over TDM); ESMC is the small Slow-Protocol frame (EtherType 0x8809, subtype 0x0A) that advertises the Synchronization Status Message (SSM) — the Quality Level (QL) of the clock each node is traceable to. It is the frequency-sync companion to PTP / IEEE 1588 (internal/ptpv2, phase/time sync): together they carry the timing plane that 5G fronthaul, power-grid teleprotection and broadcast networks depend on. Timing is an emerging attack surface — degrading or spoofing the advertised QL can push a network onto a worse clock or trigger a sync-loss reconfiguration — so a captured ESMC frame reveals the timing hierarchy: the advertised clock **Quality Level** (PRC / SSU / EEC / DNU), whether the frame is a periodic **information** heartbeat or an **event** (a QL change), and, in the enhanced TLV, the source clock identity. This is the recon headline for timing-network reconnaissance.
Wrap-vs-native judgement ¶
Native. ESMC is a fixed 10-byte Slow-Protocol/ESMC header (subtype + ITU OUI + ITU subtype + version/event flags + reserved) followed by a short TLV stream (the QL TLV is type + 2-byte length + a 1-byte SSM code). A byte/bit read + a TLV walk; stdlib only, no new go.mod dep.
Verifiable / no confidently-wrong output ¶
The header layout and the QL / Enhanced-QL TLVs were verified field-for-field against scapy's ESMC layer (scapy.contrib.esmc). The one genuine ambiguity is the SSM-code → Quality-Level name: ITU-T G.781 defines three option tables (Option I = ETSI/SDH, Option II = ANSI/SONET, Option III = TTC/Japan) that assign DIFFERENT names to the same 4-bit code, and the in-use option is a deployment setting NOT carried on the wire. To avoid a confidently-wrong single answer, the raw SSM code is surfaced together with BOTH the Option-I and Option-II names. A non-ESMC Slow-Protocol subtype is rejected; a malformed TLV stops the walk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Subtype int `json:"subtype"`
SubtypeName string `json:"subtype_name"`
ITUOUIHex string `json:"itu_oui_hex"`
ITUSubtype int `json:"itu_subtype"`
Version int `json:"version"`
EventFlag bool `json:"event_flag"`
MessageType string `json:"message_type"`
TLVs []TLV `json:"tlvs,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Result is the decoded view of an ESMC (SyncE) frame.
type TLV ¶
type TLV struct {
Type int `json:"type"`
TypeName string `json:"type_name"`
Length int `json:"length"`
// Quality Level TLV (type 1)
SSMCodeHex string `json:"ssm_code_hex,omitempty"`
QualityLevel int `json:"quality_level,omitempty"`
QualityLevelOptionI string `json:"quality_level_option_i,omitempty"`
QualityLevelOptionII string `json:"quality_level_option_ii,omitempty"`
// Enhanced Quality Level TLV (type 2)
EnhancedSSMCodeHex string `json:"enhanced_ssm_code_hex,omitempty"`
ClockIdentity string `json:"clock_identity,omitempty"`
ValueHex string `json:"value_hex,omitempty"`
}
TLV is one entry in the ESMC TLV stream.