How sach/system-verilog-packet-library works
Pktlib is a SystemVerilog packet-construction and inspection library. The principal workflow configures and randomizes protocol headers, packs them into packet bytes, then displays or compares packets; it also supports smart unpacking and PCAP input/output. Header classes model the protocol stages, while array and checksum classes provide internal byte and integrity operations. README documents these capabilities and class responsibilities; sampled source confirms PCAP DPI operations, but does not expose the full SystemVerilog call wiring, so uncertain links are omitted.
Main entry points: pktlib_class.sv Packet library · hdr_db Protocol headers · pcap_dump.c PCAP file API · pktlib_main_class.sv Library base
Components 23
Packet orchestration
- Packet library
pktlib_class.sv - Library base
pktlib_main_class.sv - Base object
pktlib_object_class.sv
Protocol headers
- Header base
hdr_db/hdr_class.sv - Protocol headers
hdr_db - Ethernet headers
hdr_db/eth_hdr_class.sv - IP headers
hdr_db/ipv4_hdr_class.sv - Transport headers
hdr_db/tcp_hdr_class.sv - Packet payload
hdr_db/data_class.sv
Packet utilities
- Byte operations
pktlib_array_class.sv - CRC and checksum
pktlib_crc_chksm_class.sv - Display and compare
pktlib_display_class.sv
PCAP integration
- PCAP DPI wrapper
hdr_db/include/pcap/pcap_dpi.sv - PCAP bridge
hdr_db/include/pcap/pcap_dpi.c - PCAP file API
hdr_db/include/pcap/pcap_dump.c
Security support
- GCM DPI interface
hdr_db/include/gcm-aes/sv-file/gcm_dpi.sv - GCM DPI bridge
hdr_db/include/gcm-aes/c-file/gcm_dpi.cpp - GCM engine
hdr_db/include/gcm-aes/c-file/gcm.cpp - AES implementation
hdr_db/include/gcm-aes/c-file/aescrypt.c
Other components
- Test author
- libpcap
- Packet bytes
- PCAP capture
Connections 21
- Test author → Packet library: configures and invokes
- Packet library → Library base: uses base
- Library base → Base object: extends
- Packet library → Protocol headers: configures and randomizes
- Protocol headers → Header base: models headers
- Protocol headers → Ethernet headers: includes
- Protocol headers → IP headers: includes
- Protocol headers → Transport headers: includes
- Protocol headers → Packet payload: includes
- Packet library → Byte operations: packs and unpacks
- Packet library → CRC and checksum: computes and corrupts
- Packet library → Display and compare: displays and compares
- Packet library → Packet bytes: packs to
- Packet bytes → Packet library: unpacks from
- PCAP DPI wrapper → PCAP bridge: calls DPI
- PCAP bridge → PCAP file API: reads and writes
- PCAP file API → libpcap: uses
- PCAP file API → PCAP capture: reads or writes
- GCM DPI interface → GCM DPI bridge: calls DPI
- GCM DPI bridge → GCM engine: invokes
- GCM engine → AES implementation: encrypts with