Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force pcapplusplus prefix in include #1586

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
  •  
  •  
  •  
8 changes: 3 additions & 5 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -669,13 +669,11 @@ jobs:
run: |
TOYVPN_PCAPPLUSPLUS="./ToyVpn-PcapPlusPlus/app/libs/pcapplusplus"
PCAPPLUSPLUS_LIBS_PATH="$TOYVPN_PCAPPLUSPLUS/${{ matrix.target }}/${{ matrix.api-version }}"
PCAPPLUSPLUS_INCLUDE_PATH="$TOYVPN_PCAPPLUSPLUS/include"
cmake -DPCAPPP_BUILD_COVERAGE=OFF -S . -B "$BUILD_DIR"
cmake --build "$BUILD_DIR" -j
cmake --install "$BUILD_DIR" --prefix ${TOYVPN_PCAPPLUSPLUS}
mkdir -p ${PCAPPLUSPLUS_LIBS_PATH} ${PCAPPLUSPLUS_INCLUDE_PATH}
mv ${TOYVPN_PCAPPLUSPLUS}/lib/*.a ${PCAPPLUSPLUS_LIBS_PATH}/
mv ${TOYVPN_PCAPPLUSPLUS}/include/pcapplusplus/*.h ${PCAPPLUSPLUS_INCLUDE_PATH}/
cmake --install "$BUILD_DIR" --prefix "${TOYVPN_PCAPPLUSPLUS}"
mkdir -p "${PCAPPLUSPLUS_LIBS_PATH}"
mv ${TOYVPN_PCAPPLUSPLUS}/lib/*.a "${PCAPPLUSPLUS_LIBS_PATH}/"

- name: Build ToyVpn-PcapPlusPlus
working-directory: ./ToyVpn-PcapPlusPlus
Expand Down
2 changes: 2 additions & 0 deletions 3rdParty/Getopt-for-Visual-Studio/getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
/* Enforce Windows.h to use winsock2 */
#include <winsock2.h>
#include <windows.h>

#ifdef __cplusplus
Expand Down
30 changes: 15 additions & 15 deletions Common++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ add_library(
src/TablePrinter.cpp)

set(public_headers
header/DeprecationUtils.h
header/GeneralUtils.h
header/IpAddress.h
header/IpAddressUtils.h
header/IpUtils.h
header/Logger.h
header/LRUList.h
header/MacAddress.h
header/OUILookup.h
header/PcapPlusPlusVersion.h
header/PointerVector.h
header/SystemUtils.h
header/TablePrinter.h
header/TimespecTimeval.h)
header/pcapplusplus/DeprecationUtils.h
header/pcapplusplus/GeneralUtils.h
header/pcapplusplus/IpAddress.h
header/pcapplusplus/IpAddressUtils.h
header/pcapplusplus/IpUtils.h
header/pcapplusplus/Logger.h
header/pcapplusplus/LRUList.h
header/pcapplusplus/MacAddress.h
header/pcapplusplus/OUILookup.h
header/pcapplusplus/PcapPlusPlusVersion.h
header/pcapplusplus/PointerVector.h
header/pcapplusplus/SystemUtils.h
header/pcapplusplus/TablePrinter.h
header/pcapplusplus/TimespecTimeval.h)

# Set the public header that will be installed
set_property(TARGET Common++ PROPERTY PUBLIC_HEADER ${public_headers})

target_include_directories(
Common++
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/header> $<INSTALL_INTERFACE:include/pcapplusplus>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/header> $<INSTALL_INTERFACE:include>
# Don't link with EndianPortable and json as it won't be exported
PRIVATE $<TARGET_PROPERTY:EndianPortable,INTERFACE_INCLUDE_DIRECTORIES>
PRIVATE $<TARGET_PROPERTY:json,INTERFACE_INCLUDE_DIRECTORIES>)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Common++/src/GeneralUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define LOG_MODULE CommonLogModuleGenericUtils

#include "GeneralUtils.h"
#include "Logger.h"
#include "pcapplusplus/GeneralUtils.h"
#include "pcapplusplus/Logger.h"
clementperon marked this conversation as resolved.
Show resolved Hide resolved
#include <sstream>
#include <iomanip>
#include <cstring>
Expand Down
6 changes: 3 additions & 3 deletions Common++/src/IpAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <sstream>
#include <stdexcept>
#include <bitset>
#include "Logger.h"
#include "IpUtils.h"
#include "IpAddress.h"
#include "pcapplusplus/Logger.h"
#include "pcapplusplus/IpUtils.h"
#include "pcapplusplus/IpAddress.h"
#include "EndianPortable.h"

// for AF_INET, AF_INET6
Expand Down
6 changes: 3 additions & 3 deletions Common++/src/IpAddressUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "IpAddressUtils.h"
#include "pcapplusplus/IpAddressUtils.h"

#include "IpAddress.h"
#include "IpUtils.h" // Just needing in_addr and in6_addr.
#include "pcapplusplus/IpAddress.h"
#include "pcapplusplus/IpUtils.h" // Just needing in_addr and in6_addr.

namespace pcpp
{
Expand Down
4 changes: 2 additions & 2 deletions Common++/src/IpUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define LOG_MODULE CommonLogModuleIpUtils

#include "IpUtils.h"
#include "Logger.h"
#include "pcapplusplus/IpUtils.h"
#include "pcapplusplus/Logger.h"
#include <cstring>
#include <stdexcept>
#ifndef NS_INADDRSZ
Expand Down
2 changes: 1 addition & 1 deletion Common++/src/Logger.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <sstream>
#include "Logger.h"
#include "pcapplusplus/Logger.h"

namespace pcpp
{
Expand Down
2 changes: 1 addition & 1 deletion Common++/src/MacAddress.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MacAddress.h"
#include "pcapplusplus/MacAddress.h"

namespace pcpp
{
Expand Down
6 changes: 3 additions & 3 deletions Common++/src/OUILookup.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "OUILookup.h"
#include "Logger.h"
#include "pcapplusplus/OUILookup.h"
#include "pcapplusplus/Logger.h"

#include "json.hpp"
#include <json.hpp>

#include <fstream>

Expand Down
2 changes: 1 addition & 1 deletion Common++/src/PcapPlusPlusVersion.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "PcapPlusPlusVersion.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"

namespace pcpp
{
Expand Down
2 changes: 1 addition & 1 deletion Common++/src/SystemUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "SystemUtils.h"
#include "pcapplusplus/SystemUtils.h"
#include "EndianPortable.h"

#ifndef _MSC_VER
Expand Down
4 changes: 2 additions & 2 deletions Common++/src/TablePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <iostream>
#include <numeric>
#include <utility>
#include "TablePrinter.h"
#include "Logger.h"
#include "pcapplusplus/TablePrinter.h"
#include "pcapplusplus/Logger.h"

namespace pcpp
{
Expand Down
19 changes: 11 additions & 8 deletions Examples/ArpSpoofing/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#include <iostream>
#include <fstream>
#include <MacAddress.h>
#include <IpAddress.h>
#include <PcapPlusPlusVersion.h>
#include <SystemUtils.h>
#include <PcapLiveDeviceList.h>
#include <PcapLiveDevice.h>
#include <EthLayer.h>
#include <ArpLayer.h>

#include "pcapplusplus/MacAddress.h"
#include "pcapplusplus/IpAddress.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"
#include "pcapplusplus/SystemUtils.h"
#include "pcapplusplus/PcapLiveDeviceList.h"
#include "pcapplusplus/PcapLiveDevice.h"
#include "pcapplusplus/EthLayer.h"
#include "pcapplusplus/ArpLayer.h"
#include "pcapplusplus/Logger.h"

#include <getopt.h>

#define EXIT_WITH_ERROR(reason) \
Expand Down
16 changes: 8 additions & 8 deletions Examples/Arping/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/

#include <iostream>
#include <MacAddress.h>
#include <IpAddress.h>
#include <Logger.h>
#include <PcapPlusPlusVersion.h>
#include <PcapLiveDeviceList.h>
#include <PcapLiveDevice.h>
#include <NetworkUtils.h>
#include <getopt.h>
#include <SystemUtils.h>
#include "pcapplusplus/MacAddress.h"
#include "pcapplusplus/IpAddress.h"
#include "pcapplusplus/Logger.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"
#include "pcapplusplus/PcapLiveDeviceList.h"
#include "pcapplusplus/PcapLiveDevice.h"
#include "pcapplusplus/NetworkUtils.h"
#include "pcapplusplus/SystemUtils.h"

#define EXIT_WITH_ERROR(reason) \
do \
Expand Down
12 changes: 6 additions & 6 deletions Examples/DNSResolver/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <iostream>
#include "PcapPlusPlusVersion.h"
#include "PcapLiveDevice.h"
#include "PcapLiveDeviceList.h"
#include "NetworkUtils.h"
#include "SystemUtils.h"
#include "Logger.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"
#include "pcapplusplus/PcapLiveDevice.h"
#include "pcapplusplus/PcapLiveDeviceList.h"
#include "pcapplusplus/NetworkUtils.h"
#include "pcapplusplus/SystemUtils.h"
#include "pcapplusplus/Logger.h"
#include <getopt.h>

#define EXIT_WITH_ERROR(reason) \
Expand Down
30 changes: 15 additions & 15 deletions Examples/DnsSpoofing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
#if !defined(_WIN32)
# include <errno.h>
#endif
#include "IpAddress.h"
#include "RawPacket.h"
#include "ProtocolType.h"
#include "Packet.h"
#include "EthLayer.h"
#include "IPv4Layer.h"
#include "IPv6Layer.h"
#include "UdpLayer.h"
#include "DnsLayer.h"
#include "PcapFilter.h"
#include "PcapLiveDevice.h"
#include "PcapLiveDeviceList.h"
#include "TablePrinter.h"
#include "SystemUtils.h"
#include "PcapPlusPlusVersion.h"
#include "pcapplusplus/IpAddress.h"
#include "pcapplusplus/RawPacket.h"
#include "pcapplusplus/ProtocolType.h"
#include "pcapplusplus/Packet.h"
#include "pcapplusplus/EthLayer.h"
#include "pcapplusplus/IPv4Layer.h"
#include "pcapplusplus/IPv6Layer.h"
#include "pcapplusplus/UdpLayer.h"
#include "pcapplusplus/DnsLayer.h"
#include "pcapplusplus/PcapFilter.h"
#include "pcapplusplus/PcapLiveDevice.h"
#include "pcapplusplus/PcapLiveDeviceList.h"
#include "pcapplusplus/TablePrinter.h"
#include "pcapplusplus/SystemUtils.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"
#include <getopt.h>

#define EXIT_WITH_ERROR(reason) \
Expand Down
8 changes: 4 additions & 4 deletions Examples/DpdkBridge/AppWorkerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include "Common.h"

#include "PacketUtils.h"
#include "DpdkDevice.h"
#include "DpdkDeviceList.h"
#include "PcapFileDevice.h"
#include "pcapplusplus/PacketUtils.h"
#include "pcapplusplus/DpdkDevice.h"
#include "pcapplusplus/DpdkDeviceList.h"
#include "pcapplusplus/PcapFileDevice.h"

/**
* The worker thread class which does all the work. It's initialized with pointers to the RX and TX devices, then it
Expand Down
7 changes: 3 additions & 4 deletions Examples/DpdkBridge/Common.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include "Packet.h"
#include "DpdkDevice.h"

#include <SystemUtils.h>
#include "pcapplusplus/Packet.h"
#include "pcapplusplus/DpdkDevice.h"
#include "pcapplusplus/SystemUtils.h"

#include <string>
#include <unordered_map>
Expand Down
8 changes: 4 additions & 4 deletions Examples/DpdkBridge/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include "Common.h"
#include "AppWorkerThread.h"

#include "DpdkDeviceList.h"
#include "SystemUtils.h"
#include "PcapPlusPlusVersion.h"
#include "TablePrinter.h"
#include "pcapplusplus/DpdkDeviceList.h"
#include "pcapplusplus/SystemUtils.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"
#include "pcapplusplus/TablePrinter.h"

#include <vector>
#include <iostream>
Expand Down
8 changes: 4 additions & 4 deletions Examples/DpdkExample-FilterTraffic/AppWorkerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include "Common.h"
#include "PacketMatchingEngine.h"

#include "PacketUtils.h"
#include "DpdkDevice.h"
#include "DpdkDeviceList.h"
#include "PcapFileDevice.h"
#include "pcapplusplus/PacketUtils.h"
#include "pcapplusplus/DpdkDevice.h"
#include "pcapplusplus/DpdkDeviceList.h"
#include "pcapplusplus/PcapFileDevice.h"

/**
* The worker thread class which does all the work: receive packets from relevant DPDK port(s), matched them with the
Expand Down
7 changes: 3 additions & 4 deletions Examples/DpdkExample-FilterTraffic/Common.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include "Packet.h"
#include "DpdkDevice.h"

#include <SystemUtils.h>
#include "pcapplusplus/Packet.h"
#include "pcapplusplus/DpdkDevice.h"
#include "pcapplusplus/SystemUtils.h"

#include <string>
#include <unordered_map>
Expand Down
10 changes: 5 additions & 5 deletions Examples/DpdkExample-FilterTraffic/PacketMatchingEngine.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "Packet.h"
#include "IPv4Layer.h"
#include "TcpLayer.h"
#include "UdpLayer.h"
#include "SystemUtils.h"
#include "pcapplusplus/Packet.h"
#include "pcapplusplus/IPv4Layer.h"
#include "pcapplusplus/TcpLayer.h"
#include "pcapplusplus/UdpLayer.h"
#include "pcapplusplus/SystemUtils.h"

/**
* Responsible for matching packets by match criteria received from the user. Current match criteria are a combination
Expand Down
12 changes: 6 additions & 6 deletions Examples/DpdkExample-FilterTraffic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#include "PacketMatchingEngine.h"
#include "AppWorkerThread.h"

#include "DpdkDeviceList.h"
#include "TcpLayer.h"
#include "UdpLayer.h"
#include "SystemUtils.h"
#include "PcapPlusPlusVersion.h"
#include "TablePrinter.h"
#include "pcapplusplus/DpdkDeviceList.h"
#include "pcapplusplus/TcpLayer.h"
#include "pcapplusplus/UdpLayer.h"
#include "pcapplusplus/SystemUtils.h"
#include "pcapplusplus/PcapPlusPlusVersion.h"
#include "pcapplusplus/TablePrinter.h"

#include <vector>
#include <iostream>
Expand Down
6 changes: 3 additions & 3 deletions Examples/ExampleApp/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
#include <IPv4Layer.h>
#include <Packet.h>
#include <PcapFileDevice.h>
#include "pcapplusplus/IPv4Layer.h"
#include "pcapplusplus/Packet.h"
#include "pcapplusplus/PcapFileDevice.h"

int main(int argc, char* argv[])
{
Expand Down
12 changes: 6 additions & 6 deletions Examples/HttpAnalyzer/HttpStatsCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include <functional>
#include <sstream>
#include "HttpLayer.h"
#include "TcpLayer.h"
#include "IPv4Layer.h"
#include "PayloadLayer.h"
#include "PacketUtils.h"
#include "SystemUtils.h"
#include "pcapplusplus/HttpLayer.h"
#include "pcapplusplus/TcpLayer.h"
#include "pcapplusplus/IPv4Layer.h"
#include "pcapplusplus/PayloadLayer.h"
#include "pcapplusplus/PacketUtils.h"
#include "pcapplusplus/SystemUtils.h"

/**
* An auxiliary struct for encapsulating rate stats
Expand Down
Loading
Loading