1LIBIPERF(3)                      User Manuals                      LIBIPERF(3)
2
3
4

NAME

6       libiperf - API for iperf3 network throughput tester
7
8

SYNOPSIS

10       #include <iperf_api.h>
11       -liperf
12
13

DESCRIPTION

15       Libiperf  gives  you access to all the functionality of the iperf3 net‐
16       work testing tool.  You can build it directly into  your  own  program,
17       instead of having to run it as a shell command.
18
19

CALLS

21       Initialization / termination:
22           struct iperf_test *iperf_new_test();
23           int iperf_defaults(struct iperf_test *t);
24           void iperf_free_test(struct iperf_test *t);
25       Setting test parameters:
26           void iperf_set_test_role( struct iperf_test *pt, char role );
27           void iperf_set_test_bind_address( struct iperf_test *t, char *bind_address );
28           void iperf_set_test_bind_dev( struct iperf_test *t, char *bind_dev );
29           void iperf_set_test_server_hostname( struct iperf_test *t, char *server_host );
30           void iperf_set_test_server_port( struct iperf_test *t, int server_port );
31           void iperf_set_test_duration( struct iperf_test *t, int duration );
32           void iperf_set_test_blksize( struct iperf_test *t, int blksize );
33           void iperf_set_test_num_streams( struct iperf_test *t, int num_streams );
34           void iperf_set_test_json_output( struct iperf_test *t, int json_output );
35           int iperf_has_zerocopy( void );
36           void iperf_set_test_zerocopy( struct iperf_test* t, int zerocopy );
37           void iperf_set_test_tos( struct iperf_test* t, int tos );
38       Authentication functions:
39           void iperf_set_test_client_username(struct iperf_test *ipt, char *client_username)
40           void iperf_set_test_client_password(struct iperf_test *ipt, char *client_password)
41           void iperf_set_test_client_rsa_pubkey(struct iperf_test *ipt, char *client_rsa_pubkey_base64)
42       Running a test:
43           int iperf_run_client(struct iperf_test *);
44           int iperf_run_server(struct iperf_test *);
45           void iperf_reset_test(struct iperf_test *);
46       Output:
47           FILE *iperf_get_test_outfile(struct iperf_test *);
48           char* iperf_get_test_json_output_string(struct iperf_test *);
49       Error reporting:
50           void iperf_err(struct iperf_test *t, const char *format, ...);
51           char *iperf_strerror(int);
52           extern int i_errno;
53       This  is  not  a complete list of the available calls.  See the include
54       file for more.
55
56

EXAMPLES

58       Here's some sample code that runs an iperf client:
59           struct iperf_test *test;
60           test = iperf_new_test();
61           if ( test == NULL ) {
62               fprintf( stderr, "%s: failed to create test0, argv0 );
63               exit( EXIT_FAILURE );
64           }
65           iperf_defaults( test );
66           iperf_set_test_role( test, 'c' );
67           iperf_set_test_server_hostname( test, host );
68           iperf_set_test_server_port( test, port );
69           if ( iperf_run_client( test ) < 0 ) {
70               fprintf( stderr, "%s: error - %s0, argv0, iperf_strerror( i_errno ) );
71               exit( EXIT_FAILURE );
72           }
73           iperf_free_test( test );
74       And here's a server:
75           struct iperf_test *test;
76           test = iperf_new_test();
77           if ( test == NULL ) {
78               fprintf( stderr, "%s: failed to create test0, argv0 );
79               exit( EXIT_FAILURE );
80           }
81           iperf_defaults( test );
82           iperf_set_test_role( test, 's' );
83           iperf_set_test_server_port( test, port );
84           for (;;) {
85               if ( iperf_run_server( test ) < 0 )
86                   fprintf( stderr, "%s: error - %s0, argv0, iperf_strerror( i_errn
87       o ) );
88               iperf_reset_test( test );
89           }
90           iperf_free_test( test );
91       These are not complete programs,  just  excerpts.   The  full  runnable
92       source  code  can  be  found in the examples subdirectory of the iperf3
93       source tree.
94
95

AUTHORS

97       A list of the contributors to iperf3 can be found within the documenta‐
98       tion located at https://software.es.net/iperf/dev.html#authors.
99
100

SEE ALSO

102       iperf3(1), https://software.es.net/iperf/
103
104
105
106ESnet                            January 2022                      LIBIPERF(3)
Impressum