diff options
author | Bruce A. Mah <bmah@es.net> | 2020-05-19 07:37:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 07:37:18 -0700 |
commit | de848cffad224bc604a5bcbeef158acb1602e1f1 (patch) | |
tree | 0affb05bec7f60e091550d2ce54e546b157fe16d | |
parent | 2609dd71235e980524dcafa58b8b4038edc2601f (diff) | |
download | iperf3-de848cffad224bc604a5bcbeef158acb1602e1f1.tar.gz |
feat(api): Provide API access to --commit-timeout. (#1001)
Fixes #1000. Part of #595.
-rw-r--r-- | src/iperf_api.c | 13 | ||||
-rw-r--r-- | src/iperf_api.h | 5 | ||||
-rw-r--r-- | src/t_api.c | 14 |
3 files changed, 30 insertions, 2 deletions
diff --git a/src/iperf_api.c b/src/iperf_api.c index 0198a85..a5dd6ae 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -344,6 +344,12 @@ iperf_get_test_no_delay(struct iperf_test *ipt) return ipt->no_delay; } +int +iperf_get_test_connect_timeout(struct iperf_test *ipt) +{ + return ipt->settings->connect_timeout; +} + /************** Setter routines for some fields inside iperf_test *************/ void @@ -627,6 +633,13 @@ iperf_set_test_no_delay(struct iperf_test* ipt, int no_delay) ipt->no_delay = no_delay; } +void +iperf_set_test_connect_timeout(struct iperf_test* ipt, int ct) +{ + ipt->settings->connect_timeout = ct; +} + + /********************** Get/set test protocol structure ***********************/ struct protocol * diff --git a/src/iperf_api.h b/src/iperf_api.h index a077f28..3770b37 100644 --- a/src/iperf_api.h +++ b/src/iperf_api.h @@ -1,5 +1,5 @@ /* - * iperf, Copyright (c) 2014-2019, The Regents of the University of + * iperf, Copyright (c) 2014-2020, The Regents of the University of * California, through Lawrence Berkeley National Laboratory (subject * to receipt of any required approvals from the U.S. Dept. of * Energy). All rights reserved. @@ -128,6 +128,7 @@ int iperf_get_test_tos( struct iperf_test* ipt ); char* iperf_get_extra_data( struct iperf_test* ipt ); char* iperf_get_iperf_version(void); int iperf_get_test_no_delay( struct iperf_test* ipt ); +int iperf_get_test_connect_timeout( struct iperf_test* ipt ); /* Setter routines for some fields inside iperf_test. */ void iperf_set_verbose( struct iperf_test* ipt, int verbose ); @@ -172,6 +173,8 @@ void iperf_set_test_server_authorized_users(struct iperf_test *ipt, char *ser void iperf_set_test_server_rsa_privkey(struct iperf_test *ipt, char *server_rsa_privkey_base64); #endif // HAVE_SSL +void iperf_set_test_connect_timeout(struct iperf_test *ipt, int ct); + /** * exchange_parameters - handles the param_Exchange part for client * diff --git a/src/t_api.c b/src/t_api.c index 0669917..f5e0984 100644 --- a/src/t_api.c +++ b/src/t_api.c @@ -1,5 +1,5 @@ /* - * iperf, Copyright (c) 2017, The Regents of the University of + * iperf, Copyright (c) 2017-2020, The Regents of the University of * California, through Lawrence Berkeley National Laboratory (subject * to receipt of any required approvals from the U.S. Dept. of * Energy). All rights reserved. @@ -45,9 +45,21 @@ int main(int argc, char **argv) { const char *ver; + struct iperf_test *test; + int sint, gint; ver = iperf_get_iperf_version(); assert(strcmp(ver, IPERF_VERSION) == 0); + test = iperf_new_test(); + assert(test != NULL); + + iperf_defaults(test); + + sint = 10; + iperf_set_test_connect_timeout(test, sint); + gint = iperf_get_test_connect_timeout(test); + assert(sint == gint); + return 0; } |