Skip to main content
Version: Next

Getting Started

PcapPlusPlus is a multi-platform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use.

PcapPlusPlus enables decoding and forging capabilities for a large variety of network protocols. It also provides easy to use C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, Npcap (WinPcap's successor), DPDK, eBPF AF_XDP and PF_RING.

Latest version: v24.09

Quick Start

This guide will help you install and build your first PcapPlusPlus application. You can find more information in the Tutorials and in the installation guide.

Please choose your platform:

Step 1 - download PcapPlusPlus

Before downloading PcapPlusPlus make sure you have the prerequisites installed for Linux.

Pre-compiled packages are available for recent versions of Ubuntu, Fedora, RHEL and Alpine. You can find them under the v24.09 release.

Another option is using Homebrew on Linux if you have it installed on your system:

brew install pcapplusplus

If you have another Linux distribution or GCC version you'll need to build PcapPlusPlus from source. Make sure not to skip the installation part.

Step 2 - create your first app

If you downloaded a pre-compiled package go to: /path/to/your/package/example-app.

If not, download the ExampleApp source files.

Make sure you see the following files:

 |-- main.cpp
|-- 1_packet.pcap
|-- CMakeLists.txt

main.cpp is the example application we'll use.

1_packet.pcap is a pcap file the app reads from.

CMakeLists.txt will help us build the app.

Step 3 - build and run your app

Configure CMake:

cmake -S . -B build -DPcapPlusPlus_ROOT=/path/to/your/package

Build the app:

cmake --build build

An executable file will be created which contains the compiled app. You can now run it and should be able to see the following output:

./example-app
Source IP is '10.0.0.138'; Dest IP is '10.0.0.1'