Skip to content
Open
16 changes: 1 addition & 15 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-22.04
- os: windows-latest
- os: macos-latest
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --recursive

- name: Install (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libpcap-dev

- name: Install (windows)
if: matrix.os == 'windows-latest'
run: choco install winpcap

- name: Install (macos)
if: matrix.os == 'macos-latest'
run: brew install libpcap

Comment thread
aamereller marked this conversation as resolved.
- name: Create Build Environment
run: cmake -E make_directory build

Expand Down
1 change: 1 addition & 0 deletions include/pcapng_exporter/flexray.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct flexray_frame
uint8_t cc;

uint8_t data[254];
uint8_t symbol_length;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PCAP FlexRay symbol is defined as array of bytes, not just one value

https://www.tcpdump.org/linktypes/LINKTYPE_FLEXRAY.html


flexray_frame() {
type = FR_TYPE_FRAME;
Expand Down
34 changes: 22 additions & 12 deletions pcapng_exporter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2020-2021 Technica Engineering GmbH
Copyright (c) 2020-2025 Technica Engineering GmbH
GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
*/
#include <iostream>
Expand Down Expand Up @@ -163,17 +163,27 @@ namespace pcapng_exporter {
const uint8_t FR_HDR_SIZE = 7;
uint8_t fr[FR_HDR_SIZE + 254] = { 0 };
fr[0] = (frame.channel << 6) | frame.type;
fr[1] = frame.err_flags;
uint64_t frh =
((uint64_t)frame.fr_flags << 35) |
((uint64_t)frame.fid << 24) |
((uint64_t)frame.len << 17) |
((uint64_t)frame.hcrc << 6) |
((uint64_t)frame.cc << 0);
((uint64_t*)(fr + 2))[0] = hton64(frh << 24);
size_t data_len = (size_t)frame.len * 2;
memcpy(fr + 7, frame.data, data_len);
std::vector<uint8_t> data(fr, fr + FR_HDR_SIZE + data_len);
uint8_t frame_length;
if (frame.type == FR_TYPE_FRAME)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aamereller, could you please fix the indentation inside the if / else blocks ?

{
fr[1] = frame.err_flags;
uint64_t frh =
((uint64_t)frame.fr_flags << 35) |
((uint64_t)frame.fid << 24) |
((uint64_t)frame.len << 17) |
((uint64_t)frame.hcrc << 6) |
((uint64_t)frame.cc << 0);
((uint64_t*)(fr + 2))[0] = hton64(frh << 24);
size_t data_len = (size_t)frame.len * 2;
memcpy(fr + 7, frame.data, data_len);
frame_length = FR_HDR_SIZE + data_len;
}
else
{
fr[1] = frame.symbol_length;
frame_length = 2;
}
std::vector<uint8_t> data(fr, fr + frame_length);
this->write_frame(header, LINKTYPE_FLEXRAY, data);
}

Expand Down