Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Integrate ANDI-10625 #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
14 changes: 12 additions & 2 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-2024 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,6 +163,9 @@ 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;
uint8_t frame_length;
if (frame.type == FR_TYPE_FRAME)
{
fr[1] = frame.err_flags;
uint64_t frh =
((uint64_t)frame.fr_flags << 35) |
Expand All @@ -173,7 +176,14 @@ namespace pcapng_exporter {
((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);
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
Loading