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 callback function to get JSON Output strings #1798

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidBar-On
Copy link
Contributor

  • Version of iperf3 (or development branch, such as master or
    3.1-STABLE) to which this pull request applies:
    master

  • Issues fixed (if any): How to use the iperf library to obtain bandwidth information in real-time at intervals? #1711

  • Brief description of code changes (suitable for use as a commit message):
    Add iperf_set_test_json_callback() that allows a user app to set a callback function to get the JSON output strings, instead of printing them to the output file.

@swlars
Copy link
Contributor

swlars commented Jan 6, 2025

Thanks for the pull request! This looks useful!

@bmah888 bmah888 self-assigned this Feb 7, 2025
Copy link
Contributor

@bmah888 bmah888 left a comment

Choose a reason for hiding this comment

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

Everything seems to work correctly. I have one question about the intended callback function...all of the other callbacks take a test argument. For those callbacks (such as on_new_stream, on_test_start, etc.), the test pointer gives all the information needed by the callback. The json_callback is different, in that it looks like it only takes a string containing a JSON rendered object. Do you think that having the test structure as well might be needed to give some context for working with the JSON? So then callback would take both a (iperf_test *) and a (char *)?

EDIT: I didn't need this change for the testing I had, but I'm just wondering if having a pointer to the test structure might be useful, say to refer to test parameters, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants