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

Only show CRC32 when EOT is set. #10

Merged
merged 1 commit into from
Jun 11, 2023
Merged
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
12 changes: 9 additions & 3 deletions cyphal_udp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,28 @@ local function dissect_cyphal_udp(buffer, pinfo, tree)
header_tree:add_le(service_not_message, snm)
header_tree:add_le(data_specifier, buffer(6, 2))
header_tree:add_le(transfer_id, buffer(8, 8))
-- process the number as BE
header_tree:add_le(frame_index_eot, buffer(16, 4))
local fi = buffer(16, 4):le_uint()
local fidx = bit.band(fi, 0x7FFFFFFF)
local eot = bit.rshift(bit.band(fi, 0x80000000), 31)
header_tree:add_le(frame_index, fidx)
header_tree:add_le(end_of_transfer, eot)
header_tree:add_le(user_data, buffer(20, 2))
-- process the number as BE
header_tree:add(crc16_ccitt_false, buffer(22, 2))
local len = buffer:len()
local rem = len - CYPHAL_UDP_HEADER_SIZE - 4 -- the remaining bytes minus CRC32C
local crc_size = 0
if eot == 1 then
crc_size = 4
end
local rem = len - CYPHAL_UDP_HEADER_SIZE - crc_size -- the remaining bytes minus CRC32C (if EOT)
if rem > 0 then
payload_tree:add_le(serialized_payload_size, rem)
payload_tree:add_le(serialized_payload, buffer(24, rem))
end
footer_tree:add_le(crc32, buffer(len-4, 4))
if eot == 1 then
footer_tree:add_le(crc32, buffer(len-crc_size, 4))
end
-- Add more field dissectors as needed
end

Expand Down