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

Feature/add-ptp-protocol #4640

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

satveerbrar
Copy link
Contributor

@satveerbrar satveerbrar commented Jan 12, 2025

@polybassa @gpotter2
Here is the draft PR to add PTP protocol.

Currently this includes basic PTP header and Sync message type.

Planned additions in future commits:

  1. post_build function to calculate and insert message length field.
  2. Classes for the remaining PTP message types.
  3. Unit tests

Let me know if I have followed the correct approach.

fixes #4637

- Implement PTP header structure based on IEEE 1588-2008
- Implement Sync message type class
@satveerbrar satveerbrar marked this pull request as draft January 12, 2025 08:12
Copy link
Member

@gpotter2 gpotter2 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
A few comments. It's a good start !

ByteField("logMessageInterval", 0)
]

def guess_payload_class(self, payload): # type: (bytes) -> Type[Packet]
Copy link
Member

Choose a reason for hiding this comment

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

We typically reserve guess_payloaf for complex cases. Here a simpler approach with bind_layers is enough, and it also handles building.

"""


class FollowUp(Packet):
Copy link
Member

Choose a reason for hiding this comment

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

If the packets really are empty, you don't need to include them. Having an enum in the parent that shows this type is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's not empty., I have to implement fields in those packets.

scapy/layers/ptp_v2.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request for Support for Precision Time Protocol (PTPv2)
2 participants