Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 583 Bytes

README.md

File metadata and controls

20 lines (16 loc) · 583 Bytes

zig-pcapfile

A pure Zig library for reading and writing PCAP files

Releases target Zig releases (e.g. 0.10.x). Master follows the Zig master branch

Status

Full support for reading and writing PCAP version 2.4 files (.pcap extension)
No support for PCAPNG files (.pcapng extension)

Usage

// PCAP reading
var in_file = try std.fs.cwd().openFile("test.pcap", .{});
var it = try pcap.iterator(allocator, .{}, in_file.reader());
defer it.deinit(allocator);

while (try it.next()) |rec| {
    try std.debug.print("packet with len = {d}\n", .{rec.data.len});
}