Skip to content

Commit 8d3e871

Browse files
authored
Bump the version to v25.05 (#166)
1 parent 905e4a8 commit 8d3e871

29 files changed

+4626
-1
lines changed

versioned_docs/version-v25.05/api.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: API Reference
3+
sidebar_position: 99
4+
---
5+
6+
# API Reference
7+
8+
import ButtonLink from '/src/components/ButtonLink';
9+
import { useActiveVersion } from '@docusaurus/plugin-content-docs/client';
10+
import { ThemedImageWithBaseUrl } from '@site/src/components/ImageWithBaseUrl';
11+
12+
<ButtonLink
13+
text="Go to Doxygen API reference"
14+
link={'pathname:///api-docs/' + useActiveVersion().label.toLowerCase()}
15+
></ButtonLink>
16+
<br />
17+
<br />
18+
PcapPlusPlus consists of 3 libraries:
19+
20+
- **Packet++** - a library for parsing, creating and editing network packets
21+
- **Pcap++** - a library for intercepting and sending packets, providing network and NIC info, stats, etc. It is actually a C++ wrapper for packet capturing engines such as libpcap, WinPcap, Npcap, DPDK and PF_RING
22+
- **Common++** - a library with some common code utilities used by both Packet++ and Pcap++
23+
24+
The dependency model between the libraries is as follows:
25+
26+
<ThemedImageWithBaseUrl
27+
srcLight="/api-docs/libraries-light.svg"
28+
srcDark="/api-docs/libraries-dark.svg"
29+
/>
30+
31+
That means, you can use **Common++** separately from the other libraries, and you can also use **Packet++** without **Pcap++**.
32+
33+
All of PcapPlusPlus APIs including classes for all of these libraries, files, data structures, etc. are documented in details using [Doxygen](http://www.doxygen.nl/).
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
title: Benchmarks
3+
sidebar_position: 8
4+
---
5+
6+
export const TCP_NO_OPTIONS_PCAPPLUSPLUS_SEC = 0.197;
7+
export const TCP_NO_OPTIONS_LIBTINS_SEC = 0.209;
8+
export const TCP_NO_OPTIONS_LIBPCAP_SEC = 0.12;
9+
10+
export const TCP_NO_OPTIONS_PCAPPLUSPLUS_PPS = 2538071;
11+
export const TCP_NO_OPTIONS_LIBTINS_PPS = 2392344;
12+
export const TCP_NO_OPTIONS_LIBPCAP_PPS = 4166666;
13+
14+
export const TCP_WITH_OPTIONS_PCAPPLUSPLUS_SEC = 0.202;
15+
export const TCP_WITH_OPTIONS_LIBTINS_SEC = 0.241;
16+
export const TCP_WITH_OPTIONS_LIBPCAP_SEC = 0.124;
17+
18+
export const TCP_WITH_OPTIONS_PCAPPLUSPLUS_PPS = 2475247;
19+
export const TCP_WITH_OPTIONS_LIBTINS_PPS = 2074688;
20+
export const TCP_WITH_OPTIONS_LIBPCAP_PPS = 4032258;
21+
22+
export const DNS_PCAPPLUSPLUS_SEC = 0.208;
23+
export const DNS_LIBTINS_SEC = 0.263;
24+
export const DNS_LIBPCAP_SEC = 0.031;
25+
26+
export const DNS_PCAPPLUSPLUS_PPS = 2403846;
27+
export const DNS_LIBTINS_PPS = 1901140;
28+
export const DNS_LIBPCAP_PPS = 16129032;
29+
30+
import Chart from 'react-google-charts';
31+
import ThemedChart from '/src/components/ThemedChart';
32+
import ConstVal from '/src/components/ConstVal';
33+
34+
To evaluate the performance of PcapPlusPlus, we employed two benchmarking methods: comparing it to similar libraries and using [Google Benchmark](https://github.com/google/benchmark) to measure key features. This page presents the results of these tests.
35+
36+
## Testing environment
37+
38+
The benchmarks were conducted on the following system configuration:
39+
40+
- Linux Ubuntu 22.04 64-bit running inside WSL2
41+
- g++ 11.4.0
42+
- The host platform is a Windows machine with Intel Core i7-8700 3.2GHz processor and 16GB RAM running Windows 10
43+
44+
## Project Comparison
45+
46+
To compare PcapPlusPlus with other C++ libraries, we used [Matias Fontanini's packet-capture-benchmarks project](https://github.com/mfontanini/packet-capture-benchmarks). This benchmark compares PcapPlusPlus with [libtins](http://libtins.github.io/) and libpcap.
47+
48+
PcapPlusPlus was only compared to similar C/C++ projects, as libraries written in higher-level languages (such as Python or Java) cannot match the performance of native C++ libraries.
49+
50+
The following versions were used during the benchmark:
51+
52+
- libpcap-dev [v1.10.1](https://www.tcpdump.org/#old-releases)
53+
- PcapPlusPlus [v24.09](https://github.com/seladb/PcapPlusPlus/releases/tag/v24.09)
54+
- libtins [v4.5](https://github.com/mfontanini/libtins/releases/tag/v4.5)
55+
56+
### Benchmark #1 - TCP parsing
57+
58+
| Library | Time taken (seconds) | Packets per second |
59+
| :--------------- | :---------------------------------------------------------------- | :---------------------------------------------------------------- |
60+
| libpcap | <ConstVal value={TCP_NO_OPTIONS_LIBPCAP_SEC}></ConstVal> | <ConstVal value={TCP_NO_OPTIONS_LIBPCAP_PPS}></ConstVal> |
61+
| **PcapPlusPlus** | **<ConstVal value={TCP_NO_OPTIONS_PCAPPLUSPLUS_SEC}></ConstVal>** | **<ConstVal value={TCP_NO_OPTIONS_PCAPPLUSPLUS_PPS}></ConstVal>** |
62+
| libtins | <ConstVal value={TCP_NO_OPTIONS_LIBTINS_SEC}></ConstVal> | <ConstVal value={TCP_NO_OPTIONS_LIBTINS_PPS}></ConstVal> |
63+
64+
<ThemedChart
65+
data={[
66+
['Library', 'Seconds'],
67+
['libpcap', TCP_NO_OPTIONS_LIBPCAP_SEC],
68+
['PcapPlusPlus', TCP_NO_OPTIONS_PCAPPLUSPLUS_SEC],
69+
['libtins', TCP_NO_OPTIONS_LIBTINS_SEC]
70+
]}
71+
/>
72+
73+
### Benchmark #2 - TCP + TCP Options parsing
74+
75+
| Library | Time taken (seconds) | Packets per second |
76+
| :--------------- | :------------------------------------------------------------------ | :------------------------------------------------------------------ |
77+
| libpcap | <ConstVal value={TCP_WITH_OPTIONS_LIBPCAP_SEC}></ConstVal> | <ConstVal value={TCP_WITH_OPTIONS_LIBPCAP_PPS}></ConstVal> |
78+
| **PcapPlusPlus** | **<ConstVal value={TCP_WITH_OPTIONS_PCAPPLUSPLUS_SEC}></ConstVal>** | **<ConstVal value={TCP_WITH_OPTIONS_PCAPPLUSPLUS_PPS}></ConstVal>** |
79+
| libtins | <ConstVal value={TCP_WITH_OPTIONS_LIBTINS_SEC}></ConstVal> | <ConstVal value={TCP_WITH_OPTIONS_LIBTINS_PPS}></ConstVal> |
80+
81+
<ThemedChart
82+
data={[
83+
['Library', 'Seconds'],
84+
['libpcap', TCP_WITH_OPTIONS_LIBPCAP_SEC],
85+
['PcapPlusPlus', TCP_WITH_OPTIONS_PCAPPLUSPLUS_SEC],
86+
['libtins', TCP_WITH_OPTIONS_LIBTINS_SEC]
87+
]}
88+
/>
89+
90+
### Benchmark #3 - DNS parsing
91+
92+
| Library | Time taken (seconds) | Packets per second |
93+
| :--------------- | :----------------------------------------------------- | :----------------------------------------------------- |
94+
| libpcap | <ConstVal value={DNS_LIBPCAP_SEC}></ConstVal> | <ConstVal value={DNS_LIBPCAP_PPS}></ConstVal> |
95+
| **PcapPlusPlus** | **<ConstVal value={DNS_PCAPPLUSPLUS_SEC}></ConstVal>** | **<ConstVal value={DNS_PCAPPLUSPLUS_PPS}></ConstVal>** |
96+
| libtins | <ConstVal value={DNS_LIBTINS_SEC}></ConstVal> | <ConstVal value={DNS_LIBTINS_PPS}></ConstVal> |
97+
98+
<ThemedChart
99+
data={[
100+
['Library', 'Seconds'],
101+
['libpcap', DNS_LIBPCAP_SEC],
102+
['PcapPlusPlus', DNS_PCAPPLUSPLUS_SEC],
103+
['libtins', DNS_LIBTINS_SEC]
104+
]}
105+
/>
106+
107+
## Google Benchmark
108+
109+
[Google Benchmark](https://github.com/google/benchmark) is a library designed for measuring the performance of C++ applications. We utilized it to evaluate several aspects of PcapPlusPlus.
110+
The benchmark code can be found in [PcapPlusPlus Examples - Google Benchmark](https://github.com/seladb/PcapPlusPlus/blob/master/Examples/PcapPlusPlus-benchmark/benchmark-google.cpp).
111+
112+
The benchmark covers the following operations:
113+
114+
- Reading pcap files (`BM_PcapFileRead`)
115+
- Writing pcap files (`BM_PcapFileWrite`)
116+
- Packet parsing (`BM_PacketCrafting`)
117+
- Packet crafting (`BM_PacketCrafting`)
118+
119+
| Benchmark | Time | CPU | Iterations | Bytes Per Second | Items Per Second |
120+
| :---------------- | :------ | :------ | :--------- | :--------------- | :--------------- |
121+
| BM_PcapFileRead | 177 ns | 177 ns | 3828289 | 2.35172Gi/s | 5.63843M/s |
122+
| BM_PcapFileWrite | 79.1 ns | 79.1 ns | 9080461 | 650.828Mi/s | 12.6378M/s |
123+
| BM_PacketParsing | 352 ns | 352 ns | 1994805 | 1.18917Gi/s | 2.84116M/s |
124+
| BM_PacketCrafting | 385 ns | 385 ns | 1799083 | 143.504Mi/s | 2.59444M/s |

0 commit comments

Comments
 (0)