Skip to content

Commit

Permalink
Allow set iperf callback(on_new_stream/on_test_start/on_connect/on_te…
Browse files Browse the repository at this point in the history
…st_finish) (#1508)
  • Loading branch information
dongfengweixiao authored Aug 3, 2023
1 parent 2ca047b commit 33a6a10
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,30 @@ iperf_set_mapped_v4(struct iperf_test *ipt, const int val)
ipt->mapped_v4 = val;
}

void
iperf_set_on_new_stream_callback(struct iperf_test* ipt, void (*callback)())
{
ipt->on_new_stream = callback;
}

void
iperf_set_on_test_start_callback(struct iperf_test* ipt, void (*callback)())
{
ipt->on_test_start = callback;
}

void
iperf_set_on_test_connect_callback(struct iperf_test* ipt, void (*callback)())
{
ipt->on_connect = callback;
}

void
iperf_set_on_test_finish_callback(struct iperf_test* ipt, void (*callback)())
{
ipt->on_test_finish = callback;
}

static void
check_sender_has_retransmits(struct iperf_test *ipt)
{
Expand Down
4 changes: 4 additions & 0 deletions src/iperf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ void iperf_set_dont_fragment( struct iperf_test* ipt, int dont_fragment );
void iperf_set_test_congestion_control(struct iperf_test* ipt, char* cc);
void iperf_set_test_mss(struct iperf_test* ipt, int mss);
void iperf_set_mapped_v4(struct iperf_test* ipt, const int val);
void iperf_set_on_new_stream_callback(struct iperf_test* ipt, void (*callback)());
void iperf_set_on_test_start_callback(struct iperf_test* ipt, void (*callback)());
void iperf_set_on_test_connect_callback(struct iperf_test* ipt, void (*callback)());
void iperf_set_on_test_finish_callback(struct iperf_test* ipt, void (*callback)());

#if defined(HAVE_SSL)
void iperf_set_test_client_username(struct iperf_test *ipt, const char *client_username);
Expand Down

0 comments on commit 33a6a10

Please sign in to comment.