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

Add --frame-only option for message output, refactoring into a Transcoder class, LengthDelimitedOutputManager #137

Merged
merged 61 commits into from
Apr 21, 2023

Conversation

salsferrazza
Copy link
Collaborator

@salsferrazza salsferrazza commented Apr 13, 2023

#93 requested a way to unframe messages from a Source and output the extracted payload without transcoding. This is useful in some cases, such as converting the payloads in a PCAP file into a length-prefixed binary file.

Making this change led to a refactoring of previously existing leaky abstractions. Notably, the MessageParser class has been refactored into a Transcoder class that is now the entry point. The CLI interaction remains the same, for library usage the entry point becomes Transcoder.transcode() vs. MessageParser.process().

This also adds a new LengthDelimitedOutputManager that sends a length-prefixed stream of unframed messages to standard output (--output_type length_delimited). An initial test of --frame-only manufacturing a new file yielded bit-identical files when redirected to a new file. Under --output_type diag, --frame-only writes base64'd payloads encapsulated in YAML to the console.

message_length_byte_length has been renamed to prefix_length which is less of a mouthful.

Markdown updates to follow.

@salsferrazza salsferrazza requested a review from mservidio April 19, 2023 21:44
@salsferrazza
Copy link
Collaborator Author

@mservidio this is the last planned batch for this change, can you do a check of pypl and final approve?

@mservidio mservidio merged commit 3c9f090 into main Apr 21, 2023
@mservidio mservidio deleted the frame_only branch April 21, 2023 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a --frame-only option that suppresses transcoding and simply re-transports message bytes
3 participants