aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@es.net>2014-07-24 09:30:45 -0700
committerBruce A. Mah <bmah@es.net>2014-07-24 09:30:45 -0700
commite0d039ea3c852b58b270c7aec518c0946adae8e1 (patch)
treebc08336ba2c288e44e5e140c3307a32410feacd1 /src
parentbef5ef87f58a4953a7165d3a5242f2a49cec32cf (diff)
downloadiperf3-e0d039ea3c852b58b270c7aec518c0946adae8e1.tar.gz
Add API methods to allow setting the bind_address test parameter.
This is the same functionality as the -B iperf3 command-line option. Fixes #197.
Diffstat (limited to 'src')
-rw-r--r--src/iperf_api.c12
-rw-r--r--src/iperf_api.h2
-rw-r--r--src/libiperf.31
3 files changed, 15 insertions, 0 deletions
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 767eef6..804ccdb 100644
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -229,6 +229,12 @@ iperf_get_test_unit_format(struct iperf_test *ipt)
return ipt->settings->unit_format;
}
+char *
+iperf_get_test_bind_address(struct iperf_test *ipt)
+{
+ return ipt->bind_address;
+}
+
/************** Setter routines for some fields inside iperf_test *************/
void
@@ -376,6 +382,12 @@ iperf_set_test_unit_format(struct iperf_test *ipt, char unit_format)
ipt->settings->unit_format = unit_format;
}
+void
+iperf_set_test_bind_address(struct iperf_test *ipt, char *bind_address)
+{
+ ipt->bind_address = strdup(bind_address);
+}
+
/********************** Get/set test protocol structure ***********************/
struct protocol *
diff --git a/src/iperf_api.h b/src/iperf_api.h
index c0c5089..37504f6 100644
--- a/src/iperf_api.h
+++ b/src/iperf_api.h
@@ -72,6 +72,7 @@ int iperf_get_test_json_output( struct iperf_test* ipt );
char* iperf_get_test_json_output_string ( struct iperf_test* ipt );
int iperf_get_test_zerocopy( struct iperf_test* ipt );
int iperf_get_test_get_server_output( struct iperf_test* ipt );
+char* iperf_get_test_bind_address ( struct iperf_test* ipt );
/* Setter routines for some fields inside iperf_test. */
void iperf_set_verbose( struct iperf_test* ipt, int verbose );
@@ -94,6 +95,7 @@ void iperf_set_test_json_output( struct iperf_test* ipt, int json_output );
int iperf_has_zerocopy( void );
void iperf_set_test_zerocopy( struct iperf_test* ipt, int zerocopy );
void iperf_set_test_get_server_output( struct iperf_test* ipt, int get_server_output );
+void iperf_set_test_bind_address( struct iperf_test* ipt, char *bind_address );
/**
* exchange_parameters - handles the param_Exchange part for client
diff --git a/src/libiperf.3 b/src/libiperf.3
index dc15a1e..7568e0a 100644
--- a/src/libiperf.3
+++ b/src/libiperf.3
@@ -24,6 +24,7 @@ Initialization / termination:
Setting test parameters:
.nf
void iperf_set_test_role( struct iperf_test *pt, char role );
+ void iperf_set_test_bind_address( struct iperf_test *t, char *bind_address );
void iperf_set_test_server_hostname( struct iperf_test *t, char *server_hos
void iperf_set_test_server_port( struct iperf_test *t, int server_port );
void iperf_set_test_duration( struct iperf_test *t, int duration );