Skip to main content

Module cdp

Module cdp 

Source
Available on crate feature cdp only.
Expand description

CDP (Cisco Discovery Protocol) parser.

Gated by the cdp feature. CDP is the Cisco-proprietary L2 discovery protocol — the LLDP sibling for environments with Cisco gear. Operationally identical signal (asset / rogue-switch / topology visibility), but wire-format-wise completely different:

  • LLDP: EtherType 0x88cc, 7-bit-type / 9-bit-length TLVs.
  • CDP: LLC+SNAP-encapsulated 802.3 frame, dst MAC 01:00:0c:cc:cc:cc, OUI 00:00:0C, PID 0x2000, 16-bit type / 16-bit length TLVs.

§Operational signals

  • Asset discovery on Cisco infrastructure: Device-ID, Platform, Software-Version, Capabilities, Mgmt-Address.
  • Topology mapping: Port-ID + Device-ID identifies the peer port of the directly-connected switch.
  • Rogue-switch detection: a CDPDU on a port where one isn’t expected (or a Device-ID that doesn’t match the asset register) is a high-confidence MITM signal.

§Wire shape

  • parse — pure CDPDU payload (after the LLC+SNAP+OUI+PID header). Use when the consumer has already validated the encapsulation.
  • parse_frame — full Ethernet frame; validates the reserved Cisco multicast dst MAC + LLC + SNAP + OUI + PID sequence.
  • CdpParser — stateless marker.

Issue #25 (0.18).

Structs§

CdpAddress
One decoded CDP address-block entry.
CdpCapabilities
CDP capability bits (TLV 0x0004). Source: Cisco’s public CDP technical reference.
CdpMessage
One parsed CDPDU. Almost every CDPDU carries Device-ID; the rest of the TLVs are optional. Bounded at the operationally-interesting field set — vendor / experimental TLVs aren’t surfaced (file follow-ups if needed).
CdpParser
Stateless CDP marker, mirroring ArpParser / LldpParser.

Enums§

ParseError
Failure mode for the parse* functions (issue #85).

Constants§

CDP_DST_MAC
CDP destination multicast MAC.
CDP_OUI
CDP OUI inside the SNAP header.
CDP_PID
CDP protocol ID inside the SNAP header.

Functions§

parse
Parse a CDPDU payload (post the LLC/SNAP/OUI/PID header).
parse_frame
Parse a full Ethernet frame whose payload is a CDPDU.