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_server_hostname( struct iperf_test *t, char *server_host );
29           void iperf_set_test_server_port( struct iperf_test *t, int server_port );
30           void iperf_set_test_duration( struct iperf_test *t, int duration );
31           void iperf_set_test_blksize( struct iperf_test *t, int blksize );
32           void iperf_set_test_num_streams( struct iperf_test *t, int num_streams );
33           void iperf_set_test_json_output( struct iperf_test *t, int json_output );
34           int iperf_has_zerocopy( void );
35           void iperf_set_test_zerocopy( struct iperf_test* t, int zerocopy );
36           void iperf_set_test_tos( struct iperf_test* t, int tos );
37       Authentication functions:
38           void iperf_set_test_client_username(struct iperf_test *ipt, char *client_username)
39           void iperf_set_test_client_password(struct iperf_test *ipt, char *client_password)
40           void iperf_set_test_client_rsa_pubkey(struct iperf_test *ipt, char *client_rsa_pubkey_base64)
41       Running a test:
42           int iperf_run_client(struct iperf_test *);
43           int iperf_run_server(struct iperf_test *);
44           void iperf_reset_test(struct iperf_test *);
45       Output:
46           FILE *iperf_get_test_outfile(struct iperf_test *);
47           char* iperf_get_test_json_output_string(struct iperf_test *);
48       Error reporting:
49           void iperf_err(struct iperf_test *t, const char *format, ...);
50           char *iperf_strerror(int);
51           extern int i_errno;
52       This  is  not  a complete list of the available calls.  See the include
53       file for more.
54
55

EXAMPLES

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

AUTHORS

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

SEE ALSO

101       iperf3(1), https://software.es.net/iperf/
102
103
104
105ESnet                              June 2018                       LIBIPERF(3)
Impressum