Parsing a proprietary packet-capture format in C++ or Python
This hard coding problem tests your ability to parse binary file formats with strict structure requirements—a core skill in quantitative trading infrastructure. Market data and order feeds are often captured in pcap files for forensic analysis; this problem asks you to implement a parser for a proprietary variant called .pcapgg.
You must correctly deserialize a fixed global header, validate endianness and magic numbers, then iterate through variable-length packet records while respecting byte boundaries and detecting corruption. The challenge lies in handling both endianness variants, managing pointer arithmetic over raw bytes, and distinguishing between file-level corruption (which invalidates everything) and packet-level corruption (which marks individual records but permits parsing to continue).
- Binary format parsing and byte-order handling (little-endian vs. big-endian)
- Fixed and variable-length record structures
- Error detection and graceful degradation (nullopt on fatal errors, corrupted flag on recoverable ones)
- Pointer safety and lifetime management in C++