Skip to content

Adds TCP broker supporting zero-delimited frames #360

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

Merged
merged 9 commits into from
Jul 2, 2025

Conversation

hannesweisbach
Copy link
Contributor

@hannesweisbach hannesweisbach commented Jun 26, 2025

This commits adds an implementation of a TCP-broker that observes the zero-byte frame delimiter of COBS-encoded Cyphal/Serial frames.

This commit addresses #300


I randomly stumbled upon #300 by accident. We at Neosat have a simple broker that does observe zero-delimited framing.
I cleaned it up a bit, added comments, etc.

I'm open to comments/change requests.

Open questions:

I'm not exactly sure where to put the file in the source tree.
How much/what tests would you require?

Edit: I forgot to bump the version number 😬 Would that be a minor or patch bump?

@coveralls
Copy link

coveralls commented Jun 27, 2025

Coverage Status

coverage: 93.948% (-0.4%) from 94.351%
when pulling f5fcaac on hannesweisbach:broker
into 5601d94 on OpenCyphal:master.

@hannesweisbach hannesweisbach force-pushed the broker branch 4 times, most recently from 473069f to b2969e2 Compare June 30, 2025 12:53
@hannesweisbach
Copy link
Contributor Author

Changes:

  • use cyphal-broker instead of ncat during CI
  • List cyphal-broker as alternative to ncat --broker in the documentation
  • Remove ncat from .test_deps/README.md

Copy link
Member

@pavel-kirienko pavel-kirienko left a comment

Choose a reason for hiding this comment

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

Very well done, I just left a couple of minor comments. Ideally we should probably distribute it as a separate Python package since it doesn't use anything from PyCyphal, but I don't have the bandwidth to arrange it now, and I'm not sure if you do, so we can just leave it as-is for now.

Please also bump the patch version.

Thanks!

Comment on lines 7 to 8
This broker is similar in functionality to :code:`ncat --broker`, but observes
reads the whole frame before passing it on to other clients.
Copy link
Member

Choose a reason for hiding this comment

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

typo?

Suggested change
This broker is similar in functionality to :code:`ncat --broker`, but observes
reads the whole frame before passing it on to other clients.
This broker is similar in functionality to :code:`ncat --broker`, but
reads the whole frame before passing it on to other clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoopsie. Yes, thank you.
Done: Rephrased.

setup.cfg Outdated
@@ -36,6 +36,10 @@ classifiers =
Operating System :: OS Independent
Typing :: Typed

[options.entry_points]
console_scripts =
cyphal-broker = pycyphal.util._broker:main
Copy link
Member

Choose a reason for hiding this comment

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

Can we please call it cyphal-serial-broker? Just cyphal-broker is misleading because it means a completely different thing.

That, or we could just call it bro. It's Latvian for "one who beheads the messiah".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we please call it cyphal-serial-broker?

Done.

Just cyphal-broker is misleading because it means a completely different thing.

Good to know that this exists. I'll have to give it a spin sometime.

That, or we could just call it bro. It's Latvian for "one who beheads the messiah".

ngl: you had me in the first half 😄 (I didn't watch the show)

Copy link
Member

Choose a reason for hiding this comment

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

Good to know that this exists. I'll have to give it a spin sometime.

This was an experiment, not something made for use in production, so keep that in mind.

@pavel-kirienko
Copy link
Member

Also, if you could share anything about your use of Cyphal at Neosat, that would be very much welcome on the forum ;)

@hannesweisbach
Copy link
Contributor Author

hannesweisbach commented Jul 2, 2025

Ideally we should probably distribute it as a separate Python package since it doesn't use anything from PyCyphal, but I don't have the bandwidth to arrange it now, and I'm not sure if you do, so we can just leave it as-is for now.

Would you want to keep it under the umbrella of OpenCyphal?
I wouldn't mind factoring it out later.

Please also bump the patch version.

Done + rebased against current master.

Also, if you could share anything about your use of Cyphal at Neosat, that would be very much welcome on the forum ;)

I'll ask what I can share.

@pavel-kirienko
Copy link
Member

Would you want to keep it under the umbrella of OpenCyphal?
I wouldn't mind factoring it out later.

Either way is fine with me. We can host it under OpenCyphal unless you prefer to maintain it separately.

@pavel-kirienko pavel-kirienko merged commit a83830a into OpenCyphal:master Jul 2, 2025
7 checks passed
@hannesweisbach
Copy link
Contributor Author

Thanks for merging it so quick!

I'd actually prefer the OpenCyphal umbrella; I wrote it specifically to broker Cyphal frames, so this is where it belongs :)

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.

3 participants