Add Lua codegen to deserialize
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 24/100
Research direction
Start by reading the code-generation entry points and templates in this repository, then trace how an existing language backend generates deserialization code and fields. The issue gives Wireshark Lua examples and proposed function interfaces, but no target files or tests; done means generated Lua modules can deserialize DSDL messages for the linked Wireshark plugins and expose the expected ProtoFields and dispatch functions.
Written by the indexing model from the issue text.
Description
Generate Lua functions to deserialize (serialization is not needed yet) for the Wireshark plugins in https://github.com/OpenCyphal-Garage/wireshark_plugins.
These would need to be "importable" modules which would take in the buffer, pfino, tree so that they could directly modify the Wireshark tree view.
The generated code would need to:
1.) emit a list of those expected ProtoFields which would have to somehow be added into their own Proto or incorporated into the Cyphal/CAN or Cyphal/UDP Protos. (TDB)
2.) emit a 'dissector' function which takes the buffer, pinfo, tree and populates the Wireshark tree using those fields
3.) emit function which has a very long switch/if/else condition per message type would also have to be created and then called from both Cyphal/CAN and Cyphal/UDP Protocol Dissectors.
Here's similar code which breaks down the Heartbeat:
payload_tree:add_le(cyphal_heartbeat_uptime, payload(0, 4))
payload_tree:add(cyphal_heartbeat_health, payload(4, 1))
payload_tree:add(cyphal_heartbeat_mode, payload(5, 1))
payload_tree:add(cyphal_heartbeat_vssc, payload(6, 1))
And the GetInfo
local offset = 0
payload_tree:add(cyphal_getinfo_protocol_version_major, payload(offset, 1))
offset = offset + 1
payload_tree:add(cyphal_getinfo_protocol_version_minor, payload(offset, 1))
offset = offset + 1
payload_tree:add(cyphal_getinfo_hardware_version_major, payload(offset, 1))
offset = offset + 1
payload_tree:add(cyphal_getinfo_hardware_version_minor, payload(offset, 1))
offset = offset + 1
payload_tree:add(cyphal_getinfo_software_version_major, payload(offset, 1))
offset = offset + 1
payload_tree:add(cyphal_getinfo_software_version_minor, payload(offset, 1))
offset = offset + 1
payload_tree:add(cyphal_getinfo_software_vcs_revision_id, payload(offset, 8))
offset = offset + 8
payload_tree:add(cyphal_getinfo_unique_id, payload(offset, 16))
offset = offset + 16
local len = payload(offset, 1):uint()
offset = offset + 1
payload_tree:add(cyphal_getinfo_name, payload(offset, len))
offset = offset + len
len = payload(offset, 1):uint()
offset = offset + 1
if len > 0 then
payload_tree:add(cyphal_getinfo_software_image_crc, payload(offset, len))
end
offset = offset + len
len = payload(offset, 1):uint()
offset = offset + 1
if len > 0 then
payload_tree:add(cyphal_getinfo_certificate_of_authority, payload(offset, len))
end
In both of these cases the payload is a Tvb object which can be subscripted to form ranges, integers, floats, etc. The payload_tree is the Wireshark 'tree' object which will hold the decoded values and the various cyphal_getinfo_* are the various ProtoField declarations which inform Wireshark what fields could be expected.
The calling function:
function decode_message(payload, pinfo, payload_tree. subject_id)
if subject_id == 7509 then -- Heartbeat
decode_cyphal_heartbeat(payload, pinfo, payload_tree)
... etc
end
end
function decode_service(payload, pinfo, payload_tree, service_id, request_not_response)
if service_id == 430 then
if request_not_response then
decode_request_getinfo(payload, pinfo, payload_tree)
else
decode_response_getinfo(payload, pinfo, payload_tree)
end
end
end
These are just ideas and are not hard requirements.
- Dominant language
- Python
- Stars
- 48
- Forks
- 26
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenCyphal/nunavut
-
build and test dependencies
Difficulty 4/5 3-5 days Newbie friendliness 55/100
OpenCyphal/nunavut#419 ·
Maintainers usually reply within 1 day
-
build and test C++ dependencies
Difficulty 4/5 3-5 days Newbie friendliness 50/100
OpenCyphal/nunavut#418 ·
Maintainers usually reply within 1 day
-
build and test Python
Difficulty 4/5 3-5 days Newbie friendliness 45/100
OpenCyphal/nunavut#416 ·
Maintainers usually reply within 1 day
-
C C++ Python
Difficulty 4/5 3-5 days Newbie friendliness 52/100
OpenCyphal/nunavut#414 · 1 comment ·
Maintainers usually reply within 1 day
-
feature under consideration
Difficulty 5/5 Over a week Newbie friendliness 32/100
OpenCyphal/nunavut#413 ·
Maintainers usually reply within 1 day
All issues in OpenCyphal/nunavut
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
py-econometrics/pyfixest#2072 ·
Maintainers usually reply within 1 day
-
~planning docs
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Kromatic-Innovation/athenaeum#3084 ·
Maintainers usually reply within 1 day
-
Bosch Room Thermostat II number entities offer -500 to 3000 °C setpoint limits and a -32768 to 32767 °C outdoor temperaturePossibly taken @zigpy-review-bot claimed this today. Openbot: code audit
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zigpy/zha-device-handlers#5769 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Half a day Newbie friendliness 80/100
R0Y00/Xbox2Windows#254 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kludex/python-multipart#375 ·
Maintainers usually reply within 1 day