Repository navigation
Conversation
d399543 to
61cbda8
Compare
61cbda8 to
e5634dd
Compare
polybassa
left a comment
There was a problem hiding this comment.
Focus on simplicity and Scapy-likeness: the protocol fields themselves are mostly fine, but ACF framing, UDP encapsulation, and duplicated post_build/extract_padding should live in the packet hierarchy once.
Main priorities from this review: ACF boundary handling → I2C length fix → UDP wrapper layer → public version classes → collapse duplicated ACF plumbing.
This review was written with the help of AI (ChatGPT).
|
Thanks for your PR |
e5634dd to
61cbda8
Compare
- Removed unused class AvtpHeaderVersion - Added AvtpUdpEncapsulation as an independent layer - Use of AvtpStreamType instead of flattening the enum - Removed usage of "_underlayer" to check for UDP - Made private hidden classes now public and used match_subclass - Reduced bolier plate code for ACF data formats - Added additional unit tests for regression Signed-off-by: Naresh Nayak <Naresh.Nayak@hs-furtwangen.de>
- Removed unused class AvtpHeaderVersion - Added AvtpUdpEncapsulation as an independent layer - Use of AvtpStreamType instead of flattening the enum - Removed usage of "_underlayer" to check for UDP - Made private hidden classes now public and used match_subclass - Reduced bolier plate code for ACF data formats - Added additional unit tests for regression Signed-off-by: Naresh Nayak <Naresh.Nayak@hs-furtwangen.de>
e4d1955 to
b40d02e
Compare
- Removed unused class AvtpHeaderVersion - Added AvtpUdpEncapsulation as an independent layer - Use of AvtpStreamType instead of flattening the enum - Removed usage of "_underlayer" to check for UDP - Made private hidden classes now public and used match_subclass - Reduced bolier plate code for ACF data formats - Added additional unit tests for regression - AI-Assisted: no
b40d02e to
9f7e707
Compare
Thanks for the exhaustive review. Got to know more about Scapy with this PR.
Let me know if you have further findings or want me to rearrange the commit history. |
polybassa
left a comment
There was a problem hiding this comment.
Follow-up on the latest tip (9f7e707): the structural cleanup looks good. Two concrete P1 regressions remain.
This review was written with the help of AI (ChatGPT).
- Fixed appending of payload to packet in AvtpCommonControlHeader. - Fixed padding arithmetic of AvtpAcfHeader - Renamed AvtpAcfI2CHeader to AvtpAcfI2CMessage - Renamed AvtpAcfI2CBriefHeader to AvtpAcfI2CBriefMessage - AI-Assisted: no
| name="mode", | ||
| default=AncMode.ANC_8BIT, | ||
| size=2, | ||
| enum={i.name: i.value for i in AncMode}, |
There was a problem hiding this comment.
P3: Pass Enum classes directly.
Where code still contains:
enum={i.name: i.value for i in AncMode}prefer:
enum=AncModeScapy enum fields already support Python Enum classes. This is already done correctly in several other places in the PR, so the remaining instances should be made consistent.
|
Thanks for the PR, just a few more comments |
- Added a serializable variant of AvtpCommonHeader as a fallback for unknown variants - Modified dispatch_hooks to avoid silent falling back to version 0 - Added missing fields to AvtpCommonStreamHeaderV0 - Incomplete header classes (other than AvtpCommonHeader) are now private classes - Improved unit test cases to check for unknown versions and UDP round trips - AI-Assisted: no
|
@polybassa I have often discussed with my colleagues the best way to model the class/packets for this protocol. I hope exposing only serializable classes and making non-serializable classes (with the exception of |
polybassa
left a comment
There was a problem hiding this comment.
Thanks for your work. I think we are almost there.
| def dispatch_hook(cls, pkt=None, **kargs): | ||
| if "version" in kargs: | ||
| version = kargs["version"] | ||
| elif pkt: |
There was a problem hiding this comment.
Added length checks as suggested.
|
Please fix the AI-Assisted trailer check. |
- Removed unused class AvtpHeaderVersion - Added AvtpUdpEncapsulation as an independent layer - Use of AvtpStreamType instead of flattening the enum - Removed usage of "_underlayer" to check for UDP - Made private hidden classes now public and used match_subclass - Reduced bolier plate code for ACF data formats - Added additional unit tests for regression - AI-Assisted: no
- Fixed appending of payload to packet in AvtpCommonControlHeader. - Fixed padding arithmetic of AvtpAcfHeader - Renamed AvtpAcfI2CHeader to AvtpAcfI2CMessage - Renamed AvtpAcfI2CBriefHeader to AvtpAcfI2CBriefMessage - AI-Assisted: no
- Added a serializable variant of AvtpCommonHeader as a fallback for unknown variants - Modified dispatch_hooks to avoid silent falling back to version 0 - Added missing fields to AvtpCommonStreamHeaderV0 - Incomplete header classes (other than AvtpCommonHeader) are now private classes - Improved unit test cases to check for unknown versions and UDP round trips - AI-Assisted: no
8c44b0a to
f3a8613
Compare
- Implemented the Chapter 9 of the IEEE 1722-2025 spec. - Added unit test cases - AI-Assisted: Co-pilot for unit tests
- Removed unused class AvtpHeaderVersion - Added AvtpUdpEncapsulation as an independent layer - Use of AvtpStreamType instead of flattening the enum - Removed usage of "_underlayer" to check for UDP - Made private hidden classes now public and used match_subclass - Reduced bolier plate code for ACF data formats - Added additional unit tests for regression - AI-Assisted: no
- Fixed appending of payload to packet in AvtpCommonControlHeader. - Fixed padding arithmetic of AvtpAcfHeader - Renamed AvtpAcfI2CHeader to AvtpAcfI2CMessage - Renamed AvtpAcfI2CBriefHeader to AvtpAcfI2CBriefMessage - AI-Assisted: no
- Replaced convenience import scapy.all with individual items import. - Consolidated padding functions in the AvtpAcfHeader and _AvtpAcfPaddedHeader. - AI-Assisted: no
- Added a serializable variant of AvtpCommonHeader as a fallback for unknown variants - Modified dispatch_hooks to avoid silent falling back to version 0 - Added missing fields to AvtpCommonStreamHeaderV0 - Incomplete header classes (other than AvtpCommonHeader) are now private classes - Improved unit test cases to check for unknown versions and UDP round trips - AI-Assisted: no
- Added packet length checks before packet acceses - Introduced enums for CRC types - Improved unit tests - AI-Assisted: no
- AI-Assisted: no
f3a8613 to
9a08caf
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5185 +/- ##
==========================================
+ Coverage 47.28% 47.38% +0.10%
==========================================
Files 375 376 +1
Lines 97732 98042 +310
==========================================
+ Hits 46209 46459 +250
- Misses 51523 51583 +60
🚀 New features to boost your workflow:
|
AI Assisted: no for the implementation/copilot for unit tests.
Checklist :
AI-Assistedtag as explained in the contributing guide. Please squash commits that belong together, and split commits that contain multiple features. ✅Description
IEEE 1722 specifies the Audio/Video Transport Protocol (AVTP) along with several serialization formats for data which can be transported over Ethernet (e.g., various audio formats, video formats etc.). The 2016 version of the specification extended the spec to also include so-called control formats including automotive fieldbus frames, e.g., CAN, LIN, FlexRay etc. Now the recent 2025 version also includes serialization formats for I2C, SPI etc.
In this PR, we focus on the AVTP control formats (the ones described in the Chapter 6 of the IEEE 1722 spec.). This is not an exhaustive implementation of IEEE 1722 as we do not focus on the audio/video formats. The reason for contributing this to the upstream project is that we see currently traction for using IEEE 1722. We (myself and a few like-minded colleagues) are working on integrating this protocol into open source projects and encourage adoption. We are also working on: