From c98e8f9b5770d9f0214d4c32d71178e821292920 Mon Sep 17 00:00:00 2001
From: Hamid Anvari
Date: Thu, 4 Feb 2021 16:16:38 -0700
Subject: [PATCH] API interface for setting/getting congestion control (#1036)
(#1112)
Same restrictions/compatibility applies as
the CLI -C/--congestion options.
(Linux and FreeBSD only)
Fixes #1036
---
src/iperf_api.c | 12 ++++++++++++
src/iperf_api.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 87e1ae1aa..e6ff75ae5 100644
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -394,6 +394,12 @@ iperf_get_test_idle_timeout(struct iperf_test *ipt)
return ipt->settings->idle_timeout;
}
+char*
+iperf_get_test_congestion_control(struct iperf_test* ipt)
+{
+ return ipt->congestion;
+}
+
/************** Setter routines for some fields inside iperf_test *************/
void
@@ -731,6 +737,12 @@ iperf_set_test_idle_timeout(struct iperf_test* ipt, int to)
ipt->settings->idle_timeout = to;
}
+void
+iperf_set_test_congestion_control(struct iperf_test* ipt, char* cc)
+{
+ ipt->congestion = strdup(cc);
+}
+
/********************** Get/set test protocol structure ***********************/
diff --git a/src/iperf_api.h b/src/iperf_api.h
index 8d55c52ae..c35f6eecd 100644
--- a/src/iperf_api.h
+++ b/src/iperf_api.h
@@ -140,6 +140,7 @@ 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 );
+char* iperf_get_test_congestion_control(struct iperf_test* ipt);
/* Setter routines for some fields inside iperf_test. */
void iperf_set_verbose( struct iperf_test* ipt, int verbose );
@@ -177,6 +178,7 @@ void iperf_set_test_tos( struct iperf_test* ipt, int tos );
void iperf_set_test_extra_data( struct iperf_test* ipt, const char *dat );
void iperf_set_test_bidirectional( struct iperf_test* ipt, int bidirectional);
void iperf_set_test_no_delay( struct iperf_test* ipt, int no_delay);
+void iperf_set_test_congestion_control(struct iperf_test* ipt, char* cc);
#if defined(HAVE_SSL)
void iperf_set_test_client_username(struct iperf_test *ipt, const char *client_username);