diff --git a/.github/workflows/auto_update.yml b/.github/workflows/auto_update.yml index 0f7e8cb4fe..6eb39488dd 100644 --- a/.github/workflows/auto_update.yml +++ b/.github/workflows/auto_update.yml @@ -13,11 +13,11 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: ref: dev - name: Setup Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: "3.8.x" - name: Run update @@ -25,7 +25,7 @@ jobs: pip install pre-commit pre-commit autoupdate - name: Create Pull Request - uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 + uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 with: token: ${{ secrets.PAT }} author: GitHub @@ -46,11 +46,11 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: ref: dev - name: Setup Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: "3.9.x" - name: Run update @@ -58,7 +58,7 @@ jobs: python3 3rdParty/OUIDataset/create_oui_data.py mv -f PCPP_OUIDataset.json 3rdParty/OUIDataset/PCPP_OUIDataset.json - name: Create Pull Request - uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 + uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 with: token: ${{ secrets.PAT }} author: GitHub diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index be7cdedb70..7f96abd31f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -25,7 +25,7 @@ jobs: container: seladb/alpine317 steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # Checkout is performed out of the container and doesn't match our user - name: Fix checkout ownership @@ -72,14 +72,14 @@ jobs: config-zstd: OFF - image: ubuntu2004-zstd config-zstd: ON - - image: fedora39 + - image: fedora40 config-zstd: OFF - - image: alpine317 + - image: alpine320 config-zstd: OFF steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # Checkout is performed out of the container and doesn't match our user - name: Fix checkout ownership @@ -177,7 +177,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Restore Ccache id: ccache-restore @@ -237,7 +237,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Restore Ccache id: ccache-restore @@ -316,10 +316,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: # support version: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json python-version: "3.12" @@ -420,10 +420,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup MSYS2 - uses: msys2/setup-msys2@d0e80f58dffbc64f6a3a1f43527d469b4fc7b6c8 # v2.23.0 + uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1 with: msystem: ${{matrix.sys}} install: >- @@ -433,7 +433,7 @@ jobs: mingw-w64-${{matrix.env}}-make - name: Setup Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: "3.12" @@ -514,10 +514,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: "3.12" @@ -585,12 +585,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: ["14.0", "13.2"] + version: ["14.1", "13.4"] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Test in FreeBSD id: test - uses: vmactions/freebsd-vm@12c207ac1ba13827f25726fe93f9c2e6f685f0f3 # v1.0.8 + uses: vmactions/freebsd-vm@d7b8fcc7711aa41ad45e8d9b737cf90f035a7e3d # v1.1.3 with: release: ${{ matrix.version }} usesh: true @@ -641,10 +641,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Checkout lipbcap for Android - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # main + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # main with: repository: seladb/libpcap-android path: ./libpcap-android @@ -658,7 +658,7 @@ jobs: run: cmake --build "$BUILD_DIR" -j - name: Checkout ToyVpn-PcapPlusPlus - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # master + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # master with: repository: seladb/ToyVpn-PcapPlusPlus path: ./ToyVpn-PcapPlusPlus @@ -697,7 +697,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install dependencies run: | @@ -762,7 +762,7 @@ jobs: image: gcr.io/oss-fuzz-base/base-builder steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install prerequisites run: | diff --git a/.github/workflows/check_dependabot.yml b/.github/workflows/check_dependabot.yml index 9d13a26c8e..fa8bd0c86d 100644 --- a/.github/workflows/check_dependabot.yml +++ b/.github/workflows/check_dependabot.yml @@ -13,6 +13,6 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: marocchino/validate-dependabot@d8ae5c0d03dd75fbd0ad5f8ab4ba8101ebbd4b37 # v3.0.0 id: validate diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index ffa3c20449..e178ea9d5a 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -35,7 +35,7 @@ jobs: dry-run: false sanitizer: ${{ matrix.sanitizer }} - name: Upload Crash - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: failure() && steps.build.outcome == 'success' with: name: artifacts diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3890a82da0..533e4a2587 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,11 +25,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 + uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -44,4 +44,4 @@ jobs: cmake --build build -j - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 + uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 6a5cfedba1..a712135723 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -18,10 +18,10 @@ jobs: container: seladb/ubuntu2204:latest steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Checkout docs repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: PcapPlusPlus/pcapplusplus.github.io path: pcapplusplus.github.io diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 29daf607bc..d4c7f8f8e1 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -39,14 +39,14 @@ jobs: config-zstd: OFF - image: rhel94 config-zstd: OFF - - image: fedora39 + - image: fedora40 config-zstd: OFF - - image: alpine317 + - image: alpine320 config-zstd: OFF steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # Checkout is performed out of the container and doesn't match our user - name: Fix checkout ownership @@ -71,7 +71,8 @@ jobs: run: cmake --build "$BUILD_DIR" --target package - name: Generate artifact attestation - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + if: github.ref_type == 'tag' + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: "${{ env.BUILD_DIR }}/*.tar.gz,${{ env.BUILD_DIR }}/*.deb,${{ env.BUILD_DIR }}/*.rpm" @@ -92,17 +93,16 @@ jobs: id-token: write strategy: matrix: - include: - - freebsd-version: "13.2" - - freebsd-version: "14.0" + version: ["14.1", "13.4"] + steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Test in FreeBSD - uses: vmactions/freebsd-vm@f8be330398166d1eb0601f01353839d4052367b2 # v1.0.7 + uses: vmactions/freebsd-vm@d7b8fcc7711aa41ad45e8d9b737cf90f035a7e3d # v1.1.3 with: - release: ${{ matrix.freebsd-version }} + release: ${{ matrix.version }} envs: 'BUILD_DIR' usesh: true prepare: | @@ -113,7 +113,8 @@ jobs: cmake --build "$BUILD_DIR" --target package - name: Generate artifact attestation - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + if: github.ref_type == 'tag' + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: "${{ env.BUILD_DIR }}/*.tar.gz" @@ -143,7 +144,7 @@ jobs: xcode-version: "${{ matrix.xcode-version }}" - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Configure PcapPlusPlus run: | @@ -156,7 +157,8 @@ jobs: run: cmake --build "$BUILD_DIR" --target package - name: Generate artifact attestation - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + if: github.ref_type == 'tag' + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: "${{ env.BUILD_DIR }}/*.tar.gz,${{ env.BUILD_DIR }}/*.pkg" @@ -185,10 +187,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup MSYS2 - uses: msys2/setup-msys2@d0e80f58dffbc64f6a3a1f43527d469b4fc7b6c8 # v2.23.0 + uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1 with: msystem: ${{matrix.sys}} update: true @@ -226,7 +228,8 @@ jobs: run: cmake --build "$BUILD_DIR" --target package - name: Generate artifact attestation - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + if: github.ref_type == 'tag' + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: "${{ env.BUILD_DIR }}/*.zip" @@ -253,7 +256,7 @@ jobs: id-token: write steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0 @@ -275,7 +278,8 @@ jobs: run: cmake --build "$env:BUILD_DIR" --config ${{ matrix.configuration }} --target package - name: Generate artifact attestation - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + if: github.ref_type == 'tag' + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: "${{ env.BUILD_DIR }}/*.zip" @@ -305,10 +309,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Checkout lipbcap for Android - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # main + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # main with: repository: seladb/libpcap-android path: ./libpcap-android @@ -338,7 +342,7 @@ jobs: mkdir -p "android-package" mv "${COMBINED_PACKAGE_DIR}" "android-package" - - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: path: android-package name: android-package-${{ matrix.target }}-${{ matrix.api-version }} @@ -365,7 +369,8 @@ jobs: tar cvf "${PACKAGE_DIR}.tar.gz" "${PACKAGE_DIR}" - name: Generate artifact attestation - uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2 + if: github.ref_type == 'tag' + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: "${{ env.PACKAGE_DIR }}.tar.gz" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index d97b8d96fd..524a67efa3 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -31,12 +31,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif @@ -58,7 +58,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: SARIF file path: results.sarif @@ -66,6 +66,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12 + uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 with: sarif_file: results.sarif diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 576459527b..dba90e8437 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,10 +21,14 @@ repos: - id: mixed-line-ending args: ['--fix=lf'] - id: trailing-whitespace - - repo: https://github.com/psf/black - rev: 24.4.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.8 hooks: - - id: black + - id: ruff # Run the linter. + types_or: [ python ] + - id: ruff-format # Run the formatter. + types_or: [ python ] + args: [ --check ] - repo: https://github.com/pocc/pre-commit-hooks rev: v1.3.5 hooks: @@ -39,7 +43,7 @@ repos: - id: codespell pass_filenames: false - repo: https://github.com/crate-ci/typos - rev: v1.23.6 + rev: v1.25.0 hooks: - id: typos args: ['--config=typos-config.toml'] diff --git a/3rdParty/MemPlumber/MemPlumber/CMakeLists.txt b/3rdParty/MemPlumber/MemPlumber/CMakeLists.txt index b96069da70..7623c7490e 100644 --- a/3rdParty/MemPlumber/MemPlumber/CMakeLists.txt +++ b/3rdParty/MemPlumber/MemPlumber/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.0...3.5) project(memplumber CXX) add_library(memplumber memplumber.cpp) diff --git a/3rdParty/OUIDataset/PCPP_OUIDataset.json b/3rdParty/OUIDataset/PCPP_OUIDataset.json index 687289d177..ca6fd632ac 100644 --- a/3rdParty/OUIDataset/PCPP_OUIDataset.json +++ b/3rdParty/OUIDataset/PCPP_OUIDataset.json @@ -2499,7 +2499,7 @@ "vendor": "Floware Wireless Systems, Ltd." }, "833": { - "vendor": "Axon Digital Design" + "vendor": "EVS Broadcast Equipment" }, "834": { "vendor": "Nortel Networks" @@ -8601,7 +8601,7 @@ "vendor": "Communications & Power Industries" }, "2895": { - "vendor": "Verifone" + "vendor": "Verifone, Inc." }, "2896": { "vendor": "Oxygnet" @@ -22146,7 +22146,7 @@ "vendor": "Tenlon Technology Co.,Ltd." }, "7411": { - "vendor": "Evs Broadcast Equipment" + "vendor": "EVS Broadcast Equipment" }, "7412": { "vendor": "Media Technology Systems Inc" @@ -26625,7 +26625,7 @@ "vendor": "SEGGER Microcontroller GmbH & Co. KG" }, "8904": { - "vendor": "Applied Instruments B.V." + "vendor": "ModuVision Technologies" }, "8905": { "vendor": "Lenord, Bauer & Co GmbH" @@ -33177,7 +33177,7 @@ "vendor": "Eldat Communication Ltd." }, "24789": { - "vendor": "AMADA MIYACHI Co., Ltd" + "vendor": "Amada Co., Ltd" }, "24790": { "vendor": "NovAtel Inc." @@ -33426,7 +33426,7 @@ "vendor": "Ruijie Networks Co.,LTD" }, "30002": { - "vendor": "Inid Bv" + "vendor": "Integrated Engineering BV" }, "30177": { "vendor": "Ampt, LLC" @@ -33464,6 +33464,9 @@ "31789": { "vendor": "Samsung Electronics Co.,Ltd" }, + "32059": { + "vendor": "Samsung Electronics Co.,Ltd" + }, "32096": { "vendor": "Apple, Inc." }, @@ -36215,6 +36218,9 @@ "47930": { "vendor": "Amazon Technologies Inc." }, + "47939": { + "vendor": "Tiinlab Corporation" + }, "47968": { "vendor": "Intel Corporate" }, @@ -39824,6 +39830,9 @@ "314093": { "vendor": "Huawei Technologies Co.,Ltd" }, + "314113": { + "vendor": "Samsung Electronics Co.,Ltd" + }, "314141": { "vendor": "Traka plc" }, @@ -39836,6 +39845,9 @@ "314645": { "vendor": "Silicon Laboratories" }, + "314816": { + "vendor": "Mist Systems, Inc." + }, "314889": { "vendor": "Shenzhen Skyworth Digital Technology CO., Ltd" }, @@ -39956,6 +39968,9 @@ "320391": { "vendor": "Cisco Systems, Inc" }, + "320485": { + "vendor": "Silicon Laboratories" + }, "320593": { "vendor": "Texas Instruments" }, @@ -40013,6 +40028,9 @@ "322867": { "vendor": "Intel Corporate" }, + "322914": { + "vendor": "Daikin Europe NV" + }, "323075": { "vendor": "Texas Instruments" }, @@ -40602,7 +40620,7 @@ "vendor": "Intel Corporate" }, "529031": { - "vendor": "Jiangxi Risound Electronics Co., LTD" + "vendor": "Jiangxi Risound Electronics Co.,LTD" }, "529061": { "vendor": "Amazon Technologies Inc." @@ -40994,6 +41012,9 @@ "553075": { "vendor": "Huawei Technologies Co.,Ltd" }, + "553304": { + "vendor": "Hanshow Technology Co.,Ltd." + }, "553360": { "vendor": "Intel Corporate" }, @@ -41189,6 +41210,9 @@ "565547": { "vendor": "ShenZhen EZL Technology Co., Ltd" }, + "565558": { + "vendor": "Cloud Network Technology Singapore Pte. Ltd." + }, "565641": { "vendor": "Hangzhou Hikvision Digital Technology Co.,Ltd." }, @@ -41270,6 +41294,9 @@ "571372": { "vendor": "Wireless Seismic" }, + "571743": { + "vendor": "Silicon Laboratories" + }, "571938": { "vendor": "Swaive Corporation" }, @@ -41393,6 +41420,9 @@ "579635": { "vendor": "Shenzhen RF Technology Co., Ltd" }, + "580867": { + "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" + }, "581099": { "vendor": "Silicon Laboratories" }, @@ -41504,6 +41534,9 @@ "586923": { "vendor": "Apple, Inc." }, + "586992": { + "vendor": "Cisco Systems, Inc" + }, "587270": { "vendor": "zte corporation" }, @@ -41642,6 +41675,9 @@ "791865": { "vendor": "Apple, Inc." }, + "791907": { + "vendor": "Apple, Inc." + }, "792005": { "vendor": "SDTEC Co., Ltd." }, @@ -41663,6 +41699,9 @@ "793104": { "vendor": "Acoustic Stream" }, + "793548": { + "vendor": "Iflytek Co.,Ltd." + }, "793625": { "vendor": "Longconn Electronics(Shenzhen) Co.,Ltd" }, @@ -42176,6 +42215,9 @@ "825183": { "vendor": "Hewlett Packard Enterprise" }, + "825243": { + "vendor": "Fujian Star-Net Communication Co.,Ltd" + }, "825400": { "vendor": "Xiaomi Communications Co Ltd" }, @@ -42281,6 +42323,9 @@ "833393": { "vendor": "ARRIS Group, Inc." }, + "833415": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "833417": { "vendor": "Honor Device Co., Ltd." }, @@ -42575,6 +42620,9 @@ "850368": { "vendor": "Sky Uk Limited" }, + "850466": { + "vendor": "Flipper Devices Inc" + }, "850968": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -43034,6 +43082,9 @@ "1072969": { "vendor": "Cisco SPVTG" }, + "1073025": { + "vendor": "INTENTSECURE Inc.," + }, "1073069": { "vendor": "Intel Corporate" }, @@ -43196,6 +43247,9 @@ "1083020": { "vendor": "ARRIS Group, Inc." }, + "1083124": { + "vendor": "Huawei Device Co., Ltd." + }, "1083407": { "vendor": "Daruma Telecomunicações e Informática S.A." }, @@ -43277,6 +43331,9 @@ "1087542": { "vendor": "Dell Inc." }, + "1087583": { + "vendor": "Inventus Power Eletronica do Brasil LTDA" + }, "1087683": { "vendor": "Murata Manufacturing Co., Ltd." }, @@ -43322,6 +43379,9 @@ "1090259": { "vendor": "Apple, Inc." }, + "1090319": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "1090488": { "vendor": "Iskratel d.o.o." }, @@ -43595,6 +43655,9 @@ "1106295": { "vendor": "ARRIS Group, Inc." }, + "1106318": { + "vendor": "Universal Global Scientific Industrial., Ltd" + }, "1106633": { "vendor": "Apple, Inc." }, @@ -43748,6 +43811,9 @@ "1312332": { "vendor": "Vogl Electronic GmbH" }, + "1312423": { + "vendor": "Cresyn" + }, "1312520": { "vendor": "Cp Plus Gmbh & Co. Kg" }, @@ -44315,6 +44381,9 @@ "1347361": { "vendor": "Garmin International" }, + "1347380": { + "vendor": "Tecno Mobile Limited" + }, "1347526": { "vendor": "Apple, Inc." }, @@ -44657,6 +44726,9 @@ "1368093": { "vendor": "Samsung Electronics Co.,Ltd" }, + "1368713": { + "vendor": "Abietec Inc." + }, "1369324": { "vendor": "mLogic LLC" }, @@ -45104,6 +45176,9 @@ "1593386": { "vendor": "Soarnex" }, + "1593459": { + "vendor": "Tianjin HuaLai Technology CO., Ltd." + }, "1593863": { "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" }, @@ -45434,6 +45509,9 @@ "1612839": { "vendor": "ARRIS Group, Inc." }, + "1612844": { + "vendor": "Dongguan Huayin Electronic Technology Co., Ltd." + }, "1612893": { "vendor": "Cisco Systems, Inc" }, @@ -45755,6 +45833,9 @@ "1632477": { "vendor": "Moduletek" }, + "1632492": { + "vendor": "STMicrolectronics International NV" + }, "1632541": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -45965,6 +46046,9 @@ "1842566": { "vendor": "Cisco Systems, Inc" }, + "1842643": { + "vendor": "Apple, Inc." + }, "1842744": { "vendor": "PCCW Global, Inc." }, @@ -46184,6 +46268,9 @@ "1854832": { "vendor": "Intel Corporate" }, + "1854857": { + "vendor": "Hangzhou Huacheng Network Technology Co.,Ltd" + }, "1855518": { "vendor": "Sunplus Technology Co., Ltd." }, @@ -46673,6 +46760,9 @@ "1884213": { "vendor": "Planex Communications Inc." }, + "1884297": { + "vendor": "Silicon Laboratories" + }, "1884428": { "vendor": "Intel Corporate" }, @@ -47114,6 +47204,9 @@ "2111420": { "vendor": "Kuipers Electronic Engineering BV" }, + "2111472": { + "vendor": "Arcadyan Corporation" + }, "2111830": { "vendor": "HMD Global Oy" }, @@ -47165,6 +47258,9 @@ "2113921": { "vendor": "ESYSE GmbH Embedded Systems Engineering" }, + "2114472": { + "vendor": "Espressif Inc." + }, "2114618": { "vendor": "Schneider Electric Asia Pacific Ltd" }, @@ -47639,6 +47735,9 @@ "2145222": { "vendor": "Jabil Circuit Hungary Ltd." }, + "2145972": { + "vendor": "Hisense broadband multimedia technology Co.,Ltd" + }, "2145976": { "vendor": "Amazon Technologies Inc." }, @@ -48077,6 +48176,9 @@ "2367780": { "vendor": "Nokia" }, + "2367838": { + "vendor": "Quectel Wireless Solutions Co.,Ltd." + }, "2367915": { "vendor": "Sony Corporation" }, @@ -48101,6 +48203,9 @@ "2369328": { "vendor": "GD Midea Air-Conditioning Equipment Co.,Ltd." }, + "2369622": { + "vendor": "Beijing Gctech Technology Co.,LTD" + }, "2369789": { "vendor": "Hangzhou Hikvision Digital Technology Co.,Ltd." }, @@ -48164,6 +48269,9 @@ "2374688": { "vendor": "Dynamode Group" }, + "2374832": { + "vendor": "Dongguan Mentech Optical & Magnetic Co., Ltd." + }, "2375472": { "vendor": "Oxygen Broadband s.a." }, @@ -48179,6 +48287,9 @@ "2376076": { "vendor": "Intel Corporate" }, + "2376190": { + "vendor": "Wistron Neweb Corporation" + }, "2376380": { "vendor": "Alinco,incorporated" }, @@ -48584,6 +48695,9 @@ "2403500": { "vendor": "Polar Electro Oy" }, + "2404044": { + "vendor": "Honor Device Co., Ltd." + }, "2404170": { "vendor": "Alcatel-Lucent IPD" }, @@ -48599,6 +48713,9 @@ "2404873": { "vendor": "Avaya Inc" }, + "2405049": { + "vendor": "Liteon Technology Corporation" + }, "2405086": { "vendor": "Espressif Inc." }, @@ -48782,9 +48899,15 @@ "2415899": { "vendor": "Qingdao Hi-image Technologies Co., Ltd" }, + "2416266": { + "vendor": "Nokia Solutions and Networks GmbH & Co. KG" + }, "2416326": { "vendor": "Hewlett Packard Enterprise" }, + "2416363": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "2416490": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -49046,6 +49169,9 @@ "2627337": { "vendor": "Huawei Technologies Co.,Ltd" }, + "2627374": { + "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" + }, "2627531": { "vendor": "Software Freedom Conservancy" }, @@ -49127,6 +49253,9 @@ "2633087": { "vendor": "Apple, Inc." }, + "2633264": { + "vendor": "Mechatronics Innovation Technologies, S.L.U." + }, "2633353": { "vendor": "Wistron Neweb Corporation" }, @@ -49172,6 +49301,9 @@ "2635539": { "vendor": "Shenzhen 3Nod Digital Technology Co., Ltd." }, + "2635567": { + "vendor": "Espressif Inc." + }, "2635575": { "vendor": "Apple, Inc." }, @@ -49226,6 +49358,9 @@ "2637850": { "vendor": "C8 MediSensors, Inc." }, + "2638045": { + "vendor": "Sony Interactive Entertainment Inc." + }, "2638113": { "vendor": "OptiSense Network, LLC" }, @@ -49238,6 +49373,12 @@ "2638896": { "vendor": "Arcade Communications Ltd." }, + "2639092": { + "vendor": "Honor Device Co., Ltd." + }, + "2639276": { + "vendor": "Huawei Device Co., Ltd." + }, "2639786": { "vendor": "Nokia Corporation" }, @@ -49250,6 +49391,9 @@ "2640979": { "vendor": "Intune Networks" }, + "2641277": { + "vendor": "zte corporation" + }, "2641298": { "vendor": "Luminator" }, @@ -49358,6 +49502,9 @@ "2648924": { "vendor": "Cisco Systems, Inc" }, + "2649012": { + "vendor": "SJIT Co., Ltd." + }, "2649095": { "vendor": "XIAOMI Electronics,CO.,LTD" }, @@ -49367,6 +49514,9 @@ "2649549": { "vendor": "Beijing Winner Microelectronics Co.,Ltd." }, + "2649562": { + "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" + }, "2649812": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -49589,6 +49739,9 @@ "2664155": { "vendor": "Huawei Technologies Co.,Ltd" }, + "2664725": { + "vendor": "Servercom (India) Private Limited" + }, "2665575": { "vendor": "Mach Power, Rappresentanze Internazionali s.r.l." }, @@ -49832,6 +49985,9 @@ "2677143": { "vendor": "Yuduan Mobile Co., Ltd." }, + "2677506": { + "vendor": "zte corporation" + }, "2677633": { "vendor": "Shanghai Guao Electronic Technology Co., Ltd" }, @@ -49967,6 +50123,9 @@ "2684059": { "vendor": "Leetek" }, + "2684203": { + "vendor": "FN-LINK TECHNOLOGY Ltd." + }, "2684210": { "vendor": "ADD-Engineering BV" }, @@ -50147,6 +50306,9 @@ "2889902": { "vendor": "Trend Electronics Co., Ltd." }, + "2890076": { + "vendor": "Beijing Xiaomi Mobile Software Co., Ltd" + }, "2890116": { "vendor": "IDN Telecom, Inc." }, @@ -50261,6 +50423,9 @@ "2896935": { "vendor": "Erco & Gener" }, + "2897019": { + "vendor": "Shenzhen Junge Technology Co.,Ltd" + }, "2897239": { "vendor": "ELIIY Power CO., Ltd." }, @@ -50477,6 +50642,9 @@ "2907539": { "vendor": "Ruckus Wireless" }, + "2907819": { + "vendor": "Mellanox Technologies, Inc." + }, "2908147": { "vendor": "Pertronic Industries" }, @@ -50756,6 +50924,9 @@ "2926464": { "vendor": "True Technologies Inc." }, + "2926487": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "2926494": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -50831,6 +51002,9 @@ "2930333": { "vendor": "RED Digital Cinema" }, + "2930370": { + "vendor": "zte corporation" + }, "2930376": { "vendor": "Raisecom Technology CO., LTD" }, @@ -50951,12 +51125,18 @@ "2937575": { "vendor": "Nokia Corporation" }, + "2937773": { + "vendor": "Texas Instruments" + }, "2937924": { "vendor": "Fujitsu Limited" }, "2938879": { "vendor": "LANCOM Systems GmbH" }, + "2939102": { + "vendor": "AltoBeam Inc." + }, "2939252": { "vendor": "Hui Zhou Gaoshengda Technology Co.,LTD" }, @@ -51227,6 +51407,9 @@ "3154874": { "vendor": "Accelerated Memory Production Inc." }, + "3154893": { + "vendor": "Fujian Star-Net Communication Co.,Ltd" + }, "3154994": { "vendor": "Intel Corporate" }, @@ -51287,6 +51470,9 @@ "3159250": { "vendor": "Availink, Inc." }, + "3159286": { + "vendor": "Vantiva Connected Home - Subcomponents" + }, "3159469": { "vendor": "Apple, Inc." }, @@ -51509,6 +51695,9 @@ "3172492": { "vendor": "Reach Technology Inc." }, + "3172499": { + "vendor": "TP-Link Systems Inc." + }, "3172683": { "vendor": "Rim" }, @@ -52025,6 +52214,12 @@ "3206268": { "vendor": "Shenzhen Along Electronics Co., Ltd" }, + "3206550": { + "vendor": "LS Mecapion" + }, + "3206560": { + "vendor": "Espressif Inc." + }, "3207121": { "vendor": "Alstom Strongwish (Shenzhen) Co., Ltd." }, @@ -52298,6 +52493,9 @@ "3418992": { "vendor": "Arris" }, + "3419278": { + "vendor": "Ufispace Co., LTD." + }, "3419332": { "vendor": "Compal Broadband Networks, Inc." }, @@ -52397,6 +52595,9 @@ "3426651": { "vendor": "Sagemcom Broadband SAS" }, + "3426843": { + "vendor": "zte corporation" + }, "3427011": { "vendor": "HuNan ZiKun Information Technology CO., Ltd" }, @@ -52490,6 +52691,9 @@ "3431488": { "vendor": "Cargt Holdings LLC" }, + "3431667": { + "vendor": "Chipsea Technologies (Shenzhen) Corp." + }, "3431696": { "vendor": "Wytek" }, @@ -52724,6 +52928,9 @@ "3444519": { "vendor": "Ruckus Wireless" }, + "3444970": { + "vendor": "Murata Manufacturing Co., Ltd." + }, "3445103": { "vendor": "UserGate Ltd." }, @@ -52829,6 +53036,9 @@ "3450958": { "vendor": "Cisco Systems, Inc" }, + "3451099": { + "vendor": "SenArch ApS" + }, "3451115": { "vendor": "Apple, Inc." }, @@ -52955,6 +53165,9 @@ "3458002": { "vendor": "Fn-Link Technology Limited" }, + "3458137": { + "vendor": "Texas Instruments" + }, "3458325": { "vendor": "Hewlett Packard Enterprise" }, @@ -53042,6 +53255,9 @@ "3462930": { "vendor": "Smartisan Digital Co., Ltd" }, + "3462959": { + "vendor": "Shenzhen SuperElectron Technology Co.,Ltd." + }, "3462967": { "vendor": "IBG Industriebeteiligungsgesellschaft mbH &b Co. KG" }, @@ -53249,6 +53465,9 @@ "3473093": { "vendor": "Shenzhen Sunwoda intelligent hardware Co.,Ltd" }, + "3473395": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "3670053": { "vendor": "Intel Corporate" }, @@ -53297,6 +53516,9 @@ "3672484": { "vendor": "Firefly Integrations" }, + "3672571": { + "vendor": "Apple, Inc." + }, "3672586": { "vendor": "Sky-City Communication and Electronics Limited Company" }, @@ -53504,6 +53726,9 @@ "3684751": { "vendor": "Silicon Laboratories" }, + "3684813": { + "vendor": "vivo Mobile Communication Co., Ltd." + }, "3685158": { "vendor": "Jiangsu Qinheng Co., Ltd." }, @@ -53651,6 +53876,9 @@ "3695013": { "vendor": "Grabango Co" }, + "3695155": { + "vendor": "Apple, Inc." + }, "3695487": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, @@ -54086,6 +54314,9 @@ "3722503": { "vendor": "Beijing FaceCam Technology Co., Ltd." }, + "3723420": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "3723573": { "vendor": "EasyIO Corporation Sdn. Bhd." }, @@ -54098,6 +54329,9 @@ "3724299": { "vendor": "Samsung Electronics Co.,Ltd" }, + "3724568": { + "vendor": "GooWi Wireless Technology Co., Limited" + }, "3724615": { "vendor": "ASUSTek COMPUTER INC." }, @@ -54318,7 +54552,7 @@ "vendor": "Kevcom Llc" }, "3808960": { - "vendor": "Aces" + "vendor": "Genesis" }, "3814721": { "vendor": "Raspberry Pi (Trading) Ltd" @@ -54392,6 +54626,9 @@ "3934065": { "vendor": "Sony Corporation" }, + "3934167": { + "vendor": "Apple, Inc." + }, "3934238": { "vendor": "Beijing Yupont Electric Power Technology Co.,Ltd" }, @@ -54623,6 +54860,9 @@ "3946374": { "vendor": "Netgear" }, + "3946532": { + "vendor": "Xiaomi Communications Co Ltd" + }, "3946632": { "vendor": "ConnectQuest, llc" }, @@ -54755,6 +54995,9 @@ "3954974": { "vendor": "TCL King Electrical Appliances (Huizhou) Co., Ltd" }, + "3955136": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "3955255": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -54794,6 +55037,9 @@ "3957488": { "vendor": "Sercomm Corporation." }, + "3957967": { + "vendor": "Tp-Link Corporation Pte. Ltd." + }, "3958550": { "vendor": "Lily Robotics" }, @@ -54854,6 +55100,9 @@ "3962186": { "vendor": "ARRIS Group, Inc." }, + "3962405": { + "vendor": "zte corporation" + }, "3962854": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, @@ -54938,6 +55187,9 @@ "3967398": { "vendor": "Kapelse" }, + "3967519": { + "vendor": "Espressif Inc." + }, "3967664": { "vendor": "Juniper Networks" }, @@ -55211,6 +55463,9 @@ "3982049": { "vendor": "Xinhua Control Engineering Co.,Ltd" }, + "3982813": { + "vendor": "Hui Zhou Gaoshengda Technology Co.,LTD" + }, "3983238": { "vendor": "Dongguan Huarong Communication Technologies Co.,Ltd." }, @@ -55295,6 +55550,9 @@ "3988668": { "vendor": "Samsung Electronics Co.,Ltd" }, + "3988823": { + "vendor": "Apple, Inc." + }, "3988873": { "vendor": "Somo Holdings & Tech. Co.,Ltd." }, @@ -55691,6 +55949,9 @@ "4212586": { "vendor": "Astro Gaming" }, + "4212846": { + "vendor": "Nokia Solutions and Networks GmbH & Co. KG" + }, "4213007": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, @@ -55763,6 +56024,9 @@ "4217499": { "vendor": "Anovo" }, + "4217727": { + "vendor": "Broadcom Limited" + }, "4217816": { "vendor": "Chongqing Fugui Electronics Co.,Ltd." }, @@ -55865,6 +56129,9 @@ "4223512": { "vendor": "Tonly Technology Co. Ltd" }, + "4223821": { + "vendor": "New H3C Technologies Co., Ltd" + }, "4224150": { "vendor": "aFUN TECHNOLOGY INC." }, @@ -55937,6 +56204,9 @@ "4228811": { "vendor": "D-Link Corporation" }, + "4229093": { + "vendor": "Wu Qi Technologies,Inc." + }, "4229125": { "vendor": "Motorola Mobility LLC, a Lenovo Company" }, @@ -56129,6 +56399,9 @@ "4239708": { "vendor": "Huawei Technologies Co.,Ltd" }, + "4239893": { + "vendor": "Extreme Networks Headquarters" + }, "4240072": { "vendor": "Nortel Networks" }, @@ -56309,6 +56582,9 @@ "4248822": { "vendor": "Honor Device Co., Ltd." }, + "4248865": { + "vendor": "LG Innotek" + }, "4248921": { "vendor": "Micro S.E.R.I." }, @@ -56525,6 +56801,9 @@ "4458970": { "vendor": "Apple, Inc." }, + "4459435": { + "vendor": "Positivo Tecnologia S.A." + }, "4459758": { "vendor": "Robert Bosch Elektronikai Kft." }, @@ -56705,6 +56984,9 @@ "4470536": { "vendor": "MRV Comunications" }, + "4470539": { + "vendor": "Guangzhou Shiyuan Electronic Technology Company Limited" + }, "4470553": { "vendor": "2 Save Energy Ltd" }, @@ -57023,6 +57305,9 @@ "4490498": { "vendor": "Shenzhen SuperElectron Technology Co.,Ltd." }, + "4490714": { + "vendor": "Shenzhen Skyworth Digital Technology CO., Ltd" + }, "4490945": { "vendor": "Siemens Low Voltage & Products" }, @@ -57041,6 +57326,9 @@ "4491286": { "vendor": "Cisco Systems, Inc" }, + "4491454": { + "vendor": "Texas Instruments" + }, "4491467": { "vendor": "Camco Technologies NV" }, @@ -57671,6 +57959,9 @@ "4728364": { "vendor": "Apple, Inc." }, + "4728396": { + "vendor": "BSH Electrical Appliances (Jiangsu) Co., Ltd." + }, "4728552": { "vendor": "Tek-Air Systems, Inc." }, @@ -57968,6 +58259,9 @@ "4743662": { "vendor": "Samsung Electronics Co.,Ltd" }, + "4743780": { + "vendor": "Arlo Technology" + }, "4743798": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -58412,6 +58706,9 @@ "4771283": { "vendor": "Huawei Technologies Co.,Ltd" }, + "4771753": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "4771863": { "vendor": "Telecom Infra Project" }, @@ -58442,6 +58739,9 @@ "4773196": { "vendor": "Jeda Networks" }, + "4773506": { + "vendor": "zte corporation" + }, "4773589": { "vendor": "Google, Inc." }, @@ -58682,6 +58982,9 @@ "4981059": { "vendor": "eero inc." }, + "4981239": { + "vendor": "Cisco Systems, Inc" + }, "4981280": { "vendor": "Xiaomi Communications Co Ltd" }, @@ -58844,6 +59147,9 @@ "4990695": { "vendor": "Welgate Co., Ltd." }, + "4991803": { + "vendor": "Huawei Device Co., Ltd." + }, "4992128": { "vendor": "Beijing Skyway Technologies Co.,Ltd" }, @@ -59030,6 +59336,9 @@ "5004604": { "vendor": "Cisco Systems, Inc" }, + "5004650": { + "vendor": "Apple, Inc." + }, "5004749": { "vendor": "Oy Finnish Electric Vehicle Technologies Ltd" }, @@ -59078,6 +59387,9 @@ "5006315": { "vendor": "Application Solutions (Electronics and Vision) Ltd" }, + "5006432": { + "vendor": "Itel Mobile Limited" + }, "5006553": { "vendor": "Guangdong Leawin Group Co., Ltd" }, @@ -59258,6 +59570,9 @@ "5017943": { "vendor": "Fujian LANDI Commercial Equipment Co.,Ltd" }, + "5018322": { + "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" + }, "5019156": { "vendor": "Juniper Networks" }, @@ -59306,6 +59621,9 @@ "5022049": { "vendor": "Rain Bird Corporation" }, + "5022607": { + "vendor": "shenzhen trolink Technology Co.,Ltd" + }, "5022631": { "vendor": "Tecno Mobile Limited" }, @@ -59459,6 +59777,9 @@ "5029898": { "vendor": "vivo Mobile Communication Co., Ltd." }, + "5030038": { + "vendor": "Shenzhen SuperElectron Technology Co.,Ltd." + }, "5030406": { "vendor": "Somfy" }, @@ -59723,6 +60044,9 @@ "5243537": { "vendor": "Espressif Inc." }, + "5243905": { + "vendor": "TelHi Corporation" + }, "5244088": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -59753,6 +60077,9 @@ "5245522": { "vendor": "Huiwan Technologies Co. Ltd" }, + "5245596": { + "vendor": "Extreme Networks Headquarters" + }, "5245734": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -59921,6 +60248,9 @@ "5255080": { "vendor": "Cisco Systems, Inc" }, + "5255099": { + "vendor": "Motorola Mobility LLC, a Lenovo Company" + }, "5255412": { "vendor": "Exascend, Inc." }, @@ -60068,6 +60398,9 @@ "5263068": { "vendor": "Ping Communication" }, + "5263163": { + "vendor": "Beijing Xiaomi Mobile Software Co., Ltd" + }, "5263252": { "vendor": "Loxone Electronics GmbH" }, @@ -60215,6 +60548,9 @@ "5269676": { "vendor": "Huawei Device Co., Ltd." }, + "5269850": { + "vendor": "AiFamous(shenzhen)Technology Co.,Ltd" + }, "5270019": { "vendor": "Netgear" }, @@ -60422,6 +60758,9 @@ "5282440": { "vendor": "Huawei Technologies Co.,Ltd" }, + "5282708": { + "vendor": "Shenzhen iComm Semiconductor CO.,LTD" + }, "5283495": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -60530,6 +60869,9 @@ "5290146": { "vendor": "ImTech Technologies LLC," }, + "5290498": { + "vendor": "Qingdao Intelligent&Precise Electronics Co.,Ltd." + }, "5291158": { "vendor": "Apple, Inc." }, @@ -60602,6 +60944,9 @@ "5295843": { "vendor": "Gigafirm.co.LTD" }, + "5295892": { + "vendor": "Quectel Wireless Solutions Co.,Ltd." + }, "5295958": { "vendor": "China Mobile Group Device Co.,Ltd." }, @@ -60866,6 +61211,9 @@ "5507155": { "vendor": "Qingdao Haier Technology Co.,Ltd" }, + "5507283": { + "vendor": "Tianyi Telecom Terminals Company Limited" + }, "5507344": { "vendor": "Apple, Inc." }, @@ -60890,6 +61238,9 @@ "5508696": { "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" }, + "5508908": { + "vendor": "Arista Networks" + }, "5508951": { "vendor": "Silicon Laboratories" }, @@ -61175,6 +61526,9 @@ "5524618": { "vendor": "Microsoft Corporation" }, + "5524948": { + "vendor": "China Mobile Group Device Co.,Ltd." + }, "5525061": { "vendor": "Private" }, @@ -61280,6 +61634,9 @@ "5532686": { "vendor": "Texas Instruments" }, + "5532844": { + "vendor": "Intelbras" + }, "5532907": { "vendor": "Intel Corporate" }, @@ -61469,6 +61826,12 @@ "5546064": { "vendor": "ASUSTek COMPUTER INC." }, + "5546244": { + "vendor": "OPTOWL Co.,Ltd" + }, + "5546565": { + "vendor": "Digisol Systems Limited" + }, "5546612": { "vendor": "Cisco Systems, Inc" }, @@ -61601,6 +61964,9 @@ "5556239": { "vendor": "Tp-Link Technologies Co.,Ltd." }, + "5556428": { + "vendor": "Shenzhen SDG Telecom Equipment Co.,Ltd." + }, "5556703": { "vendor": "Fn-Link Technology Limited" }, @@ -61823,6 +62189,9 @@ "5569368": { "vendor": "WISEWARE, Lda" }, + "5569370": { + "vendor": "Optomind Inc." + }, "5569776": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -61862,6 +62231,9 @@ "5768534": { "vendor": "Elettronica GF S.r.L." }, + "5768665": { + "vendor": "Seiko Epson Corporation" + }, "5769208": { "vendor": "Nokia Solutions and Networks GmbH & Co. KG" }, @@ -61871,6 +62243,9 @@ "5769539": { "vendor": "Private" }, + "5769607": { + "vendor": "Amazon Technologies Inc." + }, "5769701": { "vendor": "Kivic Inc." }, @@ -61964,6 +62339,9 @@ "5776757": { "vendor": "Huawei Technologies Co.,Ltd" }, + "5776762": { + "vendor": "Mobiwire Mobiles(Ningbo) Co.,Ltd" + }, "5777292": { "vendor": "Buffalo.Inc" }, @@ -62081,6 +62459,9 @@ "5786042": { "vendor": "Chitai Electronic Corp." }, + "5786556": { + "vendor": "zte corporation" + }, "5786649": { "vendor": "Chongqing Guohong Technology Development Company Limited" }, @@ -62129,6 +62510,9 @@ "5789901": { "vendor": "Extreme Networks Headquarters" }, + "5789988": { + "vendor": "Nanjing Simon Info Tech Co.,Ltd." + }, "5790146": { "vendor": "Extreme Networks Headquarters" }, @@ -62159,6 +62543,9 @@ "5793254": { "vendor": "infomark" }, + "5793389": { + "vendor": "Apple, Inc." + }, "5793466": { "vendor": "Hangzhou H3C Technologies Co., Limited" }, @@ -62465,6 +62852,9 @@ "5812495": { "vendor": "Samsung Electronics Co.,Ltd" }, + "5812623": { + "vendor": "Huawei Device Co., Ltd." + }, "5813135": { "vendor": "New H3C Technologies Co., Ltd" }, @@ -62693,6 +63083,9 @@ "5827821": { "vendor": "Integrated Device Technology (Malaysia) Sdn. Bhd." }, + "5827993": { + "vendor": "zte corporation" + }, "5828302": { "vendor": "Icon Time Systems" }, @@ -62777,6 +63170,9 @@ "5904639": { "vendor": "FiRa Consortium" }, + "5920173": { + "vendor": "Disruptive Cities SAPI DE CV" + }, "5925812": { "vendor": "Xconn Technologies" }, @@ -62795,6 +63191,9 @@ "6029368": { "vendor": "Viasat Group S.p.A." }, + "6029627": { + "vendor": "Espressif Inc." + }, "6029844": { "vendor": "Beijing Xiaomi Mobile Software Co., Ltd" }, @@ -62861,6 +63260,9 @@ "6034487": { "vendor": "Thyssenkrupp Aufzugswerke GmbH" }, + "6034667": { + "vendor": "Trident IoT" + }, "6034709": { "vendor": "Advan" }, @@ -62900,6 +63302,9 @@ "6035677": { "vendor": "Cig Shanghai Co Ltd" }, + "6035747": { + "vendor": "Hangzhou Lanly Technology Co., Ltd." + }, "6036079": { "vendor": "Cambridge Industries(Group) Co.,Ltd." }, @@ -62966,6 +63371,9 @@ "6040565": { "vendor": "Vivint Wireless Inc." }, + "6040840": { + "vendor": "Subeca" + }, "6041177": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -63041,6 +63449,9 @@ "6045784": { "vendor": "Jefferson Audio Video Systems, Inc." }, + "6045923": { + "vendor": "Novaon" + }, "6046042": { "vendor": "Amazon.com, LLC" }, @@ -63815,6 +64226,9 @@ "6092508": { "vendor": "Samsung Electronics Co.,Ltd" }, + "6092694": { + "vendor": "New H3C Technologies Co., Ltd" + }, "6092739": { "vendor": "Syntech (Hk) Technology Limited" }, @@ -64070,6 +64484,9 @@ "6302552": { "vendor": "EM Microelectronic" }, + "6303092": { + "vendor": "Extreme Networks Headquarters" + }, "6303264": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -64238,6 +64655,9 @@ "6313649": { "vendor": "Huawei Technologies Co.,Ltd" }, + "6313710": { + "vendor": "AltoBeam Inc." + }, "6313752": { "vendor": "Intel Corporate" }, @@ -64604,6 +65024,12 @@ "6336365": { "vendor": "Samsung Electronics Co.,Ltd" }, + "6336555": { + "vendor": "Qingdao Haier Technology Co.,Ltd" + }, + "6336744": { + "vendor": "Huawei Device Co., Ltd." + }, "6336901": { "vendor": "ATH system" }, @@ -64704,7 +65130,7 @@ "vendor": "Juniper Networks" }, "6342552": { - "vendor": "Verifone" + "vendor": "Verifone, Inc." }, "6342590": { "vendor": "Realme Chongqing Mobile Telecommunications Corp.,Ltd." @@ -65546,6 +65972,9 @@ "6587653": { "vendor": "zte corporation" }, + "6587940": { + "vendor": "Beijing Global Safety Technology Co., LTD." + }, "6588296": { "vendor": "Juniper Networks" }, @@ -66440,6 +66869,9 @@ "6839915": { "vendor": "PowerRay Co., Ltd." }, + "6840970": { + "vendor": "vivo Mobile Communication Co., Ltd." + }, "6841168": { "vendor": "Hella India Automotive Pvt Ltd" }, @@ -66521,6 +66953,9 @@ "6846756": { "vendor": "ELS-GmbH & Co. KG" }, + "6846916": { + "vendor": "Shanghai MXCHIP Information Technology Co., Ltd." + }, "6846941": { "vendor": "Omnipless Manufacturing (PTY) Ltd" }, @@ -66536,6 +66971,9 @@ "6847701": { "vendor": "Y Soft Corporation, a.s." }, + "6847744": { + "vendor": "Shenzhen YOUHUA Technology Co., Ltd" + }, "6847851": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -66956,6 +67394,9 @@ "6874232": { "vendor": "Qingdao Haier Technology Co.,Ltd" }, + "6874496": { + "vendor": "Apple, Inc." + }, "6874526": { "vendor": "Cisco Systems, Inc" }, @@ -67004,6 +67445,9 @@ "6876995": { "vendor": "Apple, Inc." }, + "6877099": { + "vendor": "Vention" + }, "6877117": { "vendor": "Cisco Systems, Inc" }, @@ -67142,6 +67586,9 @@ "7080406": { "vendor": "Digiquest Electronics LTD" }, + "7080798": { + "vendor": "HP Inc." + }, "7080836": { "vendor": "Universal Global Scientific Industrial Co., Ltd." }, @@ -67457,6 +67904,9 @@ "7098102": { "vendor": "Cisco Systems, Inc" }, + "7098249": { + "vendor": "Zyxel Communications Corporation" + }, "7098445": { "vendor": "Cisco Systems, Inc" }, @@ -67655,6 +68105,9 @@ "7111526": { "vendor": "Nanjing SAC Power Grid Automation Co., Ltd." }, + "7111541": { + "vendor": "Broadcom Limited" + }, "7112326": { "vendor": "Technonia" }, @@ -68009,6 +68462,9 @@ "7132959": { "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" }, + "7133088": { + "vendor": "WIKO Terminal Technology (Dongguan) Co., Ltd." + }, "7133289": { "vendor": "Guangzhou Sat Infrared Co.,LTD" }, @@ -68675,6 +69131,9 @@ "7368172": { "vendor": "Wifi-soft LLC" }, + "7368208": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "7368301": { "vendor": "Cisco Systems, Inc" }, @@ -68780,6 +69239,9 @@ "7372510": { "vendor": "Nastec Ltd." }, + "7372786": { + "vendor": "Telechips, Inc." + }, "7373061": { "vendor": "Cisco Systems, Inc" }, @@ -69050,6 +69512,9 @@ "7388232": { "vendor": "Cisco Systems, Inc" }, + "7388566": { + "vendor": "Cisco Systems, Inc" + }, "7388626": { "vendor": "Adva Network Security GmbH" }, @@ -69152,6 +69617,9 @@ "7395633": { "vendor": "Cambridge Industries(Group) Co.,Ltd." }, + "7395715": { + "vendor": "Shanghai JINXVM Microelectronics Co.,Ltd." + }, "7395863": { "vendor": "Austrian Audio GmbH" }, @@ -69329,6 +69797,9 @@ "7603441": { "vendor": "Intel Corporate" }, + "7603485": { + "vendor": "Jiangxi Risound Electronics Co.,LTD" + }, "7603580": { "vendor": "Qorvo International Pte. Ltd." }, @@ -69419,6 +69890,9 @@ "7610463": { "vendor": "Shenzhen Zhongruixin Intelligent Technology Co., Ltd." }, + "7610893": { + "vendor": "Chengdu Xuguang Technology Co,Ltd" + }, "7611067": { "vendor": "Huawei Device Co., Ltd." }, @@ -69755,6 +70229,9 @@ "7629455": { "vendor": "VS Vision Systems GmbH" }, + "7629491": { + "vendor": "MICIUS Laboratory" + }, "7629698": { "vendor": "Movek" }, @@ -69830,6 +70307,9 @@ "7632935": { "vendor": "Dell Inc." }, + "7632967": { + "vendor": "Interdisciplinary Consulting Corporation" + }, "7633062": { "vendor": "Fortinet, Inc." }, @@ -69884,6 +70364,9 @@ "7636585": { "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" }, + "7636591": { + "vendor": "zte corporation" + }, "7636602": { "vendor": "Dell Inc." }, @@ -69905,6 +70388,9 @@ "7637131": { "vendor": "ADB Broadband Italia" }, + "7637160": { + "vendor": "Bouffalo Lab (Nanjing) Co., Ltd." + }, "7637179": { "vendor": "Cisco Systems, Inc" }, @@ -70124,6 +70610,9 @@ "7649337": { "vendor": "Texas Instruments" }, + "7649448": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "7649566": { "vendor": "Nanjing Bestway Automation System Co., Ltd" }, @@ -70304,6 +70793,9 @@ "7659630": { "vendor": "Ergophone GmbH" }, + "7659847": { + "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" + }, "7659906": { "vendor": "Texas Instruments" }, @@ -70601,6 +71093,9 @@ "7872475": { "vendor": "Samsung Electronics Co.,Ltd" }, + "7872558": { + "vendor": "Skychers Creations ShenZhen Limited" + }, "7872633": { "vendor": "ID Tech" }, @@ -70757,6 +71252,9 @@ "7880932": { "vendor": "Samsung Electronics Co.,Ltd" }, + "7881244": { + "vendor": "Espressif Inc." + }, "7881733": { "vendor": "FUJITU(HONG KONG) ELECTRONIC Co.,LTD." }, @@ -70985,6 +71483,9 @@ "7892100": { "vendor": "Amazon Technologies Inc." }, + "7892139": { + "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" + }, "7892372": { "vendor": "Palo Alto Networks" }, @@ -71045,6 +71546,9 @@ "7897550": { "vendor": "China Mobile Iot Limited company" }, + "7897969": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "7898172": { "vendor": "Sony Corporation" }, @@ -71156,6 +71660,9 @@ "7903590": { "vendor": "Musilab Electronics (DongGuan)Co.,Ltd." }, + "7903623": { + "vendor": "Xiaomi Communications Co Ltd" + }, "7903631": { "vendor": "Mediline Italia Srl" }, @@ -71930,6 +72437,9 @@ "8141189": { "vendor": "Huawei Technologies Co.,Ltd" }, + "8141613": { + "vendor": "Apple, Inc." + }, "8141781": { "vendor": "Imago Group" }, @@ -72014,6 +72524,9 @@ "8147162": { "vendor": "E.J Ward" }, + "8147332": { + "vendor": "Unis Flash Memory Technology(Chengdu)Co.,Ltd." + }, "8147337": { "vendor": "SG Wireless Limited" }, @@ -72056,6 +72569,9 @@ "8151191": { "vendor": "Huawei Technologies Co.,Ltd" }, + "8151259": { + "vendor": "zte corporation" + }, "8151344": { "vendor": "Apple, Inc." }, @@ -72653,6 +73169,9 @@ "8185124": { "vendor": "Quirky, Inc." }, + "8185151": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "8185195": { "vendor": "ESEN Optoelectronics Technology Co.,Ltd." }, @@ -72755,6 +73274,9 @@ "8190592": { "vendor": "JiangSu Fulian Communication Technology Co., Ltd" }, + "8190678": { + "vendor": "Realme Chongqing Mobile Telecommunications Corp.,Ltd." + }, "8190687": { "vendor": "Apple, Inc." }, @@ -73412,6 +73934,9 @@ "8426143": { "vendor": "Apple, Inc." }, + "8426149": { + "vendor": "Valeo Interior Controls (Shenzhen) Co.,Ltd" + }, "8426387": { "vendor": "Xapt GmbH" }, @@ -73872,11 +74397,14 @@ "vendor": "Espressif Inc." }, "8654634": { - "vendor": "Jiangxi Risound Electronics Co., LTD" + "vendor": "Jiangxi Risound Electronics Co.,LTD" }, "8654661": { "vendor": "Shanghai GMT Digital Technologies Co., Ltd" }, + "8654668": { + "vendor": "Apple, Inc." + }, "8654861": { "vendor": "Motorola Mobility LLC, a Lenovo Company" }, @@ -73919,6 +74447,9 @@ "8657032": { "vendor": "Juniper Networks" }, + "8657444": { + "vendor": "Unionman Technology Co.,Ltd" + }, "8657720": { "vendor": "Shenzhen Excelsecu Data Technology Co.,Ltd" }, @@ -74069,6 +74600,9 @@ "8665487": { "vendor": "Fortinet, Inc." }, + "8665596": { + "vendor": "Nokia" + }, "8665675": { "vendor": "Intel Corporate" }, @@ -74669,6 +75203,9 @@ "8702853": { "vendor": "EM Microelectronic" }, + "8702993": { + "vendor": "LG Electornics" + }, "8703075": { "vendor": "Huawei Device Co., Ltd." }, @@ -74813,12 +75350,18 @@ "8710974": { "vendor": "Vivint Smart Home" }, + "8710975": { + "vendor": "Vivint Inc" + }, "8711151": { "vendor": "Cisco Systems, Inc" }, "8711475": { "vendor": "BBMC Co.,Ltd" }, + "8711807": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "8711908": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -74972,6 +75515,9 @@ "8918340": { "vendor": "Cisco Meraki" }, + "8918374": { + "vendor": "Huawei Device Co., Ltd." + }, "8918469": { "vendor": "Huawei Device Co., Ltd." }, @@ -75299,6 +75845,9 @@ "8939173": { "vendor": "Apple, Inc." }, + "8939334": { + "vendor": "eero inc." + }, "8939484": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -75383,6 +75932,9 @@ "8943000": { "vendor": "Samsung Electronics Co.,Ltd" }, + "8943289": { + "vendor": "D-Link Corporation" + }, "8943731": { "vendor": "Intel Corporate" }, @@ -75482,6 +76034,9 @@ "8950237": { "vendor": "Racktivity" }, + "8950476": { + "vendor": "Tonly Technology Co. Ltd" + }, "8950897": { "vendor": "Brocade Communications Systems LLC" }, @@ -75692,6 +76247,9 @@ "8961400": { "vendor": "Flaircomm Microelectronics,Inc." }, + "8961845": { + "vendor": "Verifone, Inc." + }, "8962005": { "vendor": "Simple Audio Ltd" }, @@ -76067,6 +76625,9 @@ "9179842": { "vendor": "GLBB Japan" }, + "9180130": { + "vendor": "Netlink Ict" + }, "9180340": { "vendor": "zte corporation" }, @@ -76142,6 +76703,9 @@ "9185591": { "vendor": "Apple, Inc." }, + "9185925": { + "vendor": "Amazon Technologies Inc." + }, "9185934": { "vendor": "DongGuan Ramaxel Memory Technology" }, @@ -76565,6 +77129,9 @@ "9209386": { "vendor": "Huawei Technologies Co.,Ltd" }, + "9209638": { + "vendor": "VAST Data Inc" + }, "9209659": { "vendor": "Leica Camera AG" }, @@ -76616,6 +77183,9 @@ "9211881": { "vendor": "Apple, Inc." }, + "9211949": { + "vendor": "TP-Link Systems Inc." + }, "9212115": { "vendor": "Nokia" }, @@ -77408,6 +77978,9 @@ "9459207": { "vendor": "Sichuan AI-Link Technology Co., Ltd." }, + "9459313": { + "vendor": "Cisco Systems, Inc" + }, "9459330": { "vendor": "Lenbrook Industries Limited" }, @@ -77528,6 +78101,9 @@ "9465957": { "vendor": "Texas Instruments" }, + "9466047": { + "vendor": "Mimosa Networks" + }, "9466067": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, @@ -77615,6 +78191,9 @@ "9470560": { "vendor": "IEEE 1904.1 Working Group" }, + "9470659": { + "vendor": "Quanta Computer Inc." + }, "9470795": { "vendor": "Beijing Yunyi Times Technology Co,.Ltd" }, @@ -77738,6 +78317,9 @@ "9477501": { "vendor": "ARRIS Group, Inc." }, + "9477548": { + "vendor": "Infinix mobility limited" + }, "9477600": { "vendor": "Newland Design + Assoc. Inc." }, @@ -77759,6 +78341,9 @@ "9478455": { "vendor": "Beijing Splendidtel Communication Technology Co,. Ltd" }, + "9478550": { + "vendor": "Private" + }, "9478586": { "vendor": "PNetworks Electronics Information" }, @@ -78023,6 +78608,9 @@ "9495656": { "vendor": "Guangzhou Shiyuan Electronic Technology Company Limited" }, + "9495728": { + "vendor": "SHARP Corporation" + }, "9496250": { "vendor": "ASUSTek COMPUTER INC." }, @@ -78584,6 +79172,9 @@ "9726640": { "vendor": "Arcadyan Corporation" }, + "9726980": { + "vendor": "EM Microelectronic" + }, "9727406": { "vendor": "Mellanox Technologies, Inc." }, @@ -78716,6 +79307,9 @@ "9736914": { "vendor": "KCF Technologies, Inc." }, + "9737094": { + "vendor": "Shenzhen SiACRRIER Industry Machines Co.,LTD" + }, "9737254": { "vendor": "Apple, Inc." }, @@ -78800,6 +79394,9 @@ "9742040": { "vendor": "New H3C Technologies Co., Ltd" }, + "9742152": { + "vendor": "New H3C Technologies Co., Ltd" + }, "9742263": { "vendor": "zte corporation" }, @@ -79169,6 +79766,9 @@ "9759693": { "vendor": "BlackBerry RTS" }, + "9759763": { + "vendor": "Hangzhou Ezviz Software Co.,Ltd." + }, "9759794": { "vendor": "Silicon Laboratories" }, @@ -79214,6 +79814,9 @@ "9762546": { "vendor": "Honor Device Co., Ltd." }, + "9762583": { + "vendor": "Cig Shanghai Co Ltd" + }, "9762592": { "vendor": "Tianjin Deviser Electronics Instrument Co., Ltd" }, @@ -79361,6 +79964,9 @@ "9967340": { "vendor": "IC Intracom" }, + "9967420": { + "vendor": "Private" + }, "9967601": { "vendor": "zte corporation" }, @@ -79379,6 +79985,9 @@ "9968706": { "vendor": "Laiier" }, + "9968802": { + "vendor": "Apple, Inc." + }, "9969068": { "vendor": "Cyviz AS" }, @@ -79598,6 +80207,9 @@ "9981139": { "vendor": "Mantis Deposition" }, + "9981578": { + "vendor": "Samsung Electronics Co.,Ltd" + }, "9981591": { "vendor": "Starlight Marketing (H. K.) Ltd." }, @@ -79676,6 +80288,9 @@ "9986250": { "vendor": "Apple, Inc." }, + "9986711": { + "vendor": "Shenzhen Techwinsemi Technology Co., Ltd." + }, "9987600": { "vendor": "zte corporation" }, @@ -79850,6 +80465,9 @@ "10000337": { "vendor": "MitraStar Technology Corp." }, + "10000635": { + "vendor": "Google, Inc." + }, "10001081": { "vendor": "zte corporation" }, @@ -80012,6 +80630,9 @@ "10013052": { "vendor": "Shenzhen iComm Semiconductor CO.,LTD" }, + "10013118": { + "vendor": "Shenzhen SDMC Technology CO., LTD" + }, "10013216": { "vendor": "Shanghai SIMCOM Ltd." }, @@ -80117,6 +80738,9 @@ "10019173": { "vendor": "Accutome" }, + "10019413": { + "vendor": "Nintendo Co.,Ltd" + }, "10019958": { "vendor": "Zentan" }, @@ -80294,6 +80918,9 @@ "10224280": { "vendor": "Samsung Electronics Co.,Ltd" }, + "10224465": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "10224542": { "vendor": "Beijing Winchannel Software Technology Co., Ltd" }, @@ -80552,6 +81179,9 @@ "10241520": { "vendor": "Skylark Electronics Pvt Ltd" }, + "10242036": { + "vendor": "Nokia" + }, "10242041": { "vendor": "LJU Automatisierungstechnik GmbH" }, @@ -80696,6 +81326,9 @@ "10248481": { "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" }, + "10248663": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "10248875": { "vendor": "Sumavision Technologies Co.,Ltd" }, @@ -80936,6 +81569,9 @@ "10262409": { "vendor": "1More" }, + "10262419": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "10262545": { "vendor": "Guangzhou Sunrise Electronics Development Co., Ltd" }, @@ -81017,6 +81653,9 @@ "10266328": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, + "10267077": { + "vendor": "Apple, Inc." + }, "10267108": { "vendor": "zte corporation" }, @@ -81090,7 +81729,7 @@ "vendor": "Biosoundlab Co., Ltd." }, "10272525": { - "vendor": "Framework Computer LLC" + "vendor": "Framework Computer Inc." }, "10272717": { "vendor": "Huawei Technologies Co.,Ltd" @@ -81212,6 +81851,9 @@ "10280525": { "vendor": "ML vision Co.,LTD" }, + "10280688": { + "vendor": "Jiangxi Risound Electronics Co.,LTD" + }, "10280707": { "vendor": "Harman/Becker Automotive Systems GmbH" }, @@ -81551,6 +82193,9 @@ "10498713": { "vendor": "Lenovo (Beijing) Co., Ltd." }, + "10498895": { + "vendor": "Cisco Systems, Inc" + }, "10499099": { "vendor": "Adero Inc" }, @@ -81929,6 +82574,9 @@ "10520770": { "vendor": "Mellanox Technologies, Inc." }, + "10520934": { + "vendor": "Cig Shanghai Co Ltd" + }, "10521060": { "vendor": "Skyworth Digital Technology(Shenzhen) Co.,Ltd" }, @@ -82064,6 +82712,9 @@ "10527728": { "vendor": "D-Link International" }, + "10527871": { + "vendor": "Cisco Systems, Inc" + }, "10527941": { "vendor": "Intel Corporate" }, @@ -82088,6 +82739,9 @@ "10529897": { "vendor": "Samsung Electronics Co.,Ltd" }, + "10529912": { + "vendor": "Shenzhen iComm Semiconductor CO.,LTD" + }, "10530146": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -82244,6 +82898,9 @@ "10539969": { "vendor": "Hewlett Packard" }, + "10540077": { + "vendor": "G.Tech Technology Ltd." + }, "10540597": { "vendor": "WBS Technology" }, @@ -82268,6 +82925,9 @@ "10541167": { "vendor": "Argo Ai, Llc" }, + "10541338": { + "vendor": "Texas Instruments" + }, "10541714": { "vendor": "Nanjing Glarun Atten Technology Co. Ltd." }, @@ -82400,6 +83060,9 @@ "10549960": { "vendor": "Huawei Technologies Co.,Ltd" }, + "10550120": { + "vendor": "Miba Battery Systems GmbH" + }, "10550147": { "vendor": "Honor Device Co., Ltd." }, @@ -82463,6 +83126,9 @@ "10750197": { "vendor": "Sagemcom Broadband SAS" }, + "10750387": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "10750411": { "vendor": "Alfred Kaercher GmbH & Co KG" }, @@ -82712,6 +83378,9 @@ "10764859": { "vendor": "Intel Corporate" }, + "10765184": { + "vendor": "Huawei Device Co., Ltd." + }, "10765196": { "vendor": "ARRIS Group, Inc." }, @@ -82799,6 +83468,9 @@ "10770124": { "vendor": "Vantiva USA LLC" }, + "10770336": { + "vendor": "SAMJIN Co., Ltd." + }, "10770434": { "vendor": "Shin-Il Tech" }, @@ -82833,7 +83505,7 @@ "vendor": "DreamBig Semiconductor, Inc." }, "10772497": { - "vendor": "Verifone" + "vendor": "Verifone, Inc." }, "10772530": { "vendor": "MRV Communications (Networks) LTD" @@ -82868,6 +83540,9 @@ "10775793": { "vendor": "Samsung Electronics Co.,Ltd" }, + "10775859": { + "vendor": "Phyplus Technology (Shanghai) Co., Ltd" + }, "10775972": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -83111,6 +83786,9 @@ "10790184": { "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" }, + "10790276": { + "vendor": "Cisco Systems, Inc" + }, "10790569": { "vendor": "Private" }, @@ -83141,6 +83819,9 @@ "10792602": { "vendor": "Maestro Wireless Solutions ltd." }, + "10793205": { + "vendor": "Texas Instruments" + }, "10793249": { "vendor": "Arantia 2010 S.L." }, @@ -83525,6 +84206,9 @@ "11011584": { "vendor": "Samsung Electronics Co.,Ltd" }, + "11012529": { + "vendor": "Huawei Device Co., Ltd." + }, "11013115": { "vendor": "Ruckus Wireless" }, @@ -83777,6 +84461,9 @@ "11030449": { "vendor": "Cisco Systems, Inc" }, + "11030536": { + "vendor": "Felion Technologies Company Limited" + }, "11030657": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -84377,6 +85064,9 @@ "11067911": { "vendor": "GOIP Global Services Pvt. Ltd." }, + "11068049": { + "vendor": "AzureWave Technology Inc." + }, "11068097": { "vendor": "Texas Instruments" }, @@ -84485,6 +85175,9 @@ "11075229": { "vendor": "Apple, Inc." }, + "11075278": { + "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" + }, "11075514": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -84554,6 +85247,9 @@ "11273345": { "vendor": "Jiangsu Huaxing Electronics Co., Ltd." }, + "11273386": { + "vendor": "GoPro" + }, "11273747": { "vendor": "Senselogix Ltd" }, @@ -84623,6 +85319,9 @@ "11278164": { "vendor": "tiko Energy Solutions AG" }, + "11278228": { + "vendor": "Shenzhen Chuangwei-Rgb Electronics Co.,Ltd" + }, "11278280": { "vendor": "Cisco Meraki" }, @@ -84818,6 +85517,9 @@ "11289856": { "vendor": "Apple, Inc." }, + "11290058": { + "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" + }, "11290395": { "vendor": "Huawei Device Co., Ltd." }, @@ -84998,6 +85700,9 @@ "11298738": { "vendor": "Espressif Inc." }, + "11299279": { + "vendor": "Cisco Meraki" + }, "11299491": { "vendor": "Shenzhen Kertong Technology Co.,Ltd" }, @@ -85253,6 +85958,9 @@ "11312663": { "vendor": "ASUSTek COMPUTER INC." }, + "11313091": { + "vendor": "Ring LLC" + }, "11313174": { "vendor": "Cisco Systems, Inc" }, @@ -85325,6 +86033,9 @@ "11318197": { "vendor": "Huawei Technologies Co.,Ltd" }, + "11318400": { + "vendor": "Dell Inc." + }, "11318630": { "vendor": "Renesas Electronics (Penang) Sdn. Bhd." }, @@ -86126,6 +86837,9 @@ "11565460": { "vendor": "Motorola Mobility LLC, a Lenovo Company" }, + "11565791": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "11565861": { "vendor": "Dell Inc." }, @@ -86792,6 +87506,9 @@ "11801982": { "vendor": "Celona Inc." }, + "11802232": { + "vendor": "Juniper Networks" + }, "11802445": { "vendor": "Project Monitor Inc" }, @@ -86849,6 +87566,9 @@ "11805488": { "vendor": "Itron Inc" }, + "11805602": { + "vendor": "Google, Inc." + }, "11805927": { "vendor": "Codetek Technology Co.,Ltd" }, @@ -86963,6 +87683,9 @@ "11813084": { "vendor": "Samsung Electronics Co.,Ltd" }, + "11813168": { + "vendor": "Jabil Circuit (Guangzhou) Ltd." + }, "11813242": { "vendor": "Shenzhen Gongjin Electronics Co.,Lt" }, @@ -87116,6 +87839,9 @@ "11824648": { "vendor": "Huawei Technologies Co.,Ltd" }, + "11824656": { + "vendor": "vivo Mobile Communication Co., Ltd." + }, "11824941": { "vendor": "Wahoo Fitness" }, @@ -87200,6 +87926,9 @@ "11830753": { "vendor": "Apple, Inc." }, + "11830808": { + "vendor": "GX India Pvt Ltd" + }, "11830869": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -87230,6 +87959,9 @@ "11835025": { "vendor": "Intel Corporate" }, + "11835045": { + "vendor": "Apple, Inc." + }, "11835458": { "vendor": "zte corporation" }, @@ -87563,6 +88295,9 @@ "11853853": { "vendor": "Conception Electronique" }, + "11853861": { + "vendor": "ITLook" + }, "11854029": { "vendor": "Fusion-io, Inc" }, @@ -87602,6 +88337,9 @@ "11855746": { "vendor": "Vivalnk" }, + "11855795": { + "vendor": "Edifier International" + }, "11855938": { "vendor": "Hong Kong Bouffalo Lab Limited" }, @@ -87800,6 +88538,9 @@ "12066218": { "vendor": "LG Electronics (Mobile Communications)" }, + "12066462": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "12066468": { "vendor": "Liteon Technology Corporation" }, @@ -87815,6 +88556,9 @@ "12067100": { "vendor": "Apple, Inc." }, + "12067340": { + "vendor": "Apple, Inc." + }, "12067407": { "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" }, @@ -87848,6 +88592,9 @@ "12069003": { "vendor": "Parker Hannifin Manufacturing (UK) Ltd" }, + "12069123": { + "vendor": "Vietnam Post And Telecommunication Industry Technology Join Stock Company" + }, "12069367": { "vendor": "Blaster Tech" }, @@ -87926,6 +88673,9 @@ "12073932": { "vendor": "Xiaomi Communications Co Ltd" }, + "12074016": { + "vendor": "Huawei Device Co., Ltd." + }, "12074024": { "vendor": "Apple, Inc." }, @@ -88238,6 +88988,9 @@ "12095106": { "vendor": "Huawei Device Co., Ltd." }, + "12095152": { + "vendor": "Shenzhen Skyworth Digital Technology CO., Ltd" + }, "12095174": { "vendor": "Stateless Networks" }, @@ -88334,12 +89087,18 @@ "12099532": { "vendor": "Huawei Technologies Co.,Ltd" }, + "12099768": { + "vendor": "Samsung Electronics Co.,Ltd" + }, "12099914": { "vendor": "Raisecom Technology CO., LTD" }, "12099957": { "vendor": "Roku, Inc." }, + "12100024": { + "vendor": "Arista Networks" + }, "12100189": { "vendor": "Motorola Mobility LLC, a Lenovo Company" }, @@ -88826,6 +89585,9 @@ "12323099": { "vendor": "Intel Corporate" }, + "12323164": { + "vendor": "FiSens GmbH" + }, "12323171": { "vendor": "Apple, Inc." }, @@ -88973,6 +89735,9 @@ "12331384": { "vendor": "Prama Hikvision India Private Limited" }, + "12331778": { + "vendor": "China Dragon Technology Limited" + }, "12331883": { "vendor": "Beijing Haier IC Design Co.,Ltd" }, @@ -89012,6 +89777,9 @@ "12333273": { "vendor": "Arcadyan Corporation" }, + "12333538": { + "vendor": "New H3C Technologies Co., Ltd" + }, "12333663": { "vendor": "Zhejiang Dahua Technology Co., Ltd." }, @@ -89495,6 +90263,9 @@ "12361856": { "vendor": "Samsung Electronics Co.,Ltd" }, + "12361913": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "12362042": { "vendor": "VusionGroup" }, @@ -89567,6 +90338,9 @@ "12366600": { "vendor": "Hongkong Ragentek Communication Technology Co.,Limited" }, + "12367101": { + "vendor": "NXP Semiconductor (Tianjin) LTD." + }, "12367611": { "vendor": "P4Q Electronics, S.L." }, @@ -89828,6 +90602,9 @@ "12385003": { "vendor": "Cisco Systems, Inc" }, + "12385511": { + "vendor": "ASUSTek COMPUTER INC." + }, "12385548": { "vendor": "Shenzhen Phaten Tech. LTD" }, @@ -89843,6 +90620,9 @@ "12386125": { "vendor": "Espressif Inc." }, + "12386132": { + "vendor": "zte corporation" + }, "12386220": { "vendor": "Topcon Corporation" }, @@ -89915,6 +90695,9 @@ "12589189": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, + "12589380": { + "vendor": "Juniper Networks" + }, "12589786": { "vendor": "Apple, Inc." }, @@ -90140,6 +90923,9 @@ "12601865": { "vendor": "Zhejiang Everbright Communication Equip. Co,. Ltd" }, + "12601870": { + "vendor": "Texas Instruments" + }, "12602131": { "vendor": "WonderSound Technology Co., Ltd" }, @@ -90479,6 +91265,9 @@ "12624798": { "vendor": "EarthCam, Inc." }, + "12624839": { + "vendor": "Telink Micro LLC" + }, "12625014": { "vendor": "Ruijie Networks Co.,LTD" }, @@ -90674,6 +91463,9 @@ "12637826": { "vendor": "Arista Networks" }, + "12637909": { + "vendor": "Microsoft Corporation" + }, "12638122": { "vendor": "Arcadyan Corporation" }, @@ -91226,6 +92018,9 @@ "12867359": { "vendor": "June Life Inc" }, + "12867398": { + "vendor": "Texas Instruments" + }, "12867438": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -91289,6 +92084,9 @@ "12870484": { "vendor": "U-Raku, Inc." }, + "12870596": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "12870651": { "vendor": "Neatframe AS" }, @@ -91421,6 +92219,9 @@ "12877215": { "vendor": "Samsung Electronics Co.,Ltd" }, + "12877224": { + "vendor": "NXP Semiconductor (Tianjin) LTD." + }, "12877260": { "vendor": "Zebra Technologies Inc" }, @@ -91472,6 +92273,9 @@ "12880474": { "vendor": "Jfcontrol" }, + "12880742": { + "vendor": "Hui Zhou Gaoshengda Technology Co.,LTD" + }, "12880803": { "vendor": "Cisco Meraki" }, @@ -91583,6 +92387,9 @@ "12888093": { "vendor": "D-Link International" }, + "12888504": { + "vendor": "Xiamenshi C-Chip Technology Co.,Ltd" + }, "12888729": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -91775,6 +92582,9 @@ "12900552": { "vendor": "Silicon Laboratories" }, + "12900564": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "12900565": { "vendor": "Espressif Inc." }, @@ -91895,6 +92705,9 @@ "12906458": { "vendor": "Honeywell" }, + "12906549": { + "vendor": "Hughes Network Systems, LLC" + }, "12906625": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -91922,6 +92735,9 @@ "12907941": { "vendor": "Kumalift Co., Ltd." }, + "12908481": { + "vendor": "Apple, Inc." + }, "12908501": { "vendor": "Cisco Systems, Inc" }, @@ -92090,6 +92906,9 @@ "13115326": { "vendor": "Huawei Technologies Co.,Ltd" }, + "13115368": { + "vendor": "Apple, Inc." + }, "13115370": { "vendor": "Avaya Inc" }, @@ -92408,6 +93227,9 @@ "13137243": { "vendor": "Quantify Technology Pty. Ltd." }, + "13137373": { + "vendor": "LG Electronics NV" + }, "13137396": { "vendor": "China Mobile Group Device Co.,Ltd." }, @@ -92900,6 +93722,9 @@ "13165615": { "vendor": "Technical Research Design and Development" }, + "13166048": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "13166080": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -93197,12 +94022,18 @@ "13378072": { "vendor": "InnoDigital Co., Ltd." }, + "13378271": { + "vendor": "EM Microelectronic" + }, "13378606": { "vendor": "Shenzhen SuperElectron Technology Co.,Ltd." }, "13379055": { "vendor": "Apple, Inc." }, + "13379092": { + "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" + }, "13379117": { "vendor": "Verifi, LLC" }, @@ -93437,6 +94268,9 @@ "13390937": { "vendor": "OnTime Networks AS" }, + "13391102": { + "vendor": "Mimosa Networks" + }, "13391277": { "vendor": "Rim" }, @@ -93767,6 +94601,9 @@ "13410603": { "vendor": "TCL King Electrical Appliances (Huizhou) Co., Ltd" }, + "13410640": { + "vendor": "SystemX Co.,Ltd." + }, "13410676": { "vendor": "Meta Platforms Technologies, LLC" }, @@ -93866,6 +94703,9 @@ "13417071": { "vendor": "Huawei Technologies Co.,Ltd" }, + "13417111": { + "vendor": "Espressif Inc." + }, "13417470": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -93887,6 +94727,9 @@ "13418097": { "vendor": "OptiLogix BV" }, + "13418252": { + "vendor": "Shenzhen Fenda Technology Co., Ltd" + }, "13418617": { "vendor": "Murata Manufacturing Co., Ltd." }, @@ -93992,6 +94835,9 @@ "13424833": { "vendor": "Cisco Systems, Inc" }, + "13424928": { + "vendor": "Huizhou Desay SV Automotive Co., Ltd." + }, "13425068": { "vendor": "Intel Corporate" }, @@ -94289,6 +95135,9 @@ "13639197": { "vendor": "SaiNXT Technologies LLP" }, + "13639901": { + "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" + }, "13640108": { "vendor": "Yohana" }, @@ -94712,6 +95561,9 @@ "13665456": { "vendor": "Sagemcom Broadband SAS" }, + "13666229": { + "vendor": "Safemo Pte. Ltd." + }, "13666274": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -94899,7 +95751,7 @@ "vendor": "Apple, Inc." }, "13680831": { - "vendor": "Actions Microelectronics Co., Ltd" + "vendor": "Actions Microelectronics" }, "13681043": { "vendor": "Skybell, Inc" @@ -95189,6 +96041,9 @@ "13895134": { "vendor": "eero inc." }, + "13895183": { + "vendor": "Texas Instruments" + }, "13895784": { "vendor": "Beijing Lanxum Computer Technology CO.,LTD." }, @@ -95201,6 +96056,9 @@ "13896633": { "vendor": "Solid Semecs bv." }, + "13897312": { + "vendor": "Nanjing phx-gctech Information Technology Co., Ltd" + }, "13897630": { "vendor": "Apple, Inc." }, @@ -95483,6 +96341,9 @@ "13914234": { "vendor": "CEIVA Logic, Inc" }, + "13914350": { + "vendor": "GD Midea Air-Conditioning Equipment Co.,Ltd." + }, "13914666": { "vendor": "TangoWiFi.com" }, @@ -95849,6 +96710,9 @@ "13932299": { "vendor": "Xiaomi Communications Co Ltd" }, + "13932729": { + "vendor": "vivo Mobile Communication Co., Ltd." + }, "13932908": { "vendor": "Juniper Networks" }, @@ -95906,6 +96770,9 @@ "13935421": { "vendor": "Apple, Inc." }, + "13935461": { + "vendor": "Xiaomi Communications Co Ltd" + }, "13935499": { "vendor": "Ele(Group)Co.,Ltd" }, @@ -96014,6 +96881,9 @@ "13942489": { "vendor": "Dell Inc." }, + "13942492": { + "vendor": "Roku, Inc" + }, "13942573": { "vendor": "SE Controls Asia Pacific Ltd" }, @@ -96045,7 +96915,7 @@ "vendor": "Motorola Mobility LLC, a Lenovo Company" }, "13945266": { - "vendor": "Quanergy Systems Inc" + "vendor": "Quanergy Solutions Inc" }, "13945327": { "vendor": "Hewlett Packard" @@ -96128,9 +96998,15 @@ "13949961": { "vendor": "Mist Systems, Inc." }, + "13950085": { + "vendor": "Edgecore Americas Networking Corporation" + }, "13950157": { "vendor": "Apple, Inc." }, + "13950219": { + "vendor": "Wavetel Technology Limited" + }, "13950807": { "vendor": "Alpinion Medical Systems" }, @@ -96281,6 +97157,9 @@ "14155923": { "vendor": "Aurender Inc." }, + "14156240": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "14156426": { "vendor": "Shenzhen YOUHUA Technology Co., Ltd" }, @@ -96422,6 +97301,9 @@ "14164127": { "vendor": "Cubro Acronet GesmbH" }, + "14164130": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "14164442": { "vendor": "Sernet (Suzhou) Technologies Corporation" }, @@ -97046,6 +97928,9 @@ "14200915": { "vendor": "Xiaomi Communications Co Ltd" }, + "14200929": { + "vendor": "Shenzhen Wenxun Technology Co.,Ltd" + }, "14201122": { "vendor": "Juniper Networks" }, @@ -97457,6 +98342,9 @@ "14419437": { "vendor": "Nabtesco Corporation" }, + "14419573": { + "vendor": "Espressif Inc." + }, "14419586": { "vendor": "Accessia Technology Ltd." }, @@ -97544,6 +98432,9 @@ "14425763": { "vendor": "Accensus LLC" }, + "14425813": { + "vendor": "Espressif Inc." + }, "14426120": { "vendor": "ASD Electronics Ltd" }, @@ -97616,6 +98507,9 @@ "14429955": { "vendor": "Step forward Group Co., Ltd." }, + "14430202": { + "vendor": "GE Lighting" + }, "14430364": { "vendor": "Heyrex Limited" }, @@ -97910,6 +98804,9 @@ "14449911": { "vendor": "China Mobile Group Device Co.,Ltd." }, + "14450205": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "14450596": { "vendor": "2Wire Inc" }, @@ -97928,6 +98825,9 @@ "14452190": { "vendor": "AzureWave Technology Inc." }, + "14452365": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "14452440": { "vendor": "Apple, Inc." }, @@ -98024,6 +98924,9 @@ "14458015": { "vendor": "Shenzhen YOUHUA Technology Co., Ltd" }, + "14458511": { + "vendor": "Apple, Inc." + }, "14458539": { "vendor": "Chongqing Yipingfang Technology Co., Ltd." }, @@ -99086,6 +99989,9 @@ "14720305": { "vendor": "Intel Corporate" }, + "14720371": { + "vendor": "Mellanox Technologies, Inc." + }, "14720440": { "vendor": "Planex Communications Inc." }, @@ -99239,12 +100145,18 @@ "14729425": { "vendor": "CK Telecom (Shenzhen) Limited" }, + "14729808": { + "vendor": "Netgear" + }, "14729828": { "vendor": "Intel Corporate" }, "14729862": { "vendor": "Aisai Communication Technology Co., Ltd." }, + "14729886": { + "vendor": "zte corporation" + }, "14729911": { "vendor": "Masimo Corporation" }, @@ -99476,6 +100388,12 @@ "14742296": { "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" }, + "14742309": { + "vendor": "Elkor Technologies Inc." + }, + "14742320": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "14742393": { "vendor": "Vaddio" }, @@ -99797,6 +100715,9 @@ "14961772": { "vendor": "Shenzhen Guo Wei Electronic Co,. Ltd." }, + "14962194": { + "vendor": "zte corporation" + }, "14962200": { "vendor": "Gardasoft VisionLimited" }, @@ -99851,6 +100772,9 @@ "14964920": { "vendor": "Samsung Electronics Co.,Ltd" }, + "14964924": { + "vendor": "Bose Corporation" + }, "14964967": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -100010,6 +100934,9 @@ "14974618": { "vendor": "zte corporation" }, + "14974780": { + "vendor": "zte corporation" + }, "14974898": { "vendor": "Fujitsu Limited" }, @@ -100211,6 +101138,9 @@ "14987363": { "vendor": "Espressif Inc." }, + "14987527": { + "vendor": "Huawei Device Co., Ltd." + }, "14987812": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -100340,6 +101270,9 @@ "14996797": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, + "14996875": { + "vendor": "Hangzhou Hikvision Digital Technology Co.,Ltd." + }, "14997277": { "vendor": "Oraya Therapeutics" }, @@ -100388,6 +101321,9 @@ "15000747": { "vendor": "Apple, Inc." }, + "15001096": { + "vendor": "Kiwibit Inc." + }, "15001196": { "vendor": "Tiandy Technologies Co.,LTD" }, @@ -100527,7 +101463,7 @@ "vendor": "Nortel Networks" }, "15205852": { - "vendor": "Verifone Inc." + "vendor": "Verifone, Inc." }, "15206024": { "vendor": "Apple, Inc." @@ -100535,6 +101471,9 @@ "15206032": { "vendor": "Espressif Inc." }, + "15206123": { + "vendor": "ShieldSOS LLC" + }, "15206196": { "vendor": "Champion Optical Network Engineering, LLC" }, @@ -100628,6 +101567,9 @@ "15211369": { "vendor": "Sercomm Corporation." }, + "15211685": { + "vendor": "Hewlett Packard Enterprise" + }, "15211706": { "vendor": "Fortinet, Inc." }, @@ -100670,6 +101612,9 @@ "15214262": { "vendor": "Companies House to GlucoRx Technologies Ltd." }, + "15214287": { + "vendor": "Shenzhen Jingxun Technology Co., Ltd." + }, "15214373": { "vendor": "Axis Communications AB" }, @@ -100880,6 +101825,9 @@ "15227914": { "vendor": "Cisco Systems, Inc" }, + "15227999": { + "vendor": "FN-LINK TECHNOLOGY Ltd." + }, "15228267": { "vendor": "Luminate Wireless" }, @@ -101213,6 +102161,9 @@ "15248419": { "vendor": "Huawei Technologies Co.,Ltd" }, + "15248510": { + "vendor": "Terahop Pte.Ltd." + }, "15248557": { "vendor": "zte corporation" }, @@ -101279,6 +102230,9 @@ "15252392": { "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" }, + "15252708": { + "vendor": "Cisco Systems, Inc" + }, "15252945": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -101315,6 +102269,9 @@ "15254906": { "vendor": "Ufispace Co., LTD." }, + "15255270": { + "vendor": "Changhong (Hongkong) Trading Limited" + }, "15255375": { "vendor": "Liteon Technology Corporation" }, @@ -101465,6 +102422,9 @@ "15263190": { "vendor": "Samsung Electronics Co.,Ltd" }, + "15263241": { + "vendor": "Chongqing Zhouhai intelligent technology CO., Ltd" + }, "15263538": { "vendor": "Alcatel-Lucent Enterprise" }, @@ -101474,6 +102434,9 @@ "15263606": { "vendor": "Shenzhen Kootion Technology Co., Ltd" }, + "15263683": { + "vendor": "zte corporation" + }, "15263861": { "vendor": "iS5 Communications Inc." }, @@ -101534,6 +102497,9 @@ "15265925": { "vendor": "Huawei Technologies Co.,Ltd" }, + "15265956": { + "vendor": "Antonios A. Chariton" + }, "15266224": { "vendor": "Sagemcom Broadband SAS" }, @@ -101552,6 +102518,9 @@ "15266824": { "vendor": "Intel Corporate" }, + "15266964": { + "vendor": "AltoBeam Inc." + }, "15267412": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -101612,6 +102581,9 @@ "15269784": { "vendor": "Huawei Device Co., Ltd." }, + "15269876": { + "vendor": "Apple, Inc." + }, "15339869": { "vendor": "Autovision Technology Inc." }, @@ -101747,6 +102719,9 @@ "15473757": { "vendor": "Siemens AG" }, + "15474003": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "15474047": { "vendor": "zte corporation" }, @@ -101756,6 +102731,9 @@ "15474078": { "vendor": "Quectel Wireless Solutions Co.,Ltd." }, + "15474089": { + "vendor": "Yealink(Xiamen) Network Technology Co.,Ltd." + }, "15474546": { "vendor": "Samsung Electro-Mechanics(Thailand)" }, @@ -101969,6 +102947,9 @@ "15487708": { "vendor": "WORLD MEDIA AND TECHNOLOGY Corp." }, + "15487855": { + "vendor": "Huawei Technologies Co.,Ltd" + }, "15487874": { "vendor": "Honor Device Co., Ltd." }, @@ -101996,6 +102977,9 @@ "15489511": { "vendor": "Microsoft Corporation" }, + "15489585": { + "vendor": "Buffalo.Inc" + }, "15489670": { "vendor": "Yulong Computer Telecommunication Scientific (Shenzhen) Co.,Ltd" }, @@ -102494,6 +103478,9 @@ "15521418": { "vendor": "Shenzhen JMicron Intelligent Technology Developmen" }, + "15522057": { + "vendor": "Alpsalpine Co,.Ltd" + }, "15522085": { "vendor": "Rami" }, @@ -102551,6 +103538,9 @@ "15525700": { "vendor": "Omntec mfg. inc" }, + "15525774": { + "vendor": "AsiaTelco Technologies Co." + }, "15525799": { "vendor": "Intel Corporate" }, @@ -102824,6 +103814,9 @@ "15738725": { "vendor": "Murata Manufacturing Co., Ltd." }, + "15738784": { + "vendor": "Apple, Inc." + }, "15739177": { "vendor": "Cisco Systems, Inc" }, @@ -103496,6 +104489,9 @@ "15783159": { "vendor": "varram system" }, + "15783174": { + "vendor": "Ubee Interactive Co., Limited" + }, "15783359": { "vendor": "Intel Corporate" }, @@ -104126,6 +105122,9 @@ "16016477": { "vendor": "Toshiba" }, + "16016651": { + "vendor": "Espressif Inc." + }, "16016806": { "vendor": "Apple, Inc." }, @@ -104459,6 +105458,9 @@ "16039326": { "vendor": "Cisco Systems, Inc" }, + "16039353": { + "vendor": "Ubiqcom India Pvt Ltd" + }, "16039660": { "vendor": "Apple, Inc." }, @@ -105362,6 +106364,9 @@ "16284556": { "vendor": "Amped Wireless" }, + "16284640": { + "vendor": "Funtime Pickleball Inc." + }, "16284991": { "vendor": "Huawei Device Co., Ltd." }, @@ -105812,6 +106817,9 @@ "16310393": { "vendor": "Motorola Mobility LLC, a Lenovo Company" }, + "16311135": { + "vendor": "Sichuan Tianyi Comheart Telecom Co.,LTD" + }, "16311355": { "vendor": "ASIX Electronics Corporation" }, @@ -105875,6 +106883,9 @@ "16313774": { "vendor": "Mobiwire Mobiles(Ningbo) Co.,Ltd" }, + "16314205": { + "vendor": "Motorola Mobility LLC, a Lenovo Company" + }, "16314373": { "vendor": "Newport Media Inc." }, @@ -106031,6 +107042,9 @@ "16516679": { "vendor": "Cortland Research, LLC" }, + "16516748": { + "vendor": "Shenzhen Micipc Technology Co.,Ltd" + }, "16516845": { "vendor": "M2Motive Technology Inc." }, @@ -106119,7 +107133,7 @@ "vendor": "Samsung Electronics Co.,Ltd" }, "16521512": { - "vendor": "Actions Microelectronics Co., Ltd" + "vendor": "Actions Microelectronics" }, "16521625": { "vendor": "Xiaomi Communications Co Ltd" @@ -106166,6 +107180,9 @@ "16523200": { "vendor": "Eurecam" }, + "16523804": { + "vendor": "Shenzhen Xunman Technology Co., Ltd" + }, "16523932": { "vendor": "Han Kyung I Net Co.,Ltd." }, @@ -106349,6 +107366,9 @@ "16534460": { "vendor": "Sunplus Technology Co., Ltd." }, + "16534890": { + "vendor": "Silicon Laboratories" + }, "16534924": { "vendor": "Shenzhen Pante Electronics Technology Co., Ltd" }, @@ -106448,6 +107468,9 @@ "16540270": { "vendor": "Beijing MDC Telecom" }, + "16540271": { + "vendor": "Fortx" + }, "16540345": { "vendor": "Alpsalpine Co,.Ltd" }, @@ -106622,6 +107645,9 @@ "16552811": { "vendor": "Samsung Electronics Co.,Ltd" }, + "16553006": { + "vendor": "Cisco Meraki" + }, "16553013": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -106904,6 +107930,9 @@ "16570632": { "vendor": "Xiaomi Communications Co Ltd" }, + "16570731": { + "vendor": "Realme Chongqing Mobile Telecommunications Corp.,Ltd." + }, "16571169": { "vendor": "Samsara Networks Inc" }, @@ -106922,6 +107951,9 @@ "16572048": { "vendor": "Samsung Electronics Co.,Ltd" }, + "16572101": { + "vendor": "Texas Instruments" + }, "16572160": { "vendor": "GD Midea Air-Conditioning Equipment Co.,Ltd." }, @@ -107675,7 +108707,7 @@ "22126500249600": "Private", "22126501298176": "Byzero", "22126502346752": "Inttelix Brasil Tecnologia e Sistemas Ltda", - "22126503395328": "Revenue Collection Systems France SAS", + "22126503395328": "Hitachi Rail RCS France SAS", "22126504443904": "Wisnetworks Technologies Co., Ltd.", "22126505492480": "Shenzhen CATIC Information Technology Industry Co.,Ltd", "22126506541056": "Black Moth Technologies", @@ -108416,6 +109448,31 @@ } ] }, + "2401264": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "40286524801024": "Shanghai AYAN Industry System Co.L,td", + "40286525849600": "Hunan Newman Internet of vehicles Co,Ltd", + "40286526898176": "Magna Hong Co., Ltd.", + "40286527946752": "Shanghai Weirui Electronic Technology Co., Ltd.", + "40286528995328": "Misaka Network, Inc.", + "40286530043904": "Phoenix Season LLC", + "40286531092480": "dissecto GmbH", + "40286532141056": "Coban Srl", + "40286533189632": "Weihai Hualing Opto-electronics Co., Ltd.", + "40286534238208": "EONCA Corporation", + "40286535286784": "TeraNXT Global India Pvt Ltd.", + "40286536335360": "Shenzhen Woody International Trade Co., Ltd", + "40286537383936": "Beijing Cunyin Chengqi Technology Co., Ltd.", + "40286538432512": "Micro Electroninc Products", + "40286539481088": "P4S" + } + } + ] + }, "2632706": { "vendor": "", "maskedFilters": [ @@ -109420,6 +110477,31 @@ } ] }, + "3988483": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "66915640803328": "Rancommunication Solutions Private Limited", + "66915641851904": "Zaptec", + "66915642900480": "Guangdong Yada Electronics Co.,Ltd", + "66915643949056": "Shenzhen Xinruizhi Industrial Co., Ltd", + "66915644997632": "Annapurna labs", + "66915646046208": "Zhuhai Means Company Limited", + "66915647094784": "ATANS Technology Inc.", + "66915648143360": "LINX Corporation", + "66915649191936": "Oceasoft Sas", + "66915650240512": "ible Technology Inc.", + "66915651289088": "Wenet Technology Limited", + "66915652337664": "pakflow", + "66915653386240": "Wly", + "66915654434816": "Vieletech", + "66915655483392": "JP Morgan Chase Bank, N.A." + } + } + ] + }, "3996371": { "vendor": "", "maskedFilters": [ @@ -111244,6 +112326,23 @@ } ] }, + "7611780": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "127704478253056": "Creative Synergy Ventures Pty. Ltd.", + "127704479301632": "Suzhou Surinno Photonics Technology Co.Ltd.", + "127704480350208": "alt digital s.r.o.", + "127704483495936": "Ezeconet", + "127704484544512": "Annapurna labs", + "127704489787392": "Hsptek Jsc", + "127704490835968": "Shenzhen smart-core technology co.,ltd." + } + } + ] + }, "7625669": { "vendor": "", "maskedFilters": [ @@ -113767,7 +114866,7 @@ "206921196896256": "Zhejiang Delixi Electric Appliance Co., Ltd", "206921197944832": "Temposonics,LLC", "206921198993408": "Baisstar (Shenzhen) Intelligence Co., Ltd.", - "206921200041984": "Fujitsu Component Limied", + "206921200041984": "Fcl Components Limited", "206921201090560": "Suzhou Anchi Control system.,Co.Ltd", "206921202139136": "Innoflight, Inc.", "206921203187712": "Shanghai Sigen New Energy Technology Co., Ltd", @@ -113878,6 +114977,31 @@ } ] }, + "12601391": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "211416258707456": "Protect A/S", + "211416259756032": "Sichuan Xutai communication equipment Co., LTD", + "211416260804608": "AISWEI Technology Co.", + "211416261853184": "Qingdao Xijiao Ruihang Rail Equipment Co., Ltd.", + "211416262901760": "Altice Labs India", + "211416263950336": "Shenzhen Thinkercu Electronic Technology Co., Ltd", + "211416264998912": "Chengdu Dingfeng Huizhi Technology Co., Ltd", + "211416266047488": "Megawin Switchgear Pvt. Ltd.", + "211416267096064": "Beijing D&S Fieldbus Technology co.,Ltd", + "211416268144640": "Hystrone Technology (HongKong) Co., Limited", + "211416269193216": "Willstrong Solutions Private Limited", + "211416270241792": "Shenzhen C & D Electronics Co., Ltd.", + "211416271290368": "Lunar USA Inc.", + "211416272338944": "Securico Electronics India Ltd", + "211416273387520": "Shenzhen Guan Chen Electronic Co.,LTD" + } + } + ] + }, "12607898": { "vendor": "", "maskedFilters": [ @@ -114210,6 +115334,7 @@ "mask": 28, "vendors": { "216601710297088": "Zhuhai Ninestar Information Technology Co., Ltd.", + "216601711345664": "Turing Machines Inc.", "216601712394240": "ShenZhen BoQiao Technologies CO.,LTD.", "216601713442816": "Cloudhop Inc", "216601714491392": "Malhotra Electronics Private Limited", @@ -114221,7 +115346,8 @@ "216601720782848": "Openeye", "216601721831424": "Elaraby Company For Engineering Industries", "216601722880000": "KSB SE & Co. KGaA", - "216601723928576": "Aosaishi (Hong Kong) Co.,Limited" + "216601723928576": "Aosaishi (Hong Kong) Co.,Limited", + "216601724977152": "Elbit system EW and SIGINT Elisra ltd" } } ] @@ -115531,6 +116657,31 @@ } ] }, + "15509425": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "260204973260800": "Nanjing Xinyun Technology Co., Ltd", + "260204974309376": "AKOM Technologies Private Limited", + "260204975357952": "Annapurna labs", + "260204976406528": "Strongbyte Solutions Limited", + "260204977455104": "Sichuan Ruiting Zhihui Technology Co., Ltd", + "260204978503680": "Chicony Power Technology (Dongguan) Co,. Ltd.", + "260204979552256": "Digital Audio Labs", + "260204980600832": "Shenzhen Lanroot Technology Co., Ltd", + "260204981649408": "Shenzhen zhst video technology co.,ltd", + "260204982697984": "Print International Limited", + "260204983746560": "Annapurna labs", + "260204984795136": "Shenzhen Adreamer Elite Co.,Ltd", + "260204985843712": "Hiromokuten Co.,Ltd.", + "260204986892288": "Usu Telecom India Private Limited", + "260204987940864": "Artisight, Inc." + } + } + ] + }, "15737373": { "vendor": "", "maskedFilters": [ @@ -115757,6 +116908,31 @@ } ] }, + "16005882": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "268534139584512": "AugustDevices India Private limited", + "268534140633088": "Dspread Technology (Beijing) Inc.", + "268534141681664": "Private", + "268534142730240": "Jiaxing Haishijiaan Smartcity Technology CO., LTD.", + "268534143778816": "Aifrutech Co.,LTD", + "268534144827392": "Grayeye IT Systems Private Limited", + "268534145875968": "sungshinsolution", + "268534146924544": "Valeo Schalter und Sensoren GmbH", + "268534147973120": "Metrasens Limited", + "268534149021696": "Hemant Electronics", + "268534150070272": "Annapurna labs", + "268534151118848": "CETC Suntai Information Technology Co., Ltd.", + "268534152167424": "Lenovo India Private Limited", + "268534153216000": "Houngfu Technology", + "268534154264576": "Wakari Solutions,S.L." + } + } + ] + }, "16017877": { "vendor": "", "maskedFilters": [ @@ -121510,7 +122686,7 @@ "123917677518848": "Spectra Displays Ltd", "123917677522944": "Zehntner Testing Instruments", "123917677527040": "Cardinal Scale Mfg Co", - "123917677531136": "Gilbarco Veeder-Root ‎", + "123917677531136": "Gilbarco Veeder-Root", "123917677535232": "Talleres de Escoriaza SA", "123917677539328": "Sorama BV", "123917677543424": "EA Elektroautomatik GmbH & Co. KG", @@ -125005,6 +126181,7 @@ "154066449678336": "Cristal Controles Ltee", "154066449686528": "Signtel Communications Pvt Ltd", "154066449690624": "Farmote Limited", + "154066449694720": "Rax-Tech International", "154066449702912": "Paragraf", "154066449715200": "Nordson Corporation", "154066449719296": "SCIREQ Scientific Respiratory Equipment Inc", @@ -125018,6 +126195,7 @@ "154066449788928": "SOLIDpower SpA", "154066449805312": "IQ Home Kft.", "154066449813504": "RealWear", + "154066449833984": "Orion Computers", "154066449838080": "Orion Power Systems, Inc.", "154066449842176": "Sona Business B.V.", "154066449846272": "Horizon.Inc", @@ -125044,6 +126222,7 @@ "154066450034688": "Sanwa Supply Inc.", "154066450042880": "Monnit Corporation", "154066450059264": "Dorlet Sau", + "154066450067456": "Potter Electric Signal Company", "154066450079744": "Pack'R", "154066450083840": "Engage Technologies", "154066450096128": "Flextronics International Kft", @@ -125073,6 +126252,7 @@ "154066450247680": "MB connect line GmbH Fernwartungssysteme", "154066450251776": "Techniwave", "154066450268160": "Dynamic Research, Inc.", + "154066450272256": "Gomero Nordic AB", "154066450284544": "SamabaNova Systems", "154066450292736": "Di3 Infotech Llp", "154066450296832": "Norbit ODM AS", @@ -125129,8 +126309,10 @@ "154066450739200": "Grossenbacher Systeme AG", "154066450743296": "Automata GmbH & Co. KG", "154066450747392": "Foxconn Technology Co., Ltd.", + "154066450755584": "Power Electronics Espana, S.L.", "154066450767872": "Infosoft Digital Design and Services P L", "154066450771968": "NodeUDesign", + "154066450780160": "Hefei EverACQ Technology Co., LTD", "154066450796544": "Hangzhou Sciener Smart Technology Co., Ltd.", "154066450800640": "Harvest Technology Pty Ltd", "154066450808832": "Yulista Integrated Solution", @@ -125217,8 +126399,10 @@ "154066451574784": "WBNet", "154066451587072": "Radian Research, Inc.", "154066451591168": "Canon Electron Tubes & Devices Co., Ltd.", + "154066451595264": "Haptech Defense Systems", "154066451623936": "Tantronic AG", "154066451628032": "AVCOMM Technologies Inc", + "154066451644416": "Eiffage Energie Electronique", "154066451648512": "NanoThings Inc.", "154066451685376": "Burk Technology", "154066451697664": "Hiwin Mikrosystem Corp.", @@ -125231,6 +126415,7 @@ "154066451763200": "Bipom Electronics, Inc.", "154066451779584": "XLOGIC srl", "154066451795968": "Guangzhou Desam Audio Co.,Ltd", + "154066451800064": "Exicom Technologies India Pvt. Ltd.", "154066451808256": "LLC \"EMS-Expert\"", "154066451816448": "The Bionetics Corporation", "154066451828736": "Yuansiang Optoelectronics Co.,Ltd.", @@ -125240,6 +126425,7 @@ "154066451877888": "Kaysons Electricals Private Limited", "154066451881984": "Jide Car Rastreamento e Monitoramento LTDA", "154066451898368": "Monnit Corporation", + "154066451910656": "Marson Technology Co., Ltd.", "154066451943424": "Mokila Networks Pvt Ltd", "154066451955712": "HuiTong intelligence Company", "154066451963904": "Giordano Controls Spa", @@ -125247,6 +126433,7 @@ "154066451984384": "Dadhwal Weighing Instrument Repairing Works", "154066452004864": "Shenzhen Link-All Technolgy Co., Ltd", "154066452008960": "Xi'An Jiaoda Kaida New Technology Co.Ltd", + "154066452021248": "Accurate Optoelectronics Pvt. Ltd.", "154066452025344": "Watchdog Systems", "154066452029440": "TYT Electronics CO., LTD", "154066452037632": "Zhuhai Yunzhou Intelligence Technology Ltd.", @@ -125267,6 +126454,7 @@ "154066452164608": "Distran AG", "154066452168704": "Invixium Access Inc", "154066452197376": "Oriux", + "154066452213760": "Whizz Systems Inc.", "154066452217856": "Heitec Ag", "154066452221952": "Nvp Teco Ltd", "154066452242432": "i2s", @@ -125279,6 +126467,7 @@ "154066452299776": "nanoTRONIX Computing Inc.", "154066452307968": "Roog zhi tong Technology(Beijing) Co.,Ltd", "154066452316160": "Megger Germany GmbH", + "154066452328448": "TT electronics integrated manufacturing services (Suzhou) Limited", "154066452344832": "Nagtech Llc", "154066452348928": "Connected Development", "154066452353024": "Pantherun Technologies Pvt Ltd", @@ -125306,6 +126495,7 @@ "154066452533248": "Taiwan Vtron", "154066452537344": "E2 Nova Corporation", "154066452545536": "Cambridge Research Systems Ltd", + "154066452566016": "J&J Philippines Corporation", "154066452578304": "CONTROL SYSTEMS Srl", "154066452598784": "Flextronics International Kft", "154066452602880": "Polar Bear Design", @@ -125334,6 +126524,7 @@ "154066452783104": "XCOM Labs", "154066452795392": "Flextronics International Kft", "154066452799488": "Tangent Design Engineering", + "154066452803584": "East Photonics", "154066452824064": "Cedel BV", "154066452832256": "Potter Electric Signal Company", "154066452836352": "Bacancy Systems LLP", @@ -125341,6 +126532,7 @@ "154066452848640": "Asiga Pty Ltd", "154066452852736": "joint analytical systems GmbH", "154066452856832": "Accumetrics", + "154066452869120": "STV Electronic GmbH", "154066452889600": "Kinetic Technologies", "154066452901888": "Deutescher Wetterdienst", "154066452905984": "Com Video Security Systems Co., Ltd.", @@ -125355,6 +126547,7 @@ "154066452971520": "Rheingold Heavy LLC", "154066452987904": "Hubris Technologies Private Limited", "154066452992000": "Arrow (China) Electronics Trading Co., Ltd.", + "154066453004288": "BRS Sistemas Eletrônicos", "154066453012480": "TimeMachines Inc.", "154066453032960": "Plut d.o.o.", "154066453041152": "Waves System", @@ -125381,6 +126574,7 @@ "154066453196800": "Sp Manufacturing Pte Ltd", "154066453200896": "WOLF Advanced Technology", "154066453209088": "WINK Streaming", + "154066453217280": "Accord Communications Ltd", "154066453221376": "Duevi Srl", "154066453225472": "DIAS Infrared GmbH", "154066453233664": "spar Power Technologies Inc.", @@ -125401,6 +126595,7 @@ "154066453336064": "Cpc (Uk)", "154066453340160": "mmc kommunikationstechnologie gmbh", "154066453344256": "Gre System Inc.", + "154066453352448": "Beijing Ceresdata Technology Co., LTD", "154066453360640": "Intel Corporate", "154066453364736": "Software Systems Plus", "154066453372928": "Golding Audio Ltd", @@ -125421,6 +126616,7 @@ "154066453495808": "Hubris Technologies Private Limited", "154066453508096": "Clausal Computing Oy", "154066453516288": "Oriux", + "154066453528576": "Snek", "154066453532672": "Suzhou Lianshichuangzhi Technology Co., Ltd", "154066453536768": "Samuel Cosgrove", "154066453544960": "NavSys Technology Inc.", @@ -125444,12 +126640,14 @@ "154066453716992": "BnB Information Technology", "154066453741568": "Actelser S.L.", "154066453753856": "Mitsubishi Electric India Pvt. Ltd.", + "154066453762048": "Yu Yan System Technology Co., Ltd.", "154066453774336": "STV Electronic GmbH", "154066453782528": "Plum sp. z.o.o.", "154066453786624": "Uisee(Shanghai) Automotive Technologies Ltd.", "154066453798912": "Integer.pl S.A.", "154066453815296": "Anda Telecom Pvt Ltd", "154066453823488": "techone system", + "154066453831680": "Enki Multimedia", "154066453839872": "Sichuan Aiyijan Technology Company Ltd.", "154066453843968": "PROFITT Ltd", "154066453848064": "Baker Hughes EMEA", @@ -125464,6 +126662,7 @@ "154066453917696": "Gigalane", "154066453934080": "Hiwin Mikrosystem Corp.", "154066453946368": "eumig industrie-TV GmbH.", + "154066453950464": "MB connect line GmbH Fernwartungssysteme", "154066453958656": "Abbott Diagnostics Technologies AS", "154066453966848": "Gamber Johnson-LLC", "154066453995520": "Rebel Systems", @@ -125487,20 +126686,24 @@ "154066454183936": "Solace Systems Inc.", "154066454188032": "Kara Partners LLC", "154066454192128": "Reo Ag", + "154066454204416": "Ixorigue Technologies Sl", "154066454208512": "Intamsys Technology Co.Ltd", "154066454224896": "Pharsighted LLC", "154066454257664": "Surge Networks, Inc.", "154066454265856": "Audiobyte S.R.L.", "154066454269952": "Alpine Quantum Technologies GmbH", "154066454274048": "Clair Global Corporation", + "154066454278144": "Blaucomm Ltd", "154066454286336": "AKSE srl", "154066454290432": "Missing Link Electronics, Inc.", "154066454302720": "Eb Neuro Spa", "154066454306816": "Novanta IMS", "154066454319104": "VirtualV Trading Limited", + "154066454323200": "Vismes sarl", "154066454343680": "TECHKON GmbH", "154066454351872": "Hupi", "154066454360064": "Monnit Corporation", + "154066454368256": "Private", "154066454376448": "Mecos AG", "154066454392832": "Security Products International, LLC", "154066454401024": "Dave Srl", @@ -125524,8 +126727,10 @@ "154066454556672": "IWS Global Pty Ltd", "154066454573056": "Smart Monitoring Innovations Private Limited", "154066454581248": "Clock-O-Matic", + "154066454585344": "Laser Imagineering Vertriebs GmbH", "154066454605824": "SBS SpA", "154066454614016": "Apantac LLC", + "154066454618112": "North Building Technologies Limited", "154066454630400": "Guan Show Technologe Co., Ltd.", "154066454638592": "Sicon srl", "154066454667264": "Dan Smith LLC", @@ -125565,6 +126770,7 @@ "154066454929408": "Tcl Operations Polska Sp. Z O.O.", "154066454933504": "Smart Radar System, Inc", "154066454937600": "Wagner Group GmbH", + "154066454941696": "Shenzhen Gw Technology Co.,Ltd", "154066454945792": "TELE Haase Steuergeräte Ges.m.b.H", "154066454974464": "MP-SENSOR GmbH", "154066454986752": "Aski Industrie Elektronik GmbH", @@ -125602,6 +126808,7 @@ "154066455224320": "Hanateksystem", "154066455232512": "Dexter Laundry Inc.", "154066455236608": "Deep Detection / ESB01736990", + "154066455257088": "Ultiroam", "154066455277568": "Avida, Inc.", "154066455281664": "ELTEK SpA", "154066455285760": "Acod", @@ -125626,6 +126833,7 @@ "154066455461888": "Tirasoft Technology", "154066455470080": "Primalucelab isrl", "154066455490560": "Delta Computers LLC.", + "154066455494656": "Seongwon Eng Co.,Ltd", "154066455511040": "Dave Srl", "154066455519232": "Kinney Industries, Inc", "154066455523328": "Rch Spa", @@ -125669,6 +126877,7 @@ "154066455805952": "Nv Bekaert Sa", "154066455826432": "HD Link Co., Ltd.", "154066455842816": "HongSeok Ltd.", + "154066455846912": "Forward Edge.AI", "154066455851008": "Eagle Harbor Technologies, Inc.", "154066455863296": "PolCam Systems Sp. z o.o.", "154066455867392": "Recom Llc.", @@ -125741,6 +126950,7 @@ "154066456461312": "GuangZhou HOKO Electric CO.,LTD", "154066456481792": "Wende Tan", "154066456485888": "Nexilis Electronics India Pvt Ltd (PICSYS)", + "154066456489984": "Adaptiv LTD", "154066456494080": "Hubbell Power Systems", "154066456498176": "aeroLiFi GmbH", "154066456502272": "Emerson Rosemount Analytical", @@ -125749,6 +126959,7 @@ "154066456514560": "FIDICA GmbH & Co. KG", "154066456535040": "AT-Automation Technology GmbH", "154066456543232": "Avionica", + "154066456555520": "Becton Dickinson", "154066456559616": "Automata Spa", "154066456576000": "Bulwark", "154066456588288": "Toho System Co., Ltd.", @@ -125759,6 +126970,7 @@ "154066456621056": "Feritech Ltd.", "154066456629248": "O-Net Communications(Shenzhen)Limited", "154066456637440": "Alpha-Omega Technology GmbH & Co. KG", + "154066456641536": "Larraioz Elektronika", "154066456645632": "GS Industrie-Elektronik GmbH", "154066456653824": "Season Electronics Ltd", "154066456662016": "IoT Water Analytics S.L.", @@ -125801,11 +127013,13 @@ "154066457042944": "Chell Instruments Ltd", "154066457047040": "Adasky Ltd.", "154066457055232": "Epigon spol. s r.o.", + "154066457067520": "Hangzhou Huasu Technology CO., LTD.", "154066457071616": "M/S Milind Ramachandra Rajwade", "154066457075712": "Artome Oy", "154066457079808": "Celestica Inc.", "154066457092096": "Dave Srl", "154066457108480": "Dorlet Sau", + "154066457112576": "Abbott Diagnostics Technologies AS", "154066457116672": "Antai technology Co.,Ltd", "154066457120768": "Hills Health Solutions", "154066457128960": "GMV Aerospace and Defence SAU", @@ -125821,6 +127035,7 @@ "154066457194496": "Ubiscale", "154066457198592": "Norvento Tecnología, S.L.", "154066457214976": "Chaseo Connectome", + "154066457219072": "R2D Automation", "154066457223168": "Sensus Healthcare", "154066457227264": "VisionTIR Multispectral Technology", "154066457235456": "Tiama", @@ -125841,7 +127056,9 @@ "154066457378816": "Guan Show Technologe Co., Ltd.", "154066457411584": "navXperience GmbH", "154066457415680": "Becton Dickinson", + "154066457419776": "Visiosoft Pty Ltd", "154066457423872": "Sicon srl", + "154066457427968": "ERS Elektronik GmbH", "154066457432064": "Inventio Di Nicolo' Bordoli", "154066457440256": "Db Sas", "154066457444352": "Orange Tree Technologies Ltd", @@ -125917,11 +127134,13 @@ "154066458050560": "Kymata Srl", "154066458054656": "Panoramic Power", "154066458062848": "Pribusin Inc.", + "154066458075136": "PalmSens BV", "154066458079232": "nke marine electronics", "154066458091520": "Gemini Electronics B.V.", "154066458103808": "Gogo BA", "154066458112000": "ViewSonic Corp", "154066458116096": "Tiama", + "154066458124288": "IP Devices", "154066458136576": "MTU Aero Engines AG", "154066458161152": "Flow Power", "154066458177536": "AnySignal", @@ -125947,6 +127166,7 @@ "154066458361856": "Zing 5g Communications Canada Inc.", "154066458370048": "Apen Group S.p.A. (VAT IT08767740155)", "154066458390528": "EngiNe srl", + "154066458394624": "IMI Thomson Valves", "154066458402816": "Unitron Systems b.v.", "154066458406912": "Forever Engineering Systems Pvt. Ltd.", "154066458411008": "Shenzhen Peake Technology Co.,Ltd.", @@ -125973,6 +127193,7 @@ "154066458607616": "Copper Connections Ltd", "154066458611712": "American Edge IP", "154066458632192": "Cinetix Srl", + "154066458640384": "H&abyz", "154066458656768": "Genesis Technologies AG", "154066458673152": "Massachusetts Institute of Technology", "154066458677248": "Guan Show Technologe Co., Ltd.", @@ -125991,6 +127212,7 @@ "154066458779648": "Cirrus Systems, Inc.", "154066458787840": "Hermes Network Inc", "154066458791936": "NextT Microwave Inc", + "154066458812416": "YUYAMA MFG Co.,Ltd", "154066458816512": "Chromaviso A/S", "154066458832896": "Diffraction Limited", "154066458836992": "Enerthing GmbH", @@ -126015,7 +127237,10 @@ "154066458984448": "Loadrite (Auckland) Limited", "154066458992640": "Idneo Technologies S.A.U.", "154066459000832": "HIGHVOLT Prüftechnik", + "154066459013120": "Televic Rail GmbH", + "154066459025408": "Potter Electric Signal Company", "154066459029504": "Kruger DB Series Indústria Eletrônica ltda", + "154066459037696": "Comrex", "154066459045888": "Portrait Displays, Inc.", "154066459049984": "Hensoldt Sensors GmbH", "154066459054080": "Qualitrol LLC", @@ -126053,6 +127278,7 @@ "154066459344896": "Bcmtech", "154066459353088": "Monnit Corporation", "154066459357184": "Förster Technik GmbH", + "154066459373568": "VAF Instruments BV", "154066459385856": "Paulmann Licht GmbH", "154066459394048": "Sanchar Telesystems limited", "154066459402240": "Shenzhen Longyun Lighting Electric Appliances Co., Ltd", @@ -126083,6 +127309,7 @@ "154066459635712": "Applied Electro Magnetics Pvt. Ltd.", "154066459639808": "uHave Control, Inc", "154066459656192": "EVLO Stockage Énergie", + "154066459660288": "Advanced Techne", "154066459680768": "EIDOS s.r.l.", "154066459693056": "Pacific Software Development Co., Ltd.", "154066459697152": "LadyBug Technologies, LLC", @@ -126102,6 +127329,7 @@ "154066459820032": "Header Rhyme", "154066459824128": "RealWear", "154066459832320": "Camozzi Automation SpA", + "154066459844608": "Golding Audio Ltd", "154066459860992": "EDC Acoustics", "154066459865088": "Shanghai Sizhong Information Technology Co., Ltd", "154066459873280": "JiangYu Innovative Medical Technology", @@ -126143,8 +127371,10 @@ "154066460143616": "Dorlet Sau", "154066460155904": "FUJIHENSOKUKI Co., Ltd.", "154066460160000": "INVENTIA Sp. z o.o.", + "154066460176384": "Pneumax Spa", "154066460192768": "Zilica Limited", "154066460209152": "Hitachi Energy India Limited", + "154066460237824": "Automatic Pty Ltd", "154066460250112": "Ringtail Security", "154066460258304": "WENet Vietnam Joint Stock company", "154066460266496": "ACSL Ltd.", @@ -126170,6 +127400,7 @@ "154066460459008": "Prosys", "154066460463104": "Shenzhen zhushida Technology lnformation Co.,Ltd", "154066460467200": "XTIA Ltd.", + "154066460471296": "Wattson Audio SA", "154066460475392": "Active Optical Systems, LLC", "154066460479488": "Breas Medical AB", "154066460504064": "Electrovymir LLC", @@ -126187,6 +127418,7 @@ "154066460631040": "Global Design Tech(ZS) Co.,Ltd", "154066460635136": "Morgen Technology", "154066460643328": "Mitsubishi Electric India Pvt. Ltd.", + "154066460672000": "DSGio Global Pte Ltd", "154066460676096": "Infinitive Group Limited", "154066460680192": "Agrology, PBC", "154066460688384": "Future wave ultra tech Company", @@ -126210,11 +127442,13 @@ "154066460860416": "TAIYO DENON Corporation", "154066460864512": "Stackiot Technologies Private Limited", "154066460868608": "AIQuatro", + "154066460872704": "KA Imaging Inc.", "154066460880896": "Waves System", "154066460884992": "comelec", "154066460889088": "Forever Engineering Systems Pvt. Ltd.", "154066460905472": "ShenYang LeShun Technology Co.,Ltd", "154066460913664": "Villari B.V.", + "154066460921856": "Escape Velocity Technologies", "154066460925952": "Rayhaan Networks", "154066460934144": "Elektrotechnik & Elektronik Oltmann GmbH", "154066460942336": "YUYAMA MFG Co.,Ltd", @@ -126229,6 +127463,7 @@ "154066461032448": "Adetec Sas", "154066461036544": "Ennple", "154066461040640": "INHEMETER Co.,Ltd", + "154066461048832": "Pixel Design & Manufacturing Sdn. Bhd.", "154066461052928": "MB connect line GmbH Fernwartungssysteme", "154066461061120": "Scenario Automation", "154066461065216": "MinebeaMitsumi Inc.", @@ -126279,12 +127514,14 @@ "154066461478912": "Sanchar Telesystems limited", "154066461483008": "Arcvideo", "154066461499392": "YUYAMA MFG Co.,Ltd", + "154066461503488": "Tri-light Wuhan Electronics Technology Co.,Ltd", "154066461540352": "Televic Rail GmbH", "154066461544448": "HomyHub SL", "154066461552640": "M2M craft Co., Ltd.", "154066461556736": "All-Systems Electronics Pty Ltd", "154066461560832": "Quanxing Tech Co.,LTD", "154066461569024": "KELC Electronics System Co., LTD.", + "154066461573120": "Laser Mechanisms, Inc.", "154066461577216": "Andy-L Ltd", "154066461581312": "Loop Technologies", "154066461601792": "Comm-ence, Inc.", @@ -126296,6 +127533,7 @@ "154066461642752": "Scheurich GmbH", "154066461663232": "Seed Core Co., LTD.", "154066461671424": "SPX Flow Technology", + "154066461675520": "Candela Technologies Inc", "154066461679616": "Elektronik & Modellprodukter Gävle AB", "154066461708288": "Tongye lnnovation Science and Technology (Shenzhen) Co.,Ltd", "154066461724672": "Clealink Technology", @@ -126311,6 +127549,7 @@ "154066461818880": "AvMap srlu", "154066461827072": "Mine Vision Systems", "154066461831168": "Ycn", + "154066461839360": "Jemac Sweden AB", "154066461843456": "Tieline Research Pty Ltd", "154066461855744": "Transit Solutions, LLC.", "154066461859840": "Grupo Epelsa S.L.", @@ -126352,6 +127591,7 @@ "154066462158848": "TechArgos", "154066462162944": "ASiS Technologies Pte Ltd", "154066462171136": "PuS GmbH und Co. KG", + "154066462175232": "Evolution Ventures LLC", "154066462183424": "Horiba Abx Sas", "154066462191616": "Abiman Engineering", "154066462195712": "Sanwa Corporation", @@ -126406,10 +127646,12 @@ "154066462576640": "Beijing Ceresdate Technology Co.,LTD", "154066462580736": "GMI Ltd", "154066462588928": "Ajeco Oy", + "154066462601216": "Oriux", "154066462605312": "Fiberme Communications Llc", "154066462613504": "Red Phase Technologies Limited", "154066462617600": "Mediana", "154066462625792": "EA Elektro-Automatik", + "154066462629888": "Safe Instruments", "154066462642176": "Yaviar LLC", "154066462683136": "Freedom Atlantic", "154066462687232": "MERKLE Schweissanlagen-Technik GmbH", @@ -126503,6 +127745,7 @@ "154066463498240": "YUYAMA MFG Co.,Ltd", "154066463506432": "Monarch Instrument", "154066463514624": "End 2 End Technologies", + "154066463526912": "Future Life Technology", "154066463531008": "Caproc Oy", "154066463551488": "Henan Creatbot Technology Limited", "154066463559680": "ZIGEN Lighting Solution co., ltd.", @@ -126510,6 +127753,7 @@ "154066463567872": "Gridnt", "154066463571968": "Grupo Epelsa S.L.", "154066463580160": "Wisdom Audio", + "154066463588352": "Zumbach Electronic AG", "154066463600640": "Local Security", "154066463608832": "Genius Vision Digital Private Limited", "154066463612928": "Integer.pl S.A.", @@ -126562,6 +127806,7 @@ "154066464047104": "Dwdm.Ru Llc", "154066464051200": "Peter Huber Kaeltemaschinenbau SE", "154066464055296": "Porsche engineering", + "154066464059392": "Beijing Ceresdata Technology Co., LTD", "154066464075776": "Reo Ag", "154066464096256": "Midlands Technical Co., Ltd.", "154066464100352": "Cardinal Scales Manufacturing Co", @@ -126569,10 +127814,13 @@ "154066464116736": "Abbott Diagnostics Technologies AS", "154066464124928": "Efficient Residential Heating GmbH", "154066464137216": "Jemac Sweden AB", + "154066464145408": "BorgWarner Engineering Services AG", "154066464149504": "Franke Aquarotter GmbH", + "154066464153600": "Softgent sp. z o.o.", "154066464165888": "Gogo Business Aviation", "154066464182272": "EON Technology, Corp", "154066464190464": "PXM Marek Zupnik spolka komandytowa", + "154066464198656": "PhotonPath", "154066464243712": "Wittra Networks AB", "154066464247808": "VuWall Technology Europe GmbH", "154066464251904": "Atse Llc", @@ -126597,8 +127845,10 @@ "154066464452608": "Glotech Exim Private Limited", "154066464460800": "RADA Electronics Industries Ltd.", "154066464464896": "RADA Electronics Industries Ltd.", + "154066464468992": "Breas Medical AB", "154066464473088": "VMukti Solutions Private Limited", "154066464485376": "Amiad Water Systems", + "154066464522240": "Finotex Electronic Solutions PVT LTD", "154066464534528": "Teletech Services", "154066464542720": "Grossenbacher Systeme AG", "154066464546816": "Shenzhen Forddok Technology Co., Ltd", @@ -126614,6 +127864,7 @@ "154066464600064": "Sabl Systems Pty Ltd", "154066464612352": "LcmVeloci ApS", "154066464616448": "T Proje Muhendislik Dis Tic. Ltd. Sti.", + "154066464636928": "Heitec Ag", "154066464653312": "Scientific Lightning Solutions", "154066464657408": "JinYuan International Corporation", "154066464661504": "BRICKMAKERS GmbH", @@ -126632,6 +127883,7 @@ "154066464755712": "Stercom Power Soltions GmbH", "154066464759808": "Heitec Ag", "154066464763904": "Gy-Fx Sas", + "154066464768000": "Elettronica Adriatica Srl", "154066464772096": "Shenzhen Guangwen Industrial Co.,Ltd", "154066464780288": "Dongguan Pengchen Earth Instrument CO. LT", "154066464784384": "Ashinne Technology Co., Ltd", @@ -126647,9 +127899,11 @@ "154066464882688": "Zin Technologies", "154066464899072": "Luxshare Electronic Technology (Kunshan) LTD", "154066464903168": "Pantherun Technologies Pvt Ltd", + "154066464927744": "Lumiplan Duhamel", "154066464964608": "Zumbach Electronic AG", "154066464972800": "\"KB \"Modul\", LLC", "154066464980992": "Miracle Healthcare, Inc.", + "154066464985088": "Messung Systems Pvt Ltd", "154066465005568": "Aqua Broadcast Ltd", "154066465017856": "Meiryo Denshi Corp.", "154066465026048": "Delta Solutions LLC", @@ -126662,17 +127916,21 @@ "154066465124352": "Monnit Corporation", "154066465140736": "Senso2Me Nv", "154066465144832": "Zhejiang Chitic-Safeway New Energy Technical Co.,Ltd.", + "154066465148928": "Smart Data (Shenzhen) Intelligent System Co., Ltd.", "154066465153024": "PowTechnology Limited", "154066465165312": "Netgen Hitech Solutions Llp", "154066465169408": "DEUTA-WERKE GmbH", + "154066465189888": "Xlera Solutions, LLC", "154066465193984": "Private", "154066465198080": "PuS GmbH und Co. KG", + "154066465206272": "Sichuan Huacun Zhigu Technology Co.,Ltd", "154066465218560": "Lynkx", "154066465226752": "Global Organ Group B.V.", "154066465234944": "Amess", "154066465255424": "AiUnion Co.,Ltd", "154066465259520": "Sonendo Inc", "154066465263616": "Biotage Gb Ltd", + "154066465275904": "Mediaport Systems Ltd", "154066465280000": "Sigma Defense Systems LLC", "154066465292288": "Northwest Central Indiana Community Partnerships Inc dba Wabash Heartland Innovation Network (WHIN)", "154066465304576": "Warecube,Inc", @@ -126693,6 +127951,7 @@ "154066465472512": "Albotronic", "154066465476608": "Misaka Network, Inc.", "154066465484800": "Tesat-Spacecom GmbH & Co. KG", + "154066465488896": "DEUTA Werke GmbH", "154066465505280": "Tunstall A/S", "154066465509376": "HUERNER Schweisstechnik GmbH", "154066465517568": "Quantum Technologies Inc", @@ -126722,9 +127981,11 @@ "154066465697792": "SemaConnect, Inc", "154066465701888": "Flextronics International Kft", "154066465714176": "TR7 Siber Savunma A.S.", + "154066465718272": "Portrait Displays, Inc.", "154066465730560": "Quantum Media Systems", "154066465738752": "Talleres de Escoriaza SA", "154066465751040": "YUYAMA MFG Co.,Ltd", + "154066465767424": "Sonatronic", "154066465771520": "Ophir Manufacturing Solutions Pte Ltd", "154066465783808": "Vision Systems Safety Tech", "154066465792000": "Contrader", @@ -126776,6 +128037,7 @@ "154066466193408": "Embsys Sistemas Embarcados", "154066466197504": "THE WHY HOW DO COMPANY, Inc.", "154066466205696": "Beijing Yahong Century Technology Co., Ltd", + "154066466217984": "Arkham Technology", "154066466226176": "Nuphoton Technologies", "154066466242560": "Potter Electric Signal Company", "154066466250752": "VUV Analytics, Inc.", diff --git a/3rdParty/OUIDataset/create_oui_data.py b/3rdParty/OUIDataset/create_oui_data.py index 02f1f987fc..9a36c06464 100644 --- a/3rdParty/OUIDataset/create_oui_data.py +++ b/3rdParty/OUIDataset/create_oui_data.py @@ -75,7 +75,7 @@ def convert_line(line: str) -> list[str]: def parse_mac_and_vendor(line_parts: list[str]) -> Optional[LineElements]: - if line_parts == None or len(line_parts) < 3: + if line_parts is None or len(line_parts) < 3: return None if len(line_parts[0]) == 6: diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c5b8092fa..30d5a52f3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # We need 3.12 or later, so that we can set policy CMP0074; see below. cmake_minimum_required(VERSION 3.12) -set(PCAPPP_VERSION "23.09+") +set(PCAPPP_VERSION "24.09+") # MAIN_PROJECT CHECK set(PCAPPP_MAIN_PROJECT OFF) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f83cbddd0..578a5390fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,11 +22,14 @@ Every code contribution to this project is highly valued and appreciated. I enco - PcapPlusPlus compiles successfully on your machine, including all unit-tests and examples - Unit-tests pass successfully on your machine (both `Tests/Packet++Test` and `Tests/Pcap++Test`) - All new APIs are well documented using Doxygen (please use @ for keywords) - - Make sure that pre-commit hooks are passing by using `pre-commit run --all-files`. For pre-commit hooks you need to install `cppcheck` on your system. Recommended and tested version is 2.7. You can install by using: - - For Linux (apt) `sudo apt install cppcheck` - - For Windows (using `choco`) `choco install cppcheck --version=2.7` - - For Windows (MSI install): https://github.com/danmar/cppcheck/releases/download/2.7/cppcheck-2.7-x64-Setup.msi - - Build from source: https://github.com/danmar/cppcheck/releases/tag/2.7 + - Make sure that pre-commit hooks are passing by using `pre-commit run --all-files`. For pre-commit hooks you need to install `cppcheck` and `clang-format` on your system. You can install them using the following commands: + - `pre-commit`: `pip install pre-commit` + - `cppcheck` (version 2.7 is recommended): + - For Linux (apt) `sudo apt install cppcheck` + - For Windows (using `choco`) `choco install cppcheck --version=2.7` + - For Windows (MSI install): https://github.com/danmar/cppcheck/releases/download/2.7/cppcheck-2.7-x64-Setup.msi + - Build from source: https://github.com/danmar/cppcheck/releases/tag/2.7 + - `clang-format`: `pip install clang-format==18.1.6` - After you commit the code and push it to GitHub, before creating the pull request please make sure that: - You merge all new code from **dev** to your fork - CI passes on all platforms diff --git a/Common++/header/Logger.h b/Common++/header/Logger.h index 6973cf530d..fafe6a9e37 100644 --- a/Common++/header/Logger.h +++ b/Common++/header/Logger.h @@ -103,6 +103,7 @@ namespace pcpp PacketLogModuleSomeIpSdLayer, ///< SomeIpSdLayer module (Packet++) PacketLogModuleWakeOnLanLayer, ///< WakeOnLanLayer module (Packet++) PacketLogModuleSmtpLayer, ///< SmtpLayer module (Packet++) + PacketLogModuleWireGuardLayer, ///< WireGuardLayer module (Packet++) PcapLogModuleWinPcapLiveDevice, ///< WinPcapLiveDevice module (Pcap++) PcapLogModuleRemoteDevice, ///< WinPcapRemoteDevice module (Pcap++) PcapLogModuleLiveDevice, ///< PcapLiveDevice module (Pcap++) diff --git a/Common++/header/PcapPlusPlusVersion.h b/Common++/header/PcapPlusPlusVersion.h index 0f43cea2a8..0e47016610 100644 --- a/Common++/header/PcapPlusPlusVersion.h +++ b/Common++/header/PcapPlusPlusVersion.h @@ -10,7 +10,7 @@ */ namespace pcpp { -#define PCAPPLUSPLUS_VERSION "23.09+" +#define PCAPPLUSPLUS_VERSION "24.09+" #define PCAPPLUSPLUS_VERSION_OFFICIAL "non-official release" #define PCAPPLUSPLUS_VERSION_FULL "v" PCAPPLUSPLUS_VERSION " (" PCAPPLUSPLUS_VERSION_OFFICIAL ")" diff --git a/Common++/header/PointerVector.h b/Common++/header/PointerVector.h index bd04b38261..342ad62e0b 100644 --- a/Common++/header/PointerVector.h +++ b/Common++/header/PointerVector.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "DeprecationUtils.h" @@ -17,6 +18,34 @@ */ namespace pcpp { + namespace internal + { + /** + * @brief A helper struct to facilitate the creation of a copy of an object. + * @tparam T The type of object to copy. + * @tparam Enable Helper parameter for SFINAE. + */ + template struct Copier + { + std::unique_ptr operator()(const T& obj) const + { + return std::unique_ptr(new T(obj)); + } + }; + + /** + * @brief A specialization of Copier to facilitate the safe copying of polymorphic objects via clone() method. + * @tparam T The type of object to copy. + */ + template struct Copier::value>::type> + { + std::unique_ptr operator()(const T& obj) const + { + // Clone can return unique_ptr or raw pointer. + return std::unique_ptr(std::move(obj.clone())); + } + }; + } // namespace internal /** * @class PointerVector @@ -343,21 +372,16 @@ namespace pcpp static std::vector deepCopyUnsafe(std::vector const& origin) { std::vector copyVec; + // Allocate the vector initially to ensure no exceptions are thrown during push_back. + copyVec.reserve(origin.size()); try { for (const auto iter : origin) { - T* objCopy = new T(*iter); - try - { - copyVec.push_back(objCopy); - } - catch (const std::exception&) - { - delete objCopy; - throw; - } + std::unique_ptr objCopy = internal::Copier()(*iter); + // There shouldn't be a memory leak as the vector is reserved. + copyVec.push_back(objCopy.release()); } } catch (const std::exception&) diff --git a/Examples/IcmpFileTransfer/IcmpFileTransfer-pitcher.cpp b/Examples/IcmpFileTransfer/IcmpFileTransfer-pitcher.cpp index 67848321fa..800e86d03b 100644 --- a/Examples/IcmpFileTransfer/IcmpFileTransfer-pitcher.cpp +++ b/Examples/IcmpFileTransfer/IcmpFileTransfer-pitcher.cpp @@ -36,12 +36,15 @@ void usleep(__int64 usec) LARGE_INTEGER ft; ft.QuadPart = -(10 * usec); // Convert to 100 nanosecond interval, negative value indicates relative time - + // NULL is used instead of nullptr for Windows APIs. Check + // https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175 timer = CreateWaitableTimer(NULL, TRUE, NULL); if (timer == nullptr) { throw std::runtime_error("Could not create waitable timer with error: " + std::to_string(GetLastError())); } + // NULL is used instead of nullptr for Windows APIs. Check + // https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175 SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); WaitForSingleObject(timer, INFINITE); CloseHandle(timer); diff --git a/Packet++/CMakeLists.txt b/Packet++/CMakeLists.txt index cc7a8268d2..bab9488be6 100644 --- a/Packet++/CMakeLists.txt +++ b/Packet++/CMakeLists.txt @@ -64,6 +64,7 @@ add_library( src/VrrpLayer.cpp src/VxlanLayer.cpp src/WakeOnLanLayer.cpp + src/WireGuardLayer.cpp # Force hash-library pcapng to be link fully static ) @@ -133,7 +134,8 @@ set(public_headers header/VlanLayer.h header/VrrpLayer.h header/VxlanLayer.h - header/WakeOnLanLayer.h) + header/WakeOnLanLayer.h + header/WireGuardLayer.h) # Don't use set_target_properties CMake limit to 50 elements set_property(TARGET Packet++ PROPERTY PUBLIC_HEADER ${public_headers}) diff --git a/Packet++/header/ArpLayer.h b/Packet++/header/ArpLayer.h index 8cdba5cf2d..4fb1b0db4c 100644 --- a/Packet++/header/ArpLayer.h +++ b/Packet++/header/ArpLayer.h @@ -67,9 +67,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ ArpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + : Layer(data, dataLen, prevLayer, packet, ARP) { - m_Protocol = ARP; m_DataLen = sizeof(arphdr); } @@ -84,8 +83,7 @@ namespace pcpp ArpLayer(ArpOpcode opCode, const MacAddress& senderMacAddr, const MacAddress& targetMacAddr, const IPv4Address& senderIpAddr, const IPv4Address& targetIpAddr); - ~ArpLayer() - {} + ~ArpLayer() override = default; /** * Get a pointer to the ARP header. Notice this points directly to the data, so every change will change the @@ -94,7 +92,7 @@ namespace pcpp */ inline arphdr* getArpHeader() const { - return (arphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -138,13 +136,13 @@ namespace pcpp /** * Does nothing for this layer (ArpLayer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return The size of @ref arphdr */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(arphdr); } @@ -157,7 +155,7 @@ namespace pcpp * - @ref arphdr#protocolSize = 4 (assume IPv4 over ARP) * - if it's an ARP request: @ref arphdr#targetMacAddr = MacAddress("00:00:00:00:00:00") */ - void computeCalculateFields(); + void computeCalculateFields() override; /** * Is this packet an ARP request? @@ -169,9 +167,9 @@ namespace pcpp */ bool isReply() const; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } diff --git a/Packet++/header/BgpLayer.h b/Packet++/header/BgpLayer.h index 478d0fc734..39030acf65 100644 --- a/Packet++/header/BgpLayer.h +++ b/Packet++/header/BgpLayer.h @@ -99,17 +99,17 @@ namespace pcpp /** * @return The size of the BGP message */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Multiple BGP messages can reside in a single packet, and the only layer that can come after a BGP message * is another BGP message. This method checks for remaining data and parses it as another BGP layer */ - void parseNextLayer(); + void parseNextLayer() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -120,21 +120,19 @@ namespace pcpp * - Set message type value * - Set message length */ - void computeCalculateFields(); + void computeCalculateFields() override; protected: // protected c'tors, this class cannot be instantiated by users BgpLayer() {} BgpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = BGP; - } + : Layer(data, dataLen, prevLayer, packet, BGP) + {} bgp_common_header* getBasicHeader() const { - return (bgp_common_header*)m_Data; + return reinterpret_cast(m_Data); } void setBgpFields(size_t messageLen = 0); @@ -224,7 +222,7 @@ namespace pcpp */ bgp_open_message* getOpenMsgHeader() const { - return (bgp_open_message*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -274,7 +272,7 @@ namespace pcpp // implement abstract methods - BgpMessageType getBgpMessageType() const + BgpMessageType getBgpMessageType() const override { return BgpLayer::Open; } @@ -390,7 +388,7 @@ namespace pcpp */ bgp_common_header* getBasicMsgHeader() const { - return (bgp_common_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -482,7 +480,7 @@ namespace pcpp // implement abstract methods - BgpMessageType getBgpMessageType() const + BgpMessageType getBgpMessageType() const override { return BgpLayer::Update; } @@ -563,7 +561,7 @@ namespace pcpp */ bgp_notification_message* getNotificationMsgHeader() const { - return (bgp_notification_message*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -608,7 +606,7 @@ namespace pcpp // implement abstract methods - BgpMessageType getBgpMessageType() const + BgpMessageType getBgpMessageType() const override { return BgpLayer::Notification; } @@ -654,12 +652,12 @@ namespace pcpp */ bgp_keepalive_message* getKeepaliveHeader() const { - return (bgp_keepalive_message*)getBasicHeader(); + return reinterpret_cast(getBasicHeader()); } // implement abstract methods - BgpMessageType getBgpMessageType() const + BgpMessageType getBgpMessageType() const override { return BgpLayer::Keepalive; } @@ -713,12 +711,12 @@ namespace pcpp */ bgp_route_refresh_message* getRouteRefreshHeader() const { - return (bgp_route_refresh_message*)getBasicHeader(); + return reinterpret_cast(getBasicHeader()); } // implement abstract methods - BgpMessageType getBgpMessageType() const + BgpMessageType getBgpMessageType() const override { return BgpLayer::RouteRefresh; } diff --git a/Packet++/header/CotpLayer.h b/Packet++/header/CotpLayer.h index 4d5544d7b2..3897e1eb83 100644 --- a/Packet++/header/CotpLayer.h +++ b/Packet++/header/CotpLayer.h @@ -37,10 +37,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ CotpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = COTP; - } + : Layer(data, dataLen, prevLayer, packet, COTP) + {} /** * A constructor that allocates a new COTP header @@ -48,8 +46,7 @@ namespace pcpp */ explicit CotpLayer(uint8_t tpduNumber); - virtual ~CotpLayer() - {} + ~CotpLayer() override = default; /** * @return COTP length @@ -121,7 +118,7 @@ namespace pcpp private: cotphdr* getCotpHeader() const { - return (cotphdr*)m_Data; + return reinterpret_cast(m_Data); } }; diff --git a/Packet++/header/DhcpLayer.h b/Packet++/header/DhcpLayer.h index 435becbdbc..90230593d7 100644 --- a/Packet++/header/DhcpLayer.h +++ b/Packet++/header/DhcpLayer.h @@ -408,8 +408,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - virtual ~DhcpOption() - {} + ~DhcpOption() override = default; /** * Retrieve DHCP option data as IPv4 address. Relevant only if option value is indeed an IPv4 address @@ -444,7 +443,8 @@ namespace pcpp if (m_Data == nullptr || m_Data->recordLen - valueOffset < 1) return ""; - return std::string((const char*)m_Data->recordValue + valueOffset, (int)m_Data->recordLen - valueOffset); + return std::string(reinterpret_cast(m_Data->recordValue) + valueOffset, + static_cast(m_Data->recordLen) - valueOffset); } /** @@ -458,7 +458,7 @@ namespace pcpp void setValueString(const std::string& stringValue, int valueOffset = 0) { // calculate the maximum length of the destination buffer - size_t len = (size_t)m_Data->recordLen - (size_t)valueOffset; + size_t len = static_cast(m_Data->recordLen) - static_cast(valueOffset); // use the length of input string if a buffer is large enough for whole string if (stringValue.length() < len) @@ -475,14 +475,15 @@ namespace pcpp */ static bool canAssign(const uint8_t* recordRawData, size_t tlvDataLen) { - auto data = (TLVRawData*)recordRawData; + auto data = reinterpret_cast(recordRawData); if (data == nullptr) return false; if (tlvDataLen < sizeof(TLVRawData::recordType)) return false; - if (data->recordType == (uint8_t)DHCPOPT_END || data->recordType == (uint8_t)DHCPOPT_PAD) + if (data->recordType == static_cast(DHCPOPT_END) || + data->recordType == static_cast(DHCPOPT_PAD)) return true; return TLVRecord::canAssign(recordRawData, tlvDataLen); @@ -490,23 +491,25 @@ namespace pcpp // implement abstract methods - size_t getTotalSize() const + size_t getTotalSize() const override { if (m_Data == nullptr) return 0; - if (m_Data->recordType == (uint8_t)DHCPOPT_END || m_Data->recordType == (uint8_t)DHCPOPT_PAD) + if (m_Data->recordType == static_cast(DHCPOPT_END) || + m_Data->recordType == static_cast(DHCPOPT_PAD)) return sizeof(uint8_t); - return sizeof(uint8_t) * 2 + (size_t)m_Data->recordLen; + return sizeof(uint8_t) * 2 + static_cast(m_Data->recordLen); } - size_t getDataSize() const + size_t getDataSize() const override { if (m_Data == nullptr) return 0; - if (m_Data->recordType == (uint8_t)DHCPOPT_END || m_Data->recordType == (uint8_t)DHCPOPT_PAD) + if (m_Data->recordType == static_cast(DHCPOPT_END) || + m_Data->recordType == static_cast(DHCPOPT_PAD)) return 0; return m_Data->recordLen; @@ -530,7 +533,7 @@ namespace pcpp * @param[in] optionValueLen DHCP option value length in bytes */ DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t* optionValue, uint8_t optionValueLen) - : TLVRecordBuilder((uint8_t)optionType, optionValue, optionValueLen) + : TLVRecordBuilder(static_cast(optionType), optionValue, optionValueLen) {} /** @@ -540,7 +543,7 @@ namespace pcpp * @param[in] optionValue A 1-byte option value */ DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -550,7 +553,7 @@ namespace pcpp * @param[in] optionValue A 2-byte option value */ DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -560,7 +563,7 @@ namespace pcpp * @param[in] optionValue A 4-byte option value */ DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -570,7 +573,7 @@ namespace pcpp * @param[in] optionValue The IPv4 address option value */ DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address& optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -580,7 +583,7 @@ namespace pcpp * @param[in] optionValue The string option value */ DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string& optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -640,8 +643,7 @@ namespace pcpp /** * A destructor for this layer */ - virtual ~DhcpLayer() - {} + ~DhcpLayer() override = default; /** * Get a pointer to the DHCP header. Notice this points directly to the data, so every change will change the @@ -650,7 +652,7 @@ namespace pcpp */ dhcp_header* getDhcpHeader() const { - return (dhcp_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -658,7 +660,7 @@ namespace pcpp */ BootpOpCodes getOpCode() const { - return (BootpOpCodes)getDhcpHeader()->opCode; + return static_cast(getDhcpHeader()->opCode); } /** @@ -834,13 +836,13 @@ namespace pcpp /** * Does nothing for this layer (DhcpLayer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return The size of @ref dhcp_header + size of options */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } @@ -855,11 +857,11 @@ namespace pcpp * - @ref dhcp_header#hardwareType = 1 (Ethernet) * - @ref dhcp_header#hardwareAddressLength = 6 (MAC address length) */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } diff --git a/Packet++/header/DhcpV6Layer.h b/Packet++/header/DhcpV6Layer.h index 57e0edb5fc..5a07cdad6b 100644 --- a/Packet++/header/DhcpV6Layer.h +++ b/Packet++/header/DhcpV6Layer.h @@ -205,8 +205,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - virtual ~DhcpV6Option() - {} + ~DhcpV6Option() override = default; /** * @return The option type converted to ::DhcpV6OptionType enum @@ -220,8 +219,8 @@ namespace pcpp // implement abstract methods - size_t getTotalSize() const; - size_t getDataSize() const; + size_t getTotalSize() const override; + size_t getDataSize() const override; }; /** @@ -415,13 +414,13 @@ namespace pcpp /** * Does nothing for this layer (DhcpV6Layer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return The size of @ref dhcpv6_header + size of options */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } @@ -429,12 +428,12 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -446,7 +445,7 @@ namespace pcpp } dhcpv6_header* getDhcpHeader() const { - return (dhcpv6_header*)m_Data; + return reinterpret_cast(m_Data); } DhcpV6Option addOptionAt(const DhcpV6OptionBuilder& optionBuilder, int offset); diff --git a/Packet++/header/DnsLayer.h b/Packet++/header/DnsLayer.h index 06819a791a..7749989af3 100644 --- a/Packet++/header/DnsLayer.h +++ b/Packet++/header/DnsLayer.h @@ -125,7 +125,7 @@ namespace pcpp */ DnsLayer& operator=(const DnsLayer& other); - virtual ~DnsLayer(); + ~DnsLayer() override; /** * Get a pointer to the DNS header (as opposed to the DNS data which is the queries, answers, etc. Data can be @@ -434,14 +434,14 @@ namespace pcpp /** * Does nothing for this layer (DnsLayer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return The size of the DNS data in the packet including he DNS header and size of all queries, answers, * authorities and additional records */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } // No layer above DNS @@ -449,12 +449,12 @@ namespace pcpp /** * Does nothing for this layer */ - virtual void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -566,7 +566,7 @@ namespace pcpp /** * Calculate the TCP message length field */ - void computeCalculateFields(); + void computeCalculateFields() override; }; // implementation of inline methods diff --git a/Packet++/header/DnsResource.h b/Packet++/header/DnsResource.h index af34fe621f..b1b47cfd25 100644 --- a/Packet++/header/DnsResource.h +++ b/Packet++/header/DnsResource.h @@ -61,8 +61,7 @@ namespace pcpp void setDnsLayer(DnsLayer* dnsLayer, size_t offsetInLayer); public: - virtual ~IDnsResource() - {} + virtual ~IDnsResource() = default; /** * @return The DNS type of this record @@ -146,15 +145,14 @@ namespace pcpp {} public: - virtual ~DnsQuery() - {} + ~DnsQuery() override = default; // implementation of abstract methods - virtual size_t getSize() const + size_t getSize() const override { return m_NameLength + 2 * sizeof(uint16_t); } - virtual DnsResourceType getType() const + DnsResourceType getType() const override { return DnsQueryType; } @@ -182,8 +180,7 @@ namespace pcpp {} public: - virtual ~DnsResource() - {} + ~DnsResource() override = default; /** * @return The time-to-leave value for this record @@ -260,11 +257,11 @@ namespace pcpp void setCustomDnsClass(uint16_t customValue); // implementation of abstract methods - virtual size_t getSize() const + size_t getSize() const override { return m_NameLength + 3 * sizeof(uint16_t) + sizeof(uint32_t) + getDataLength(); } - virtual DnsResourceType getType() const + DnsResourceType getType() const override { return m_ResourceType; } diff --git a/Packet++/header/DnsResourceData.h b/Packet++/header/DnsResourceData.h index 990990a29b..082670bcc6 100644 --- a/Packet++/header/DnsResourceData.h +++ b/Packet++/header/DnsResourceData.h @@ -40,8 +40,7 @@ namespace pcpp /** * A virtual d'tor, does nothing */ - virtual ~IDnsResourceData() - {} + virtual ~IDnsResourceData() = default; /** * A templated method which takes a class that derives from IDnsResourceData as the template argument and @@ -142,8 +141,7 @@ namespace pcpp StringDnsResourceData(const uint8_t* dataPtr, size_t dataLen, IDnsResource* dnsResource); - ~StringDnsResourceData() - {} + ~StringDnsResourceData() override = default; /** * Equality operator overload for this class that compares the strings stored in each object @@ -157,11 +155,11 @@ namespace pcpp // implement abstract methods - std::string toString() const + std::string toString() const override { return m_Data; } - bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const; + bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const override; }; /** @@ -215,11 +213,11 @@ namespace pcpp // implement abstract methods - std::string toString() const + std::string toString() const override { return m_Data.toString(); } - bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const; + bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const override; }; /** @@ -273,11 +271,11 @@ namespace pcpp // implement abstract methods - std::string toString() const + std::string toString() const override { return m_Data.toString(); } - bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const; + bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const override; }; /** @@ -319,8 +317,7 @@ namespace pcpp */ MxDnsResourceData(const uint16_t& preference, const std::string& mailExchange); - ~MxDnsResourceData() - {} + ~MxDnsResourceData() override = default; /** * Equality operator overload for this class that compares the MX data stored in each object @@ -351,9 +348,9 @@ namespace pcpp * A string representation of the MX data stored in this object. The string format is as follows: * 'pref: {preference_value}; mx: {mail_exchange_hostname_value}' */ - std::string toString() const; + std::string toString() const override; - bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const; + bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const override; private: MxData m_Data; @@ -391,7 +388,7 @@ namespace pcpp */ GenericDnsResourceData(const GenericDnsResourceData& other); - ~GenericDnsResourceData() + ~GenericDnsResourceData() override { if (m_Data != nullptr) delete[] m_Data; @@ -408,8 +405,8 @@ namespace pcpp // implement abstract methods - std::string toString() const; - bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const; + std::string toString() const override; + bool toByteArr(uint8_t* arr, size_t& arrLength, IDnsResource* dnsResource) const override; }; } // namespace pcpp diff --git a/Packet++/header/EthDot3Layer.h b/Packet++/header/EthDot3Layer.h index 99d7845cad..c2a39e9afe 100644 --- a/Packet++/header/EthDot3Layer.h +++ b/Packet++/header/EthDot3Layer.h @@ -41,10 +41,9 @@ namespace pcpp * @param[in] dataLen Size of the data in bytes * @param[in] packet A pointer to the Packet instance where layer will be stored in */ - EthDot3Layer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet) - { - m_Protocol = EthernetDot3; - } + EthDot3Layer(uint8_t* data, size_t dataLen, Packet* packet) + : Layer(data, dataLen, nullptr, packet, EthernetDot3) + {} /** * A constructor that creates the layer from an existing packet raw data @@ -54,10 +53,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ EthDot3Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = EthernetDot3; - } + : Layer(data, dataLen, prevLayer, packet, EthernetDot3) + {} /** * A constructor that creates a new IEEE 802.3 Ethernet header and allocates the data @@ -67,8 +64,7 @@ namespace pcpp */ EthDot3Layer(const MacAddress& sourceMac, const MacAddress& destMac, uint16_t length); - ~EthDot3Layer() - {} + ~EthDot3Layer() override = default; /** * Get a pointer to the Ethernet header. Notice this points directly to the data, so every change will change @@ -77,7 +73,7 @@ namespace pcpp */ ether_dot3_header* getEthHeader() const { - return (ether_dot3_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -121,12 +117,12 @@ namespace pcpp /** * Parses next layer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of ether_dot3_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(ether_dot3_header); } @@ -134,12 +130,12 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/EthLayer.h b/Packet++/header/EthLayer.h index d6f87d1f95..4e9a354c80 100644 --- a/Packet++/header/EthLayer.h +++ b/Packet++/header/EthLayer.h @@ -78,10 +78,8 @@ namespace pcpp * @param[in] dataLen Size of the data in bytes * @param[in] packet A pointer to the Packet instance where layer will be stored in */ - EthLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet) - { - m_Protocol = Ethernet; - } + EthLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet, Ethernet) + {} /** * A constructor that creates the layer from an existing packet raw data @@ -91,10 +89,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ EthLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = Ethernet; - } + : Layer(data, dataLen, prevLayer, packet, Ethernet) + {} /** * A constructor that creates a new Ethernet header and allocates the data @@ -105,8 +101,7 @@ namespace pcpp */ EthLayer(const MacAddress& sourceMac, const MacAddress& destMac, uint16_t etherType = 0); - ~EthLayer() - {} + ~EthLayer() override = default; /** * Get a pointer to the Ethernet header. Notice this points directly to the data, so every change will change @@ -115,7 +110,7 @@ namespace pcpp */ inline ether_header* getEthHeader() const { - return (ether_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -160,12 +155,12 @@ namespace pcpp * Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, PPPoESessionLayer, * PPPoEDiscoveryLayer, MplsLayer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of ether_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(ether_header); } @@ -173,11 +168,11 @@ namespace pcpp /** * Calculate ether_header#etherType for known protocols: IPv4, IPv6, ARP, VLAN */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/FtpLayer.h b/Packet++/header/FtpLayer.h index 2bd5523cba..0b429ffcd5 100644 --- a/Packet++/header/FtpLayer.h +++ b/Packet++/header/FtpLayer.h @@ -19,14 +19,9 @@ namespace pcpp { protected: FtpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : SingleCommandTextProtocol(data, dataLen, prevLayer, packet) - { - m_Protocol = FTP; - }; - FtpLayer(const std::string& command, const std::string& option) : SingleCommandTextProtocol(command, option) - { - m_Protocol = FTP; - }; + : SingleCommandTextProtocol(data, dataLen, prevLayer, packet, FTP) {}; + FtpLayer(const std::string& command, const std::string& option) + : SingleCommandTextProtocol(command, option, FTP) {}; public: /** @@ -50,25 +45,25 @@ namespace pcpp // overridden methods /// FTP is the always last so does nothing for this layer - void parseNextLayer() + void parseNextLayer() override {} /** * @return Get the size of the layer */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return The OSI layer level of FTP (Application Layer). */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -302,7 +297,7 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; /** @@ -494,7 +489,7 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; /** @@ -518,6 +513,6 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; } // namespace pcpp diff --git a/Packet++/header/GreLayer.h b/Packet++/header/GreLayer.h index e5aaabaff1..53a6cc4229 100644 --- a/Packet++/header/GreLayer.h +++ b/Packet++/header/GreLayer.h @@ -104,8 +104,7 @@ namespace pcpp class GreLayer : public Layer { public: - virtual ~GreLayer() - {} + ~GreLayer() override = default; /** * A static method that determines the GRE version of GRE layer raw data by looking at the @@ -147,21 +146,21 @@ namespace pcpp * IPv4Layer, IPv6Layer, VlanLayer, MplsLayer, PPP_PPTPLayer, EthLayer, EthDot3Layer * Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of GRE header (may change if optional fields are added or removed) */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } protected: - GreLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + GreLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol) + : Layer(data, dataLen, prevLayer, packet, protocol) {} GreLayer() @@ -196,18 +195,15 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ GREv0Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : GreLayer(data, dataLen, prevLayer, packet) - { - m_Protocol = GREv0; - } + : GreLayer(data, dataLen, prevLayer, packet, GREv0) + {} /** * A constructor that creates a new GREv0 header and allocates the data */ GREv0Layer(); - virtual ~GREv0Layer() - {} + ~GREv0Layer() override = default; /** * Get a pointer to the basic GRE header containing only non-optional fields. Notice this points directly to the @@ -220,7 +216,7 @@ namespace pcpp */ gre_basic_header* getGreHeader() const { - return (gre_basic_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -303,9 +299,9 @@ namespace pcpp * - gre_basic_header#protocol * - GRE checksum field (if exists in packet) */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; }; /** @@ -322,10 +318,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ GREv1Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : GreLayer(data, dataLen, prevLayer, packet) - { - m_Protocol = GREv1; - } + : GreLayer(data, dataLen, prevLayer, packet, GREv1) + {} /** * A constructor that creates a new GREv1 header and allocates the data @@ -333,8 +327,7 @@ namespace pcpp */ explicit GREv1Layer(uint16_t callID); - virtual ~GREv1Layer() - {} + ~GREv1Layer() override = default; /** * Get a pointer to the basic GREv1 header containing all non-optional fields. Notice this points directly to @@ -348,7 +341,7 @@ namespace pcpp */ gre1_header* getGreHeader() const { - return (gre1_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -393,9 +386,9 @@ namespace pcpp * - gre1_header#payloadLength * - gre_basic_header#protocol */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; }; /** @@ -414,10 +407,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ PPP_PPTPLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = PPP_PPTP; - } + : Layer(data, dataLen, prevLayer, packet, PPP_PPTP) + {} /** * A constructor that allocates a new PPP-PPTP header @@ -426,8 +417,7 @@ namespace pcpp */ PPP_PPTPLayer(uint8_t address, uint8_t control); - ~PPP_PPTPLayer() - {} + ~PPP_PPTPLayer() override = default; /** * Get a pointer to the PPP-PPTP header. Notice this points directly to the data, so every change will change @@ -436,7 +426,7 @@ namespace pcpp */ ppp_pptp_header* getPPP_PPTPHeader() const { - return (ppp_pptp_header*)m_Data; + return reinterpret_cast(m_Data); } // implement abstract methods @@ -444,12 +434,12 @@ namespace pcpp /** * Currently identifies the following next layers: IPv4Layer, IPv6Layer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return The size of @ref ppp_pptp_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(ppp_pptp_header); } @@ -458,14 +448,14 @@ namespace pcpp * Calculate the following fields: * - ppp_pptp_header#protocol */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const + std::string toString() const override { return "PPP for PPTP Layer"; } - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelSesionLayer; } diff --git a/Packet++/header/GtpLayer.h b/Packet++/header/GtpLayer.h index 1849c42fb3..ffebf04513 100644 --- a/Packet++/header/GtpLayer.h +++ b/Packet++/header/GtpLayer.h @@ -307,8 +307,7 @@ namespace pcpp GtpExtension getNextExtension() const; }; // GtpExtension - virtual ~GtpV1Layer() - {} + ~GtpV1Layer() override = default; /** A constructor that creates the layer from an existing packet raw data * @param[in] data A pointer to the raw data @@ -317,10 +316,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ GtpV1Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = GTPv1; - } + : Layer(data, dataLen, prevLayer, packet, GTPv1) + {} /** * A constructor that creates a new GTPv1 layer and sets the message type and the TEID value @@ -359,7 +356,7 @@ namespace pcpp */ gtpv1_header* getHeader() const { - return (gtpv1_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -456,7 +453,7 @@ namespace pcpp /** * Identifies the following next layers for GTP-U packets: IPv4Layer, IPv6Layer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return The size of the GTP header. For GTP-C packets the size is determined by the value of @@ -464,17 +461,17 @@ namespace pcpp * the size of gtpv1_header plus the size of the optional fields such as sequence number, N-PDU * or extensions if exist) */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Calculate the following fields: * - gtpv1_header#messageLength */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelTransportLayer; } diff --git a/Packet++/header/HttpLayer.h b/Packet++/header/HttpLayer.h index 18e9cf97f6..cc22499b44 100644 --- a/Packet++/header/HttpLayer.h +++ b/Packet++/header/HttpLayer.h @@ -73,8 +73,7 @@ namespace pcpp class HttpMessage : public TextBasedProtocolMessage { public: - virtual ~HttpMessage() - {} + ~HttpMessage() override = default; /** * A static method that checks whether the port is considered as HTTP @@ -88,20 +87,20 @@ namespace pcpp // overridden methods - virtual HeaderField* addField(const std::string& fieldName, const std::string& fieldValue); - virtual HeaderField* addField(const HeaderField& newField); - virtual HeaderField* insertField(HeaderField* prevField, const std::string& fieldName, - const std::string& fieldValue); - virtual HeaderField* insertField(HeaderField* prevField, const HeaderField& newField); + HeaderField* addField(const std::string& fieldName, const std::string& fieldValue) override; + HeaderField* addField(const HeaderField& newField) override; + HeaderField* insertField(HeaderField* prevField, const std::string& fieldName, + const std::string& fieldValue) override; + HeaderField* insertField(HeaderField* prevField, const HeaderField& newField) override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } protected: - HttpMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : TextBasedProtocolMessage(data, dataLen, prevLayer, packet) + HttpMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol) + : TextBasedProtocolMessage(data, dataLen, prevLayer, packet, protocol) {} HttpMessage() : TextBasedProtocolMessage() {} @@ -114,11 +113,11 @@ namespace pcpp } // implementation of abstract methods - char getHeaderFieldNameValueSeparator() const + char getHeaderFieldNameValueSeparator() const override { return ':'; } - bool spacesAllowedBetweenHeaderFieldNameAndValue() const + bool spacesAllowedBetweenHeaderFieldNameAndValue() const override { return true; } @@ -187,7 +186,7 @@ namespace pcpp */ HttpRequestLayer(HttpMethod method, const std::string& uri, HttpVersion version); - virtual ~HttpRequestLayer(); + ~HttpRequestLayer() override; /** * A copy constructor for this layer. This copy constructor inherits base copy constructor @@ -222,7 +221,7 @@ namespace pcpp std::string getUrl() const; // implement Layer's abstract methods - std::string toString() const; + std::string toString() const override; private: HttpRequestFirstLine* m_FirstLine; @@ -554,7 +553,7 @@ namespace pcpp */ explicit HttpResponseLayer(HttpVersion version, const HttpResponseStatusCode& statusCode); - virtual ~HttpResponseLayer(); + ~HttpResponseLayer() override; /** * A copy constructor for this layer. This copy constructor inherits base copy constructor @@ -606,7 +605,7 @@ namespace pcpp // implement Layer's abstract methods - std::string toString() const; + std::string toString() const override; private: HttpResponseFirstLine* m_FirstLine; diff --git a/Packet++/header/IPLayer.h b/Packet++/header/IPLayer.h index b65f4217a7..187f4e439e 100644 --- a/Packet++/header/IPLayer.h +++ b/Packet++/header/IPLayer.h @@ -21,8 +21,7 @@ namespace pcpp class IPLayer { protected: - IPLayer() - {} + IPLayer() = default; public: /** @@ -40,7 +39,6 @@ namespace pcpp /** * An empty destructor */ - virtual ~IPLayer() - {} + virtual ~IPLayer() = default; }; } // namespace pcpp diff --git a/Packet++/header/IPReassembly.h b/Packet++/header/IPReassembly.h index cf16724f3e..54571ebd5c 100644 --- a/Packet++/header/IPReassembly.h +++ b/Packet++/header/IPReassembly.h @@ -201,17 +201,17 @@ namespace pcpp // implement abstract methods - uint32_t getHashValue() const; + uint32_t getHashValue() const override; /** * @return pcpp#IPv4 protocol */ - ProtocolType getProtocolType() const + ProtocolType getProtocolType() const override { return IPv4; } - PacketKey* clone() const + PacketKey* clone() const override { return new IPv4PacketKey(*this); } @@ -319,17 +319,17 @@ namespace pcpp // implement abstract methods - uint32_t getHashValue() const; + uint32_t getHashValue() const override; /** * @return pcpp#IPv6 protocol */ - ProtocolType getProtocolType() const + ProtocolType getProtocolType() const override { return IPv6; } - PacketKey* clone() const + PacketKey* clone() const override { return new IPv6PacketKey(*this); } diff --git a/Packet++/header/IPSecLayer.h b/Packet++/header/IPSecLayer.h index ef116654b4..2ef17bd905 100644 --- a/Packet++/header/IPSecLayer.h +++ b/Packet++/header/IPSecLayer.h @@ -58,10 +58,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ AuthenticationHeaderLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = AuthenticationHeader; - } + : Layer(data, dataLen, prevLayer, packet, AuthenticationHeader) + {} /** * Get a pointer to the raw AH header. Notice this points directly to the data, so every change will change the @@ -70,7 +68,7 @@ namespace pcpp */ ipsec_authentication_header* getAHHeader() const { - return (ipsec_authentication_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -111,26 +109,26 @@ namespace pcpp /** * @return The size of the AH header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { - return 4 * (getAHHeader()->payloadLen + 2); + return static_cast(4) * (getAHHeader()->payloadLen + 2); } /** * Currently identifies the following next layers: UdpLayer, TcpLayer, IPv4Layer, IPv6Layer and ESPLayer. * Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } @@ -155,14 +153,12 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ ESPLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = ESP; - } + : Layer(data, dataLen, prevLayer, packet, ESP) + {} ipsec_esp* getESPHeader() const { - return (ipsec_esp*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -188,7 +184,7 @@ namespace pcpp /** * @return The size of the ESP header (8 bytes) */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(ipsec_esp); } @@ -196,17 +192,17 @@ namespace pcpp /** * The payload of an ESP layer is encrypted, hence the next layer is always a generic payload (PayloadLayer) */ - void parseNextLayer(); + void parseNextLayer() override; /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelTransportLayer; } diff --git a/Packet++/header/IPv4Layer.h b/Packet++/header/IPv4Layer.h index d88133fd39..4d7317872b 100644 --- a/Packet++/header/IPv4Layer.h +++ b/Packet++/header/IPv4Layer.h @@ -226,8 +226,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - ~IPv4Option() - {} + ~IPv4Option() override = default; /** * A method for parsing the IPv4 option value as a list of IPv4 addresses. This method is relevant only for @@ -347,7 +346,7 @@ namespace pcpp // implement abstract methods - size_t getTotalSize() const + size_t getTotalSize() const override { if (m_Data == nullptr) return 0; @@ -359,7 +358,7 @@ namespace pcpp return static_cast(m_Data->recordLen); } - size_t getDataSize() const + size_t getDataSize() const override { if (m_Data == nullptr) return 0; @@ -505,7 +504,7 @@ namespace pcpp */ iphdr* getIPv4Header() const { - return (iphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -513,7 +512,7 @@ namespace pcpp * but adds a level of abstraction because IPAddress can be used for both IPv4 and IPv6 addresses * @return An IPAddress containing the source address */ - IPAddress getSrcIPAddress() const + IPAddress getSrcIPAddress() const override { return getSrcIPv4Address(); } @@ -541,7 +540,7 @@ namespace pcpp * but adds a level of abstraction because IPAddress can be used for both IPv4 and IPv6 addresses * @return An IPAddress containing the destination address */ - IPAddress getDstIPAddress() const + IPAddress getDstIPAddress() const override { return getDstIPv4Address(); } @@ -673,12 +672,12 @@ namespace pcpp * * Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of IPv4 header (including IPv4 options if exist) */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return static_cast(static_cast(getIPv4Header()->internetHeaderLength) * 4) + m_TempHeaderExtension; @@ -692,11 +691,11 @@ namespace pcpp * - iphdr#protocol = calculated if next layer is known: ::PACKETPP_IPPROTO_TCP for TCP, ::PACKETPP_IPPROTO_UDP * for UDP, ::PACKETPP_IPPROTO_ICMP for ICMP */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } diff --git a/Packet++/header/IPv6Extensions.h b/Packet++/header/IPv6Extensions.h index 92bd16740f..b459f30d8b 100644 --- a/Packet++/header/IPv6Extensions.h +++ b/Packet++/header/IPv6Extensions.h @@ -576,7 +576,7 @@ namespace pcpp * calculation is: [ 4 * (ipv6_authentication_header#headerLen + 2) ] * @return The length of this extension */ - size_t getExtensionLen() const + size_t getExtensionLen() const override { return 4 * (getBaseHeader()->headerLen + 2); } diff --git a/Packet++/header/IPv6Layer.h b/Packet++/header/IPv6Layer.h index d3c2096e23..2c96f5f35d 100644 --- a/Packet++/header/IPv6Layer.h +++ b/Packet++/header/IPv6Layer.h @@ -83,7 +83,7 @@ namespace pcpp /** * A destructor for this layer */ - ~IPv6Layer(); + ~IPv6Layer() override; /** * An assignment operator that first delete all data from current layer and then copy the entire header from the @@ -98,7 +98,7 @@ namespace pcpp */ ip6_hdr* getIPv6Header() const { - return (ip6_hdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -106,7 +106,7 @@ namespace pcpp * but adds a level of abstraction because IPAddress can be used for both IPv4 and IPv6 addresses * @return An IPAddress containing the source address */ - IPAddress getSrcIPAddress() const + IPAddress getSrcIPAddress() const override { return getSrcIPv6Address(); } @@ -143,7 +143,7 @@ namespace pcpp * but adds a level of abstraction because IPAddress can be used for both IPv4 and IPv6 addresses * @return An IPAddress containing the destination address */ - IPAddress getDstIPAddress() const + IPAddress getDstIPAddress() const override { return getDstIPv6Address(); } @@ -213,12 +213,12 @@ namespace pcpp * * Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of @ref ip6_hdr */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(ip6_hdr) + m_ExtensionsLen; } @@ -230,11 +230,11 @@ namespace pcpp * - ip6_hdr#nextHeader = calculated if next layer is known: ::PACKETPP_IPPROTO_TCP for TCP, * ::PACKETPP_IPPROTO_UDP for UDP, ::PACKETPP_IPPROTO_ICMP for ICMP */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } diff --git a/Packet++/header/IcmpLayer.h b/Packet++/header/IcmpLayer.h index f90c44ab7d..f1330ec4c0 100644 --- a/Packet++/header/IcmpLayer.h +++ b/Packet++/header/IcmpLayer.h @@ -385,10 +385,8 @@ namespace pcpp */ // cppcheck-suppress uninitMemberVar IcmpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = ICMP; - } + : Layer(data, dataLen, prevLayer, packet, ICMP) + {} /** * An empty constructor that creates a new layer with an empty ICMP header without setting the ICMP type or ICMP @@ -396,8 +394,7 @@ namespace pcpp */ IcmpLayer(); - virtual ~IcmpLayer() - {} + ~IcmpLayer() override = default; /** * Get a pointer to the basic ICMP header. Notice this points directly to the data, so every change will change @@ -406,7 +403,7 @@ namespace pcpp */ icmphdr* getIcmpHeader() const { - return (icmphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -708,23 +705,23 @@ namespace pcpp * ICMP_PARAM_PROBLEM have data that contains IPv4 header and some L4 header (TCP/UDP/ICMP). This method parses * these headers as separate layers on top of the ICMP layer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return The ICMP header length. This length varies according to the ICMP message type. This length doesn't * include IPv4 and L4 headers in case ICMP message type are: ICMP_DEST_UNREACHABLE, ICMP_SOURCE_QUENCH, * ICMP_TIME_EXCEEDED, ICMP_REDIRECT, ICMP_PARAM_PROBLEM */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Calculate ICMP checksum field */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } diff --git a/Packet++/header/IcmpV6Layer.h b/Packet++/header/IcmpV6Layer.h index 1d834957a4..0ee8cd12e8 100644 --- a/Packet++/header/IcmpV6Layer.h +++ b/Packet++/header/IcmpV6Layer.h @@ -140,10 +140,8 @@ namespace pcpp * @param packet A pointer to the Packet instance where layer will be stored in */ IcmpV6Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = ICMPv6; - } + : Layer(data, dataLen, prevLayer, packet, ICMPv6) + {} /** * A constructor that allocates a new ICMPv6 layer with type, code and data @@ -154,8 +152,7 @@ namespace pcpp */ IcmpV6Layer(ICMPv6MessageType msgType, uint8_t code, const uint8_t* data, size_t dataLen); - virtual ~IcmpV6Layer() - {} + ~IcmpV6Layer() override = default; /** * A static method that creates an ICMPv6 layer from packet raw data @@ -194,13 +191,13 @@ namespace pcpp /** * Does nothing for this layer. ICMPv6 is the last layer. */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return The size of the ICMPv6 message */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } @@ -208,14 +205,14 @@ namespace pcpp /** * Calculate ICMPv6 checksum field */ - void computeCalculateFields(); + void computeCalculateFields() override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } - std::string toString() const; + std::string toString() const override; protected: IcmpV6Layer() = default; @@ -224,7 +221,7 @@ namespace pcpp void calculateChecksum(); icmpv6hdr* getIcmpv6Header() const { - return (icmpv6hdr*)m_Data; + return reinterpret_cast(m_Data); } }; @@ -267,8 +264,7 @@ namespace pcpp */ ICMPv6EchoLayer(ICMPv6EchoType echoType, uint16_t id, uint16_t sequence, const uint8_t* data, size_t dataLen); - virtual ~ICMPv6EchoLayer() - {} + ~ICMPv6EchoLayer() override = default; /** * @return Identifier in host representation @@ -296,12 +292,12 @@ namespace pcpp return m_Data + sizeof(icmpv6_echo_hdr); } - std::string toString() const; + std::string toString() const override; private: icmpv6_echo_hdr* getEchoHeader() const { - return (icmpv6_echo_hdr*)m_Data; + return reinterpret_cast(m_Data); } }; diff --git a/Packet++/header/IgmpLayer.h b/Packet++/header/IgmpLayer.h index 5720bd4ca8..97b1b5f46d 100644 --- a/Packet++/header/IgmpLayer.h +++ b/Packet++/header/IgmpLayer.h @@ -162,10 +162,8 @@ namespace pcpp { protected: IgmpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType igmpVer) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = igmpVer; - } + : Layer(data, dataLen, prevLayer, packet, igmpVer) + {} IgmpLayer(IgmpType type, const IPv4Address& groupAddr, uint8_t maxResponseTime, ProtocolType igmpVer); @@ -174,8 +172,7 @@ namespace pcpp size_t getHeaderSizeByVerAndType(ProtocolType igmpVer, IgmpType igmpType) const; public: - virtual ~IgmpLayer() - {} + ~IgmpLayer() override = default; /** * Get a pointer to the raw IGMPv1/IGMPv2 header. Notice this points directly to the data, so every change will @@ -184,7 +181,7 @@ namespace pcpp */ igmp_header* getIgmpHeader() const { - return (igmp_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -228,20 +225,20 @@ namespace pcpp /** * Does nothing for this layer (IGMP layer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return Size of IGMP header = 8B */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(igmp_header); } - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } @@ -278,15 +275,14 @@ namespace pcpp /** * A destructor for this layer (does nothing) */ - ~IgmpV1Layer() - {} + ~IgmpV1Layer() override = default; // implement abstract methods /** * Calculate the IGMP checksum and set igmp_header#maxResponseTime to 0 (this field is unused in IGMPv1) */ - void computeCalculateFields(); + void computeCalculateFields() override; }; /** @@ -322,15 +318,14 @@ namespace pcpp /** * A destructor for this layer (does nothing) */ - ~IgmpV2Layer() - {} + ~IgmpV2Layer() override = default; // implement abstract methods /** * Calculate the IGMP checksum */ - void computeCalculateFields(); + void computeCalculateFields() override; }; /** @@ -368,7 +363,7 @@ namespace pcpp */ igmpv3_query_header* getIgmpV3QueryHeader() const { - return (igmpv3_query_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -425,13 +420,13 @@ namespace pcpp /** * Calculate the IGMP checksum */ - void computeCalculateFields(); + void computeCalculateFields() override; /** * @return The message size in bytes which include the size of the basic header + the size of the source address * list */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; }; /** @@ -468,7 +463,7 @@ namespace pcpp */ igmpv3_report_header* getReportHeader() const { - return (igmpv3_report_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -541,13 +536,13 @@ namespace pcpp /** * Calculate the IGMP checksum */ - void computeCalculateFields(); + void computeCalculateFields() override; /** * @return The message size in bytes which include the size of the basic header + the size of the group record * list */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } diff --git a/Packet++/header/LLCLayer.h b/Packet++/header/LLCLayer.h index f88eacb7c2..a3595a107c 100644 --- a/Packet++/header/LLCLayer.h +++ b/Packet++/header/LLCLayer.h @@ -41,10 +41,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ LLCLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = LLC; - } + : Layer(data, dataLen, prevLayer, packet, LLC) + {} /** * A constructor that creates the LLC layer from provided values @@ -60,22 +58,22 @@ namespace pcpp */ inline llc_header* getLlcHeader() const { - return (llc_header*)m_Data; + return reinterpret_cast(m_Data); }; // overridden methods /// Parses the next layer. Currently only STP supported as next layer - void parseNextLayer(); + void parseNextLayer() override; /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return Get the size of the LLC header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(llc_header); } @@ -83,12 +81,12 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; /** * @return The OSI layer level of LLC (Data Link Layer). */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/Layer.h b/Packet++/header/Layer.h index 4685ca0677..828cb5c84f 100644 --- a/Packet++/header/Layer.h +++ b/Packet++/header/Layer.h @@ -29,8 +29,7 @@ namespace pcpp */ virtual uint8_t* getDataPtr(size_t offset = 0) const = 0; - virtual ~IDataContainer() - {} + virtual ~IDataContainer() = default; }; class Packet; @@ -75,7 +74,7 @@ namespace pcpp * A destructor for this class. Frees the data if it was allocated by the layer constructor (see * isAllocatedToPacket() for more info) */ - virtual ~Layer(); + ~Layer() override; /** * @return A pointer to the next layer in the protocol stack or nullptr if the layer is the last one @@ -164,9 +163,9 @@ namespace pcpp // implement abstract methods - uint8_t* getDataPtr(size_t offset = 0) const + uint8_t* getDataPtr(size_t offset = 0) const override { - return (uint8_t*)(m_Data + offset); + return static_cast(m_Data + offset); } // abstract methods @@ -211,8 +210,8 @@ namespace pcpp m_PrevLayer(nullptr), m_IsAllocatedInPacket(false) {} - Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : m_Data(data), m_DataLen(dataLen), m_Packet(packet), m_Protocol(UnknownProtocol), m_NextLayer(nullptr), + Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol = UnknownProtocol) + : m_Data(data), m_DataLen(dataLen), m_Packet(packet), m_Protocol(protocol), m_NextLayer(nullptr), m_PrevLayer(prevLayer), m_IsAllocatedInPacket(false) {} diff --git a/Packet++/header/LdapLayer.h b/Packet++/header/LdapLayer.h index c2d68a26e3..e3813ebc30 100644 --- a/Packet++/header/LdapLayer.h +++ b/Packet++/header/LdapLayer.h @@ -410,8 +410,7 @@ namespace pcpp LdapLayer(uint16_t messageId, LdapOperationType operationType, const std::vector& messageRecords, const std::vector& controls = std::vector()); - ~LdapLayer() - {} + ~LdapLayer() override = default; /** * @return The root ASN.1 record of the LDAP message. All of the message data will be under this record. diff --git a/Packet++/header/MplsLayer.h b/Packet++/header/MplsLayer.h index b40f8f57a1..dc111da685 100644 --- a/Packet++/header/MplsLayer.h +++ b/Packet++/header/MplsLayer.h @@ -29,7 +29,7 @@ namespace pcpp mpls_header* getMplsHeader() const { - return (mpls_header*)m_Data; + return reinterpret_cast(m_Data); } public: @@ -40,10 +40,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ MplsLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = MPLS; - } + : Layer(data, dataLen, prevLayer, packet, MPLS) + {} /** * A constructor that allocates a new MPLS header @@ -55,8 +53,7 @@ namespace pcpp */ MplsLayer(uint32_t mplsLabel, uint8_t ttl, uint8_t experimentalUseValue, bool bottomOfStack); - virtual ~MplsLayer() - {} + ~MplsLayer() override = default; /** * @return TTL value of the MPLS header @@ -116,12 +113,12 @@ namespace pcpp /** * Currently identifies the following next layers: IPv4Layer, IPv6Layer, MplsLayer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of MPLS header (4 bytes) */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(mpls_header); } @@ -130,11 +127,11 @@ namespace pcpp * Set/unset the bottom-of-stack bit according to next layer: if it's a MPLS layer then bottom-of-stack will be * unset. If it's not a MPLS layer this bit will be set */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelNetworkLayer; } diff --git a/Packet++/header/NdpLayer.h b/Packet++/header/NdpLayer.h index 518fb54fc1..6c88df2403 100644 --- a/Packet++/header/NdpLayer.h +++ b/Packet++/header/NdpLayer.h @@ -48,8 +48,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - ~NdpOption() - {} + ~NdpOption() override = default; /** * @return NDP option type casted as pcpp::NDPNeighborOptionTypes enum. If the data is null a value @@ -65,15 +64,15 @@ namespace pcpp // implement abstract methods - size_t getTotalSize() const + size_t getTotalSize() const override { if (m_Data == nullptr) - return (size_t)0; + return 0; - return (size_t)m_Data->recordLen * 8; + return static_cast(m_Data->recordLen) * 8; } - size_t getDataSize() const + size_t getDataSize() const override { if (m_Data == nullptr) { @@ -81,7 +80,7 @@ namespace pcpp } // length value is stored in units of 8 octets - return (size_t)m_Data->recordLen * 8 - (2 * sizeof(uint8_t)); + return static_cast(m_Data->recordLen) * 8 - (2 * sizeof(uint8_t)); } }; @@ -120,8 +119,7 @@ namespace pcpp class NDPLayerBase : public IcmpV6Layer { public: - virtual ~NDPLayerBase() - {} + ~NDPLayerBase() override = default; /** * @return The number of NDP options in this layer @@ -232,8 +230,7 @@ namespace pcpp */ NDPNeighborSolicitationLayer(uint8_t code, const IPv6Address& targetIP, const MacAddress& srcMac); - virtual ~NDPNeighborSolicitationLayer() - {} + ~NDPNeighborSolicitationLayer() override = default; /** * @return Get the IP address specified as the target IP address in the solicitation message @@ -255,15 +252,15 @@ namespace pcpp */ MacAddress getLinkLayerAddress() const; - std::string toString() const; + std::string toString() const override; private: void initLayer(uint8_t code, const IPv6Address& targetIP); ndpneighborsolicitationhdr* getNdpHeader() const { - return (ndpneighborsolicitationhdr*)m_Data; + return reinterpret_cast(m_Data); } - size_t getNdpHeaderLen() const + size_t getNdpHeaderLen() const override { return sizeof(ndpneighborsolicitationhdr); }; @@ -349,8 +346,7 @@ namespace pcpp NDPNeighborAdvertisementLayer(uint8_t code, const IPv6Address& targetIP, bool routerFlag, bool unicastFlag, bool overrideFlag); - virtual ~NDPNeighborAdvertisementLayer() - {} + ~NDPNeighborAdvertisementLayer() override = default; /** * @return Get the target MAC address @@ -394,15 +390,15 @@ namespace pcpp return getNdpHeader()->override; } - std::string toString() const; + std::string toString() const override; private: void initLayer(uint8_t code, const IPv6Address& targetIP, bool routerFlag, bool unicastFlag, bool overrideFlag); ndpneighboradvertisementhdr* getNdpHeader() const { - return (ndpneighboradvertisementhdr*)m_Data; + return reinterpret_cast(m_Data); } - size_t getNdpHeaderLen() const + size_t getNdpHeaderLen() const override { return sizeof(ndpneighboradvertisementhdr); }; diff --git a/Packet++/header/NflogLayer.h b/Packet++/header/NflogLayer.h index 435018df07..12052911c0 100644 --- a/Packet++/header/NflogLayer.h +++ b/Packet++/header/NflogLayer.h @@ -115,7 +115,7 @@ namespace pcpp */ void assign(uint8_t* recordRawData) { - m_Data = (NflogTLVRawData*)recordRawData; + m_Data = reinterpret_cast(recordRawData); } /** @@ -150,7 +150,7 @@ namespace pcpp */ uint8_t* getRecordBasePtr() const { - return (uint8_t*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -175,21 +175,18 @@ namespace pcpp * @param[in] dataLen Size of the data in bytes * @param[in] packet A pointer to the Packet instance where layer will be stored in */ - NflogLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet) - { - m_Protocol = NFLOG; - } - - ~NflogLayer() + NflogLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet, NFLOG) {} + ~NflogLayer() override = default; + /** * Get a pointer to the Nflog header. * @return A pointer to the nflog_header */ nflog_header* getNflogHeader() const { - return (nflog_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -226,21 +223,21 @@ namespace pcpp * Currently identifies the following next layers: IPv4Layer, IPv6Layer using address family * Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of nflog_header */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Does nothing for this layer */ - void computeCalculateFields() {}; + void computeCalculateFields() override {}; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/NtpLayer.h b/Packet++/header/NtpLayer.h index 8badfbc64e..2fc062bc33 100644 --- a/Packet++/header/NtpLayer.h +++ b/Packet++/header/NtpLayer.h @@ -326,10 +326,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ NtpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = NTP; - } + : Layer(data, dataLen, prevLayer, packet, NTP) + {} /** * Empty c'tor @@ -671,25 +669,25 @@ namespace pcpp // overridden methods /// Parses the next layer. NTP is the always last so does nothing for this layer - void parseNextLayer() + void parseNextLayer() override {} /** * @return Get the size of the layer (Including the extension and authentication fields if exists) */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return The OSI layer level of NTP (Application Layer). */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -697,7 +695,7 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; } // namespace pcpp diff --git a/Packet++/header/NullLoopbackLayer.h b/Packet++/header/NullLoopbackLayer.h index 8ca1627b91..726133c3f9 100644 --- a/Packet++/header/NullLoopbackLayer.h +++ b/Packet++/header/NullLoopbackLayer.h @@ -36,10 +36,9 @@ namespace pcpp * @param[in] dataLen Size of the data in bytes * @param[in] packet A pointer to the Packet instance where layer will be stored in */ - NullLoopbackLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet) - { - m_Protocol = NULL_LOOPBACK; - } + NullLoopbackLayer(uint8_t* data, size_t dataLen, Packet* packet) + : Layer(data, dataLen, nullptr, packet, NULL_LOOPBACK) + {} /** * A constructor that allocates a new Null/Loopback header @@ -50,8 +49,7 @@ namespace pcpp /** * A destructor for this layer (does nothing) */ - ~NullLoopbackLayer() - {} + ~NullLoopbackLayer() override = default; /** * @return The protocol family in this layer @@ -73,12 +71,12 @@ namespace pcpp * IPv6Layer * - for other values the next layer in PayloadLayer (unknown protocol) */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of Null/Loopback header = 4B */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(uint32_t); } @@ -86,12 +84,12 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/PPPoELayer.h b/Packet++/header/PPPoELayer.h index fe9bd4d74c..60f773df22 100644 --- a/Packet++/header/PPPoELayer.h +++ b/Packet++/header/PPPoELayer.h @@ -80,8 +80,7 @@ namespace pcpp PPPOE_CODE_PADN = 0xd4 }; - ~PPPoELayer() - {} + ~PPPoELayer() override = default; /** * Get a pointer to the PPPoE header. Notice this points directly to the data, so every change will change the @@ -90,7 +89,7 @@ namespace pcpp */ pppoe_header* getPPPoEHeader() const { - return (pppoe_header*)m_Data; + return reinterpret_cast(m_Data); } // abstract methods implementation @@ -98,17 +97,17 @@ namespace pcpp /** * Calculate @ref pppoe_header#payloadLength field */ - virtual void computeCalculateFields(); + void computeCalculateFields() override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } protected: // protected c'tor as this class shouldn't be instantiated - PPPoELayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + PPPoELayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol) + : Layer(data, dataLen, prevLayer, packet, protocol) {} // protected c'tor as this class shouldn't be instantiated @@ -131,10 +130,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ PPPoESessionLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : PPPoELayer(data, dataLen, prevLayer, packet) - { - m_Protocol = PPPoESession; - } + : PPPoELayer(data, dataLen, prevLayer, packet, PPPoESession) + {} /** * A constructor that allocates a new PPPoE Session header with version, type and session ID @@ -150,8 +147,7 @@ namespace pcpp setPPPNextProtocol(pppNextProtocol); } - virtual ~PPPoESessionLayer() - {} + ~PPPoESessionLayer() override = default; /** * @return The protocol after the PPPoE session header. The return value is one of the PPP_* macros listed @@ -179,17 +175,17 @@ namespace pcpp /** * Currently identifies the following next layers: IPv4Layer, IPv6Layer. Otherwise sets PayloadLayer */ - virtual void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of @ref pppoe_header */ - virtual size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(pppoe_header) + sizeof(uint16_t); } - virtual std::string toString() const; + std::string toString() const override; }; /** @@ -259,8 +255,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - virtual ~PPPoETag() - {} + ~PPPoETag() override = default; /** * @return The tag type converted to PPPoEDiscoveryLayer#PPPoETagTypes enum @@ -277,14 +272,14 @@ namespace pcpp if (dataSize < 1) return ""; - return std::string((const char*)m_Data->recordValue, dataSize); + return std::string(reinterpret_cast(m_Data->recordValue), dataSize); } // implement abstract methods - size_t getTotalSize() const; + size_t getTotalSize() const override; - size_t getDataSize() const; + size_t getDataSize() const override; }; /** @@ -340,9 +335,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ PPPoEDiscoveryLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : PPPoELayer(data, dataLen, prevLayer, packet) + : PPPoELayer(data, dataLen, prevLayer, packet, PPPoEDiscovery) { - m_Protocol = PPPoEDiscovery; m_DataLen = getHeaderLen(); } @@ -432,15 +426,15 @@ namespace pcpp /** * Does nothing for this layer (PPPoE discovery is always the last layer) */ - virtual void parseNextLayer() + void parseNextLayer() override {} /** * @return The header length which is size of strcut pppoe_header plus the total size of tags */ - virtual size_t getHeaderLen() const; + size_t getHeaderLen() const override; - virtual std::string toString() const + std::string toString() const override { return "PPP-over-Ethernet Discovery (" + codeToString((PPPoELayer::PPPoECode)getPPPoEHeader()->code) + ")"; } diff --git a/Packet++/header/PacketTrailerLayer.h b/Packet++/header/PacketTrailerLayer.h index 7dbc819626..49b24fbd50 100644 --- a/Packet++/header/PacketTrailerLayer.h +++ b/Packet++/header/PacketTrailerLayer.h @@ -38,14 +38,11 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ PacketTrailerLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = PacketTrailer; - } - - ~PacketTrailerLayer() + : Layer(data, dataLen, prevLayer, packet, PacketTrailer) {} + ~PacketTrailerLayer() override = default; + /** * Get a pointer to the trailer data * @return A pointer to the trailer data @@ -74,13 +71,13 @@ namespace pcpp /** * Does nothing for this layer (PacketTrailerLayer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return trailer data length in bytes */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } @@ -88,12 +85,12 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/PayloadLayer.h b/Packet++/header/PayloadLayer.h index 759a192b3a..dd66880e27 100644 --- a/Packet++/header/PayloadLayer.h +++ b/Packet++/header/PayloadLayer.h @@ -25,10 +25,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ PayloadLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = GenericPayload; - } + : Layer(data, dataLen, prevLayer, packet, GenericPayload) + {} /** * A constructor that allocates a new payload @@ -47,8 +45,7 @@ namespace pcpp */ explicit PayloadLayer(const std::string& payloadAsHexStream); - ~PayloadLayer() - {} + ~PayloadLayer() override = default; /** * Get a pointer to the payload data @@ -73,13 +70,13 @@ namespace pcpp /** * Does nothing for this layer (PayloadLayer is always last) */ - void parseNextLayer() + void parseNextLayer() override {} /** * @return Payload data length in bytes */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } @@ -87,7 +84,7 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} /** @@ -98,9 +95,9 @@ namespace pcpp */ void setPayload(const uint8_t* newPayload, size_t newPayloadLength); - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } diff --git a/Packet++/header/ProtocolType.h b/Packet++/header/ProtocolType.h index ada6950c5e..bb775fb9ff 100644 --- a/Packet++/header/ProtocolType.h +++ b/Packet++/header/ProtocolType.h @@ -347,6 +347,11 @@ namespace pcpp */ const ProtocolType LDAP = 55; + /* + * WireGuard protocol + */ + const ProtocolType WireGuard = 56; + /** * An enum representing OSI model layers */ diff --git a/Packet++/header/RadiusLayer.h b/Packet++/header/RadiusLayer.h index 11013b0a36..87cec5df2f 100644 --- a/Packet++/header/RadiusLayer.h +++ b/Packet++/header/RadiusLayer.h @@ -48,25 +48,24 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - virtual ~RadiusAttribute() - {} + ~RadiusAttribute() override = default; // implement abstract methods - size_t getTotalSize() const + size_t getTotalSize() const override { if (m_Data == nullptr) return 0; - return (size_t)m_Data->recordLen; + return static_cast(m_Data->recordLen); } - size_t getDataSize() const + size_t getDataSize() const override { if (m_Data == nullptr) return 0; - return (size_t)m_Data->recordLen - 2 * sizeof(uint8_t); + return static_cast(m_Data->recordLen) - 2 * sizeof(uint8_t); } }; @@ -184,10 +183,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ RadiusLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = Radius; - } + : Layer(data, dataLen, prevLayer, packet, Radius) + {} /** * A constructor that creates a new layer from scratch @@ -215,8 +212,7 @@ namespace pcpp /** * A d'tor for this layer, currently does nothing */ - ~RadiusLayer() - {} + ~RadiusLayer() override = default; /** * Get a pointer to the RADIUS header. Notice this points directly to the data, so every change will change the @@ -225,7 +221,7 @@ namespace pcpp */ radius_header* getRadiusHeader() const { - return (radius_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -325,22 +321,22 @@ namespace pcpp /** * @return The size written in radius_header#length */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Does nothing for this layer, RADIUS is always last */ - void parseNextLayer() + void parseNextLayer() override {} /** * Calculate and store the value of radius_header#length according to the layer size */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } diff --git a/Packet++/header/RawPacket.h b/Packet++/header/RawPacket.h index e1065aa192..d3136ed9c8 100644 --- a/Packet++/header/RawPacket.h +++ b/Packet++/header/RawPacket.h @@ -339,6 +339,12 @@ namespace pcpp */ RawPacket& operator=(const RawPacket& other); + /** + * @brief Clones the current packet. Caller is responsible for deallocation of the memory. + * @return A pointer to the new RawPacket object which is a clone of this object + */ + virtual RawPacket* clone() const; + /** * @return RawPacket object type. Each derived class should return a different value */ diff --git a/Packet++/header/S7CommLayer.h b/Packet++/header/S7CommLayer.h index 01d96f6f8d..d9c2175fad 100644 --- a/Packet++/header/S7CommLayer.h +++ b/Packet++/header/S7CommLayer.h @@ -53,8 +53,7 @@ namespace pcpp S7CommParameter() {} - virtual ~S7CommParameter() - {} + virtual ~S7CommParameter() = default; /** * @return The data of the Parameter @@ -104,13 +103,12 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ S7CommLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + : Layer(data, dataLen, prevLayer, packet, S7COMM) { - m_Protocol = S7COMM; m_Parameter = nullptr; } - virtual ~S7CommLayer() + ~S7CommLayer() override { if (m_Parameter) delete m_Parameter; @@ -217,14 +215,14 @@ namespace pcpp private: s7commhdr* getS7commHeader() const { - return (s7commhdr*)m_Data; + return reinterpret_cast(m_Data); } s7comm_ack_data_hdr* getS7commAckDataHeader() const { if (getS7commHeader()->msgType == 0x03) { - return (s7comm_ack_data_hdr*)m_Data; + return reinterpret_cast(m_Data); } return nullptr; } diff --git a/Packet++/header/SSHLayer.h b/Packet++/header/SSHLayer.h index 9de2f6c5a0..61b18272c6 100644 --- a/Packet++/header/SSHLayer.h +++ b/Packet++/header/SSHLayer.h @@ -104,15 +104,15 @@ namespace pcpp * Several SSH records can reside in a single packets. This method examins the remaining data and creates * additional SSH records if applicable */ - void parseNextLayer(); + void parseNextLayer() override; /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -120,10 +120,8 @@ namespace pcpp protected: // protected c'tor, this class cannot be instantiated SSHLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = SSH; - } + : Layer(data, dataLen, prevLayer, packet, SSH) + {} private: // this layer supports only parsing @@ -163,12 +161,12 @@ namespace pcpp /** * @return The size of the identification message */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } - std::string toString() const; + std::string toString() const override; private: // this layer supports only parsing @@ -273,9 +271,9 @@ namespace pcpp /** * @return The size of the SSH handshake message including the padding and message header */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; - std::string toString() const; + std::string toString() const override; protected: #pragma pack(push, 1) @@ -300,7 +298,7 @@ namespace pcpp ssh_message_base* getMsgBaseHeader() const { - return (ssh_message_base*)m_Data; + return reinterpret_cast(m_Data); } }; @@ -470,12 +468,12 @@ namespace pcpp /** * @return The size of the message which is equal to the size of the layer */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } - std::string toString() const; + std::string toString() const override; }; } // namespace pcpp diff --git a/Packet++/header/SSLHandshake.h b/Packet++/header/SSLHandshake.h index 7fa085d085..9c41752e2b 100644 --- a/Packet++/header/SSLHandshake.h +++ b/Packet++/header/SSLHandshake.h @@ -129,8 +129,7 @@ namespace pcpp */ explicit SSLExtension(uint8_t* data); - virtual ~SSLExtension() - {} + virtual ~SSLExtension() = default; /** * @return The type of the extension as enum @@ -176,7 +175,7 @@ namespace pcpp SSLExtensionStruct* getExtensionStruct() const { - return (SSLExtensionStruct*)m_RawData; + return reinterpret_cast(m_RawData); } }; @@ -280,7 +279,7 @@ namespace pcpp * @param[in] dataLen The length in bytes of the raw data * @param[in] allDataExists Certificate messages usually spread on more than 1 packet. So a certificate is * likely to split between 2 packets or more. This field indicates whether the raw data contains all - * ceritificate data of just a part of it + * certificate data of just a part of it */ SSLx509Certificate(uint8_t* data, size_t dataLen, bool allDataExists) : m_Data(data), m_DataLen(dataLen), m_AllDataExists(allDataExists) @@ -338,8 +337,7 @@ namespace pcpp class SSLHandshakeMessage { public: - virtual ~SSLHandshakeMessage() - {} + virtual ~SSLHandshakeMessage() = default; /** * A factory method for creating instances of handshake messages from raw data @@ -453,8 +451,7 @@ namespace pcpp */ SSLClientHelloMessage(uint8_t* data, size_t dataLen, SSLHandshakeLayer* container); - virtual ~SSLClientHelloMessage() - {} + ~SSLClientHelloMessage() override = default; /** * @return A struct containing common fields for client-hello and server-hello messages. Notice this points @@ -462,7 +459,7 @@ namespace pcpp */ ssl_tls_client_server_hello* getClientHelloHeader() const { - return (ssl_tls_client_server_hello*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -572,7 +569,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; private: PointerVector m_ExtensionList; @@ -632,8 +629,7 @@ namespace pcpp */ SSLServerHelloMessage(uint8_t* data, size_t dataLen, SSLHandshakeLayer* container); - virtual ~SSLServerHelloMessage() - {} + ~SSLServerHelloMessage() override = default; /** * @return A struct containing common fields for client-hello and server-hello messages. Notice this points @@ -641,7 +637,7 @@ namespace pcpp */ ssl_tls_client_server_hello* getServerHelloHeader() const { - return (ssl_tls_client_server_hello*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -747,7 +743,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; private: PointerVector m_ExtensionList; @@ -773,8 +769,7 @@ namespace pcpp */ SSLCertificateMessage(uint8_t* data, size_t dataLen, SSLHandshakeLayer* container); - virtual ~SSLCertificateMessage() - {} + ~SSLCertificateMessage() override = default; /** * @return The number of certificates encapsulated in this message (as written in the 'length' field of the @@ -795,7 +790,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; private: PointerVector m_CertificateList; @@ -820,12 +815,11 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - virtual ~SSLHelloRequestMessage() - {} + ~SSLHelloRequestMessage() override = default; // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -848,8 +842,7 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - ~SSLServerKeyExchangeMessage() - {} + ~SSLServerKeyExchangeMessage() override = default; /** * @return A pointer to the raw data of the server key exchange params. Currently this data can only returned as @@ -868,7 +861,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -891,8 +884,7 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - ~SSLClientKeyExchangeMessage() - {} + ~SSLClientKeyExchangeMessage() override = default; /** * @return A pointer to the raw data of the server key exchange params. Currently this data can only be returned @@ -911,7 +903,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -931,8 +923,7 @@ namespace pcpp */ SSLCertificateRequestMessage(uint8_t* data, size_t dataLen, SSLHandshakeLayer* container); - ~SSLCertificateRequestMessage() - {} + ~SSLCertificateRequestMessage() override = default; /** * @return A reference to a vector containing all client certificate types exist in this message @@ -956,7 +947,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; private: std::vector m_ClientCertificateTypes; @@ -981,12 +972,11 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - virtual ~SSLServerHelloDoneMessage() - {} + ~SSLServerHelloDoneMessage() override = default; // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -1009,8 +999,7 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - virtual ~SSLCertificateVerifyMessage() - {} + ~SSLCertificateVerifyMessage() override = default; /** * @return A pointer to the signed hash data as raw data (byte array). Parsing of this data may be added @@ -1029,7 +1018,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -1052,8 +1041,7 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - virtual ~SSLFinishedMessage() - {} + ~SSLFinishedMessage() override = default; /** * @return A pointer to the signed hash data as raw data (byte array). Parsing of this data may be added @@ -1072,7 +1060,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -1094,8 +1082,7 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - virtual ~SSLNewSessionTicketMessage() - {} + ~SSLNewSessionTicketMessage() override = default; /** * @return A pointer to the session ticket data as raw data (byte array). Parsing of this data may be added @@ -1114,7 +1101,7 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; }; /** @@ -1137,24 +1124,23 @@ namespace pcpp : SSLHandshakeMessage(data, dataLen, container) {} - virtual ~SSLUnknownMessage() - {} + ~SSLUnknownMessage() override = default; // implement virtual and abstract methods /** * @return Always ::SSL_HANDSHAKE_UNKNOWN (overridden from SSLHandshakeMessage) */ - SSLHandshakeType getHandshakeType() const; + SSLHandshakeType getHandshakeType() const override; /** * @return The length of the data from message start until the end of the layer. Since it's an unknown type * or an encrypted message the length parsed from the message can't be guaranteed to be the correct length. * That's why the length returned is the size until the end of the layer */ - size_t getMessageLength() const; + size_t getMessageLength() const override; - std::string toString() const; + std::string toString() const override; }; template TExtension* SSLClientHelloMessage::getExtensionOfType() const @@ -1164,7 +1150,7 @@ namespace pcpp { SSLExtension* curElem = const_cast(m_ExtensionList.at(i)); if (dynamic_cast(curElem) != nullptr) - return (TExtension*)curElem; + return static_cast(curElem); } return nullptr; @@ -1177,7 +1163,7 @@ namespace pcpp { SSLExtension* curElem = const_cast(m_ExtensionList.at(i)); if (dynamic_cast(curElem) != nullptr) - return (TExtension*)curElem; + return static_cast(curElem); } return nullptr; diff --git a/Packet++/header/SSLLayer.h b/Packet++/header/SSLLayer.h index 29822eef53..adf70a17ba 100644 --- a/Packet++/header/SSLLayer.h +++ b/Packet++/header/SSLLayer.h @@ -230,7 +230,7 @@ namespace pcpp */ ssl_tls_record_layer* getRecordLayer() const { - return (ssl_tls_record_layer*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -248,25 +248,23 @@ namespace pcpp /** * @return The record size as extracted from the record data (in ssl_tls_record_layer#length) */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Several SSL/TLS records can reside in a single packets. So this method checks the remaining data and if it's * identified as SSL/TLS it creates another SSL/TLS record layer as the next layer */ - void parseNextLayer(); + void parseNextLayer() override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelPresentationLayer; } protected: SSLLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = SSL; - } + : Layer(data, dataLen, prevLayer, packet, SSL) + {} }; // class SSLLayer @@ -367,12 +365,12 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; /** * There are no calculated fields for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} private: @@ -398,17 +396,16 @@ namespace pcpp : SSLLayer(data, dataLen, prevLayer, packet) {} - ~SSLChangeCipherSpecLayer() - {} + ~SSLChangeCipherSpecLayer() override = default; // implement abstract methods - std::string toString() const; + std::string toString() const override; /** * There are no calculated fields for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} }; // class SSLChangeCipherSpecLayer @@ -431,8 +428,7 @@ namespace pcpp : SSLLayer(data, dataLen, prevLayer, packet) {} - ~SSLAlertLayer() - {} + ~SSLAlertLayer() override = default; /** * @return SSL/TLS alert level. Will return ::SSL_ALERT_LEVEL_ENCRYPTED if alert is encrypted @@ -446,12 +442,12 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; /** * There are no calculated fields for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} }; // class SSLAlertLayer @@ -474,8 +470,7 @@ namespace pcpp : SSLLayer(data, dataLen, prevLayer, packet) {} - ~SSLApplicationDataLayer() - {} + ~SSLApplicationDataLayer() override = default; /** * @return A pointer to the encrypted data. This data can be decrypted only if you have the symmetric key @@ -490,12 +485,12 @@ namespace pcpp // implement abstract methods - std::string toString() const; + std::string toString() const override; /** * There are no calculated fields for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} }; // class SSLApplicationDataLayer diff --git a/Packet++/header/SdpLayer.h b/Packet++/header/SdpLayer.h index 067f4d8feb..74e6e3d0fc 100644 --- a/Packet++/header/SdpLayer.h +++ b/Packet++/header/SdpLayer.h @@ -95,8 +95,7 @@ namespace pcpp SdpLayer(const std::string& username, long sessionID, long sessionVersion, IPv4Address ipAddress, const std::string& sessionName, long startTime, long stopTime); - ~SdpLayer() - {} + ~SdpLayer() override = default; /** * A copy constructor for this layer. Inherits the base copy constructor and doesn't add @@ -164,20 +163,20 @@ namespace pcpp // overridden methods - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelSesionLayer; } - std::string toString() const; + std::string toString() const override; protected: // implementation of abstract methods - char getHeaderFieldNameValueSeparator() const + char getHeaderFieldNameValueSeparator() const override { return '='; } - bool spacesAllowedBetweenHeaderFieldNameAndValue() const + bool spacesAllowedBetweenHeaderFieldNameAndValue() const override { return false; } diff --git a/Packet++/header/SingleCommandTextProtocol.h b/Packet++/header/SingleCommandTextProtocol.h index dea2af9dc9..cee3343f8f 100644 --- a/Packet++/header/SingleCommandTextProtocol.h +++ b/Packet++/header/SingleCommandTextProtocol.h @@ -23,10 +23,11 @@ namespace pcpp bool hyphenRequired(const std::string& value); protected: - SingleCommandTextProtocol(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) {}; + SingleCommandTextProtocol(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, + ProtocolType protocol) + : Layer(data, dataLen, prevLayer, packet, protocol) {}; - SingleCommandTextProtocol(const std::string& command, const std::string& option); + SingleCommandTextProtocol(const std::string& command, const std::string& option, ProtocolType protocol); bool setCommandInternal(std::string value); bool setCommandOptionInternal(std::string value); diff --git a/Packet++/header/SipLayer.h b/Packet++/header/SipLayer.h index c35bed3064..f9ceae6337 100644 --- a/Packet++/header/SipLayer.h +++ b/Packet++/header/SipLayer.h @@ -100,7 +100,7 @@ namespace pcpp // Overridden methods - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelSesionLayer; } @@ -110,13 +110,13 @@ namespace pcpp * If content-length field doesn't exist or set to zero and still there is data after this layer, a PayloadLayer * will be created */ - void parseNextLayer(); + void parseNextLayer() override; /** * Set the content-length only if a content-length field already exists and if its current value is different * than the total length of the next layer(s) */ - void computeCalculateFields(); + void computeCalculateFields() override; /** * A static method that checks whether the port is considered as SIP @@ -128,8 +128,8 @@ namespace pcpp } protected: - SipLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : TextBasedProtocolMessage(data, dataLen, prevLayer, packet) + SipLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType protocol) + : TextBasedProtocolMessage(data, dataLen, prevLayer, packet, protocol) {} SipLayer() : TextBasedProtocolMessage() {} @@ -142,11 +142,11 @@ namespace pcpp } // implementation of abstract methods - char getHeaderFieldNameValueSeparator() const + char getHeaderFieldNameValueSeparator() const override { return ':'; } - bool spacesAllowedBetweenHeaderFieldNameAndValue() const + bool spacesAllowedBetweenHeaderFieldNameAndValue() const override { return true; } @@ -222,7 +222,7 @@ namespace pcpp */ SipRequestLayer(SipMethod method, const std::string& requestUri, const std::string& version = "SIP/2.0"); - ~SipRequestLayer(); + ~SipRequestLayer() override; /** * A copy constructor for this layer. Inherits base copy constructor SipLayer and adds the functionality @@ -248,7 +248,7 @@ namespace pcpp // implement Layer's abstract methods - std::string toString() const; + std::string toString() const override; private: SipRequestFirstLine* m_FirstLine; @@ -493,7 +493,7 @@ namespace pcpp explicit SipResponseLayer(SipResponseLayer::SipResponseStatusCode statusCode, std::string statusCodeString = "", const std::string& sipVersion = "SIP/2.0"); - virtual ~SipResponseLayer(); + ~SipResponseLayer() override; /** * A copy constructor for this layer. This copy constructor inherits base copy constructor SipLayer and adds the @@ -519,7 +519,7 @@ namespace pcpp // implement Layer's abstract methods - std::string toString() const; + std::string toString() const override; private: SipResponseFirstLine* m_FirstLine; diff --git a/Packet++/header/Sll2Layer.h b/Packet++/header/Sll2Layer.h index 8ab0458e3d..324cbb3c17 100644 --- a/Packet++/header/Sll2Layer.h +++ b/Packet++/header/Sll2Layer.h @@ -55,10 +55,8 @@ namespace pcpp * @param[in] dataLen Size of the data in bytes * @param[in] packet A pointer to the Packet instance where layer will be stored in */ - Sll2Layer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet) - { - m_Protocol = SLL2; - } + Sll2Layer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet, SLL2) + {} /** * A constructor that creates a new SLL2 header and allocates the data @@ -68,8 +66,7 @@ namespace pcpp */ Sll2Layer(uint32_t interfaceIndex, uint16_t ARPHRDType, uint8_t packetType); - ~Sll2Layer() - {} + ~Sll2Layer() override = default; /** * Get a pointer to the Sll header. Notice this points directly to the data, so every change will change the @@ -78,7 +75,7 @@ namespace pcpp */ sll2_header* getSll2Header() const { - return (sll2_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -177,24 +174,24 @@ namespace pcpp * Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, PPPoESessionLayer, * PPPoEDiscoveryLayer, MplsLayer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * Calculate the next protocol type for known protocols: IPv4, IPv6, ARP, VLAN */ - void computeCalculateFields(); + void computeCalculateFields() override; /** * @return Size of sll2_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(sll2_header); } - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/SllLayer.h b/Packet++/header/SllLayer.h index 656b90ca06..6a02e86041 100644 --- a/Packet++/header/SllLayer.h +++ b/Packet++/header/SllLayer.h @@ -50,10 +50,8 @@ namespace pcpp * @param[in] dataLen Size of the data in bytes * @param[in] packet A pointer to the Packet instance where layer will be stored in */ - SllLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet) - { - m_Protocol = SLL; - } + SllLayer(uint8_t* data, size_t dataLen, Packet* packet) : Layer(data, dataLen, nullptr, packet, SLL) + {} /** * A constructor that creates a new SLL header and allocates the data @@ -62,8 +60,7 @@ namespace pcpp */ SllLayer(uint16_t packetType, uint16_t ARPHRDType); - ~SllLayer() - {} + ~SllLayer() override = default; /** * Get a pointer to the Sll header. Notice this points directly to the data, so every change will change the @@ -72,7 +69,7 @@ namespace pcpp */ sll_header* getSllHeader() const { - return (sll_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -94,12 +91,12 @@ namespace pcpp * Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, PPPoESessionLayer, * PPPoEDiscoveryLayer, MplsLayer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of sll_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(sll_header); } @@ -107,11 +104,11 @@ namespace pcpp /** * Calculate the next protocol type for known protocols: IPv4, IPv6, ARP, VLAN */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/SmtpLayer.h b/Packet++/header/SmtpLayer.h index fca5c6b2bb..b5ffbaf80f 100644 --- a/Packet++/header/SmtpLayer.h +++ b/Packet++/header/SmtpLayer.h @@ -19,15 +19,10 @@ namespace pcpp { protected: SmtpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : SingleCommandTextProtocol(data, dataLen, prevLayer, packet) - { - m_Protocol = SMTP; - }; + : SingleCommandTextProtocol(data, dataLen, prevLayer, packet, SMTP) {}; - SmtpLayer(const std::string& command, const std::string& option) : SingleCommandTextProtocol(command, option) - { - m_Protocol = SMTP; - }; + SmtpLayer(const std::string& command, const std::string& option) + : SingleCommandTextProtocol(command, option, SMTP) {}; public: /** @@ -43,25 +38,25 @@ namespace pcpp // overridden methods /// SMTP is the always last so does nothing for this layer - void parseNextLayer() + void parseNextLayer() override {} /** * @return Get the size of the layer */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return The OSI layer level of SMTP (Application Layer). */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -200,7 +195,7 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; /** @@ -346,7 +341,7 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; } // namespace pcpp diff --git a/Packet++/header/SomeIpLayer.h b/Packet++/header/SomeIpLayer.h index 448964858a..0102e9d30d 100644 --- a/Packet++/header/SomeIpLayer.h +++ b/Packet++/header/SomeIpLayer.h @@ -92,10 +92,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ SomeIpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = SomeIP; - } + : Layer(data, dataLen, prevLayer, packet, SomeIP) + {} /** * Construct a new layer object @@ -118,8 +116,7 @@ namespace pcpp /** * Destroy the layer object */ - ~SomeIpLayer() - {} + ~SomeIpLayer() override = default; /** * A static method that creates a SOME/IP or SOME/IP-TP layer from packet raw data. Returns PayloadLayer if data @@ -139,7 +136,7 @@ namespace pcpp */ someiphdr* getSomeIpHeader() const { - return (someiphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -331,7 +328,7 @@ namespace pcpp * Get the Length of the SOME/IP header inc payload * @return size_t */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(uint32_t) * 2 + getLengthField(); } @@ -339,23 +336,23 @@ namespace pcpp /** * Does nothing for this layer */ - virtual void computeCalculateFields() + virtual void computeCalculateFields() override {} /** * Identifies the following next layers: SomeIpLayer, SomeIpTpLayer, SomeIpSdLayer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return The string representation of the SOME/IP layer */ - virtual std::string toString() const; + virtual std::string toString() const override; /** * @return The OSI model layer of this layer */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -427,8 +424,7 @@ namespace pcpp /** * Destroy the layer object */ - ~SomeIpTpLayer() - {} + ~SomeIpTpLayer() override = default; /** * Get a pointer to the basic SOME/IP-TP header. Notice this points directly to the data, so every change will @@ -437,7 +433,7 @@ namespace pcpp */ someiptphdr* getSomeIpTpHeader() const { - return (someiptphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -468,18 +464,18 @@ namespace pcpp /** * Sets the message type in this layer with enabling the TP flag */ - void computeCalculateFields(); + void computeCalculateFields() override; /** * @return The string representation of the SOME/IP-TP layer */ - std::string toString() const; + std::string toString() const override; private: static const uint32_t SOMEIP_TP_MORE_FLAG_MASK = 0x01; static const uint32_t SOMEIP_TP_OFFSET_MASK = 0xFFFFFFF0; - size_t getSomeIpHeaderLen() const + size_t getSomeIpHeaderLen() const override { return sizeof(someiptphdr); } diff --git a/Packet++/header/SomeIpSdLayer.h b/Packet++/header/SomeIpSdLayer.h index b7c1bd9024..71c8bd3bf3 100644 --- a/Packet++/header/SomeIpSdLayer.h +++ b/Packet++/header/SomeIpSdLayer.h @@ -662,8 +662,7 @@ namespace pcpp /** * Destroy the layer object */ - ~SomeIpSdLayer() - {} + ~SomeIpSdLayer() override = default; /** * Checks if given port is a SOME/IP-SD protocol port @@ -746,12 +745,12 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() {}; + void computeCalculateFields() override {}; /** * @return The string representation of the SOME/IP-SD layer */ - std::string toString() const; + std::string toString() const override; private: /** diff --git a/Packet++/header/StpLayer.h b/Packet++/header/StpLayer.h index eb84f54948..f1b3cf75fd 100644 --- a/Packet++/header/StpLayer.h +++ b/Packet++/header/StpLayer.h @@ -127,10 +127,8 @@ namespace pcpp { protected: StpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = STP; - } + : Layer(data, dataLen, prevLayer, packet, STP) + {} explicit StpLayer(size_t dataLen) { @@ -155,7 +153,7 @@ namespace pcpp */ stp_header* getStpHeader() const { - return (stp_header*)(m_Data); + return reinterpret_cast(m_Data); } /** @@ -217,19 +215,19 @@ namespace pcpp /** * @return The size of STP packet */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return The OSI layer level of STP (Data Link Layer). */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } @@ -296,18 +294,18 @@ namespace pcpp /** * @return The size of STP TCN message */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(stp_tcn_bpdu); } /// Parses next layer - void parseNextLayer(); + void parseNextLayer() override; /** * @return Returns the protocol info as readable string */ - std::string toString() const + std::string toString() const override { return "Spanning Tree Topology Change Notification"; } @@ -358,7 +356,7 @@ namespace pcpp */ stp_conf_bpdu* getStpConfHeader() const { - return (stp_conf_bpdu*)(m_Data); + return reinterpret_cast(m_Data); } /** @@ -558,18 +556,18 @@ namespace pcpp /** * @return The size of STP configuration BPDU message */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(stp_conf_bpdu); } /// Parses next layer - void parseNextLayer(); + void parseNextLayer() override; /** * @return Returns the protocol info as readable string */ - std::string toString() const + std::string toString() const override { return "Spanning Tree Configuration"; } @@ -620,7 +618,7 @@ namespace pcpp */ rstp_conf_bpdu* getRstpConfHeader() const { - return (rstp_conf_bpdu*)(m_Data); + return reinterpret_cast(m_Data); } /** @@ -646,18 +644,18 @@ namespace pcpp /** * @return The size of Rapid STP message */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(rstp_conf_bpdu); } /// Parses next layer - void parseNextLayer(); + void parseNextLayer() override; /** * @return Returns the protocol info as readable string */ - std::string toString() const + std::string toString() const override { return "Rapid Spanning Tree"; } @@ -705,7 +703,7 @@ namespace pcpp */ mstp_conf_bpdu* getMstpHeader() const { - return (mstp_conf_bpdu*)(m_Data); + return reinterpret_cast(m_Data); } /** @@ -879,13 +877,13 @@ namespace pcpp // overridden methods /// Parses next layer - void parseNextLayer() + void parseNextLayer() override {} /** * @return Returns the protocol info as readable string */ - std::string toString() const + std::string toString() const override { return "Multiple Spanning Tree"; } diff --git a/Packet++/header/TLVData.h b/Packet++/header/TLVData.h index 54787915b4..d265c925e0 100644 --- a/Packet++/header/TLVData.h +++ b/Packet++/header/TLVData.h @@ -58,8 +58,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - virtual ~TLVRecord() - {} + virtual ~TLVRecord() = default; /** * Assign a pointer to the TLV record raw data (byte array) @@ -167,7 +166,7 @@ namespace pcpp */ uint8_t* getRecordBasePtr() const { - return (uint8_t*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -246,7 +245,7 @@ namespace pcpp */ TLVRecordReader() { - m_RecordCount = (size_t)-1; + m_RecordCount = static_cast(-1); } /** @@ -260,8 +259,7 @@ namespace pcpp /** * A d'tor for this class which currently does nothing */ - virtual ~TLVRecordReader() - {} + virtual ~TLVRecordReader() = default; /** * Overload of the assignment operator for this class @@ -372,7 +370,7 @@ namespace pcpp */ size_t getTLVRecordCount(uint8_t* tlvDataBasePtr, size_t tlvDataLen) const { - if (m_RecordCount != (size_t)-1) + if (m_RecordCount != static_cast(-1)) return m_RecordCount; m_RecordCount = 0; @@ -395,7 +393,7 @@ namespace pcpp */ void changeTLVRecordCount(int changedBy) { - if (m_RecordCount != (size_t)-1) + if (m_RecordCount != static_cast(-1)) m_RecordCount += changedBy; } }; diff --git a/Packet++/header/TcpLayer.h b/Packet++/header/TcpLayer.h index fbe762f280..fe17f8f593 100644 --- a/Packet++/header/TcpLayer.h +++ b/Packet++/header/TcpLayer.h @@ -267,7 +267,7 @@ namespace pcpp /** * A d'tor for this class, currently does nothing */ - ~TcpOption() = default; + ~TcpOption() override = default; /** * @deprecated This method is deprecated, please use getTcpOptionEnumType() @@ -311,7 +311,7 @@ namespace pcpp // implement abstract methods - size_t getTotalSize() const + size_t getTotalSize() const override { if (m_Data == nullptr) return 0; @@ -323,7 +323,7 @@ namespace pcpp return static_cast(m_Data->recordLen); } - size_t getDataSize() const + size_t getDataSize() const override { if (m_Data == nullptr) return 0; @@ -389,7 +389,7 @@ namespace pcpp */ PCPP_DEPRECATED_TCP_OPTION_TYPE TcpOptionBuilder(TcpOptionType optionType, const uint8_t* optionValue, uint8_t optionValueLen) - : TLVRecordBuilder((uint8_t)optionType, optionValue, optionValueLen) + : TLVRecordBuilder(static_cast(optionType), optionValue, optionValueLen) {} /** @@ -409,7 +409,7 @@ namespace pcpp */ PCPP_DEPRECATED_TCP_OPTION_TYPE TcpOptionBuilder(TcpOptionType optionType, uint8_t optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -427,7 +427,7 @@ namespace pcpp */ PCPP_DEPRECATED_TCP_OPTION_TYPE TcpOptionBuilder(TcpOptionType optionType, uint16_t optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -445,7 +445,7 @@ namespace pcpp */ PCPP_DEPRECATED_TCP_OPTION_TYPE TcpOptionBuilder(TcpOptionType optionType, uint32_t optionValue) - : TLVRecordBuilder((uint8_t)optionType, optionValue) + : TLVRecordBuilder(static_cast(optionType), optionValue) {} /** @@ -507,7 +507,7 @@ namespace pcpp */ TcpLayer(uint16_t portSrc, uint16_t portDst); - ~TcpLayer() = default; + ~TcpLayer() override = default; /** * A copy constructor that copy the entire header from the other TcpLayer (including TCP options) @@ -527,7 +527,7 @@ namespace pcpp */ tcphdr* getTcpHeader() const { - return (tcphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -647,12 +647,12 @@ namespace pcpp * Currently identifies the following next layers: HttpRequestLayer, HttpResponseLayer. Otherwise sets * PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of @ref tcphdr + all TCP options */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return getTcpHeader()->dataOffset * 4; } @@ -660,11 +660,11 @@ namespace pcpp /** * Calculate @ref tcphdr#headerChecksum field */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelTransportLayer; } diff --git a/Packet++/header/TelnetLayer.h b/Packet++/header/TelnetLayer.h index 64873092ec..0689ee6468 100644 --- a/Packet++/header/TelnetLayer.h +++ b/Packet++/header/TelnetLayer.h @@ -227,9 +227,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ TelnetLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + : Layer(data, dataLen, prevLayer, packet, Telnet) { - m_Protocol = Telnet; lastPositionOffset = SIZE_MAX; }; @@ -332,25 +331,25 @@ namespace pcpp // overridden methods /// Parses the next layer. Telnet is the always last so does nothing for this layer - void parseNextLayer() + void parseNextLayer() override {} /** * @return Get the size of the layer */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return The OSI layer level of Telnet (Application Layer). */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelApplicationLayer; } @@ -358,7 +357,7 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; } // namespace pcpp diff --git a/Packet++/header/TextBasedProtocol.h b/Packet++/header/TextBasedProtocol.h index fdfda1dda8..0e57db5174 100644 --- a/Packet++/header/TextBasedProtocol.h +++ b/Packet++/header/TextBasedProtocol.h @@ -124,7 +124,7 @@ namespace pcpp friend class HeaderField; public: - ~TextBasedProtocolMessage(); + ~TextBasedProtocolMessage() override; /** * Get a pointer to a header field by name. The search is case insensitive, meaning if a field with name "Host" @@ -247,20 +247,21 @@ namespace pcpp /** * Currently set only PayloadLayer for the rest of the data */ - virtual void parseNextLayer(); + void parseNextLayer() override; /** * @return The message length */ - size_t getHeaderLen() const; + size_t getHeaderLen() const override; /** * Does nothing for this class */ - virtual void computeCalculateFields(); + void computeCalculateFields() override; protected: - TextBasedProtocolMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet); + TextBasedProtocolMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, + ProtocolType protocol); TextBasedProtocolMessage() : m_FieldList(nullptr), m_LastField(nullptr), m_FieldsOffset(0) {} diff --git a/Packet++/header/TpktLayer.h b/Packet++/header/TpktLayer.h index e7ab49e45b..35bdbcca03 100644 --- a/Packet++/header/TpktLayer.h +++ b/Packet++/header/TpktLayer.h @@ -43,10 +43,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ TpktLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = TPKT; - } + : Layer(data, dataLen, prevLayer, packet, TPKT) + {} /** * A constructor that allocates a new TPKT header @@ -55,8 +53,7 @@ namespace pcpp */ TpktLayer(uint8_t version, uint16_t length); - virtual ~TpktLayer() - {} + ~TpktLayer() override = default; /** * @return TPKT reserved @@ -142,7 +139,7 @@ namespace pcpp */ tpkthdr* getTpktHeader() const { - return (tpkthdr*)m_Data; + return reinterpret_cast(m_Data); } }; diff --git a/Packet++/header/UdpLayer.h b/Packet++/header/UdpLayer.h index a325698b2c..f219bb20f1 100644 --- a/Packet++/header/UdpLayer.h +++ b/Packet++/header/UdpLayer.h @@ -44,10 +44,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ UdpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = UDP; - } + : Layer(data, dataLen, prevLayer, packet, UDP) + {} /** * A constructor that allocates a new UDP header with source and destination ports @@ -63,7 +61,7 @@ namespace pcpp */ udphdr* getUdpHeader() const { - return (udphdr*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -90,12 +88,12 @@ namespace pcpp * Currently identifies the following next layers: DnsLayer, DhcpLayer, VxlanLayer, SipRequestLayer, * SipResponseLayer, RadiusLayer. Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of @ref udphdr */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(udphdr); } @@ -103,11 +101,11 @@ namespace pcpp /** * Calculate @ref udphdr#headerChecksum field */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelTransportLayer; } diff --git a/Packet++/header/VlanLayer.h b/Packet++/header/VlanLayer.h index cb46753dd8..32c1bae9f9 100644 --- a/Packet++/header/VlanLayer.h +++ b/Packet++/header/VlanLayer.h @@ -48,10 +48,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ VlanLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = VLAN; - } + : Layer(data, dataLen, prevLayer, packet, VLAN) + {} /** * A constructor that allocates a new VLAN header @@ -63,8 +61,7 @@ namespace pcpp */ VlanLayer(const uint16_t vlanID, bool cfi, uint8_t priority, uint16_t etherType = 0); - ~VlanLayer() - {} + ~VlanLayer() override = default; /** * Get a pointer to the VLAN header. Notice this points directly to the data, so every change will change the @@ -73,7 +70,7 @@ namespace pcpp */ vlan_header* getVlanHeader() const { - return (vlan_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -124,12 +121,12 @@ namespace pcpp * Currently identifies the following next layers: IPv4Layer, IPv6Layer, ArpLayer, VlanLayer, MplsLayer. * Otherwise sets PayloadLayer */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of vlan_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(vlan_header); } @@ -137,11 +134,11 @@ namespace pcpp /** * Calculate the EtherType for known protocols: IPv4, IPv6, ARP, VLAN */ - void computeCalculateFields(); + void computeCalculateFields() override; - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/VrrpLayer.h b/Packet++/header/VrrpLayer.h index 39549b34e7..48d6cc1b15 100644 --- a/Packet++/header/VrrpLayer.h +++ b/Packet++/header/VrrpLayer.h @@ -135,10 +135,8 @@ namespace pcpp protected: VrrpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, ProtocolType vrrpVer, IPAddress::AddressType addressType) - : Layer(data, dataLen, prevLayer, packet), m_AddressType(addressType) - { - m_Protocol = vrrpVer; - } + : Layer(data, dataLen, prevLayer, packet, vrrpVer), m_AddressType(addressType) + {} explicit VrrpLayer(ProtocolType subProtocol, uint8_t virtualRouterId, uint8_t priority); @@ -177,8 +175,7 @@ namespace pcpp Other }; - virtual ~VrrpLayer() - {} + ~VrrpLayer() override = default; /** * @return The VRRP IP Address type @@ -377,8 +374,7 @@ namespace pcpp /** * A destructor for this layer (does nothing) */ - ~VrrpV2Layer() - {} + ~VrrpV2Layer() override = default; /** * @return The VRRP advertisement interval in this message @@ -454,8 +450,7 @@ namespace pcpp /** * A destructor for this layer (does nothing) */ - ~VrrpV3Layer() - {} + ~VrrpV3Layer() override = default; /** * @return The maximum advertisement interval in this message diff --git a/Packet++/header/VxlanLayer.h b/Packet++/header/VxlanLayer.h index c078e87121..e31b10bcd5 100644 --- a/Packet++/header/VxlanLayer.h +++ b/Packet++/header/VxlanLayer.h @@ -78,10 +78,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ VxlanLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = VXLAN; - } + : Layer(data, dataLen, prevLayer, packet, VXLAN) + {} /** * A constructor that creates a new VXLAN header and allocates the data. Note: the VNI present flag is set @@ -95,8 +93,7 @@ namespace pcpp explicit VxlanLayer(uint32_t vni = 0, uint16_t groupPolicyID = 0, bool setGbpFlag = false, bool setPolicyAppliedFlag = false, bool setDontLearnFlag = false); - ~VxlanLayer() - {} + ~VxlanLayer() override = default; /** * Get a pointer to the VXLAN header. Notice this points directly to the data, so every change will change the @@ -105,7 +102,7 @@ namespace pcpp */ vxlan_header* getVxlanHeader() const { - return (vxlan_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -133,12 +130,12 @@ namespace pcpp /** * Next layer for VXLAN is always Ethernet */ - void parseNextLayer(); + void parseNextLayer() override; /** * @return Size of vxlan_header */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return sizeof(vxlan_header); } @@ -146,12 +143,12 @@ namespace pcpp /** * Does nothing for this layer */ - void computeCalculateFields() + void computeCalculateFields() override {} - std::string toString() const; + std::string toString() const override; - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } diff --git a/Packet++/header/WakeOnLanLayer.h b/Packet++/header/WakeOnLanLayer.h index a06d78bbc7..5b5a999085 100644 --- a/Packet++/header/WakeOnLanLayer.h +++ b/Packet++/header/WakeOnLanLayer.h @@ -43,10 +43,8 @@ namespace pcpp * @param[in] packet A pointer to the Packet instance where layer will be stored in */ WakeOnLanLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = WakeOnLan; - } + : Layer(data, dataLen, prevLayer, packet, WakeOnLan) + {} /** * Construct a new Wake On Lan Layer with provided values @@ -83,7 +81,7 @@ namespace pcpp */ inline wol_header* getWakeOnLanHeader() const { - return (wol_header*)m_Data; + return reinterpret_cast(m_Data); } /** @@ -153,25 +151,25 @@ namespace pcpp // overridden methods /// Parses the next layer. Wake on LAN is the always last so does nothing for this layer - void parseNextLayer() + void parseNextLayer() override {} /** * @return Get the size of the layer */ - size_t getHeaderLen() const + size_t getHeaderLen() const override { return m_DataLen; } /// Does nothing for this layer - void computeCalculateFields() + void computeCalculateFields() override {} /** * @return The OSI layer level of Wake on LAN (Data Link Layer) */ - OsiModelLayer getOsiModelLayer() const + OsiModelLayer getOsiModelLayer() const override { return OsiModelDataLinkLayer; } @@ -179,6 +177,6 @@ namespace pcpp /** * @return Returns the protocol info as readable string */ - std::string toString() const; + std::string toString() const override; }; } // namespace pcpp diff --git a/Packet++/header/WireGuardLayer.h b/Packet++/header/WireGuardLayer.h new file mode 100644 index 0000000000..acb0bf8c24 --- /dev/null +++ b/Packet++/header/WireGuardLayer.h @@ -0,0 +1,606 @@ +#pragma once + +#include "Layer.h" +#include "IpAddress.h" +#include "MacAddress.h" + +/// @file + +/** + * \namespace pcpp + * \brief The main namespace for the PcapPlusPlus lib + */ +namespace pcpp +{ + + /** + * @class WireGuardLayer + * Represents a WireGuard protocol layer + */ + class WireGuardLayer : public Layer + { + protected: +#pragma pack(push, 1) + /** + * @struct wg_common_header + * Represents the common header for all WireGuard message types + */ + struct wg_common_header + { + /** Message type field */ + uint8_t messageType; + /** Reserved field (3 bytes) */ + uint8_t reserved[3]; + }; +#pragma pack(pop) + wg_common_header* getBasicHeader() const + { + return reinterpret_cast(m_Data); + } + + WireGuardLayer() = default; + + public: + /** + * WireGuard message types + */ + enum class WireGuardMessageType + { + /** Unknown Initiation message */ + Unknown = 0, + /** Handshake Initiation message */ + HandshakeInitiation = 1, + /** Handshake Response message */ + HandshakeResponse = 2, + /** Cookie Reply message */ + CookieReply = 3, + /** Transport Data message */ + TransportData = 4 + }; + + /** + * Constructs a WireGuardLayer object. + * + * @param data Pointer to the raw data representing the WireGuard layer + * @param dataLen Length of the data + * @param prevLayer Pointer to the previous layer in the packet (if any) + * @param packet Pointer to the packet this layer belongs to + */ + WireGuardLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) + : Layer(data, dataLen, prevLayer, packet, WireGuard) + {} + + /** + * Checks if the given port numbers are WireGuard ports. + * + * @param portSrc The source port number to check + * @param portDst The destination port number to check + * @return True if either port matches the WireGuard port (51820), false otherwise + */ + static bool isWireGuardPorts(uint16_t portSrc, uint16_t portDst) + { + return (portSrc == 51820 || portDst == 51820); + } + + /** + * Checks if the given data represents a WireGuard message. + * + * @param data Pointer to the raw data + * @param dataLen Length of the data + * @return True if the data starts with a valid WireGuard message type, false otherwise + */ + static bool isDataValid(const uint8_t* data, size_t dataLen); + + /** + * Parses the raw data into a WireGuard layer. + * + * @param data Pointer to the raw data + * @param dataLen Length of the data + * @param prevLayer Pointer to the previous layer + * @param packet Pointer to the packet + * @return A pointer to the parsed WireGuardLayer, or nullptr if parsing fails + */ + static WireGuardLayer* parseWireGuardLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet); + + /** + * @return String representation of the message type. + */ + std::string getMessageTypeAsString() const; + + /** + * @return The message type as an unsigned 32-bit integer. + */ + uint8_t getMessageType() const; + + /** + * @return The reserved field as a 32-bit integer. + */ + uint32_t getReserved() const; + + /** + * @param reserved The reserved field to set as a An array containing the 3-byte. + */ + void setReserved(const std::array& reserved); + + /** + * Does nothing for this layer (WireGuard layer is always last) + */ + void parseNextLayer() override + {} + + /** + * @return Size of the header in bytes. + */ + size_t getHeaderLen() const override; + + /** + * No fields to compute or update, so this method is left empty. + */ + void computeCalculateFields() override + {} + + /** + * Converts the WireGuard layer to a string representation. + * + * @return String representation of the WireGuard layer + */ + std::string toString() const override; + + /** + * @return OSI model layer corresponding to the Network layer + */ + OsiModelLayer getOsiModelLayer() const override + { + return OsiModelNetworkLayer; + } + + /** + * @return The message type as a WireGuardMessageType enum value. + */ + virtual WireGuardMessageType getWireGuardMessageType() const + { + return WireGuardMessageType::Unknown; + } + }; + + /** + * @class WireGuardHandshakeInitiationLayer + * Represents the Handshake Initiation message layer + */ + class WireGuardHandshakeInitiationLayer : public WireGuardLayer + { + private: +#pragma pack(push, 1) + /** + * @struct wg_handshake_initiation + * Represents the Handshake Initiation message structure + */ + typedef struct wg_handshake_initiation : wg_common_header + { + /** Sender index */ + uint32_t senderIndex; + /** Initiator's ephemeral public key */ + uint8_t initiatorEphemeral[32]; + /** Encrypted initiator's static key */ + uint8_t encryptedInitiatorStatic[48]; + /** Encrypted timestamp */ + uint8_t encryptedTimestamp[28]; + /** MAC1 field */ + uint8_t mac1[16]; + /** MAC2 field */ + uint8_t mac2[16]; + } wg_handshake_initiation; +#pragma pack(pop) + wg_handshake_initiation* getHandshakeInitiationHeader() const + { + return reinterpret_cast(getBasicHeader()); + } + + public: + /** + * A constructor that creates the layer from an existing packet raw data + * @param[in] data A pointer to the raw data + * @param[in] dataLen Size of the data in bytes + * @param[in] prevLayer A pointer to the previous layer + * @param[in] packet A pointer to the Packet instance where layer will be stored in + */ + WireGuardHandshakeInitiationLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) + : WireGuardLayer(data, dataLen, prevLayer, packet) + {} + + /** + * A constructor that creates a new Handshake Initiation message + * @param[in] senderIndex The sender's index + * @param[in] initiatorEphemeral The initiator's ephemeral public key + * @param[in] encryptedInitiatorStatic The encrypted initiator's static key + * @param[in] encryptedTimestamp The encrypted timestamp + * @param[in] mac1 The MAC1 field + * @param[in] mac2 The MAC2 field + */ + WireGuardHandshakeInitiationLayer(uint32_t senderIndex, const uint8_t initiatorEphemeral[32], + const uint8_t encryptedInitiatorStatic[48], + const uint8_t encryptedTimestamp[28], const uint8_t mac1[16], + const uint8_t mac2[16]); + + /** + * @return The sender index as a 32-bit integer. + */ + uint32_t getSenderIndex() const; + + /** + * @return An array containing the initiator's ephemeral public key. + */ + std::array getInitiatorEphemeral() const; + + /** + * @return An array containing the encrypted initiator's static key. + */ + std::array getEncryptedInitiatorStatic() const; + + /** + * @return An array containing the encrypted timestamp. + */ + std::array getEncryptedTimestamp() const; + + /** + * @return An array containing the MAC1 field. + */ + std::array getMac1() const; + + /** + * @return An array containing the MAC2 field. + */ + std::array getMac2() const; + + /** + * @param senderIndex A 32-bit integer representing the sender index. + */ + void setSenderIndex(uint32_t senderIndex); + + /** + * @param initiatorEphemeral An array containing the 32-byte initiator ephemeral public key. + */ + void setInitiatorEphemeral(const std::array& initiatorEphemeral); + + /** + * @param encryptedInitiatorStatic An array containing the 48-byte encrypted initiator's static key. + */ + void setEncryptedInitiatorStatic(const std::array& encryptedInitiatorStatic); + + /** + * @param encryptedTimestamp An array containing the 28-byte encrypted timestamp. + */ + void setEncryptedTimestamp(const std::array& encryptedTimestamp); + + /** + * @param mac1 An array containing the 16-byte MAC1 field. + */ + void setMac1(const std::array& mac1); + + /** + * @param mac2 An array containing the 16-byte MAC2 field. + */ + void setMac2(const std::array& mac2); + + // implement abstract methods + + /** + * @return WireGuardMessageType enum value indicating HandshakeInitiation. + */ + WireGuardMessageType getWireGuardMessageType() const override + { + return WireGuardMessageType::HandshakeInitiation; + } + }; + + /** + * @class WireGuardHandshakeResponseLayer + * Represents a Handshake Response message + */ + class WireGuardHandshakeResponseLayer : public WireGuardLayer + { + private: +#pragma pack(push, 1) + /** + * @struct wg_handshake_response + * Represents the Handshake Response message structure + */ + typedef struct wg_handshake_response : wg_common_header + { + /** Sender index */ + uint32_t senderIndex; + /** Receiver index */ + uint32_t receiverIndex; + /** Responder's ephemeral public key */ + uint8_t responderEphemeral[32]; + /** Encrypted empty field */ + uint8_t encryptedEmpty[16]; + /** MAC1 field */ + uint8_t mac1[16]; + /** MAC2 field */ + uint8_t mac2[16]; + } wg_handshake_response; +#pragma pack(pop) + + wg_handshake_response* getHandshakeResponseHeader() const + { + return reinterpret_cast(getBasicHeader()); + } + + public: + /** + * A constructor that creates the layer from an existing packet raw data + * @param[in] data A pointer to the raw data + * @param[in] dataLen Size of the data in bytes + * @param[in] prevLayer A pointer to the previous layer + * @param[in] packet A pointer to the Packet instance where layer will be stored in + */ + WireGuardHandshakeResponseLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) + : WireGuardLayer(data, dataLen, prevLayer, packet) + {} + + /** + * A constructor that creates a new Handshake Response message + * @param[in] senderIndex The sender index + * @param[in] receiverIndex The receiver index + * @param[in] responderEphemeral The responder's ephemeral public key + * @param[in] encryptedEmpty The encrypted empty field + * @param[in] mac1 The MAC1 field + * @param[in] mac2 The MAC2 field + */ + WireGuardHandshakeResponseLayer(uint32_t senderIndex, uint32_t receiverIndex, + const uint8_t responderEphemeral[32], const uint8_t encryptedEmpty[16], + const uint8_t mac1[16], const uint8_t mac2[16]); + + /** + * @return The sender index as a 32-bit unsigned integer. + */ + uint32_t getSenderIndex() const; + + /** + * @return The receiver index as a 32-bit unsigned integer. + */ + uint32_t getReceiverIndex() const; + + /** + * @return The responder's ephemeral public key as an array of 32 bytes. + */ + std::array getResponderEphemeral() const; + + /** + * @return The encrypted empty field as an array of 16 bytes. + */ + std::array getEncryptedEmpty() const; + + /** + * @return The MAC1 field as an array of 16 bytes. + */ + std::array getMac1() const; + + /** + * @return The MAC2 field as an array of 16 bytes. + */ + std::array getMac2() const; + + /** + * @param senderIndex A 32-bit unsigned integer representing the sender index. + */ + void setSenderIndex(uint32_t senderIndex); + + /** + * @param receiverIndex A 32-bit unsigned integer representing the receiver index. + */ + void setReceiverIndex(uint32_t receiverIndex); + + /** + * @param responderEphemeral An array containing the 32-byte responder ephemeral public key. + */ + void setResponderEphemeral(const std::array& responderEphemeral); + + /** + * @param encryptedEmpty An array containing the 16-byte encrypted empty field. + */ + void setEncryptedEmpty(const std::array& encryptedEmpty); + + /** + * @param mac1 An array containing the 16-byte MAC1 field. + */ + void setMac1(const std::array& mac1); + + /** + * @param mac2 An array containing the 16-byte MAC2 field. + */ + void setMac2(const std::array& mac2); + + // implement abstract methods + + /** + * @return The message type as a WireGuardMessageType enum value. + */ + WireGuardMessageType getWireGuardMessageType() const override + { + return WireGuardMessageType::HandshakeResponse; + } + }; + + /** + * @class WireGuardCookieReplyLayer + * Represents a Cookie Reply message + */ + class WireGuardCookieReplyLayer : public WireGuardLayer + { + private: +#pragma pack(push, 1) + /** + * @struct wg_cookie_reply + * Represents the Cookie Reply message structure + */ + typedef struct wg_cookie_reply : wg_common_header + { + /** Receiver index */ + uint32_t receiverIndex; + /** Nonce field */ + uint8_t nonce[24]; + /** Encrypted cookie */ + uint8_t encryptedCookie[32]; + } wg_cookie_reply; +#pragma pack(pop) + + wg_cookie_reply* getCookieReplyHeader() const + { + return reinterpret_cast(getBasicHeader()); + } + + public: + /** + * A constructor that creates the layer from an existing packet raw data + * @param[in] data A pointer to the raw data + * @param[in] dataLen Size of the data in bytes + * @param[in] prevLayer A pointer to the previous layer + * @param[in] packet A pointer to the Packet instance where layer will be stored in + */ + WireGuardCookieReplyLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) + : WireGuardLayer(data, dataLen, prevLayer, packet) + {} + + /** + * A constructor that creates a new Cookie Reply message + * @param[in] receiverIndex The receiver index + * @param[in] nonce The nonce field + * @param[in] encryptedCookie The encrypted cookie + */ + WireGuardCookieReplyLayer(uint32_t receiverIndex, const uint8_t nonce[24], const uint8_t encryptedCookie[32]); + + /** + * @return The receiver index as a 32-bit unsigned integer. + */ + uint32_t getReceiverIndex() const; + + /** + * @return The nonce field as an array of 24 bytes. + */ + std::array getNonce() const; + + /** + * @return The encrypted cookie as an array of 32 bytes. + */ + std::array getEncryptedCookie() const; + + /** + * @param receiverIndex A 32-bit unsigned integer representing the receiver index. + */ + void setReceiverIndex(uint32_t receiverIndex); + + /** + * @param nonce An array containing the 24-byte nonce field. + */ + void setNonce(const std::array& nonce); + + /** + * @param encryptedCookie An array containing the 32-byte encrypted cookie. + */ + void setEncryptedCookie(const std::array& encryptedCookie); + + // implement abstract methods + + /** + * @return The message type as a WireGuardMessageType enum value. + */ + WireGuardMessageType getWireGuardMessageType() const override + { + return WireGuardMessageType::CookieReply; + } + }; + + /** + * @class WireGuardTransportDataLayer + * Represents a Transport Data message + */ + class WireGuardTransportDataLayer : public WireGuardLayer + { + private: +#pragma pack(push, 1) + /** + * @struct wg_transport_data + * Represents the Transport Data message structure + */ + typedef struct wg_transport_data : wg_common_header + { + /** Receiver index */ + uint32_t receiverIndex; + /** Counter field */ + uint64_t counter; + /** Flexible array member for encrypted data */ + uint8_t encryptedData[0]; + } wg_transport_data; +#pragma pack(pop) + + wg_transport_data* getTransportHeader() const + { + return reinterpret_cast(getBasicHeader()); + } + + public: + /** + * A constructor that creates the layer from an existing packet raw data + * @param[in] data A pointer to the raw data + * @param[in] dataLen Size of the data in bytes + * @param[in] prevLayer A pointer to the previous layer + * @param[in] packet A pointer to the Packet instance where layer will be stored in + */ + WireGuardTransportDataLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) + : WireGuardLayer(data, dataLen, prevLayer, packet) + {} + + /** + * A constructor that creates a new Transport Data message + * @param[in] receiverIndex The receiver index + * @param[in] counter The counter field + * @param[in] encryptedData The encrypted data + * @param[in] encryptedDataLen The length of the encrypted data + */ + WireGuardTransportDataLayer(uint32_t receiverIndex, uint64_t counter, const uint8_t* encryptedData, + size_t encryptedDataLen); + + /** + * @return The receiver index as a 32-bit unsigned integer. + */ + uint32_t getReceiverIndex() const; + + /** + * @return The counter field as a 64-bit unsigned integer. + */ + uint64_t getCounter() const; + + /** + * @return A pointer to the encrypted data field. + */ + const uint8_t* getEncryptedData() const; + + /** + * @param receiverIndex A 32-bit unsigned integer representing the receiver index. + */ + void setReceiverIndex(uint32_t receiverIndex); + + /** + * @param counter A 64-bit unsigned integer representing the counter field. + */ + void setCounter(uint64_t counter); + + /** + * @param encryptedData A pointer to the encrypted data. + * @param encryptedDataLen The length of the encrypted data. + */ + void setEncryptedData(const uint8_t* encryptedData, size_t encryptedDataLen); + + // implement abstract methods + + /** + * @return The message type as a WireGuardMessageType enum value. + */ + WireGuardMessageType getWireGuardMessageType() const override + { + return WireGuardMessageType::TransportData; + } + }; +} // namespace pcpp diff --git a/Packet++/src/DhcpLayer.cpp b/Packet++/src/DhcpLayer.cpp index b75b841295..b5f15511fc 100644 --- a/Packet++/src/DhcpLayer.cpp +++ b/Packet++/src/DhcpLayer.cpp @@ -42,10 +42,8 @@ namespace pcpp } DhcpLayer::DhcpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = DHCP; - } + : Layer(data, dataLen, prevLayer, packet, DHCP) + {} void DhcpLayer::initDhcpLayer(size_t numOfBytesToAllocate) { diff --git a/Packet++/src/DhcpV6Layer.cpp b/Packet++/src/DhcpV6Layer.cpp index ba017106ac..e6a2d2a0e5 100644 --- a/Packet++/src/DhcpV6Layer.cpp +++ b/Packet++/src/DhcpV6Layer.cpp @@ -68,10 +68,8 @@ namespace pcpp } DhcpV6Layer::DhcpV6Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) - { - m_Protocol = DHCPv6; - } + : Layer(data, dataLen, prevLayer, packet, DHCPv6) + {} DhcpV6Layer::DhcpV6Layer(DhcpV6MessageType messageType, uint32_t transactionId) { diff --git a/Packet++/src/HttpLayer.cpp b/Packet++/src/HttpLayer.cpp index c3949b9c3f..46a37531ad 100644 --- a/Packet++/src/HttpLayer.cpp +++ b/Packet++/src/HttpLayer.cpp @@ -63,9 +63,8 @@ namespace pcpp // -------- Class HttpRequestLayer ----------------- HttpRequestLayer::HttpRequestLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : HttpMessage(data, dataLen, prevLayer, packet) + : HttpMessage(data, dataLen, prevLayer, packet, HTTPRequest) { - m_Protocol = HTTPRequest; m_FirstLine = new HttpRequestFirstLine(this); m_FieldsOffset = m_FirstLine->getSize(); parseFields(); @@ -669,9 +668,8 @@ namespace pcpp } HttpResponseLayer::HttpResponseLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : HttpMessage(data, dataLen, prevLayer, packet) + : HttpMessage(data, dataLen, prevLayer, packet, HTTPResponse) { - m_Protocol = HTTPResponse; m_FirstLine = new HttpResponseFirstLine(this); m_FieldsOffset = m_FirstLine->getSize(); parseFields(); diff --git a/Packet++/src/IPv6Layer.cpp b/Packet++/src/IPv6Layer.cpp index 3819a97b6c..f09e68816b 100644 --- a/Packet++/src/IPv6Layer.cpp +++ b/Packet++/src/IPv6Layer.cpp @@ -29,9 +29,8 @@ namespace pcpp } IPv6Layer::IPv6Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + : Layer(data, dataLen, prevLayer, packet, IPv6) { - m_Protocol = IPv6; m_FirstExtension = nullptr; m_LastExtension = nullptr; m_ExtensionsLen = 0; diff --git a/Packet++/src/LdapLayer.cpp b/Packet++/src/LdapLayer.cpp index 470f2aeda3..c123fc0f2d 100644 --- a/Packet++/src/LdapLayer.cpp +++ b/Packet++/src/LdapLayer.cpp @@ -193,9 +193,8 @@ namespace pcpp LdapLayer::LdapLayer(std::unique_ptr asn1Record, uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + : Layer(data, dataLen, prevLayer, packet, LDAP) { - m_Protocol = LDAP; m_Asn1Record = std::move(asn1Record); } diff --git a/Packet++/src/Packet.cpp b/Packet++/src/Packet.cpp index 30a2790fa9..7a7cc82c49 100644 --- a/Packet++/src/Packet.cpp +++ b/Packet++/src/Packet.cpp @@ -84,9 +84,17 @@ namespace pcpp if (curLayer != nullptr && curLayer->getOsiModelLayer() > parseUntilLayer) { - m_LastLayer = curLayer->getPrevLayer(); - delete curLayer; - m_LastLayer->m_NextLayer = nullptr; + // don't delete the first layer. If already past the target layer, treat the same as if the layer was found. + if (curLayer == m_FirstLayer) + { + curLayer->m_IsAllocatedInPacket = true; + } + else + { + m_LastLayer = curLayer->getPrevLayer(); + delete curLayer; + m_LastLayer->m_NextLayer = nullptr; + } } if (m_LastLayer != nullptr && parseUntil == UnknownProtocol && parseUntilLayer == OsiModelLayerUnknown) diff --git a/Packet++/src/RawPacket.cpp b/Packet++/src/RawPacket.cpp index 4a42a3c7be..4ae29bea8a 100644 --- a/Packet++/src/RawPacket.cpp +++ b/Packet++/src/RawPacket.cpp @@ -68,6 +68,11 @@ namespace pcpp return *this; } + RawPacket* RawPacket::clone() const + { + return new RawPacket(*this); + } + void RawPacket::copyDataFrom(const RawPacket& other, bool allocateData) { if (!other.m_RawPacketSet) diff --git a/Packet++/src/SdpLayer.cpp b/Packet++/src/SdpLayer.cpp index 240fd75e73..375eb7371b 100644 --- a/Packet++/src/SdpLayer.cpp +++ b/Packet++/src/SdpLayer.cpp @@ -21,9 +21,8 @@ namespace pcpp } SdpLayer::SdpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : TextBasedProtocolMessage(data, dataLen, prevLayer, packet) + : TextBasedProtocolMessage(data, dataLen, prevLayer, packet, SDP) { - m_Protocol = SDP; m_FieldsOffset = 0; parseFields(); } diff --git a/Packet++/src/SingleCommandTextProtocol.cpp b/Packet++/src/SingleCommandTextProtocol.cpp index 7d6ee5c7d0..f24407f56d 100644 --- a/Packet++/src/SingleCommandTextProtocol.cpp +++ b/Packet++/src/SingleCommandTextProtocol.cpp @@ -59,8 +59,10 @@ namespace pcpp return (firstPos != std::string::npos) && (lastPos != std::string::npos) && (firstPos != lastPos); } - SingleCommandTextProtocol::SingleCommandTextProtocol(const std::string& command, const std::string& option) + SingleCommandTextProtocol::SingleCommandTextProtocol(const std::string& command, const std::string& option, + ProtocolType protocol) { + m_Protocol = protocol; m_Data = new uint8_t[MIN_PACKET_LENGTH]; m_DataLen = MIN_PACKET_LENGTH; if (!command.empty()) diff --git a/Packet++/src/SipLayer.cpp b/Packet++/src/SipLayer.cpp index 4e94801e51..6cfa8256c9 100644 --- a/Packet++/src/SipLayer.cpp +++ b/Packet++/src/SipLayer.cpp @@ -349,9 +349,8 @@ namespace pcpp // -------- Class SipRequestLayer ----------------- SipRequestLayer::SipRequestLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : SipLayer(data, dataLen, prevLayer, packet) + : SipLayer(data, dataLen, prevLayer, packet, SIPRequest) { - m_Protocol = SIPRequest; m_FirstLine = new SipRequestFirstLine(this); m_FieldsOffset = m_FirstLine->getSize(); parseFields(); @@ -586,9 +585,8 @@ namespace pcpp }; SipResponseLayer::SipResponseLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : SipLayer(data, dataLen, prevLayer, packet) + : SipLayer(data, dataLen, prevLayer, packet, SIPResponse) { - m_Protocol = SIPResponse; m_FirstLine = new SipResponseFirstLine(this); m_FieldsOffset = m_FirstLine->getSize(); parseFields(); diff --git a/Packet++/src/SmtpLayer.cpp b/Packet++/src/SmtpLayer.cpp index 4e1c2620cb..bf2a703637 100644 --- a/Packet++/src/SmtpLayer.cpp +++ b/Packet++/src/SmtpLayer.cpp @@ -17,7 +17,7 @@ namespace pcpp size_t val = 0; std::string field = getCommandString(); - for (size_t idx = 0; idx < field.size(); ++idx) + for (size_t idx = 0; idx < std::min(field.size(), static_cast(8)); ++idx) { val |= static_cast(field.c_str()[idx]) << (idx * 8); } diff --git a/Packet++/src/TcpLayer.cpp b/Packet++/src/TcpLayer.cpp index 8731c25fc2..c6963d2259 100644 --- a/Packet++/src/TcpLayer.cpp +++ b/Packet++/src/TcpLayer.cpp @@ -317,9 +317,8 @@ namespace pcpp } TcpLayer::TcpLayer(uint8_t* data, const size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet) + : Layer(data, dataLen, prevLayer, packet, TCP) { - m_Protocol = TCP; m_NumOfTrailingBytes = 0; } diff --git a/Packet++/src/TcpReassembly.cpp b/Packet++/src/TcpReassembly.cpp index 697041c915..7e958aa953 100644 --- a/Packet++/src/TcpReassembly.cpp +++ b/Packet++/src/TcpReassembly.cpp @@ -232,8 +232,15 @@ namespace pcpp // if this side already got FIN or RST packet before, ignore this packet as this side is considered closed if (tcpReassemblyData->twoSides[sideIndex].gotFinOrRst) { + if (!tcpReassemblyData->twoSides[1 - sideIndex].gotFinOrRst && isRst) + { + handleFinOrRst(tcpReassemblyData, 1 - sideIndex, flowKey, isRst); + return FIN_RSTWithNoData; + } + PCPP_LOG_DEBUG("Got a packet after FIN or RST were already seen on this side (" << static_cast(sideIndex) << "). Ignoring this packet"); + return Ignore_PacketOfClosedFlow; } diff --git a/Packet++/src/TextBasedProtocol.cpp b/Packet++/src/TextBasedProtocol.cpp index 2b385b22cd..6c01010813 100644 --- a/Packet++/src/TextBasedProtocol.cpp +++ b/Packet++/src/TextBasedProtocol.cpp @@ -23,8 +23,10 @@ namespace pcpp // -------- Class TextBasedProtocolMessage ----------------- - TextBasedProtocolMessage::TextBasedProtocolMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) - : Layer(data, dataLen, prevLayer, packet), m_FieldList(nullptr), m_LastField(nullptr), m_FieldsOffset(0) + TextBasedProtocolMessage::TextBasedProtocolMessage(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet, + ProtocolType protocol) + : Layer(data, dataLen, prevLayer, packet, protocol), m_FieldList(nullptr), m_LastField(nullptr), + m_FieldsOffset(0) {} TextBasedProtocolMessage::TextBasedProtocolMessage(const TextBasedProtocolMessage& other) : Layer(other) diff --git a/Packet++/src/UdpLayer.cpp b/Packet++/src/UdpLayer.cpp index 2e17b9cddc..274695b856 100644 --- a/Packet++/src/UdpLayer.cpp +++ b/Packet++/src/UdpLayer.cpp @@ -15,6 +15,7 @@ #include "NtpLayer.h" #include "SomeIpLayer.h" #include "WakeOnLanLayer.h" +#include "WireGuardLayer.h" #include "PacketUtils.h" #include "Logger.h" #include @@ -134,6 +135,13 @@ namespace pcpp m_NextLayer = SomeIpLayer::parseSomeIpLayer(udpData, udpDataLen, this, m_Packet); else if ((WakeOnLanLayer::isWakeOnLanPort(portDst) && WakeOnLanLayer::isDataValid(udpData, udpDataLen))) m_NextLayer = new WakeOnLanLayer(udpData, udpDataLen, this, m_Packet); + else if ((WireGuardLayer::isWireGuardPorts(portDst, portSrc) && + WireGuardLayer::isDataValid(udpData, udpDataLen))) + { + m_NextLayer = WireGuardLayer::parseWireGuardLayer(udpData, udpDataLen, this, m_Packet); + if (!m_NextLayer) + m_NextLayer = new PayloadLayer(udpData, udpDataLen, this, m_Packet); + } else m_NextLayer = new PayloadLayer(udpData, udpDataLen, this, m_Packet); } diff --git a/Packet++/src/WireGuardLayer.cpp b/Packet++/src/WireGuardLayer.cpp new file mode 100644 index 0000000000..316c605c51 --- /dev/null +++ b/Packet++/src/WireGuardLayer.cpp @@ -0,0 +1,412 @@ +#define LOG_MODULE PacketLogModuleWireGuardLayer + +#include "UdpLayer.h" +#include "WireGuardLayer.h" +#include "EndianPortable.h" +#include +#include + +namespace pcpp +{ + WireGuardLayer* WireGuardLayer::parseWireGuardLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) + { + if (dataLen < sizeof(WireGuardLayer::wg_common_header)) + return nullptr; + wg_common_header* wgHeader = reinterpret_cast(data); + + switch (wgHeader->messageType) + { + case static_cast(WireGuardMessageType::HandshakeInitiation): + return new WireGuardHandshakeInitiationLayer(data, dataLen, prevLayer, packet); + case static_cast(WireGuardMessageType::HandshakeResponse): + return new WireGuardHandshakeResponseLayer(data, dataLen, prevLayer, packet); + case static_cast(WireGuardMessageType::CookieReply): + return new WireGuardCookieReplyLayer(data, dataLen, prevLayer, packet); + case static_cast(WireGuardMessageType::TransportData): + return new WireGuardTransportDataLayer(data, dataLen, prevLayer, packet); + default: + return nullptr; + } + } + + std::string WireGuardLayer::getMessageTypeAsString() const + { + uint32_t messageType = getMessageType(); + switch (messageType) + { + case static_cast(WireGuardMessageType::HandshakeInitiation): + return "Handshake Initiation"; + case static_cast(WireGuardMessageType::HandshakeResponse): + return "Handshake Response"; + case static_cast(WireGuardMessageType::CookieReply): + return "Cookie Reply"; + case static_cast(WireGuardMessageType::TransportData): + return "Transport Data"; + default: + return "Unknown"; + } + } + + std::string WireGuardLayer::toString() const + { + return "WireGuard Layer, " + getMessageTypeAsString() + " message"; + } + + size_t WireGuardLayer::getHeaderLen() const + { + return m_DataLen; + } + + uint8_t WireGuardLayer::getMessageType() const + { + return getBasicHeader()->messageType; + } + + uint32_t WireGuardLayer::getReserved() const + { + uint32_t reservedValue = 0; + memcpy(&reservedValue, getBasicHeader()->reserved, 3); + return be32toh(reservedValue); + } + + void WireGuardLayer::setReserved(const std::array& reserved) + { + wg_common_header* msg = reinterpret_cast(m_Data); + memcpy(msg->reserved, reserved.data(), 3); + } + + bool WireGuardLayer::isDataValid(const uint8_t* data, size_t dataLen) + { + if (dataLen < sizeof(WireGuardLayer::wg_common_header)) + return false; + + uint8_t messageType = data[0]; + return messageType >= static_cast(WireGuardLayer::WireGuardMessageType::HandshakeInitiation) && + messageType <= static_cast(WireGuardLayer::WireGuardMessageType::TransportData); + } + + // ~~~~~~~~~~~~~~~~~~~~ + // WireGuardHandshakeInitiationLayer + // ~~~~~~~~~~~~~~~~~~~~ + + WireGuardHandshakeInitiationLayer::WireGuardHandshakeInitiationLayer(uint32_t senderIndex, + const uint8_t initiatorEphemeral[32], + const uint8_t encryptedInitiatorStatic[48], + const uint8_t encryptedTimestamp[28], + const uint8_t mac1[16], const uint8_t mac2[16]) + { + const size_t messageLen = sizeof(wg_handshake_initiation); + m_DataLen = messageLen; + m_Data = new uint8_t[messageLen]; + memset(m_Data, 0, messageLen); + + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + + msg->messageType = static_cast(WireGuardMessageType::HandshakeInitiation); + memset(msg->reserved, 0, 3); + msg->senderIndex = htobe32(senderIndex); + + memcpy(msg->initiatorEphemeral, initiatorEphemeral, 32); + memcpy(msg->encryptedInitiatorStatic, encryptedInitiatorStatic, 48); + memcpy(msg->encryptedTimestamp, encryptedTimestamp, 28); + memcpy(msg->mac1, mac1, 16); + memcpy(msg->mac2, mac2, 16); + + m_Protocol = WireGuard; + } + + uint32_t WireGuardHandshakeInitiationLayer::getSenderIndex() const + { + return be32toh(getHandshakeInitiationHeader()->senderIndex); + } + + std::array WireGuardHandshakeInitiationLayer::getInitiatorEphemeral() const + { + std::array ephemeralArray; + memcpy(ephemeralArray.data(), getHandshakeInitiationHeader()->initiatorEphemeral, 32); + return ephemeralArray; + } + + std::array WireGuardHandshakeInitiationLayer::getEncryptedInitiatorStatic() const + { + std::array initArray; + memcpy(initArray.data(), getHandshakeInitiationHeader()->encryptedInitiatorStatic, 48); + return initArray; + } + + std::array WireGuardHandshakeInitiationLayer::getEncryptedTimestamp() const + { + std::array tsArray; + memcpy(tsArray.data(), getHandshakeInitiationHeader()->encryptedTimestamp, 28); + return tsArray; + } + + std::array WireGuardHandshakeInitiationLayer::getMac1() const + { + std::array mac1Array; + memcpy(mac1Array.data(), getHandshakeInitiationHeader()->mac1, 16); + return mac1Array; + } + + std::array WireGuardHandshakeInitiationLayer::getMac2() const + { + std::array mac2Array; + memcpy(mac2Array.data(), getHandshakeInitiationHeader()->mac2, 16); + return mac2Array; + } + + void WireGuardHandshakeInitiationLayer::setSenderIndex(uint32_t senderIndex) + { + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + msg->senderIndex = htobe32(senderIndex); + } + + void WireGuardHandshakeInitiationLayer::setInitiatorEphemeral(const std::array& initiatorEphemeral) + { + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + memcpy(msg->initiatorEphemeral, initiatorEphemeral.data(), 32); + } + + void WireGuardHandshakeInitiationLayer::setEncryptedInitiatorStatic( + const std::array& encryptedInitiatorStatic) + { + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + memcpy(msg->encryptedInitiatorStatic, encryptedInitiatorStatic.data(), 48); + } + + void WireGuardHandshakeInitiationLayer::setEncryptedTimestamp(const std::array& encryptedTimestamp) + { + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + memcpy(msg->encryptedTimestamp, encryptedTimestamp.data(), 28); + } + + void WireGuardHandshakeInitiationLayer::setMac1(const std::array& mac1) + { + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + memcpy(msg->mac1, mac1.data(), 16); + } + + void WireGuardHandshakeInitiationLayer::setMac2(const std::array& mac2) + { + wg_handshake_initiation* msg = reinterpret_cast(m_Data); + memcpy(msg->mac2, mac2.data(), 16); + } + + // ~~~~~~~~~~~~~~~~~~~~ + // WireGuardHandshakeResponseLayer + // ~~~~~~~~~~~~~~~~~~~~ + + WireGuardHandshakeResponseLayer::WireGuardHandshakeResponseLayer(uint32_t senderIndex, uint32_t receiverIndex, + const uint8_t responderEphemeral[32], + const uint8_t encryptedEmpty[16], + const uint8_t mac1[16], const uint8_t mac2[16]) + { + const size_t messageLen = sizeof(wg_handshake_response); + m_DataLen = messageLen; + m_Data = new uint8_t[messageLen]; + wg_handshake_response* msg = reinterpret_cast(m_Data); + + msg->messageType = static_cast(WireGuardMessageType::HandshakeResponse); + memset(msg->reserved, 0, 3); + msg->senderIndex = htobe32(senderIndex); + msg->receiverIndex = htobe32(receiverIndex); + memcpy(msg->responderEphemeral, responderEphemeral, 32); + memcpy(msg->encryptedEmpty, encryptedEmpty, 16); + memcpy(msg->mac1, mac1, 16); + memcpy(msg->mac2, mac2, 16); + + m_Protocol = WireGuard; + } + + uint32_t WireGuardHandshakeResponseLayer::getSenderIndex() const + { + return be32toh(getHandshakeResponseHeader()->senderIndex); + } + + uint32_t WireGuardHandshakeResponseLayer::getReceiverIndex() const + { + return be32toh(getHandshakeResponseHeader()->receiverIndex); + } + + std::array WireGuardHandshakeResponseLayer::getResponderEphemeral() const + { + std::array responderEphemeralArray; + memcpy(responderEphemeralArray.data(), getHandshakeResponseHeader()->responderEphemeral, 32); + return responderEphemeralArray; + } + + std::array WireGuardHandshakeResponseLayer::getEncryptedEmpty() const + { + std::array encryptedEmptyArray; + memcpy(encryptedEmptyArray.data(), getHandshakeResponseHeader()->encryptedEmpty, 16); + return encryptedEmptyArray; + } + + std::array WireGuardHandshakeResponseLayer::getMac1() const + { + std::array mac1Array; + memcpy(mac1Array.data(), getHandshakeResponseHeader()->mac1, 16); + return mac1Array; + } + + std::array WireGuardHandshakeResponseLayer::getMac2() const + { + std::array mac2Array; + memcpy(mac2Array.data(), getHandshakeResponseHeader()->mac2, 16); + return mac2Array; + } + + void WireGuardHandshakeResponseLayer::setSenderIndex(uint32_t senderIndex) + { + + wg_handshake_response* msg = reinterpret_cast(m_Data); + msg->senderIndex = htobe32(senderIndex); + } + + void WireGuardHandshakeResponseLayer::setReceiverIndex(uint32_t receiverIndex) + { + wg_handshake_response* msg = reinterpret_cast(m_Data); + msg->receiverIndex = htobe32(receiverIndex); + } + + void WireGuardHandshakeResponseLayer::setResponderEphemeral(const std::array& responderEphemeral) + { + wg_handshake_response* msg = reinterpret_cast(m_Data); + memcpy(msg->responderEphemeral, responderEphemeral.data(), 32); + } + + void WireGuardHandshakeResponseLayer::setEncryptedEmpty(const std::array& encryptedEmpty) + { + wg_handshake_response* msg = reinterpret_cast(m_Data); + memcpy(msg->encryptedEmpty, encryptedEmpty.data(), 16); + } + + void WireGuardHandshakeResponseLayer::setMac1(const std::array& mac1) + { + wg_handshake_response* msg = reinterpret_cast(m_Data); + memcpy(msg->mac1, mac1.data(), 16); + } + + void WireGuardHandshakeResponseLayer::setMac2(const std::array& mac2) + { + wg_handshake_response* msg = reinterpret_cast(m_Data); + memcpy(msg->mac2, mac2.data(), 16); + } + + // ~~~~~~~~~~~~~~~~~~~~ + // WireGuardCookieReplyLayer + // ~~~~~~~~~~~~~~~~~~~~ + + WireGuardCookieReplyLayer::WireGuardCookieReplyLayer(uint32_t receiverIndex, const uint8_t nonce[24], + const uint8_t encryptedCookie[32]) + { + const size_t messageLen = sizeof(wg_cookie_reply); + m_DataLen = messageLen; + m_Data = new uint8_t[messageLen]; + memset(m_Data, 0, messageLen); + + wg_cookie_reply* msg = reinterpret_cast(m_Data); + + msg->messageType = static_cast(WireGuardMessageType::CookieReply); + memset(msg->reserved, 0, 3); + msg->receiverIndex = htobe32(receiverIndex); + memcpy(msg->nonce, nonce, 24); + memcpy(msg->encryptedCookie, encryptedCookie, 32); + + m_Protocol = WireGuard; + } + + uint32_t WireGuardCookieReplyLayer::getReceiverIndex() const + { + return be32toh(getCookieReplyHeader()->receiverIndex); + } + + std::array WireGuardCookieReplyLayer::getNonce() const + { + std::array nonceArray; + memcpy(nonceArray.data(), getCookieReplyHeader()->nonce, 24); + return nonceArray; + } + + std::array WireGuardCookieReplyLayer::getEncryptedCookie() const + { + std::array encryptedCookieArray; + memcpy(encryptedCookieArray.data(), getCookieReplyHeader()->encryptedCookie, 32); + return encryptedCookieArray; + } + + void WireGuardCookieReplyLayer::setReceiverIndex(uint32_t receiverIndex) + { + wg_cookie_reply* msg = reinterpret_cast(m_Data); + msg->receiverIndex = htobe32(receiverIndex); + } + + void WireGuardCookieReplyLayer::setNonce(const std::array& nonce) + { + wg_cookie_reply* msg = reinterpret_cast(m_Data); + memcpy(msg->nonce, nonce.data(), 24); + } + + void WireGuardCookieReplyLayer::setEncryptedCookie(const std::array& encryptedCookie) + { + wg_cookie_reply* msg = reinterpret_cast(m_Data); + memcpy(msg->encryptedCookie, encryptedCookie.data(), 32); + } + + // ~~~~~~~~~~~~~~~~~~~~ + // WireGuardTransportDataLayer + // ~~~~~~~~~~~~~~~~~~~~ + + WireGuardTransportDataLayer::WireGuardTransportDataLayer(uint32_t receiverIndex, uint64_t counter, + const uint8_t* encryptedData, size_t encryptedDataLen) + { + const size_t messageLen = sizeof(wg_transport_data) + encryptedDataLen; + m_DataLen = messageLen; + m_Data = new uint8_t[messageLen]; + memset(m_Data, 0, messageLen); + + wg_transport_data* msg = reinterpret_cast(m_Data); + + msg->messageType = static_cast(WireGuardMessageType::TransportData); + memset(msg->reserved, 0, 3); + msg->receiverIndex = htobe32(receiverIndex); + msg->counter = htobe64(counter); + memcpy(m_Data + sizeof(wg_transport_data), encryptedData, encryptedDataLen); + + m_Protocol = WireGuard; + } + + uint32_t WireGuardTransportDataLayer::getReceiverIndex() const + { + return be32toh(getTransportHeader()->receiverIndex); + } + + uint64_t WireGuardTransportDataLayer::getCounter() const + { + return be64toh(getTransportHeader()->counter); + } + + const uint8_t* WireGuardTransportDataLayer::getEncryptedData() const + { + return getTransportHeader()->encryptedData; + } + + void WireGuardTransportDataLayer::setReceiverIndex(uint32_t receiverIndex) + { + wg_transport_data* msg = reinterpret_cast(m_Data); + msg->receiverIndex = htobe32(receiverIndex); + } + + void WireGuardTransportDataLayer::setCounter(uint64_t counter) + { + wg_transport_data* msg = reinterpret_cast(m_Data); + msg->counter = htobe64(counter); + } + + void WireGuardTransportDataLayer::setEncryptedData(const uint8_t* encryptedData, size_t encryptedDataLen) + { + wg_transport_data* msg = reinterpret_cast(m_Data); + memcpy(msg->encryptedData, encryptedData, encryptedDataLen); + } + +} // namespace pcpp diff --git a/Pcap++/CMakeLists.txt b/Pcap++/CMakeLists.txt index f28fcb6be6..ab3ef642bd 100644 --- a/Pcap++/CMakeLists.txt +++ b/Pcap++/CMakeLists.txt @@ -71,9 +71,9 @@ if(WIN32) list( APPEND public_headers - header/WinPcapLiveDevice.h header/PcapRemoteDevice.h - header/PcapRemoteDeviceList.h) + header/PcapRemoteDeviceList.h + header/WinPcapLiveDevice.h) endif() set_property(TARGET Pcap++ PROPERTY PUBLIC_HEADER ${public_headers}) diff --git a/Pcap++/header/MBufRawPacket.h b/Pcap++/header/MBufRawPacket.h index 865c3787e1..51e024cbed 100644 --- a/Pcap++/header/MBufRawPacket.h +++ b/Pcap++/header/MBufRawPacket.h @@ -166,6 +166,13 @@ namespace pcpp */ MBufRawPacket& operator=(const MBufRawPacket& other); + /** + * @brief Clone this MBufRawPacket object. See copy constructor for details. + * The caller is responsible for the deallocation of the returned pointer. + * @return A pointer to the new MBufRawPacket object which is a clone of this object + */ + MBufRawPacket* clone() const override; + /** * Set raw data to the mbuf by copying the data to it. In order to stay compatible with the ancestor method * which takes control of the data pointer and frees it when RawPacket is destroyed, this method frees this diff --git a/Pcap++/header/PcapFileDevice.h b/Pcap++/header/PcapFileDevice.h index 8006943745..89dd8c7b12 100644 --- a/Pcap++/header/PcapFileDevice.h +++ b/Pcap++/header/PcapFileDevice.h @@ -458,7 +458,9 @@ namespace pcpp * A destructor for this class */ ~PcapFileWriterDevice() - {} + { + PcapFileWriterDevice::close(); + } /** * Write a RawPacket to the file. Before using this method please verify the file is opened using open(). This diff --git a/Pcap++/header/PcapRemoteDevice.h b/Pcap++/header/PcapRemoteDevice.h index 26104b6db9..b0c366cb2f 100644 --- a/Pcap++/header/PcapRemoteDevice.h +++ b/Pcap++/header/PcapRemoteDevice.h @@ -1,10 +1,8 @@ #pragma once -#if defined(_WIN32) - -# include -# include -# include "PcapLiveDevice.h" +#include +#include +#include "PcapLiveDevice.h" /// @file @@ -160,5 +158,3 @@ namespace pcpp }; } // namespace pcpp - -#endif // _WIN32 diff --git a/Pcap++/header/PcapRemoteDeviceList.h b/Pcap++/header/PcapRemoteDeviceList.h index df6e6a93eb..9d1d1fac6c 100644 --- a/Pcap++/header/PcapRemoteDeviceList.h +++ b/Pcap++/header/PcapRemoteDeviceList.h @@ -1,11 +1,9 @@ #pragma once -#if defined(_WIN32) - -# include -# include "IpAddress.h" -# include "PcapRemoteDevice.h" -# include "DeprecationUtils.h" +#include +#include "IpAddress.h" +#include "PcapRemoteDevice.h" +#include "DeprecationUtils.h" /// @file @@ -222,5 +220,3 @@ namespace pcpp }; } // namespace pcpp - -#endif // _WIN32 diff --git a/Pcap++/header/WinPcapLiveDevice.h b/Pcap++/header/WinPcapLiveDevice.h index 9cc5a501a3..816a96cf05 100644 --- a/Pcap++/header/WinPcapLiveDevice.h +++ b/Pcap++/header/WinPcapLiveDevice.h @@ -1,10 +1,8 @@ #pragma once -#if defined(_WIN32) - /// @file -# include "PcapLiveDevice.h" +#include "PcapLiveDevice.h" /** * \namespace pcpp @@ -34,17 +32,17 @@ namespace pcpp WinPcapLiveDevice& operator=(const WinPcapLiveDevice& other); public: - virtual LiveDeviceType getDeviceType() const + LiveDeviceType getDeviceType() const override { return WinPcapDevice; } bool startCapture(OnPacketArrivesCallback onPacketArrives, void* onPacketArrivesUserCookie, int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate, - void* onStatsUpdateUserCookie); + void* onStatsUpdateUserCookie) override; bool startCapture(int intervalInSecondsToUpdateStats, OnStatsUpdateCallback onStatsUpdate, - void* onStatsUpdateUserCookie); - bool startCapture(RawPacketVector& capturedPacketsVector) + void* onStatsUpdateUserCookie) override; + bool startCapture(RawPacketVector& capturedPacketsVector) override { return PcapLiveDevice::startCapture(capturedPacketsVector); } @@ -76,5 +74,3 @@ namespace pcpp }; } // namespace pcpp - -#endif // _WIN32 diff --git a/Pcap++/src/DpdkDevice.cpp b/Pcap++/src/DpdkDevice.cpp index 6b44fb11c9..28f37caa0b 100644 --- a/Pcap++/src/DpdkDevice.cpp +++ b/Pcap++/src/DpdkDevice.cpp @@ -1,38 +1,36 @@ -#ifdef USE_DPDK - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModuleDpdkDevice - -# define __STDC_LIMIT_MACROS -# define __STDC_FORMAT_MACROS - -# include "DpdkDevice.h" -# include "DpdkDeviceList.h" -# include "Logger.h" -# include "rte_version.h" -# if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) -# include "rte_bus_pci.h" -# endif -# include "rte_pci.h" -# include "rte_config.h" -# include "rte_ethdev.h" -# include "rte_errno.h" -# include "rte_malloc.h" -# include "rte_cycles.h" -# include -# include -# include - -# define MAX_BURST_SIZE 64 - -# define MEMPOOL_CACHE_SIZE 256 - -# if (RTE_VER_YEAR < 21) || (RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11) -# define GET_MASTER_CORE rte_get_master_lcore -# else -# define GET_MASTER_CORE rte_get_main_lcore -# endif +#define LOG_MODULE PcapLogModuleDpdkDevice + +#define __STDC_LIMIT_MACROS +#define __STDC_FORMAT_MACROS + +#include "DpdkDevice.h" +#include "DpdkDeviceList.h" +#include "Logger.h" +#include "rte_version.h" +#if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) +# include "rte_bus_pci.h" +#endif +#include "rte_pci.h" +#include "rte_config.h" +#include "rte_ethdev.h" +#include "rte_errno.h" +#include "rte_malloc.h" +#include "rte_cycles.h" +#include +#include +#include + +#define MAX_BURST_SIZE 64 + +#define MEMPOOL_CACHE_SIZE 256 + +#if (RTE_VER_YEAR < 21) || (RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11) +# define GET_MASTER_CORE rte_get_master_lcore +#else +# define GET_MASTER_CORE rte_get_main_lcore +#endif namespace pcpp { @@ -43,65 +41,65 @@ namespace pcpp * ================ */ -# define DPDK_CONFIG_HEADER_SPLIT 0 /**< Header Split disabled */ -# define DPDK_CONFIG_SPLIT_HEADER_SIZE 0 -# define DPDK_CONFIG_HW_IP_CHECKSUM 0 /**< IP checksum offload disabled */ -# define DPDK_CONFIG_HW_VLAN_FILTER 0 /**< VLAN filtering disabled */ -# define DPDK_CONFIG_JUMBO_FRAME 0 /**< Jumbo Frame Support disabled */ -# define DPDK_CONFIG_HW_STRIP_CRC 0 /**< CRC stripped by hardware disabled */ -# if (RTE_VER_YEAR < 21) || (RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11) -# define DPDK_CONFIG_ETH_LINK_FULL_DUPLEX ETH_LINK_FULL_DUPLEX -# define DPDK_CONFIG_MQ_RSS ETH_RSS -# define DPDK_CONFIG_MQ_NO_RSS ETH_MQ_RX_NONE -# else -# define DPDK_CONFIG_ETH_LINK_FULL_DUPLEX RTE_ETH_LINK_FULL_DUPLEX -# define DPDK_CONFIG_MQ_RSS RTE_ETH_MQ_RX_RSS -# define DPDK_CONFIG_MQ_NO_RSS RTE_ETH_MQ_RX_NONE -# endif - -# if (RTE_VER_YEAR < 22) || (RTE_VER_YEAR == 22 && RTE_VER_MONTH < 11) -# define DPDK_CONFIG_ETH_RSS_IPV4 ETH_RSS_IPV4 -# define DPDK_CONFIG_ETH_RSS_FRAG_IPV4 ETH_RSS_FRAG_IPV4 -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_TCP ETH_RSS_NONFRAG_IPV4_TCP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_UDP ETH_RSS_NONFRAG_IPV4_UDP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_SCTP ETH_RSS_NONFRAG_IPV4_SCTP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_OTHER ETH_RSS_NONFRAG_IPV4_OTHER -# define DPDK_CONFIG_ETH_RSS_IPV6 ETH_RSS_IPV6 -# define DPDK_CONFIG_ETH_RSS_FRAG_IPV6 ETH_RSS_FRAG_IPV6 -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_TCP ETH_RSS_NONFRAG_IPV6_TCP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_UDP ETH_RSS_NONFRAG_IPV6_UDP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_SCTP ETH_RSS_NONFRAG_IPV6_SCTP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_OTHER ETH_RSS_NONFRAG_IPV6_OTHER -# define DPDK_CONFIG_ETH_RSS_L2_PAYLOAD ETH_RSS_L2_PAYLOAD -# define DPDK_CONFIG_ETH_RSS_IPV6_EX ETH_RSS_IPV6_EX -# define DPDK_CONFIG_ETH_RSS_IPV6_TCP_EX ETH_RSS_IPV6_TCP_EX -# define DPDK_CONFIG_ETH_RSS_IPV6_UDP_EX ETH_RSS_IPV6_UDP_EX -# define DPDK_CONFIG_ETH_RSS_PORT ETH_RSS_PORT -# define DPDK_CONFIG_ETH_RSS_VXLAN ETH_RSS_VXLAN -# define DPDK_CONFIG_ETH_RSS_GENEVE ETH_RSS_GENEVE -# define DPDK_CONFIG_ETH_RSS_NVGRE ETH_RSS_NVGRE -# else -# define DPDK_CONFIG_ETH_RSS_IPV4 RTE_ETH_RSS_IPV4 -# define DPDK_CONFIG_ETH_RSS_FRAG_IPV4 RTE_ETH_RSS_FRAG_IPV4 -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_TCP RTE_ETH_RSS_NONFRAG_IPV4_TCP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_UDP RTE_ETH_RSS_NONFRAG_IPV4_UDP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_SCTP RTE_ETH_RSS_NONFRAG_IPV4_SCTP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_OTHER RTE_ETH_RSS_NONFRAG_IPV4_OTHER -# define DPDK_CONFIG_ETH_RSS_IPV6 RTE_ETH_RSS_IPV6 -# define DPDK_CONFIG_ETH_RSS_FRAG_IPV6 RTE_ETH_RSS_FRAG_IPV6 -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_TCP RTE_ETH_RSS_NONFRAG_IPV6_TCP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_UDP RTE_ETH_RSS_NONFRAG_IPV6_UDP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_SCTP RTE_ETH_RSS_NONFRAG_IPV6_SCTP -# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_OTHER RTE_ETH_RSS_NONFRAG_IPV6_OTHER -# define DPDK_CONFIG_ETH_RSS_L2_PAYLOAD RTE_ETH_RSS_L2_PAYLOAD -# define DPDK_CONFIG_ETH_RSS_IPV6_EX RTE_ETH_RSS_IPV6_EX -# define DPDK_CONFIG_ETH_RSS_IPV6_TCP_EX RTE_ETH_RSS_IPV6_TCP_EX -# define DPDK_CONFIG_ETH_RSS_IPV6_UDP_EX RTE_ETH_RSS_IPV6_UDP_EX -# define DPDK_CONFIG_ETH_RSS_PORT RTE_ETH_RSS_PORT -# define DPDK_CONFIG_ETH_RSS_VXLAN RTE_ETH_RSS_VXLAN -# define DPDK_CONFIG_ETH_RSS_GENEVE RTE_ETH_RSS_GENEVE -# define DPDK_CONFIG_ETH_RSS_NVGRE RTE_ETH_RSS_NVGRE -# endif +#define DPDK_CONFIG_HEADER_SPLIT 0 /**< Header Split disabled */ +#define DPDK_CONFIG_SPLIT_HEADER_SIZE 0 +#define DPDK_CONFIG_HW_IP_CHECKSUM 0 /**< IP checksum offload disabled */ +#define DPDK_CONFIG_HW_VLAN_FILTER 0 /**< VLAN filtering disabled */ +#define DPDK_CONFIG_JUMBO_FRAME 0 /**< Jumbo Frame Support disabled */ +#define DPDK_CONFIG_HW_STRIP_CRC 0 /**< CRC stripped by hardware disabled */ +#if (RTE_VER_YEAR < 21) || (RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11) +# define DPDK_CONFIG_ETH_LINK_FULL_DUPLEX ETH_LINK_FULL_DUPLEX +# define DPDK_CONFIG_MQ_RSS ETH_RSS +# define DPDK_CONFIG_MQ_NO_RSS ETH_MQ_RX_NONE +#else +# define DPDK_CONFIG_ETH_LINK_FULL_DUPLEX RTE_ETH_LINK_FULL_DUPLEX +# define DPDK_CONFIG_MQ_RSS RTE_ETH_MQ_RX_RSS +# define DPDK_CONFIG_MQ_NO_RSS RTE_ETH_MQ_RX_NONE +#endif + +#if (RTE_VER_YEAR < 22) || (RTE_VER_YEAR == 22 && RTE_VER_MONTH < 11) +# define DPDK_CONFIG_ETH_RSS_IPV4 ETH_RSS_IPV4 +# define DPDK_CONFIG_ETH_RSS_FRAG_IPV4 ETH_RSS_FRAG_IPV4 +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_TCP ETH_RSS_NONFRAG_IPV4_TCP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_UDP ETH_RSS_NONFRAG_IPV4_UDP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_SCTP ETH_RSS_NONFRAG_IPV4_SCTP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_OTHER ETH_RSS_NONFRAG_IPV4_OTHER +# define DPDK_CONFIG_ETH_RSS_IPV6 ETH_RSS_IPV6 +# define DPDK_CONFIG_ETH_RSS_FRAG_IPV6 ETH_RSS_FRAG_IPV6 +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_TCP ETH_RSS_NONFRAG_IPV6_TCP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_UDP ETH_RSS_NONFRAG_IPV6_UDP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_SCTP ETH_RSS_NONFRAG_IPV6_SCTP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_OTHER ETH_RSS_NONFRAG_IPV6_OTHER +# define DPDK_CONFIG_ETH_RSS_L2_PAYLOAD ETH_RSS_L2_PAYLOAD +# define DPDK_CONFIG_ETH_RSS_IPV6_EX ETH_RSS_IPV6_EX +# define DPDK_CONFIG_ETH_RSS_IPV6_TCP_EX ETH_RSS_IPV6_TCP_EX +# define DPDK_CONFIG_ETH_RSS_IPV6_UDP_EX ETH_RSS_IPV6_UDP_EX +# define DPDK_CONFIG_ETH_RSS_PORT ETH_RSS_PORT +# define DPDK_CONFIG_ETH_RSS_VXLAN ETH_RSS_VXLAN +# define DPDK_CONFIG_ETH_RSS_GENEVE ETH_RSS_GENEVE +# define DPDK_CONFIG_ETH_RSS_NVGRE ETH_RSS_NVGRE +#else +# define DPDK_CONFIG_ETH_RSS_IPV4 RTE_ETH_RSS_IPV4 +# define DPDK_CONFIG_ETH_RSS_FRAG_IPV4 RTE_ETH_RSS_FRAG_IPV4 +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_TCP RTE_ETH_RSS_NONFRAG_IPV4_TCP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_UDP RTE_ETH_RSS_NONFRAG_IPV4_UDP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_SCTP RTE_ETH_RSS_NONFRAG_IPV4_SCTP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV4_OTHER RTE_ETH_RSS_NONFRAG_IPV4_OTHER +# define DPDK_CONFIG_ETH_RSS_IPV6 RTE_ETH_RSS_IPV6 +# define DPDK_CONFIG_ETH_RSS_FRAG_IPV6 RTE_ETH_RSS_FRAG_IPV6 +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_TCP RTE_ETH_RSS_NONFRAG_IPV6_TCP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_UDP RTE_ETH_RSS_NONFRAG_IPV6_UDP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_SCTP RTE_ETH_RSS_NONFRAG_IPV6_SCTP +# define DPDK_CONFIG_ETH_RSS_NONFRAG_IPV6_OTHER RTE_ETH_RSS_NONFRAG_IPV6_OTHER +# define DPDK_CONFIG_ETH_RSS_L2_PAYLOAD RTE_ETH_RSS_L2_PAYLOAD +# define DPDK_CONFIG_ETH_RSS_IPV6_EX RTE_ETH_RSS_IPV6_EX +# define DPDK_CONFIG_ETH_RSS_IPV6_TCP_EX RTE_ETH_RSS_IPV6_TCP_EX +# define DPDK_CONFIG_ETH_RSS_IPV6_UDP_EX RTE_ETH_RSS_IPV6_UDP_EX +# define DPDK_CONFIG_ETH_RSS_PORT RTE_ETH_RSS_PORT +# define DPDK_CONFIG_ETH_RSS_VXLAN RTE_ETH_RSS_VXLAN +# define DPDK_CONFIG_ETH_RSS_GENEVE RTE_ETH_RSS_GENEVE +# define DPDK_CONFIG_ETH_RSS_NVGRE RTE_ETH_RSS_NVGRE +#endif // RSS random key: uint8_t DpdkDevice::m_RSSKey[40] = { @@ -119,11 +117,11 @@ namespace pcpp m_DeviceName = deviceNameStream.str(); m_DeviceSocketId = rte_eth_dev_socket_id(m_Id); -# if (RTE_VER_YEAR > 19) || (RTE_VER_YEAR == 19 && RTE_VER_MONTH >= 8) +#if (RTE_VER_YEAR > 19) || (RTE_VER_YEAR == 19 && RTE_VER_MONTH >= 8) struct rte_ether_addr etherAddr; -# else +#else struct ether_addr etherAddr; -# endif +#endif rte_eth_macaddr_get((uint8_t)m_Id, ðerAddr); m_MacAddress = MacAddress(etherAddr.addr_bytes[0], etherAddr.addr_bytes[1], etherAddr.addr_bytes[2], etherAddr.addr_bytes[3], etherAddr.addr_bytes[4], etherAddr.addr_bytes[5]); @@ -309,16 +307,16 @@ namespace pcpp struct rte_eth_conf portConf; memset(&portConf, 0, sizeof(rte_eth_conf)); -# if (RTE_VER_YEAR < 22) || (RTE_VER_YEAR == 22 && RTE_VER_MONTH < 11) +#if (RTE_VER_YEAR < 22) || (RTE_VER_YEAR == 22 && RTE_VER_MONTH < 11) portConf.rxmode.split_hdr_size = DPDK_CONFIG_SPLIT_HEADER_SIZE; -# endif -# if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 8) +#endif +#if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 8) portConf.rxmode.header_split = DPDK_CONFIG_HEADER_SPLIT; portConf.rxmode.hw_ip_checksum = DPDK_CONFIG_HW_IP_CHECKSUM; portConf.rxmode.hw_vlan_filter = DPDK_CONFIG_HW_VLAN_FILTER; portConf.rxmode.jumbo_frame = DPDK_CONFIG_JUMBO_FRAME; portConf.rxmode.hw_strip_crc = DPDK_CONFIG_HW_STRIP_CRC; -# endif +#endif // Enable RSS only if hardware supports it and the user wants to use it if (m_Config.rssHashFunction == RSS_NONE) { @@ -545,19 +543,19 @@ namespace pcpp else m_PMDType = PMD_UNKNOWN; -# if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 5) // before 18.05 +#if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 5) // before 18.05 char pciName[30]; -# if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) // 17.11 - 18.02 +# if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) // 17.11 - 18.02 rte_pci_device_name(&(portInfo.pci_dev->addr), pciName, 30); -# else // 16.11 - 17.11 +# else // 16.11 - 17.11 rte_eal_pci_device_name(&(portInfo.pci_dev->addr), pciName, 30); -# endif +# endif m_PciAddress = std::string(pciName); -# elif (RTE_VER_YEAR < 22) || (RTE_VER_YEAR == 22 && RTE_VER_MONTH < 11) // before 22.11 +#elif (RTE_VER_YEAR < 22) || (RTE_VER_YEAR == 22 && RTE_VER_MONTH < 11) // before 22.11 m_PciAddress = std::string(portInfo.device->name); -# else // 22.11 forward +#else // 22.11 forward m_PciAddress = std::string(rte_dev_name(portInfo.device)); -# endif +#endif PCPP_LOG_DEBUG("Device [" << m_DeviceName << "] has " << portInfo.max_rx_queues << " RX queues"); PCPP_LOG_DEBUG("Device [" << m_DeviceName << "] has " << portInfo.max_tx_queues << " TX queues"); @@ -788,7 +786,7 @@ namespace pcpp return 0; } -# define nanosec_gap(begin, end) ((end.tv_sec - begin.tv_sec) * 1000000000.0 + (end.tv_nsec - begin.tv_nsec)) +#define nanosec_gap(begin, end) ((end.tv_sec - begin.tv_sec) * 1000000000.0 + (end.tv_nsec - begin.tv_nsec)) void DpdkDevice::getStatistics(DpdkDeviceStats& stats) const { @@ -1066,7 +1064,7 @@ namespace pcpp uint16_t packetsSent = 0; int lastSleep = 0; -# define PACKET_TRANSMISSION_THRESHOLD 0.8 +#define PACKET_TRANSMISSION_THRESHOLD 0.8 int packetTxThreshold = m_Config.transmitDescriptorsNumber * PACKET_TRANSMISSION_THRESHOLD; while (packetIndex < arrLength) @@ -1541,5 +1539,3 @@ namespace pcpp } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* USE_DPDK */ diff --git a/Pcap++/src/DpdkDeviceList.cpp b/Pcap++/src/DpdkDeviceList.cpp index 4517e6c6c3..f41d1bba9e 100644 --- a/Pcap++/src/DpdkDeviceList.cpp +++ b/Pcap++/src/DpdkDeviceList.cpp @@ -1,54 +1,52 @@ -#ifdef USE_DPDK - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModuleDpdkDevice - -# define __STDC_LIMIT_MACROS -# define __STDC_FORMAT_MACROS - -# include "DpdkDeviceList.h" -# include "Logger.h" - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include -# include - -# if (RTE_VER_YEAR < 21) || (RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11) -# define GET_MASTER_CORE rte_get_master_lcore -# define MASTER_LCORE "--master-lcore" -# else -# define GET_MASTER_CORE rte_get_main_lcore -# define MASTER_LCORE "--main-lcore" -# endif +#define LOG_MODULE PcapLogModuleDpdkDevice + +#define __STDC_LIMIT_MACROS +#define __STDC_FORMAT_MACROS + +#include "DpdkDeviceList.h" +#include "Logger.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if (RTE_VER_YEAR < 21) || (RTE_VER_YEAR == 21 && RTE_VER_MONTH < 11) +# define GET_MASTER_CORE rte_get_master_lcore +# define MASTER_LCORE "--master-lcore" +#else +# define GET_MASTER_CORE rte_get_main_lcore +# define MASTER_LCORE "--main-lcore" +#endif namespace pcpp { @@ -179,11 +177,11 @@ namespace pcpp if (m_IsInitialized) return true; -# if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 5) +#if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 5) int numOfPorts = (int)rte_eth_dev_count(); -# else +#else int numOfPorts = (int)rte_eth_dev_count_avail(); -# endif +#endif if (numOfPorts <= 0) { @@ -299,26 +297,26 @@ namespace pcpp void DpdkDeviceList::setDpdkLogLevel(Logger::LogLevel logLevel) { -# if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) +#if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) if (logLevel == Logger::Info) rte_log_set_global_level(RTE_LOG_NOTICE); else // logLevel == Logger::Debug rte_log_set_global_level(RTE_LOG_DEBUG); -# else +#else if (logLevel == Logger::Info) rte_set_log_level(RTE_LOG_NOTICE); else // logLevel == Logger::Debug rte_set_log_level(RTE_LOG_DEBUG); -# endif +#endif } Logger::LogLevel DpdkDeviceList::getDpdkLogLevel() const { -# if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) +#if (RTE_VER_YEAR > 17) || (RTE_VER_YEAR == 17 && RTE_VER_MONTH >= 11) if (rte_log_get_global_level() <= RTE_LOG_NOTICE) -# else +#else if (rte_get_log_level() <= RTE_LOG_NOTICE) -# endif +#endif return Logger::Info; else return Logger::Debug; @@ -438,5 +436,3 @@ namespace pcpp } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* USE_DPDK */ diff --git a/Pcap++/src/KniDevice.cpp b/Pcap++/src/KniDevice.cpp index aeb012eda5..0d144ec8b3 100644 --- a/Pcap++/src/KniDevice.cpp +++ b/Pcap++/src/KniDevice.cpp @@ -1,44 +1,42 @@ -#if defined(USE_DPDK) && defined(__linux__) - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModuleKniDevice - -# include "KniDevice.h" -# include "Logger.h" -# include "SystemUtils.h" - -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include - -# ifndef KNI_MEMPOOL_NAME_PREFIX -# define KNI_MEMPOOL_NAME_PREFIX "kniMempool" -# endif -# ifndef MEMPOOL_CACHE_SIZE -# define MEMPOOL_CACHE_SIZE 256 -# endif -# ifndef MAX_BURST_SIZE -# define MAX_BURST_SIZE 64 -# endif - -# define CPP_VLA(TYPE, SIZE) (TYPE*)__builtin_alloca(sizeof(TYPE) * SIZE) +#define LOG_MODULE PcapLogModuleKniDevice + +#include "KniDevice.h" +#include "Logger.h" +#include "SystemUtils.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifndef KNI_MEMPOOL_NAME_PREFIX +# define KNI_MEMPOOL_NAME_PREFIX "kniMempool" +#endif +#ifndef MEMPOOL_CACHE_SIZE +# define MEMPOOL_CACHE_SIZE 256 +#endif +#ifndef MAX_BURST_SIZE +# define MAX_BURST_SIZE 64 +#endif + +#define CPP_VLA(TYPE, SIZE) (TYPE*)__builtin_alloca(sizeof(TYPE) * SIZE) namespace pcpp { @@ -119,17 +117,17 @@ namespace pcpp { return oldState = KniDevice::LINK_ERROR; } -# if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0) +#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0) oldState = (KniDevice::KniLinkState)rte_kni_update_link(kni, state); if (oldState == KniDevice::LINK_ERROR) { //? NOTE(echo-Mike): Not LOG_ERROR because will generate a lot of junk messages on some DPDK versions PCPP_LOG_DEBUG("DPDK KNI Failed to update links state for device '" << deviceName << "'"); } -# else +#else // To avoid compiler warnings (void)kni; (void)deviceName; -# endif +#endif return oldState; } @@ -175,30 +173,30 @@ namespace pcpp kniConf.core_id = conf.kthreadCoreId; kniConf.mbuf_size = RTE_MBUF_DEFAULT_BUF_SIZE; kniConf.force_bind = conf.bindKthread ? 1 : 0; -# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0) +#if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0) if (conf.mac != MacAddress::Zero) conf.mac.copyTo((uint8_t*)kniConf.mac_addr); kniConf.mtu = conf.mtu; -# endif +#endif kniOps.port_id = conf.portId; -# if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0) +#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0) if (conf.callbacks != nullptr) { kniOps.change_mtu = conf.callbacks->change_mtu; kniOps.config_network_if = conf.callbacks->config_network_if; -# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0) +# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0) kniOps.config_mac_address = conf.callbacks->config_mac_address; kniOps.config_promiscusity = conf.callbacks->config_promiscusity; -# endif +# endif } -# else +#else if (conf.oldCallbacks != nullptr) { kniOps.change_mtu = conf.oldCallbacks->change_mtu; kniOps.config_network_if = conf.oldCallbacks->config_network_if; } -# endif +#endif m_Device = rte_kni_alloc(m_MBufMempool, &kniConf, &kniOps); if (m_Device == nullptr) @@ -984,5 +982,3 @@ namespace pcpp } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* defined(USE_DPDK) && defined(__linux__) */ diff --git a/Pcap++/src/KniDeviceList.cpp b/Pcap++/src/KniDeviceList.cpp index e588cd81b9..36a0856639 100644 --- a/Pcap++/src/KniDeviceList.cpp +++ b/Pcap++/src/KniDeviceList.cpp @@ -1,24 +1,22 @@ -#if defined(USE_DPDK) && defined(__linux__) - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModuleKniDevice +#define LOG_MODULE PcapLogModuleKniDevice -# include -# include +#include +#include -# include "KniDeviceList.h" -# include "Logger.h" -# include "SystemUtils.h" +#include "KniDeviceList.h" +#include "Logger.h" +#include "SystemUtils.h" -# include -# include +#include +#include -# ifndef MAX_KNI_DEVICES +#ifndef MAX_KNI_DEVICES // This value have no meaning in current DPDK implementation (ver >= 18.11) // In older versions have literal meaning -# define MAX_KNI_DEVICES 4 -# endif +# define MAX_KNI_DEVICES 4 +#endif namespace pcpp { @@ -54,15 +52,15 @@ namespace pcpp m_Initialized = false; return; } -# if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0) +#if RTE_VERSION >= RTE_VERSION_NUM(18, 11, 0, 0) if (rte_kni_init(MAX_KNI_DEVICES) < 0) { PCPP_LOG_ERROR("Failed to initialize DPDK KNI module"); m_Initialized = false; } -# else +#else rte_kni_init(MAX_KNI_DEVICES); -# endif +#endif } KniDeviceList::~KniDeviceList() @@ -143,11 +141,11 @@ namespace pcpp KniDeviceList::KniCallbackVersion KniDeviceList::callbackVersion() { -# if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0) +#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 0) return KniDeviceList::CALLBACKS_NEW; -# else +#else return KniDeviceList::CALLBACKS_OLD; -# endif +#endif } bool KniDeviceList::isCallbackSupported(const KniCallbackType cbType) @@ -161,16 +159,14 @@ namespace pcpp case KniDeviceList::CALLBACK_MAC: /* fall through */ case KniDeviceList::CALLBACK_PROMISC: -# if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0) +#if RTE_VERSION >= RTE_VERSION_NUM(18, 2, 0, 0) return true; -# else +#else return false; -# endif +#endif } return false; } } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* defined(USE_DPDK) && defined(__linux__) */ diff --git a/Pcap++/src/LinuxNicInformationSocket.cpp b/Pcap++/src/LinuxNicInformationSocket.cpp index a70db5e341..f75d1d8c36 100644 --- a/Pcap++/src/LinuxNicInformationSocket.cpp +++ b/Pcap++/src/LinuxNicInformationSocket.cpp @@ -1,21 +1,19 @@ -#ifdef __linux__ +#define LOG_MODULE UndefinedLogModule -# define LOG_MODULE UndefinedLogModule +#include "Logger.h" +#include "LinuxNicInformationSocket.h" -# include "Logger.h" -# include "LinuxNicInformationSocket.h" +#include +#include +#include +#include +#include -# include -# include -# include -# include -# include +#include +#include +#include -# include -# include -# include - -# define INVALID_SOCKET_VALUE (-1) +#define INVALID_SOCKET_VALUE (-1) namespace pcpp { @@ -71,4 +69,3 @@ namespace pcpp return true; } } // namespace pcpp -#endif /* __linux__ */ diff --git a/Pcap++/src/MBufRawPacket.cpp b/Pcap++/src/MBufRawPacket.cpp index f055057f0f..fc271f0d64 100644 --- a/Pcap++/src/MBufRawPacket.cpp +++ b/Pcap++/src/MBufRawPacket.cpp @@ -1,26 +1,24 @@ -#ifdef USE_DPDK - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModuleMBufRawPacket +#define LOG_MODULE PcapLogModuleMBufRawPacket -# define __STDC_LIMIT_MACROS -# define __STDC_FORMAT_MACROS +#define __STDC_LIMIT_MACROS +#define __STDC_FORMAT_MACROS -# include "rte_mbuf.h" -# include "rte_mempool.h" -# include "rte_errno.h" +#include "rte_mbuf.h" +#include "rte_mempool.h" +#include "rte_errno.h" -# include "MBufRawPacket.h" -# include "Logger.h" -# include "DpdkDevice.h" -# ifdef USE_DPDK_KNI -# include "KniDevice.h" -# endif +#include "MBufRawPacket.h" +#include "Logger.h" +#include "DpdkDevice.h" +#ifdef USE_DPDK_KNI +# include "KniDevice.h" +#endif -# include -# include -# include +#include +#include +#include namespace pcpp { @@ -70,12 +68,12 @@ namespace pcpp return init(device->m_MBufMempool); } -# ifdef USE_DPDK_KNI +#ifdef USE_DPDK_KNI bool MBufRawPacket::init(KniDevice* device) { return init(device->m_MBufMempool); } -# endif +#endif bool MBufRawPacket::initFromRawPacket(const RawPacket* rawPacket, struct rte_mempool* mempool) { @@ -104,12 +102,12 @@ namespace pcpp return initFromRawPacket(rawPacket, device->m_MBufMempool); } -# ifdef USE_DPDK_KNI +#ifdef USE_DPDK_KNI bool MBufRawPacket::initFromRawPacket(const RawPacket* rawPacket, KniDevice* device) { return initFromRawPacket(rawPacket, device->m_MBufMempool); } -# endif +#endif MBufRawPacket::MBufRawPacket(const MBufRawPacket& other) { @@ -175,6 +173,11 @@ namespace pcpp return *this; } + MBufRawPacket* MBufRawPacket::clone() const + { + return new MBufRawPacket(*this); + } + bool MBufRawPacket::setRawData(const uint8_t* pRawData, int rawDataLen, timespec timestamp, LinkLayerType layerType, int frameLength) { @@ -340,5 +343,3 @@ namespace pcpp } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* USE_DPDK */ diff --git a/Pcap++/src/PcapLiveDevice.cpp b/Pcap++/src/PcapLiveDevice.cpp index 7ac0f79edc..5faa7c4dca 100644 --- a/Pcap++/src/PcapLiveDevice.cpp +++ b/Pcap++/src/PcapLiveDevice.cpp @@ -1011,15 +1011,15 @@ namespace pcpp return; } - uint8_t buf[len]; + std::vector buf(len); - if (sysctl(mib, 6, buf, &len, nullptr, 0) < 0) + if (sysctl(mib, 6, buf.data(), &len, nullptr, 0) < 0) { PCPP_LOG_DEBUG("Error in retrieving MAC address: sysctl 2 error"); return; } - struct if_msghdr* ifm = (struct if_msghdr*)buf; + struct if_msghdr* ifm = (struct if_msghdr*)buf.data(); struct sockaddr_dl* sdl = (struct sockaddr_dl*)(ifm + 1); uint8_t* ptr = (uint8_t*)LLADDR(sdl); m_MacAddress = MacAddress(ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); diff --git a/Pcap++/src/PcapRemoteDevice.cpp b/Pcap++/src/PcapRemoteDevice.cpp index 3b020aba5e..e4e037df17 100644 --- a/Pcap++/src/PcapRemoteDevice.cpp +++ b/Pcap++/src/PcapRemoteDevice.cpp @@ -1,10 +1,8 @@ -#if defined(_WIN32) +#define LOG_MODULE PcapLogModuleRemoteDevice -# define LOG_MODULE PcapLogModuleRemoteDevice - -# include "PcapRemoteDevice.h" -# include "Logger.h" -# include "pcap.h" +#include "PcapRemoteDevice.h" +#include "Logger.h" +#include "pcap.h" namespace pcpp { @@ -99,5 +97,3 @@ namespace pcpp } } // namespace pcpp - -#endif // _WIN32 diff --git a/Pcap++/src/PcapRemoteDeviceList.cpp b/Pcap++/src/PcapRemoteDeviceList.cpp index 4ad2ac4f42..368529789a 100644 --- a/Pcap++/src/PcapRemoteDeviceList.cpp +++ b/Pcap++/src/PcapRemoteDeviceList.cpp @@ -1,15 +1,13 @@ -#if defined(_WIN32) +#define LOG_MODULE PcapLogModuleRemoteDevice -# define LOG_MODULE PcapLogModuleRemoteDevice - -# include "PcapRemoteDeviceList.h" -# include "Logger.h" -# include "IpUtils.h" -# include "PcapUtils.h" -# include "IpAddressUtils.h" -# include "pcap.h" -# include -# include +#include "PcapRemoteDeviceList.h" +#include "Logger.h" +#include "IpUtils.h" +#include "PcapUtils.h" +#include "IpAddressUtils.h" +#include "pcap.h" +#include +#include namespace pcpp { @@ -239,5 +237,3 @@ namespace pcpp } } // namespace pcpp - -#endif // _WIN32 diff --git a/Pcap++/src/PfRingDevice.cpp b/Pcap++/src/PfRingDevice.cpp index 3850501352..8a945a9c20 100644 --- a/Pcap++/src/PfRingDevice.cpp +++ b/Pcap++/src/PfRingDevice.cpp @@ -1,19 +1,17 @@ -#ifdef USE_PF_RING - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModulePfRingDevice +#define LOG_MODULE PcapLogModulePfRingDevice -# include "PfRingDevice.h" -# include "EthLayer.h" -# include "VlanLayer.h" -# include "Logger.h" -# include -# include -# include -# include +#include "PfRingDevice.h" +#include "EthLayer.h" +#include "VlanLayer.h" +#include "Logger.h" +#include +#include +#include +#include -# define DEFAULT_PF_RING_SNAPLEN 1600 +#define DEFAULT_PF_RING_SNAPLEN 1600 namespace pcpp { @@ -760,7 +758,7 @@ namespace pcpp uint8_t flushTxAsUint = (flushTxQueues ? 1 : 0); -# define MAX_TRIES 5 +#define MAX_TRIES 5 int tries = 0; int res = 0; @@ -903,5 +901,3 @@ namespace pcpp } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* USE_PF_RING */ diff --git a/Pcap++/src/PfRingDeviceList.cpp b/Pcap++/src/PfRingDeviceList.cpp index 1b9dae42f5..be41d07be8 100644 --- a/Pcap++/src/PfRingDeviceList.cpp +++ b/Pcap++/src/PfRingDeviceList.cpp @@ -1,17 +1,15 @@ -#ifdef USE_PF_RING - // GCOVR_EXCL_START -# define LOG_MODULE PcapLogModulePfRingDevice +#define LOG_MODULE PcapLogModulePfRingDevice -# include -# include -# include "PfRingDeviceList.h" -# include "SystemUtils.h" -# include "DeviceUtils.h" -# include "Logger.h" -# include "pcap.h" -# include "pfring.h" +#include +#include +#include "PfRingDeviceList.h" +#include "SystemUtils.h" +#include "DeviceUtils.h" +#include "Logger.h" +#include "pcap.h" +#include "pfring.h" namespace pcpp { @@ -136,5 +134,3 @@ namespace pcpp } // namespace pcpp // GCOVR_EXCL_STOP - -#endif /* USE_PF_RING */ diff --git a/Pcap++/src/RawSocketDevice.cpp b/Pcap++/src/RawSocketDevice.cpp index bc635fb1f2..00174272c8 100644 --- a/Pcap++/src/RawSocketDevice.cpp +++ b/Pcap++/src/RawSocketDevice.cpp @@ -430,6 +430,8 @@ namespace pcpp int n = 1; DWORD dwBytesRet; + // NULL is used instead of nullptr for Windows APIs. Check + // https://devblogs.microsoft.com/oldnewthing/20180307-00/?p=98175 if (WSAIoctl(fd, SIO_RCVALL, &n, sizeof(n), NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR) { PCPP_LOG_ERROR("Call to WSAIotcl(" << std::hex << SIO_RCVALL << ") failed with error code " diff --git a/Pcap++/src/WinPcapLiveDevice.cpp b/Pcap++/src/WinPcapLiveDevice.cpp index efe736ffe8..94f20f2cd3 100644 --- a/Pcap++/src/WinPcapLiveDevice.cpp +++ b/Pcap++/src/WinPcapLiveDevice.cpp @@ -1,11 +1,9 @@ -#if defined(_WIN32) +#define LOG_MODULE PcapLogModuleWinPcapLiveDevice -# define LOG_MODULE PcapLogModuleWinPcapLiveDevice - -# include "WinPcapLiveDevice.h" -# include "Logger.h" -# include "TimespecTimeval.h" -# include "pcap.h" +#include "WinPcapLiveDevice.h" +#include "Logger.h" +#include "TimespecTimeval.h" +#include "pcap.h" namespace pcpp { @@ -139,5 +137,3 @@ namespace pcpp } } // namespace pcpp - -#endif // _WIN32 diff --git a/Pcap++/src/XdpDevice.cpp b/Pcap++/src/XdpDevice.cpp index 1ebca1cdb2..d1f9e99f75 100644 --- a/Pcap++/src/XdpDevice.cpp +++ b/Pcap++/src/XdpDevice.cpp @@ -1,4 +1,5 @@ #define LOG_MODULE PcapLogModuleXdpDevice + #include "XdpDevice.h" #include "GeneralUtils.h" #include "Logger.h" diff --git a/README.md b/README.md index 282ded2f29..d94c469db7 100644 --- a/README.md +++ b/README.md @@ -243,43 +243,44 @@ PcapPlusPlus currently supports parsing, editing and creation of packets of the 22. NDP 23. Raw IP (IPv4 & IPv6) 24. VRRP (IPv4 & IPv6) +25. WireGuard ### Transport Layer (L4) -25. COTP -26. GTP (v1) -27. IPSec AH & ESP - parsing only (no editing capabilities) -28. TCP -29. TPKT -30. UDP +26. COTP +27. GTP (v1) +28. IPSec AH & ESP - parsing only (no editing capabilities) +29. TCP +30. TPKT +31. UDP ### Session Layer (L5) -31. SDP -32. SIP +32. SDP +33. SIP ### Presentation Layer (L6) -33. SSL/TLS - parsing only (no editing capabilities) +34. SSL/TLS - parsing only (no editing capabilities) ### Application Layer (L7) -34. ASN.1 decoder and encoder -35. BGP (v4) -36. DHCP -37. DHCPv6 -38. DNS -39. FTP -40. HTTP headers (request & response) -41. LDAP -42. NTP (v3, v4) -43. Radius -44. S7 Communication (S7comm) -45. SMTP -46. SOME/IP -47. SSH - parsing only (no editing capabilities) -48. Telnet - parsing only (no editing capabilities) -49. Generic payload +35. ASN.1 decoder and encoder +36. BGP (v4) +37. DHCP +38. DHCPv6 +39. DNS +40. FTP +41. HTTP headers (request & response) +42. LDAP +43. NTP (v3, v4) +44. Radius +45. S7 Communication (S7comm) +46. SMTP +47. SOME/IP +48. SSH - parsing only (no editing capabilities) +49. Telnet - parsing only (no editing capabilities) +50. Generic payload ## DPDK And PF_RING Support diff --git a/Tests/ExamplesTest/requirements.txt b/Tests/ExamplesTest/requirements.txt index a32a4796c1..e3c641046f 100644 --- a/Tests/ExamplesTest/requirements.txt +++ b/Tests/ExamplesTest/requirements.txt @@ -1,7 +1,7 @@ -attrs==23.2.0 +attrs==24.2.0 iniconfig==2.0.0 py==1.11.0 -pyparsing==3.1.2 -pytest==8.3.2 -scapy==2.5.0 +pyparsing==3.1.4 +pytest==8.3.3 +scapy==2.6.0 toml==0.10.2 diff --git a/Tests/ExamplesTest/tests/test_httpanalyzer.py b/Tests/ExamplesTest/tests/test_httpanalyzer.py index 66808b66dd..8aff8f55e1 100644 --- a/Tests/ExamplesTest/tests/test_httpanalyzer.py +++ b/Tests/ExamplesTest/tests/test_httpanalyzer.py @@ -1,5 +1,4 @@ from os import path -from itertools import filterfalse import pytest from .test_utils import ExampleTest, compare_stdout_with_file diff --git a/Tests/ExamplesTest/tests/test_pcapsearch.py b/Tests/ExamplesTest/tests/test_pcapsearch.py index 121e97d421..3e7b2a6dbc 100644 --- a/Tests/ExamplesTest/tests/test_pcapsearch.py +++ b/Tests/ExamplesTest/tests/test_pcapsearch.py @@ -1,6 +1,4 @@ -from os import path import pytest -import re import ntpath from .test_utils import ExampleTest @@ -42,7 +40,7 @@ def test_exact_file_format(self): num_of_packets = int(words[0]) file_name = ntpath.basename(words[-1].replace("'", "")) actual.add((num_of_packets, file_name)) - except: + except Exception: pass assert expected.issubset(actual) @@ -52,7 +50,7 @@ def test_different_file_extensions(self): completed_process = self.run_example(args=args) assert ".dmp'" in completed_process.stdout assert ".pcapng'" in completed_process.stdout - assert not ".pcap'" in completed_process.stdout + assert ".pcap'" not in completed_process.stdout def test_no_args(self): args = {} diff --git a/Tests/ExamplesTest/tests/test_pcapsplitter.py b/Tests/ExamplesTest/tests/test_pcapsplitter.py index 77912eb25f..3d5ba89d18 100644 --- a/Tests/ExamplesTest/tests/test_pcapsplitter.py +++ b/Tests/ExamplesTest/tests/test_pcapsplitter.py @@ -238,7 +238,7 @@ def test_split_by_connection(self, tmpdir): else: conn = frozenset([]) - assert not conn in connection_map + assert conn not in connection_map connection_map[conn] = True if len(conn) == 0: diff --git a/Tests/ExamplesTest/tests/test_sslanalyzer.py b/Tests/ExamplesTest/tests/test_sslanalyzer.py index f11419a6d8..7524da3477 100644 --- a/Tests/ExamplesTest/tests/test_sslanalyzer.py +++ b/Tests/ExamplesTest/tests/test_sslanalyzer.py @@ -1,5 +1,4 @@ from os import path -from itertools import filterfalse import pytest from .test_utils import ExampleTest, compare_stdout_with_file diff --git a/Tests/ExamplesTest/tests/test_tlsfingerprinting.py b/Tests/ExamplesTest/tests/test_tlsfingerprinting.py index 172a89039e..7ec6026790 100644 --- a/Tests/ExamplesTest/tests/test_tlsfingerprinting.py +++ b/Tests/ExamplesTest/tests/test_tlsfingerprinting.py @@ -1,5 +1,4 @@ import os -import filecmp import pytest from .test_utils import ( ExampleTest, diff --git a/Tests/Fuzzers/FuzzTarget.cpp b/Tests/Fuzzers/FuzzTarget.cpp index 97058e8f35..c81ab1d91a 100644 --- a/Tests/Fuzzers/FuzzTarget.cpp +++ b/Tests/Fuzzers/FuzzTarget.cpp @@ -10,7 +10,7 @@ static std::string tmpFile; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (tmpName.empty()) - tmpName = tmpnam(NULL); + tmpName = tmpnam(nullptr); if (tmpFile.empty()) tmpFile = tmpName + FILE_EXT; @@ -59,7 +59,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) pcpp::Packet parsedPacket(&rawPacket); parsedPacket.toString(); auto layer = parsedPacket.getFirstLayer(); - while (layer != NULL) + while (layer != nullptr) { std::cout << layer->toString() << std::endl; layer->getHeaderLen(); diff --git a/Tests/Fuzzers/FuzzWriter.cpp b/Tests/Fuzzers/FuzzWriter.cpp index ad591789f8..588040d421 100644 --- a/Tests/Fuzzers/FuzzWriter.cpp +++ b/Tests/Fuzzers/FuzzWriter.cpp @@ -13,7 +13,7 @@ static int writes = 0; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (tmpName.empty()) - tmpName = tmpnam(NULL); + tmpName = tmpnam(nullptr); if (tmpFile.empty()) tmpFile = tmpName + FILE_EXT; diff --git a/Tests/Fuzzers/RegressionTests/regression_samples/clusterfuzz-testcase-minimized-FuzzTarget-5487001111429120 b/Tests/Fuzzers/RegressionTests/regression_samples/clusterfuzz-testcase-minimized-FuzzTarget-5487001111429120 new file mode 100644 index 0000000000..3d81654d2c Binary files /dev/null and b/Tests/Fuzzers/RegressionTests/regression_samples/clusterfuzz-testcase-minimized-FuzzTarget-5487001111429120 differ diff --git a/Tests/Packet++Test/CMakeLists.txt b/Tests/Packet++Test/CMakeLists.txt index 0e6bbc75bc..0bcac69e63 100644 --- a/Tests/Packet++Test/CMakeLists.txt +++ b/Tests/Packet++Test/CMakeLists.txt @@ -42,6 +42,7 @@ add_executable( Tests/VlanMplsTests.cpp Tests/VrrpTest.cpp Tests/WakeOnLanTests.cpp + Tests/WireGuardTests.cpp Utils/TestUtils.cpp) target_link_libraries( diff --git a/Tests/Packet++Test/PacketExamples/WireGuard.pcap b/Tests/Packet++Test/PacketExamples/WireGuard.pcap new file mode 100644 index 0000000000..5d21e849cf Binary files /dev/null and b/Tests/Packet++Test/PacketExamples/WireGuard.pcap differ diff --git a/Tests/Packet++Test/PacketExamples/WireGuardCookieReply.dat b/Tests/Packet++Test/PacketExamples/WireGuardCookieReply.dat new file mode 100644 index 0000000000..cf8caaf01e --- /dev/null +++ b/Tests/Packet++Test/PacketExamples/WireGuardCookieReply.dat @@ -0,0 +1 @@ +aabbccddeeff00504311223308004500005c07d000004011a717c0a801010a000001ca6cca6c0048f55503000000ab7df4060100000000000000010000000000000001000000000000000100000000000000010000000000000001000000000000000100000000000000 \ No newline at end of file diff --git a/Tests/Packet++Test/PacketExamples/WireGuardHandshakeInitiation.dat b/Tests/Packet++Test/PacketExamples/WireGuardHandshakeInitiation.dat new file mode 100644 index 0000000000..5c3cc26711 --- /dev/null +++ b/Tests/Packet++Test/PacketExamples/WireGuardHandshakeInitiation.dat @@ -0,0 +1 @@ +a2e63494b5833a36e5bf5af80800458800b0024b0000401163560a0900010a090002a9c6ca6c009c14c201000000d837d0305fcec7c8e5c8e2e3f7989eef60c228d82329d602b6b1e2bb9d068f89cf9d4d4532780f6d27264f7b98701fdc27a4ec00aeb6becdbef2332f1b4084cadb93823935c012ae255e7b25eff13940c321fa6bd66a2a87b061db1430173e937f569349de2856dc5f2616763eeeafc0533b01dd965e7ec76976e28f683d671200000000000000000000000000000000 \ No newline at end of file diff --git a/Tests/Packet++Test/PacketExamples/WireGuardHandshakeResponse.dat b/Tests/Packet++Test/PacketExamples/WireGuardHandshakeResponse.dat new file mode 100644 index 0000000000..8242113990 --- /dev/null +++ b/Tests/Packet++Test/PacketExamples/WireGuardHandshakeResponse.dat @@ -0,0 +1 @@ +3a36e5bf5af8a2e63494b5830800458800782a39000040113ba00a0900020a090001ca6ca9c60064148a0200000006f47dabd837d030b18d5550bd4042a37a46823ac08db1ec66839bc0ca2d64bc15cd80232b66232faec24af8918de1060ff5c98e865d5f35f272214c5260110dc4c61e32cdd8542100000000000000000000000000000000 \ No newline at end of file diff --git a/Tests/Packet++Test/PacketExamples/WireGuardTransportData.dat b/Tests/Packet++Test/PacketExamples/WireGuardTransportData.dat new file mode 100644 index 0000000000..766c173f54 --- /dev/null +++ b/Tests/Packet++Test/PacketExamples/WireGuardTransportData.dat @@ -0,0 +1 @@ +a2e63494b5833a36e5bf5af808004500009c024c0000401163f10a0900010a090002a9c6ca6c008814ae0400000006f47dab0000000000000000a4ebc12ee3f990da18033a0789c04e2700f6f5c271d42ac4b4d6262e666549b445a7436e829bffb6ac65f05648bc0c391fe7c5884874376127164940188f03dba67af8388eaab76c593628bf9dc7be03346d912e916dad862545454701364f2d2486d7ced4c8642ce547ddb26ef6a46b \ No newline at end of file diff --git a/Tests/Packet++Test/TestDefinition.h b/Tests/Packet++Test/TestDefinition.h index b628c34f56..05ffbbca24 100644 --- a/Tests/Packet++Test/TestDefinition.h +++ b/Tests/Packet++Test/TestDefinition.h @@ -58,6 +58,7 @@ PTF_TEST_CASE(PacketTrailerTest); PTF_TEST_CASE(ResizeLayerTest); PTF_TEST_CASE(PrintPacketAndLayersTest); PTF_TEST_CASE(ProtocolFamilyMembershipTest); +PTF_TEST_CASE(PacketParseLayerLimitTest); // Implemented in HttpTests.cpp PTF_TEST_CASE(HttpRequestParseMethodTest); @@ -262,3 +263,11 @@ PTF_TEST_CASE(Asn1EncodingTest); // Implemented in LdapTests.cpp PTF_TEST_CASE(LdapParsingTest); PTF_TEST_CASE(LdapCreationTest); + +// Implemented in WireGuardTests.cpp +PTF_TEST_CASE(WireGuardHandshakeInitParsingTest); +PTF_TEST_CASE(WireGuardHandshakeRespParsingTest); +PTF_TEST_CASE(WireGuardCookieReplyParsingTest); +PTF_TEST_CASE(WireGuardTransportDataParsingTest); +PTF_TEST_CASE(WireGuardCreationTest); +PTF_TEST_CASE(WireGuardEditTest); diff --git a/Tests/Packet++Test/Tests/PacketTests.cpp b/Tests/Packet++Test/Tests/PacketTests.cpp index ee1fc217ef..12bce597fd 100644 --- a/Tests/Packet++Test/Tests/PacketTests.cpp +++ b/Tests/Packet++Test/Tests/PacketTests.cpp @@ -1068,3 +1068,17 @@ PTF_TEST_CASE(ProtocolFamilyMembershipTest) PTF_ASSERT_FALSE(httpLayer->isMemberOfProtocolFamily(pcpp::HTTPResponse)); PTF_ASSERT_FALSE(httpLayer->isMemberOfProtocolFamily(pcpp::IP)); } + +PTF_TEST_CASE(PacketParseLayerLimitTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + READ_FILE_AND_CREATE_PACKET(0, "PacketExamples/TcpPacketWithOptions3.dat"); + pcpp::Packet packet0(&rawPacket0, pcpp::OsiModelPhysicalLayer); + PTF_ASSERT_EQUAL(packet0.getLastLayer(), packet0.getFirstLayer()); + + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/TcpPacketWithOptions3.dat"); + pcpp::Packet packet1(&rawPacket1, pcpp::OsiModelTransportLayer); + PTF_ASSERT_EQUAL(packet1.getLastLayer()->getOsiModelLayer(), pcpp::OsiModelTransportLayer); +} diff --git a/Tests/Packet++Test/Tests/WireGuardTests.cpp b/Tests/Packet++Test/Tests/WireGuardTests.cpp new file mode 100644 index 0000000000..480ce74ff0 --- /dev/null +++ b/Tests/Packet++Test/Tests/WireGuardTests.cpp @@ -0,0 +1,532 @@ +#include "../TestDefinition.h" +#include "../Utils/TestUtils.h" +#include "Packet.h" +#include "WireGuardLayer.h" +#include "SystemUtils.h" +#include +#include "EndianPortable.h" + +PTF_TEST_CASE(WireGuardHandshakeInitParsingTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/WireGuardHandshakeInitiation.dat"); + + pcpp::Packet wgHandShakeInitPacket(&rawPacket1); + + PTF_ASSERT_TRUE(wgHandShakeInitPacket.isPacketOfType(pcpp::WireGuard)); + + auto wgLayer = wgHandShakeInitPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgLayer); + + auto wgHandShakeInitLayer = wgHandShakeInitPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgHandShakeInitLayer); + + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getMessageTypeAsString(), "Handshake Initiation"); + + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getMessageType(), 1); + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getReserved(), 0); + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getHeaderLen(), 148); + + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->toString(), + "WireGuard Layer, " + wgHandShakeInitLayer->getMessageTypeAsString() + " message"); + + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getWireGuardMessageType() == + pcpp::WireGuardLayer::WireGuardMessageType::HandshakeInitiation); + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getSenderIndex(), 0xd837d030); + + std::array expectedPublicKey = { 0x5f, 0xce, 0xc7, 0xc8, 0xe5, 0xc8, 0xe2, 0xe3, 0xf7, 0x98, 0x9e, + 0xef, 0x60, 0xc2, 0x28, 0xd8, 0x23, 0x29, 0xd6, 0x02, 0xb6, 0xb1, + 0xe2, 0xbb, 0x9d, 0x06, 0x8f, 0x89, 0xcf, 0x9d, 0x4d, 0x45 }; + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getInitiatorEphemeral() == expectedPublicKey); + + std::array expectedStaticKey = { 0x32, 0x78, 0x0f, 0x6d, 0x27, 0x26, 0x4f, 0x7b, 0x98, 0x70, + 0x1f, 0xdc, 0x27, 0xa4, 0xec, 0x00, 0xae, 0xb6, 0xbe, 0xcd, + 0xbe, 0xf2, 0x33, 0x2f, 0x1b, 0x40, 0x84, 0xca, 0xdb, 0x93, + 0x82, 0x39, 0x35, 0xc0, 0x12, 0xae, 0x25, 0x5e, 0x7b, 0x25, + 0xef, 0xf1, 0x39, 0x40, 0xc3, 0x21, 0xfa, 0x6b }; + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getEncryptedInitiatorStatic() == expectedStaticKey); + + std::array expectedTimestamp = { 0xd6, 0x6a, 0x2a, 0x87, 0xb0, 0x61, 0xdb, 0x14, 0x30, 0x17, + 0x3e, 0x93, 0x7f, 0x56, 0x93, 0x49, 0xde, 0x28, 0x56, 0xdc, + 0x5f, 0x26, 0x16, 0x76, 0x3e, 0xee, 0xaf, 0xc0 }; + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getEncryptedTimestamp() == expectedTimestamp); + + std::array expectedMac1 = { 0x53, 0x3b, 0x01, 0xdd, 0x96, 0x5e, 0x7e, 0xc7, + 0x69, 0x76, 0xe2, 0x8f, 0x68, 0x3d, 0x67, 0x12 }; + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getMac1() == expectedMac1); + + std::array expectedMac2 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getMac2() == expectedMac2); +} + +PTF_TEST_CASE(WireGuardHandshakeRespParsingTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/WireGuardHandshakeResponse.dat"); + + pcpp::Packet wgHandShakeResponsePacket(&rawPacket1); + + PTF_ASSERT_TRUE(wgHandShakeResponsePacket.isPacketOfType(pcpp::WireGuard)); + auto wgLayer = wgHandShakeResponsePacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgLayer); + + auto wgHandShakeResponseLayer = wgHandShakeResponsePacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgHandShakeResponseLayer); + + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getMessageTypeAsString(), "Handshake Response"); + + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getMessageType(), 2); + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getReserved(), 0); + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getHeaderLen(), 92); + + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->toString(), + "WireGuard Layer, " + wgHandShakeResponseLayer->getMessageTypeAsString() + " message"); + + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getWireGuardMessageType() == + pcpp::WireGuardLayer::WireGuardMessageType::HandshakeResponse); + + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getSenderIndex(), 0x06f47dab); + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getReceiverIndex(), 0xd837d030); + + std::array expectedResponderEphemeral = { 0xb1, 0x8d, 0x55, 0x50, 0xbd, 0x40, 0x42, 0xa3, + 0x7a, 0x46, 0x82, 0x3a, 0xc0, 0x8d, 0xb1, 0xec, + 0x66, 0x83, 0x9b, 0xc0, 0xca, 0x2d, 0x64, 0xbc, + 0x15, 0xcd, 0x80, 0x23, 0x2b, 0x66, 0x23, 0x2f }; + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getResponderEphemeral() == expectedResponderEphemeral); + + std::array encryptedEmptyData = { 0xae, 0xc2, 0x4a, 0xf8, 0x91, 0x8d, 0xe1, 0x06, + 0x0f, 0xf5, 0xc9, 0x8e, 0x86, 0x5d, 0x5f, 0x35 }; + + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getEncryptedEmpty() == encryptedEmptyData); + + std::array expectedMac1 = { 0xf2, 0x72, 0x21, 0x4c, 0x52, 0x60, 0x11, 0x0d, + 0xc4, 0xc6, 0x1e, 0x32, 0xcd, 0xd8, 0x54, 0x21 }; + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getMac1() == expectedMac1); + + std::array expectedMac2 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getMac2() == expectedMac2); +} + +PTF_TEST_CASE(WireGuardCookieReplyParsingTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/WireGuardCookieReply.dat"); + + pcpp::Packet wgCookieReplyPacket(&rawPacket1); + + PTF_ASSERT_TRUE(wgCookieReplyPacket.isPacketOfType(pcpp::WireGuard)); + auto wgLayer = wgCookieReplyPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgLayer); + + auto wgCookieReplyaLayer = wgCookieReplyPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgCookieReplyaLayer); + + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getMessageTypeAsString(), "Cookie Reply"); + + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getMessageType(), 3); + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getReserved(), 0); + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getHeaderLen(), 64); + + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->toString(), + "WireGuard Layer, " + wgCookieReplyaLayer->getMessageTypeAsString() + " message"); + + PTF_ASSERT_TRUE(wgCookieReplyaLayer->getWireGuardMessageType() == + pcpp::WireGuardLayer::WireGuardMessageType::CookieReply); + + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getReceiverIndex(), 0xab7df406); + + uint8_t nonce[24] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + PTF_ASSERT_TRUE(std::memcmp(wgCookieReplyaLayer->getNonce().data(), nonce, sizeof(nonce)) == 0); + uint8_t encryptedCookie[32] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + PTF_ASSERT_TRUE( + std::memcmp(wgCookieReplyaLayer->getEncryptedCookie().data(), encryptedCookie, sizeof(encryptedCookie)) == 0); +} + +PTF_TEST_CASE(WireGuardTransportDataParsingTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/WireGuardTransportData.dat"); + + pcpp::Packet wgTransportDataPacket(&rawPacket1); + PTF_ASSERT_TRUE(wgTransportDataPacket.isPacketOfType(pcpp::WireGuard)); + auto wgLayer = wgTransportDataPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgLayer); + + auto wgTransportDataLayer = wgTransportDataPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgTransportDataLayer); + + PTF_ASSERT_EQUAL(wgTransportDataLayer->getMessageTypeAsString(), "Transport Data"); + + PTF_ASSERT_EQUAL(wgTransportDataLayer->getMessageType(), 4); + PTF_ASSERT_EQUAL(wgTransportDataLayer->getReserved(), 0); + PTF_ASSERT_EQUAL(wgTransportDataLayer->getHeaderLen(), 128); + + PTF_ASSERT_EQUAL(wgTransportDataLayer->toString(), + "WireGuard Layer, " + wgTransportDataLayer->getMessageTypeAsString() + " message"); + + PTF_ASSERT_TRUE(wgTransportDataLayer->getWireGuardMessageType() == + pcpp::WireGuardLayer::WireGuardMessageType::TransportData); + + PTF_ASSERT_EQUAL(wgTransportDataLayer->getReceiverIndex(), 0x06f47dab); + + PTF_ASSERT_EQUAL(wgTransportDataLayer->getCounter(), 0); + + uint8_t expectedEncryptedData[112] = { 0xa4, 0xeb, 0xc1, 0x2e, 0xe3, 0xf9, 0x90, 0xda, 0x18, 0x03, 0x3a, 0x07, 0x89, + 0xc0, 0x4e, 0x27, 0x00, 0xf6, 0xf5, 0xc2, 0x71, 0xd4, 0x2a, 0xc4, 0xb4, 0xd6, + 0x26, 0x2e, 0x66, 0x65, 0x49, 0xb4, 0x45, 0xa7, 0x43, 0x6e, 0x82, 0x9b, 0xff, + 0xb6, 0xac, 0x65, 0xf0, 0x56, 0x48, 0xbc, 0x0c, 0x39, 0x1f, 0xe7, 0xc5, 0x88, + 0x48, 0x74, 0x37, 0x61, 0x27, 0x16, 0x49, 0x40, 0x18, 0x8f, 0x03, 0xdb, 0xa6, + 0x7a, 0xf8, 0x38, 0x8e, 0xaa, 0xb7, 0x6c, 0x59, 0x36, 0x28, 0xbf, 0x9d, 0xc7, + 0xbe, 0x03, 0x34, 0x6d, 0x91, 0x2e, 0x91, 0x6d, 0xad, 0x86, 0x25, 0x45, 0x45, + 0x47, 0x01, 0x36, 0x4f, 0x2d, 0x24, 0x86, 0xd7, 0xce, 0xd4, 0xc8, 0x64, 0x2c, + 0xe5, 0x47, 0xdd, 0xb2, 0x6e, 0xf6, 0xa4, 0x6b }; + PTF_ASSERT_BUF_COMPARE(wgTransportDataLayer->getEncryptedData(), expectedEncryptedData, + sizeof(expectedEncryptedData)); +} + +PTF_TEST_CASE(WireGuardCreationTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/WireGuardHandshakeInitiation.dat"); + READ_FILE_AND_CREATE_PACKET(2, "PacketExamples/WireGuardHandshakeResponse.dat"); + READ_FILE_AND_CREATE_PACKET(3, "PacketExamples/WireGuardCookieReply.dat"); + READ_FILE_AND_CREATE_PACKET(4, "PacketExamples/WireGuardTransportData.dat"); + + uint8_t origBuffer[1500]; + + // create WireGuard Handshake Initiation message + memcpy(origBuffer, buffer1, bufferLength1); + + uint8_t expectedPublicKeyInit[32] = { 0x5f, 0xce, 0xc7, 0xc8, 0xe5, 0xc8, 0xe2, 0xe3, 0xf7, 0x98, 0x9e, + 0xef, 0x60, 0xc2, 0x28, 0xd8, 0x23, 0x29, 0xd6, 0x02, 0xb6, 0xb1, + 0xe2, 0xbb, 0x9d, 0x06, 0x8f, 0x89, 0xcf, 0x9d, 0x4d, 0x45 }; + + uint8_t expectedStaticKeyInit[48] = { 0x32, 0x78, 0x0f, 0x6d, 0x27, 0x26, 0x4f, 0x7b, 0x98, 0x70, 0x1f, 0xdc, + 0x27, 0xa4, 0xec, 0x00, 0xae, 0xb6, 0xbe, 0xcd, 0xbe, 0xf2, 0x33, 0x2f, + 0x1b, 0x40, 0x84, 0xca, 0xdb, 0x93, 0x82, 0x39, 0x35, 0xc0, 0x12, 0xae, + 0x25, 0x5e, 0x7b, 0x25, 0xef, 0xf1, 0x39, 0x40, 0xc3, 0x21, 0xfa, 0x6b }; + uint8_t expectedTimestampInit[28] = { 0xd6, 0x6a, 0x2a, 0x87, 0xb0, 0x61, 0xdb, 0x14, 0x30, 0x17, + 0x3e, 0x93, 0x7f, 0x56, 0x93, 0x49, 0xde, 0x28, 0x56, 0xdc, + 0x5f, 0x26, 0x16, 0x76, 0x3e, 0xee, 0xaf, 0xc0 }; + + uint8_t expectedMac1Init[16] = { 0x53, 0x3b, 0x01, 0xdd, 0x96, 0x5e, 0x7e, 0xc7, + 0x69, 0x76, 0xe2, 0x8f, 0x68, 0x3d, 0x67, 0x12 }; + + uint8_t expectedMac2Init[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + pcpp::WireGuardHandshakeInitiationLayer newHandshakeInitMessage(0xd837d030, expectedPublicKeyInit, + expectedStaticKeyInit, expectedTimestampInit, + expectedMac1Init, expectedMac2Init); + pcpp::Packet wgHandshakeInitPacket(&rawPacket1); + auto origHandshakeInitMessage = + dynamic_cast(wgHandshakeInitPacket.detachLayer(pcpp::WireGuard)); + PTF_ASSERT_NOT_NULL(origHandshakeInitMessage); + + PTF_ASSERT_EQUAL(newHandshakeInitMessage.getSenderIndex(), 0xd837d030); + PTF_ASSERT_BUF_COMPARE(newHandshakeInitMessage.getInitiatorEphemeral().data(), expectedPublicKeyInit, 32); + PTF_ASSERT_BUF_COMPARE(newHandshakeInitMessage.getEncryptedInitiatorStatic().data(), expectedStaticKeyInit, 48); + PTF_ASSERT_BUF_COMPARE(newHandshakeInitMessage.getEncryptedTimestamp().data(), expectedTimestampInit, 28); + PTF_ASSERT_BUF_COMPARE(newHandshakeInitMessage.getMac1().data(), expectedMac1Init, 16); + PTF_ASSERT_BUF_COMPARE(newHandshakeInitMessage.getMac2().data(), expectedMac2Init, 16); + + PTF_ASSERT_TRUE(wgHandshakeInitPacket.addLayer(&newHandshakeInitMessage)); + + PTF_ASSERT_EQUAL(wgHandshakeInitPacket.getRawPacket()->getRawDataLen(), bufferLength1); + PTF_ASSERT_EQUAL(newHandshakeInitMessage.getDataLen(), origHandshakeInitMessage->getDataLen()); + + PTF_ASSERT_BUF_COMPARE(newHandshakeInitMessage.getData(), origHandshakeInitMessage->getData(), + origHandshakeInitMessage->getDataLen()); + + delete origHandshakeInitMessage; + + // create WireGuard Handshake Response message + memcpy(origBuffer, buffer2, bufferLength2); + uint8_t expectedResponderEphemeralResp[32] = { 0xb1, 0x8d, 0x55, 0x50, 0xbd, 0x40, 0x42, 0xa3, 0x7a, 0x46, 0x82, + 0x3a, 0xc0, 0x8d, 0xb1, 0xec, 0x66, 0x83, 0x9b, 0xc0, 0xca, 0x2d, + 0x64, 0xbc, 0x15, 0xcd, 0x80, 0x23, 0x2b, 0x66, 0x23, 0x2f }; + + uint8_t encryptedEmptyDataResp[16] = { 0xae, 0xc2, 0x4a, 0xf8, 0x91, 0x8d, 0xe1, 0x06, + 0x0f, 0xf5, 0xc9, 0x8e, 0x86, 0x5d, 0x5f, 0x35 }; + + uint8_t expectedMac1Resp[16] = { 0xf2, 0x72, 0x21, 0x4c, 0x52, 0x60, 0x11, 0x0d, + 0xc4, 0xc6, 0x1e, 0x32, 0xcd, 0xd8, 0x54, 0x21 }; + + uint8_t expectedMac2Resp[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + pcpp::WireGuardHandshakeResponseLayer newHandshakeRespMessage( + 0x06f47dab, 0xd837d030, expectedResponderEphemeralResp, encryptedEmptyDataResp, expectedMac1Resp, + expectedMac2Resp); + pcpp::Packet wgHandshakeRespPacket(&rawPacket2); + pcpp::WireGuardHandshakeResponseLayer* origHandshakeRespMessage = + dynamic_cast(wgHandshakeRespPacket.detachLayer(pcpp::WireGuard)); + PTF_ASSERT_NOT_NULL(origHandshakeRespMessage); + PTF_ASSERT_EQUAL(newHandshakeRespMessage.getDataLen(), origHandshakeRespMessage->getDataLen()); + PTF_ASSERT_EQUAL(newHandshakeRespMessage.getSenderIndex(), 0x06f47dab); + PTF_ASSERT_EQUAL(newHandshakeRespMessage.getReceiverIndex(), 0xd837d030); + PTF_ASSERT_BUF_COMPARE(newHandshakeRespMessage.getResponderEphemeral().data(), expectedResponderEphemeralResp, 32); + PTF_ASSERT_BUF_COMPARE(newHandshakeRespMessage.getEncryptedEmpty().data(), encryptedEmptyDataResp, 16); + PTF_ASSERT_BUF_COMPARE(newHandshakeRespMessage.getMac1().data(), expectedMac1Resp, 16); + PTF_ASSERT_BUF_COMPARE(newHandshakeRespMessage.getMac2().data(), expectedMac2Resp, 16); + + PTF_ASSERT_TRUE(wgHandshakeRespPacket.addLayer(&newHandshakeRespMessage)); + + PTF_ASSERT_EQUAL(wgHandshakeRespPacket.getRawPacket()->getRawDataLen(), bufferLength2); + PTF_ASSERT_EQUAL(newHandshakeRespMessage.getDataLen(), origHandshakeRespMessage->getDataLen()); + + PTF_ASSERT_BUF_COMPARE(newHandshakeRespMessage.getData(), origHandshakeRespMessage->getData(), + origHandshakeRespMessage->getDataLen()); + + delete origHandshakeRespMessage; + + // create WireGuard Cookie Reply message + + memcpy(origBuffer, buffer3, bufferLength3); + + uint8_t nonce[24] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + uint8_t encryptedCookie[32] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + pcpp::WireGuardCookieReplyLayer newCookieReplyMessage(0xab7df406, nonce, encryptedCookie); + pcpp::Packet wgCookieReplyPacket(&rawPacket3); + + auto origCookieReplyMessage = + dynamic_cast(wgCookieReplyPacket.detachLayer(pcpp::WireGuard)); + PTF_ASSERT_NOT_NULL(origCookieReplyMessage); + + PTF_ASSERT_EQUAL(newCookieReplyMessage.getDataLen(), origCookieReplyMessage->getDataLen()); + PTF_ASSERT_EQUAL(newCookieReplyMessage.getReceiverIndex(), 0xab7df406); + PTF_ASSERT_TRUE(std::memcmp(newCookieReplyMessage.getNonce().data(), nonce, sizeof(nonce)) == 0); + PTF_ASSERT_TRUE( + std::memcmp(newCookieReplyMessage.getEncryptedCookie().data(), encryptedCookie, sizeof(encryptedCookie)) == 0); + PTF_ASSERT_TRUE(wgCookieReplyPacket.addLayer(&newCookieReplyMessage)); + + PTF_ASSERT_EQUAL(wgCookieReplyPacket.getRawPacket()->getRawDataLen(), bufferLength3); + PTF_ASSERT_EQUAL(newCookieReplyMessage.getDataLen(), origCookieReplyMessage->getDataLen()); + + PTF_ASSERT_BUF_COMPARE(newCookieReplyMessage.getData(), origCookieReplyMessage->getData(), + origCookieReplyMessage->getDataLen()); + + delete origCookieReplyMessage; + + // create WireGuard Transport Data message + + memcpy(origBuffer, buffer4, bufferLength4); + + uint64_t expectedCounterTransport = 0x0000000000000000; + uint8_t expectedEncryptedDataTransport[112] = { + 0xa4, 0xeb, 0xc1, 0x2e, 0xe3, 0xf9, 0x90, 0xda, 0x18, 0x03, 0x3a, 0x07, 0x89, 0xc0, 0x4e, 0x27, + 0x00, 0xf6, 0xf5, 0xc2, 0x71, 0xd4, 0x2a, 0xc4, 0xb4, 0xd6, 0x26, 0x2e, 0x66, 0x65, 0x49, 0xb4, + 0x45, 0xa7, 0x43, 0x6e, 0x82, 0x9b, 0xff, 0xb6, 0xac, 0x65, 0xf0, 0x56, 0x48, 0xbc, 0x0c, 0x39, + 0x1f, 0xe7, 0xc5, 0x88, 0x48, 0x74, 0x37, 0x61, 0x27, 0x16, 0x49, 0x40, 0x18, 0x8f, 0x03, 0xdb, + 0xa6, 0x7a, 0xf8, 0x38, 0x8e, 0xaa, 0xb7, 0x6c, 0x59, 0x36, 0x28, 0xbf, 0x9d, 0xc7, 0xbe, 0x03, + 0x34, 0x6d, 0x91, 0x2e, 0x91, 0x6d, 0xad, 0x86, 0x25, 0x45, 0x45, 0x47, 0x01, 0x36, 0x4f, 0x2d, + 0x24, 0x86, 0xd7, 0xce, 0xd4, 0xc8, 0x64, 0x2c, 0xe5, 0x47, 0xdd, 0xb2, 0x6e, 0xf6, 0xa4, 0x6b + }; + + pcpp::WireGuardTransportDataLayer newTransportDataMessage(0x06f47dab, expectedCounterTransport, + expectedEncryptedDataTransport, 112); + pcpp::Packet wgTransportDataPacket(&rawPacket4); + + auto origTransportDataMessage = + dynamic_cast(wgTransportDataPacket.detachLayer(pcpp::WireGuard)); + PTF_ASSERT_NOT_NULL(origTransportDataMessage); + PTF_ASSERT_EQUAL(newTransportDataMessage.getDataLen(), origTransportDataMessage->getDataLen()); + PTF_ASSERT_EQUAL(newCookieReplyMessage.getReceiverIndex(), 0xab7df406); + PTF_ASSERT_EQUAL(newTransportDataMessage.getCounter(), expectedCounterTransport); + PTF_ASSERT_BUF_COMPARE(newTransportDataMessage.getEncryptedData(), expectedEncryptedDataTransport, 112); + PTF_ASSERT_TRUE(wgTransportDataPacket.addLayer(&newTransportDataMessage)); + + PTF_ASSERT_EQUAL(wgTransportDataPacket.getRawPacket()->getRawDataLen(), bufferLength4); + PTF_ASSERT_EQUAL(newTransportDataMessage.getDataLen(), origTransportDataMessage->getDataLen()); + + PTF_ASSERT_BUF_COMPARE(newTransportDataMessage.getData(), origTransportDataMessage->getData(), + origTransportDataMessage->getDataLen()); + + delete origTransportDataMessage; +} // WireGuardCreationTest + +PTF_TEST_CASE(WireGuardEditTest) +{ + timeval time; + gettimeofday(&time, nullptr); + + // edit WireGuard Handshake Initiation message + READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/WireGuardHandshakeInitiation.dat"); + + pcpp::Packet wgHandShakeInitPacket(&rawPacket1); + + PTF_ASSERT_TRUE(wgHandShakeInitPacket.isPacketOfType(pcpp::WireGuard)); + + auto wgLayer = wgHandShakeInitPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgLayer); + + auto wgHandShakeInitLayer = wgHandShakeInitPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgHandShakeInitLayer); + + std::array expectedReservedInit = { 0x01, 0x01, 0x01 }; + + std::array expectedPublicKeyInit = { 0x5f, 0xce, 0xc7, 0xc8, 0xe5, 0xc8, 0xe2, 0xe3, 0xf7, 0x98, 0x9e, + 0xef, 0x60, 0xc2, 0x28, 0xd8, 0x23, 0x29, 0xd6, 0x02, 0xb6, 0xb1, + 0xe2, 0xbb, 0x9d, 0x06, 0x8f, 0x89, 0xcf, 0x9d, 0x4d, 0x45 }; + + std::array expectedStaticKeyInit = { 0x32, 0x78, 0x0f, 0x6d, 0x27, 0x26, 0x4f, 0x7b, 0x98, 0x70, + 0x1f, 0xdc, 0x27, 0xa4, 0xec, 0x00, 0xae, 0xb6, 0xbe, 0xcd, + 0xbe, 0xf2, 0x33, 0x2f, 0x1b, 0x40, 0x84, 0xca, 0xdb, 0x93, + 0x82, 0x39, 0x35, 0xc0, 0x12, 0xae, 0x25, 0x5e, 0x7b, 0x25, + 0xef, 0xf1, 0x39, 0x40, 0xc3, 0x21, 0xfa, 0x6b }; + std::array expectedTimestampInit = { 0xd6, 0x6a, 0x2a, 0x87, 0xb0, 0x61, 0xdb, 0x14, 0x30, 0x17, + 0x3e, 0x93, 0x7f, 0x56, 0x93, 0x49, 0xde, 0x28, 0x56, 0xdc, + 0x5f, 0x26, 0x16, 0x76, 0x3e, 0xee, 0xaf, 0xc0 }; + std::array expectedMac1Init = { 0x53, 0x3b, 0x01, 0xdd, 0x96, 0x5e, 0x7e, 0xc7, + 0x69, 0x76, 0xe2, 0x8f, 0x68, 0x3d, 0x67, 0x12 }; + std::array expectedMac2Init = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + wgHandShakeInitLayer->setReserved(expectedReservedInit); + wgHandShakeInitLayer->setSenderIndex(1); + wgHandShakeInitLayer->setInitiatorEphemeral(expectedPublicKeyInit); + wgHandShakeInitLayer->setEncryptedInitiatorStatic(expectedStaticKeyInit); + wgHandShakeInitLayer->setEncryptedTimestamp(expectedTimestampInit); + wgHandShakeInitLayer->setMac1(expectedMac1Init); + wgHandShakeInitLayer->setMac2(expectedMac2Init); + wgHandShakeInitLayer = wgHandShakeInitPacket.getLayerOfType(); + + uint32_t reservedValueInit = 0; + memcpy(&reservedValueInit, expectedReservedInit.data(), 3); + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getReserved(), be32toh(reservedValueInit)); + PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getSenderIndex(), 1); + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getInitiatorEphemeral() == expectedPublicKeyInit); + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getEncryptedInitiatorStatic() == expectedStaticKeyInit); + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getEncryptedTimestamp() == expectedTimestampInit); + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getMac1() == expectedMac1Init); + PTF_ASSERT_TRUE(wgHandShakeInitLayer->getMac2() == expectedMac2Init); + + // edit WireGuard Handshake Response message + READ_FILE_AND_CREATE_PACKET(2, "PacketExamples/WireGuardHandshakeResponse.dat"); + + pcpp::Packet wgHandShakeResponsePacket(&rawPacket2); + + PTF_ASSERT_TRUE(wgHandShakeResponsePacket.isPacketOfType(pcpp::WireGuard)); + + auto wgHandShakeResponseLayer = wgHandShakeResponsePacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgHandShakeResponseLayer); + + std::array expectedReservedResp = { 0x01, 0x01, 0x01 }; + + std::array expectedResponderEphemeralResp = { 0xb1, 0x8d, 0x55, 0x50, 0xbd, 0x40, 0x42, 0xa3, + 0x7a, 0x46, 0x82, 0x3a, 0xc0, 0x8d, 0xb1, 0xec, + 0x66, 0x83, 0x9b, 0xc0, 0xca, 0x2d, 0x64, 0xbc, + 0x15, 0xcd, 0x80, 0x23, 0x2b, 0x66, 0x23, 0x2f }; + + std::array encryptedEmptyDataResp = { 0xae, 0xc2, 0x4a, 0xf8, 0x91, 0x8d, 0xe1, 0x06, + 0x0f, 0xf5, 0xc9, 0x8e, 0x86, 0x5d, 0x5f, 0x35 }; + + std::array expectedMac1Resp = { 0xf2, 0x72, 0x21, 0x4c, 0x52, 0x60, 0x11, 0x0d, + 0xc4, 0xc6, 0x1e, 0x32, 0xcd, 0xd8, 0x54, 0x21 }; + + std::array expectedMac2Resp = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + wgHandShakeResponseLayer->setReserved(expectedReservedResp); + wgHandShakeResponseLayer->setSenderIndex(1); + wgHandShakeResponseLayer->setReceiverIndex(1); + wgHandShakeResponseLayer->setResponderEphemeral(expectedResponderEphemeralResp); + wgHandShakeResponseLayer->setEncryptedEmpty(encryptedEmptyDataResp); + wgHandShakeResponseLayer->setMac1(expectedMac1Resp); + wgHandShakeResponseLayer->setMac2(expectedMac2Resp); + wgHandShakeResponseLayer = wgHandShakeResponsePacket.getLayerOfType(); + + uint32_t reservedValueResp = 0; + memcpy(&reservedValueResp, expectedReservedResp.data(), 3); + + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getSenderIndex(), 1); + PTF_ASSERT_EQUAL(wgHandShakeResponseLayer->getReceiverIndex(), 1); + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getResponderEphemeral() == expectedResponderEphemeralResp); + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getEncryptedEmpty() == encryptedEmptyDataResp); + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getMac1() == expectedMac1Resp); + PTF_ASSERT_TRUE(wgHandShakeResponseLayer->getMac2() == expectedMac2Resp); + + // edit WireGuard Cookie Reply message + READ_FILE_AND_CREATE_PACKET(3, "PacketExamples/WireGuardCookieReply.dat"); + + pcpp::Packet wgCookieReplyPacket(&rawPacket3); + + PTF_ASSERT_TRUE(wgCookieReplyPacket.isPacketOfType(pcpp::WireGuard)); + + auto wgCookieReplyaLayer = wgCookieReplyPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgCookieReplyaLayer); + + std::array expectedReservedCookie = { 0x01, 0x01, 0x01 }; + + std::array nonceCookie = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + std::array encryptedCookie = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + wgCookieReplyaLayer->setReserved(expectedReservedCookie); + wgCookieReplyaLayer->setNonce(nonceCookie); + wgCookieReplyaLayer->setReceiverIndex(1); + wgCookieReplyaLayer->setEncryptedCookie(encryptedCookie); + wgCookieReplyaLayer = wgCookieReplyPacket.getLayerOfType(); + + uint32_t reservedValueCookie = 0; + memcpy(&reservedValueCookie, expectedReservedCookie.data(), 3); + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getReserved(), be32toh(reservedValueCookie)); + PTF_ASSERT_EQUAL(wgCookieReplyaLayer->getReceiverIndex(), 1); + PTF_ASSERT_BUF_COMPARE(wgCookieReplyaLayer->getNonce().data(), nonceCookie.data(), 24); + PTF_ASSERT_BUF_COMPARE(wgCookieReplyaLayer->getEncryptedCookie().data(), encryptedCookie.data(), 32); + + // edit WireGuard Transport Data message + READ_FILE_AND_CREATE_PACKET(4, "PacketExamples/WireGuardTransportData.dat"); + + pcpp::Packet wgTransportDataPacket(&rawPacket4); + + PTF_ASSERT_TRUE(wgTransportDataPacket.isPacketOfType(pcpp::WireGuard)); + + auto wgTransportDataLayer = wgTransportDataPacket.getLayerOfType(); + PTF_ASSERT_NOT_NULL(wgTransportDataLayer); + + std::array expectedReservedTrans = { 0x01, 0x01, 0x01 }; + + uint8_t expectedEncryptedDataTrans[112] = { + 0xa4, 0xeb, 0xc1, 0x2e, 0xe3, 0xf9, 0x90, 0xda, 0x18, 0x03, 0x3a, 0x07, 0x89, 0xc0, 0x4e, 0x27, + 0x00, 0xf6, 0xf5, 0xc2, 0x71, 0xd4, 0x2a, 0xc4, 0xb4, 0xd6, 0x26, 0x2e, 0x66, 0x65, 0x49, 0xb4, + 0x45, 0xa7, 0x43, 0x6e, 0x82, 0x9b, 0xff, 0xb6, 0xac, 0x65, 0xf0, 0x56, 0x48, 0xbc, 0x0c, 0x39, + 0x1f, 0xe7, 0xc5, 0x88, 0x48, 0x74, 0x37, 0x61, 0x27, 0x16, 0x49, 0x40, 0x18, 0x8f, 0x03, 0xdb, + 0xa6, 0x7a, 0xf8, 0x38, 0x8e, 0xaa, 0xb7, 0x6c, 0x59, 0x36, 0x28, 0xbf, 0x9d, 0xc7, 0xbe, 0x03, + 0x34, 0x6d, 0x91, 0x2e, 0x91, 0x6d, 0xad, 0x86, 0x25, 0x45, 0x45, 0x47, 0x01, 0x36, 0x4f, 0x2d, + 0x24, 0x86, 0xd7, 0xce, 0xd4, 0xc8, 0x64, 0x2c, 0xe5, 0x47, 0xdd, 0xb2, 0x6e, 0xf6, 0xa4, 0x6b + }; + wgTransportDataLayer->setReserved(expectedReservedTrans); + wgTransportDataLayer->setCounter(1); + wgTransportDataLayer->setReceiverIndex(1); + wgTransportDataLayer->setEncryptedData(expectedEncryptedDataTrans, sizeof(expectedEncryptedDataTrans)); + wgTransportDataLayer = wgTransportDataPacket.getLayerOfType(); + + uint32_t reservedValue = 0; + memcpy(&reservedValue, expectedReservedTrans.data(), 3); + PTF_ASSERT_EQUAL(wgTransportDataLayer->getCounter(), 1); + PTF_ASSERT_EQUAL(wgTransportDataLayer->getReceiverIndex(), 1); + + PTF_ASSERT_BUF_COMPARE(wgTransportDataLayer->getEncryptedData(), expectedEncryptedDataTrans, + sizeof(expectedEncryptedDataTrans)); + +} // WireGuardEditTest diff --git a/Tests/Packet++Test/main.cpp b/Tests/Packet++Test/main.cpp index d235f69f41..0e14158065 100644 --- a/Tests/Packet++Test/main.cpp +++ b/Tests/Packet++Test/main.cpp @@ -161,6 +161,7 @@ int main(int argc, char* argv[]) PTF_RUN_TEST(ResizeLayerTest, "packet;resize"); PTF_RUN_TEST(PrintPacketAndLayersTest, "packet;print"); PTF_RUN_TEST(ProtocolFamilyMembershipTest, "packet"); + PTF_RUN_TEST(PacketParseLayerLimitTest, "packet"); PTF_RUN_TEST(HttpRequestParseMethodTest, "http"); PTF_RUN_TEST(HttpRequestLayerParsingTest, "http"); @@ -333,5 +334,12 @@ int main(int argc, char* argv[]) PTF_RUN_TEST(LdapParsingTest, "ldap"); PTF_RUN_TEST(LdapCreationTest, "ldap"); + PTF_RUN_TEST(WireGuardHandshakeInitParsingTest, "wg"); + PTF_RUN_TEST(WireGuardHandshakeRespParsingTest, "wg"); + PTF_RUN_TEST(WireGuardCookieReplyParsingTest, "wg"); + PTF_RUN_TEST(WireGuardTransportDataParsingTest, "wg"); + PTF_RUN_TEST(WireGuardCreationTest, "wg"); + PTF_RUN_TEST(WireGuardEditTest, "wg"); + PTF_END_RUNNING_TESTS; } diff --git a/Tests/Pcap++Test/Common/PcapFileNamesDef.h b/Tests/Pcap++Test/Common/PcapFileNamesDef.h index d39c35c38d..41d724152b 100644 --- a/Tests/Pcap++Test/Common/PcapFileNamesDef.h +++ b/Tests/Pcap++Test/Common/PcapFileNamesDef.h @@ -30,5 +30,7 @@ #define SLL2_PCAP_PATH "PcapExamples/sll2.pcap" #define SLL2_PCAP_WRITE_PATH "PcapExamples/sll2_copy.pcap" #define EXAMPLE_PCAP_MICRO_PATH "PcapExamples/microsecs.pcap" +#define EXAMPLE_PCAP_DESTRUCTOR1_PATH "PcapExamples/destructor1.pcap" +#define EXAMPLE_PCAP_DESTRUCTOR2_PATH "PcapExamples/destructor2.pcap" #define EXAMPLE_PCAP_NANO_PATH "PcapExamples/nanosecs.pcap" #define EXAMPLE_PCAPNG_NANO_PATH "PcapExamples/nanosecs.pcapng" diff --git a/Tests/Pcap++Test/PcapExamples/one_tcp_stream_fin_rst_close_packet.pcap b/Tests/Pcap++Test/PcapExamples/one_tcp_stream_fin_rst_close_packet.pcap new file mode 100755 index 0000000000..208a6123e4 Binary files /dev/null and b/Tests/Pcap++Test/PcapExamples/one_tcp_stream_fin_rst_close_packet.pcap differ diff --git a/Tests/Pcap++Test/TestDefinition.h b/Tests/Pcap++Test/TestDefinition.h index 2ed9ac12b5..f460c29d22 100644 --- a/Tests/Pcap++Test/TestDefinition.h +++ b/Tests/Pcap++Test/TestDefinition.h @@ -30,6 +30,7 @@ PTF_TEST_CASE(TestPcapFileReadLinkTypeIPv6); PTF_TEST_CASE(TestPcapFileReadLinkTypeIPv4); PTF_TEST_CASE(TestSolarisSnoopFileRead); PTF_TEST_CASE(TestPcapNgFilePrecision); +PTF_TEST_CASE(TestPcapFileWriterDeviceDestructor); // Implemented in LiveDeviceTests.cpp PTF_TEST_CASE(TestPcapLiveDeviceList); @@ -78,6 +79,7 @@ PTF_TEST_CASE(TestTcpReassemblyMaxOOOFrags); PTF_TEST_CASE(TestTcpReassemblyMaxSeq); PTF_TEST_CASE(TestTcpReassemblyDisableOOOCleanup); PTF_TEST_CASE(TestTcpReassemblyTimeStamps); +PTF_TEST_CASE(TestTcpReassemblyFinReset); // Implemented in IPFragmentationTests.cpp PTF_TEST_CASE(TestIPFragmentationSanity); diff --git a/Tests/Pcap++Test/Tests/FileTests.cpp b/Tests/Pcap++Test/Tests/FileTests.cpp index cf715e1f7c..95ee4ac378 100644 --- a/Tests/Pcap++Test/Tests/FileTests.cpp +++ b/Tests/Pcap++Test/Tests/FileTests.cpp @@ -974,3 +974,45 @@ PTF_TEST_CASE(TestSolarisSnoopFileRead) readerDev.close(); } // TestSolarisSnoopFileRead + +PTF_TEST_CASE(TestPcapFileWriterDeviceDestructor) +{ + std::array testPayload = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; + pcpp::RawPacket rawPacket1(testPayload.data(), testPayload.size(), timeval{}, false); + pcpp::RawPacket rawPacket2(testPayload.data(), testPayload.size(), timeval{}, false); + + // Create some pcaps in a nested scope to test cleanup on destruction. + { + // create a file to leave open on destruction. If close is properly done on destruction, the contents & size of + // this file should match the next explicitly closed file. + pcpp::PcapFileWriterDevice writerDevDestructorNoClose(EXAMPLE_PCAP_DESTRUCTOR1_PATH, pcpp::LINKTYPE_ETHERNET, + false); + PTF_ASSERT_TRUE(writerDevDestructorNoClose.open()); + PTF_ASSERT_TRUE(writerDevDestructorNoClose.writePacket(rawPacket1)); + PTF_ASSERT_TRUE(writerDevDestructorNoClose.writePacket(rawPacket2)); + + // create a file that will be explicitly closed before construction + pcpp::PcapFileWriterDevice writerDevDestructorExplicitClose(EXAMPLE_PCAP_DESTRUCTOR2_PATH, + pcpp::LINKTYPE_ETHERNET, false); + PTF_ASSERT_TRUE(writerDevDestructorExplicitClose.open()); + PTF_ASSERT_TRUE(writerDevDestructorExplicitClose.writePacket(rawPacket1)); + PTF_ASSERT_TRUE(writerDevDestructorExplicitClose.writePacket(rawPacket2)); + writerDevDestructorExplicitClose.close(); + } + + // Check that file sizes are equal. This should fail if the pcpp::PcapFileWriterDevice destructor does not close + // properly. + std::ifstream fileDestructorNoClose(EXAMPLE_PCAP_DESTRUCTOR1_PATH, std::ios::binary | std::ios::in); + fileDestructorNoClose.seekg(0, std::ios::end); + auto posNoClose = fileDestructorNoClose.tellg(); + + std::ifstream fileDestructorExplicitClose(EXAMPLE_PCAP_DESTRUCTOR2_PATH, std::ios::binary | std::ios::in); + fileDestructorExplicitClose.seekg(0, std::ios::end); + auto posExplicitClose = fileDestructorExplicitClose.tellg(); + + // sizes should be non-zero and match if files both got closed properly + PTF_ASSERT_NOT_EQUAL(0, posNoClose); + PTF_ASSERT_NOT_EQUAL(0, posExplicitClose); + PTF_ASSERT_EQUAL(posNoClose, posExplicitClose); +} // TestPcapFileWriterDeviceDestructor diff --git a/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp b/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp index 094f0ebdad..e43ebcd7f6 100644 --- a/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp +++ b/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp @@ -1263,3 +1263,21 @@ PTF_TEST_CASE(TestTcpReassemblyTimeStamps) packetStream.clear(); tcpReassemblyResults.clear(); } // TestTcpReassemblyTimeStamps + +PTF_TEST_CASE(TestTcpReassemblyFinReset) +{ + std::string errMsg; + + std::vector packetStream; + PTF_ASSERT_TRUE( + readPcapIntoPacketVec("PcapExamples/one_tcp_stream_fin_rst_close_packet.pcap", packetStream, errMsg)); + + TcpReassemblyMultipleConnStats tcpReassemblyResults; + tcpReassemblyTest(packetStream, tcpReassemblyResults, true, false); + + TcpReassemblyMultipleConnStats::Stats& stats = tcpReassemblyResults.stats; + PTF_ASSERT_EQUAL(stats.size(), 1); + PTF_ASSERT_TRUE(stats.begin()->second.connectionsStarted); + PTF_ASSERT_TRUE(stats.begin()->second.connectionsEnded); + PTF_ASSERT_FALSE(stats.begin()->second.connectionsEndedManually); +} // TestTcpReassemblyFinReset diff --git a/Tests/Pcap++Test/main.cpp b/Tests/Pcap++Test/main.cpp index 3e6479110f..86b5244d09 100644 --- a/Tests/Pcap++Test/main.cpp +++ b/Tests/Pcap++Test/main.cpp @@ -227,6 +227,7 @@ int main(int argc, char* argv[]) PTF_RUN_TEST(TestPcapFileReadLinkTypeIPv6, "no_network;pcap"); PTF_RUN_TEST(TestPcapFileReadLinkTypeIPv4, "no_network;pcap"); PTF_RUN_TEST(TestSolarisSnoopFileRead, "no_network;pcap;snoop"); + PTF_RUN_TEST(TestPcapFileWriterDeviceDestructor, "no_network;pcap"); PTF_RUN_TEST(TestPcapLiveDeviceList, "no_network;live_device;skip_mem_leak_check"); PTF_RUN_TEST(TestPcapLiveDeviceListSearch, "live_device"); @@ -289,6 +290,7 @@ int main(int argc, char* argv[]) PTF_RUN_TEST(TestTcpReassemblyMaxSeq, "no_network;tcp_reassembly"); PTF_RUN_TEST(TestTcpReassemblyDisableOOOCleanup, "no_network;tcp_reassembly"); PTF_RUN_TEST(TestTcpReassemblyTimeStamps, "no_network;tcp_reassembly"); + PTF_RUN_TEST(TestTcpReassemblyFinReset, "no_network;tcp_reassembly"); PTF_RUN_TEST(TestIPFragmentationSanity, "no_network;ip_frag"); PTF_RUN_TEST(TestIPFragOutOfOrder, "no_network;ip_frag"); diff --git a/ci/run_tests/requirements.txt b/ci/run_tests/requirements.txt index 81360b1777..5f8a78b51a 100644 --- a/ci/run_tests/requirements.txt +++ b/ci/run_tests/requirements.txt @@ -1 +1 @@ -scapy==2.5.0 +scapy==2.6.0 diff --git a/ci/run_tests/run_tests_windows.py b/ci/run_tests/run_tests_windows.py index e12d609b29..df9a3daab7 100644 --- a/ci/run_tests/run_tests_windows.py +++ b/ci/run_tests/run_tests_windows.py @@ -57,7 +57,7 @@ def find_interface(): if completed_process.returncode != 0: continue return interface, ip_address - except: + except Exception: pass return None, None diff --git a/cmake/PcapPlusPlusUninstall.cmake.in b/cmake/PcapPlusPlusUninstall.cmake.in index 9a3121336c..bd98d771f1 100644 --- a/cmake/PcapPlusPlusUninstall.cmake.in +++ b/cmake/PcapPlusPlusUninstall.cmake.in @@ -7,16 +7,13 @@ string(REGEX REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - # If the file exists or is symlink - # run remove command through cmake in command mode - # See https://cmake.org/cmake/help/latest/manual/cmake.1.html#run-a-command-line-tool - exec_program( - "@CMAKE_COMMAND@" ARGS "-E rm -rf \"$ENV{DESTDIR}${file}\"" + execute_process( + COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}" OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval + RESULT_VARIABLE rm_retval ) if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Error when removing $ENV{DESTDIR}${file}") + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") endif() else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") message(STATUS "File $ENV{DESTDIR}${file} does not exist.") diff --git a/cmake/package/READMEs/README.release.header b/cmake/package/READMEs/README.release.header index bc380b3081..875be006cd 100644 --- a/cmake/package/READMEs/README.release.header +++ b/cmake/package/READMEs/README.release.header @@ -1,2 +1,2 @@ -September 2023 release of PcapPlusPlus (v23.09) +September 2024 release of PcapPlusPlus (v24.09) =============================================== diff --git a/cmake/package/READMEs/release_notes.txt b/cmake/package/READMEs/release_notes.txt index 6d6921b055..67e2915824 100644 --- a/cmake/package/READMEs/release_notes.txt +++ b/cmake/package/READMEs/release_notes.txt @@ -1,74 +1,126 @@ -Release notes (changes from v22.11) +Release notes (changes from v23.09) ----------------------------------- - - PcapPlusPlus moved from a custom build system to CMake! (thanks @clementperon !) - - Added IP/IPv4/IPv6 network classes to better support netmask and subnets - - Add support for opening NFLOG live device (thanks @MrPeck !) - - MAC address OUI Lookup (thanks @egecetin !) - - Intel oneAPI compiler support (icpx) (thanks @egecetin !) - - DPDK improvements: - - Properly support no RSS mode in `DpdkDevice` - - Make DPDK app name configurable (thanks @szokovacs !) - - More generic search of DPDK KNI kernel module in `setup_dpdk.py` - - New protocols: - - NFLOG (Linux Netfilter NFLOG) (thanks @jafar75 !) - - SLL2 (Linux cooked capture v2) (thanks @jiangjiongyu !) - - TPKT (thanks @wivien19 !) - - COTP (thanks @wivien19 !) - - VRRP (thanks @wangchong2023 !) - - Existing protocols improvements: - - HTTP - refactor and improve `HttpResponseStatusCode` (thanks @tigercosmos !) - - SSL/TLS - better detection of possible encrypted handshake messages (thanks @axmahr !) - - DNS - support parsing of resources with larger data (thanks @aengusjiang !) - - STP - add editing/crafting support (thanks @egecetin !) - - ARP - add `isRequest` and `isReply` methods (thanks @tigercosmos !) - - FTP-DATA support (thanks @egecetin !) - - NTP - support Kiss of Death (thanks @egecetin !) - - SIP - refactor status codes + add a few missing ones - - Modernize the codebase to use `nullptr` instead of `NULL` (thanks @clementperon !) - - Remove usage of unsupported `pcap_compile_nopcap()` (thanks @yushijinhun !) - - Internal tools: - - Codecov integration for coverage reports (thanks @egecetin !) - - Enable Clang-Tidy (thanks @clementperon !) - - Enable `cppcheck` (thanks @egecetin !) - - Improve the test framework - - Increase test coverage - - Remove deprecated methods (due to typos): - - `DhcpLayer::getMesageType()` -> replaced by `DhcpLayer::getMessageType()` - - `DhcpLayer::setMesageType()` -> replaced by `DhcpLayer::setMessageType()` - - `SSLHandshakeMessage::createHandhakeMessage()` -> replaced by `SSLHandshakeMessage::createHandshakeMessage()` - - `SSLClientHelloMessage::getExtensionsLenth()` -> replaced by `SSLClientHelloMessage::getExtensionsLength()` - - `SSLServerHelloMessage::getExtensionsLenth()` -> replaced by `SSLServerHelloMessage::getExtensionsLength()` - - Tons of bug fixes, security fixes, major and minor improvements (thanks @egecetin, @clementperon, @sashashura, @tigercosmos, @kolbex, @traversebitree, @JasMetzger, @tbhaxor, @yishai1999, @aengusjiang, @Heysunk, @jpcofr !) +- Added support for eBPF AF_XDP +- New protocols: + - SMTP (thanks @egecetin !) + - ASN.1 encoding and decoding + - Enabled ASN.1 root record parsing in x509 certificates + - LDAP + - S7COMM (thanks @wivien19 !) +- DPDK improvements: + - DPDK 22.11 support (thanks @clementperon !) + - Jumbo frames support (thanks @gyl30 !) + - Added an option to disable hugepages and driver verification on initialization (thanks @MatteO-Matic !) + - NUMA awareness (thanks @SesomB !) +- Examples and utils: + - Added `XdpExample-FilterTraffic` to demonstrate `XdpDevice` usage + - `PcapSplitter`: updated output filenames with 5-tuple information (thanks @hidd3ncod3s !) +- Added support for nanosecond precision in reading and writing pcap files (thanks @egecetin !) +- Blocking mode packet capture now uses `poll()` (thanks @tigercosmos !) +- Added millisecond precision timeout in `RawSocketDevice` (thanks @tigercosmos !) +- Extended `IPFilter` to support IPv6 where possible (thanks @Dimi1010 !) +- Boosted build time with Ccache (thanks @clementperon !) +- Fixed precision issue in pcapng file reader (thanks @mserdarsanli !) +- Improved method for retrieving the default gateway on macOS (thanks @zhengfeihe !) +- Added security and code of conduct guidelines (thanks @egecetin !) +- Refactoring and modernization of the code base: + - Refactored and cleaned up live devices (thanks @Dimi1010 !) + - Added a getter for fetching all IP addresses as `IPAddress` objects. + - Refactored IP address classes `IPv4Address`, `IPv6Address`, `IPAddress` (thanks @tigercosmos , @Dimi1010 !) + - Added equality operators between `IPAddress` and `in_addr` types + - Refactored the MAC address class `MacAddress` (thanks @tigercosmos !) + - Ported PcapPlusPlus libraries to C++11 (thanks @Dimi1010 , @tigercosmos , @egecetin , @WojtekMs , @rtmeng, @DeepakReddy1999 !) + - Ported most of the examples and tutorials to C++11 (thanks @jpcofr , @merttozer !) + - Refactored and cleaned up PF_RING devices (thanks @Dimi1010 !) + - Refactored and cleaned up the `PointerVector` class (thanks @Dimi1010 !) + - Converted Macro Guard to `pragma once` (thanks @clementperon !) + - Replaced `std::map` with `std::unordered_map` (thanks @tigercosmos !) + - Refactored large parts of the packet filtering code (thanks @Dimi1010 !) +- Supported platforms update: + - Ubuntu: added 24.04 LTS and dropped 18.04 LTS (thanks @tigercosmos !) + - Added support for RHEL 9.4 (thanks @clementperon !) + - Fedora: added support for 39 and removed 37 (thanks @clementperon !) + - Removed support for CentOS 7 + - FreeBSD: added support for 14.0 and dropped 12 (thanks @clementperon !) +- Internal tools: + - Reformatted the entire code base using `clang-format` (thanks @tigercosmos , @Dimi1010 !) + - Added `dependabot` to keep GitHub Actions and Python packages up-to-date (thanks @egecetin !) + - Added OpenSSF Scorecard automation to monitor and enhance security (thanks @egecetin !) + - Transitioned from CirrusCI to GitHub Actions for all workflows (thanks @tigercosmos !) + - Scheduled regular CI builds (thanks @tigercosmos !) + - Replaced deprecated `netifaces` by `scapy` (thanks @zhengfeihe !) + - Improved fuzzing coverage and added Fuzz CI (thanks @sashashura !) + - Added a template for opening GitHub issues (thanks @tigercosmos !) + - Upgraded `LightPcapNg` to the latest from `master` (thanks @tigercosmos !) + - Fixed unhandled exceptions crashing the entire test suite (thanks @Dimi1010 !) +- Tons of bug fixes, security fixes and small improvements (thanks @sashashura , @tigercosmos , @clementperon , @egecetin , @kraj , @liu0hy , @lucashc , @axmahr, @Double0101, @prudens , @MCredbear, @rahagal, @nadongjun !) + + +Breaking changes +---------------- + +This version includes a small number of breaking changes: +- Removed `isValid()` from `MacAddress,` `IPAddress`, `IPv4Address`, `IPv6Address`, instead they throw an exception if the input argument is invalid +- Introduced a new `TcpOptionEnumType` +- Removed the `dummy` argument in `PayloadLayer`'s constructor + + +Deprecation list +---------------- + +The following methods that were marked as deprecated in previous versions were removed: +- `IPv4Address::matchSubnet()` + +The following methods are now marked as deprecated and will be removed in future versions: +- `PointerVector::getAndRemoveFromVector()` -> replaced by `PointerVector::getAndDetach()` +- `HttpResponseLayer::HttpResponseLayer(version, statusCode, statusCodeString)` -> use other constructors +- `HttpResponseLayer::setStatusCode(newStatusCode, statusCodeString)` -> use the other overload +- `TcpOptionType` enum -> replaced by `TcpOptionEnumType` +- `TcpOption::getTcpOptionType()` -> replaced by `TcpOption::getTcpOptionEnumType()` +- `TcpOptionBuilder::TcpOptionBuilder()` -> use other constructors +- `TcpLayer::getTcpOption(TcpOptionType option)` -> use the other overload +- `TcpLayer::addTcpOptionAfter()` -> replaced by `TcpLayer::insertTcpOptionAfter()` +- `TcpLayer::removeTcpOption()` -> use the other overload +- `PcapLiveDevice::getAddresses()` -> replaced by `PcapLiveDevice::getIPAddresses()` +- `PcapRemoteDeviceList::getRemoteDeviceList()` -> replaced by `PcapRemoteDeviceList::createRemoteDeviceList()` Collaborators ------------- - - @clementperon + - @tigercosmos + - @Dimi1010 - @egecetin + - @clementperon + - @seladb Contributors ------------ - - @sashashura - - @tigercosmos - - @wivien19 - - @jafar75 - - @MrPeck - - @szokovacs - - @axmahr - - @yishai1999 - - @traversebitree - - @jiangjiongyu - - @wangchong2023 - - @kolbex - - @JasMetzger - - @yushijinhun - - @aengusjiang - - @tbhaxor - - @Heysunk - - @jpcofr - -**Full Changelog**: https://github.com/seladb/PcapPlusPlus/compare/v22.11...v23.09 +- @sashashura +- @zhengfeihe +- @wivien19 +- @gyl30 +- @MatteO-Matic +- @SesomB +- @jpcofr +- @liu0hy +- @merttozer +- @lucashc +- @axmahr +- @Double0101 +- @prudens +- @rtmeng +- @hidd3ncod3s +- @WojtekMs +- @mserdarsanli +- @MCredbear +- @rahagal +- @DeepakReddy1999 +- @kraj +- @nadongjun + + +**Full Changelog**: https://github.com/seladb/PcapPlusPlus/compare/v23.09...v24.09 diff --git a/cmake/setup_dpdk.py b/cmake/setup_dpdk.py index 1e1f22f031..0d7a2937bf 100755 --- a/cmake/setup_dpdk.py +++ b/cmake/setup_dpdk.py @@ -230,9 +230,7 @@ def usage(): [Restore] sudo python setup_dpdk.py restore\n\n - """.format( - settings_file=_SETTINGS_FILE - ) + """.format(settings_file=_SETTINGS_FILE) # This is roughly compatible with check_output function in subprocess module @@ -439,7 +437,7 @@ def handle_error(error_msg): filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"] try: file_d = open(filename, "a") - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: unbind failed for %s - Cannot open %s" % (dev_id, filename) ) @@ -491,7 +489,7 @@ def handle_error(error_msg): if os.path.exists(filename): try: file_d = open(filename, "w") - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: bind failed for %s - Cannot open %s" % (dev_id, filename) ) @@ -500,7 +498,7 @@ def handle_error(error_msg): file_d.write("%s" % driver) logger.debug("bind_one: write '%s' to '%s'", driver, filename) file_d.close() - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: bind failed for %s - Cannot write driver %s to " "PCI ID " % (dev_id, driver) @@ -511,7 +509,7 @@ def handle_error(error_msg): filename = "/sys/bus/pci/drivers/%s/new_id" % driver try: file_d = open(filename, "w") - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: bind failed for %s - Cannot open %s" % (dev_id, filename) ) @@ -520,7 +518,7 @@ def handle_error(error_msg): # Convert Device and Vendor Id to int to write to new_id file_d.write("%04x %04x" % (int(dev["Vendor"], 16), int(dev["Device"], 16))) file_d.close() - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: bind failed for %s - Cannot write new PCI ID to " "driver %s" % (dev_id, driver) @@ -531,7 +529,7 @@ def handle_error(error_msg): filename = "/sys/bus/pci/drivers/%s/bind" % driver try: file_d = open(filename, "a") - except: # pylint:disable=bare-except + except Exception: logger.error("Error: bind failed for %s - Cannot open %s", dev_id, filename) if saved_driver is not None: # restore any previous driver bind_one(dev_id, saved_driver, quiet, force) @@ -540,7 +538,7 @@ def handle_error(error_msg): file_d.write(dev_id) logger.debug("bind_one: write '%s' to '%s'", dev_id, filename) file_d.close() - except: # pylint:disable=bare-except + except Exception: # for some reason, closing dev_id after adding a new PCI ID to new_id # results in IOError. however, if the device was successfully bound, # we don't care for any errors and can safely ignore IOError @@ -561,7 +559,7 @@ def handle_error(error_msg): if os.path.exists(filename): try: file_d = open(filename, "w") - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: unbind failed for %s - Cannot open %s" % (dev_id, filename) ) @@ -570,7 +568,7 @@ def handle_error(error_msg): file_d.write("\00") logger.debug("bind_one: write '\00' to '%s'", filename) file_d.close() - except: # pylint:disable=bare-except + except Exception: handle_error( "Error: unbind failed for %s - Cannot open %s" % (dev_id, filename) ) @@ -1216,7 +1214,7 @@ def main(): try: args.func(args, settings) settings.save(settings_file_full_path) - except: # pylint:disable=bare-except + except Exception: pass diff --git a/cppcheckSuppressions.txt b/cppcheckSuppressions.txt index bab0d70856..771a24fba0 100644 --- a/cppcheckSuppressions.txt +++ b/cppcheckSuppressions.txt @@ -11,5 +11,6 @@ noExplicitConstructor:Common++/header/IpAddress.h noExplicitConstructor:Common++/header/MacAddress.h noExplicitConstructor:Pcap++/header/PcapFileDevice.h -missingOverride:* +missingOverride:Pcap++/* +missingOverride:Examples/* cstyleCast:*