Annotation of embedaddon/iperf/src/libiperf.3, revision 1.1.1.3
1.1.1.3 ! misho 1: .TH LIBIPERF 3 "January 2022" ESnet "User Manuals"
1.1 misho 2: .SH NAME
3: libiperf \- API for iperf3 network throughput tester
4:
5: .SH SYNOPSIS
6: #include <iperf_api.h>
7: .br
8: \-liperf
9:
10: .SH DESCRIPTION
11: .PP
12: Libiperf gives you access to all the functionality of the iperf3
13: network testing tool.
14: You can build it directly into your own program, instead of having
15: to run it as a shell command.
16:
17: .SH CALLS
18: Initialization / termination:
19: .nf
20: struct iperf_test *iperf_new_test();
21: int iperf_defaults(struct iperf_test *t);
22: void iperf_free_test(struct iperf_test *t);
23: .fi
24: Setting test parameters:
25: .nf
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 );
1.1.1.3 ! misho 28: void iperf_set_test_bind_dev( struct iperf_test *t, char *bind_dev );
1.1 misho 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 );
1.1.1.2 misho 37: void iperf_set_test_tos( struct iperf_test* t, int tos );
38: .fi
39: Authentication functions:
40: .nf
41: void iperf_set_test_client_username(struct iperf_test *ipt, char *client_username)
42: void iperf_set_test_client_password(struct iperf_test *ipt, char *client_password)
43: void iperf_set_test_client_rsa_pubkey(struct iperf_test *ipt, char *client_rsa_pubkey_base64)
1.1 misho 44: .fi
45: Running a test:
46: .nf
47: int iperf_run_client(struct iperf_test *);
48: int iperf_run_server(struct iperf_test *);
1.1.1.2 misho 49: void iperf_reset_test(struct iperf_test *);
1.1 misho 50: .fi
51: Output:
52: .nf
53: FILE *iperf_get_test_outfile(struct iperf_test *);
54: char* iperf_get_test_json_output_string(struct iperf_test *);
55: .fi
56: Error reporting:
57: .nf
58: void iperf_err(struct iperf_test *t, const char *format, ...);
59: char *iperf_strerror(int);
60: extern int i_errno;
61: .fi
62: This is not a complete list of the available calls.
63: See the include file for more.
64:
65: .SH EXAMPLES
66: Here's some sample code that runs an iperf client:
67: .nf
68: struct iperf_test *test;
69: test = iperf_new_test();
70: if ( test == NULL ) {
71: fprintf( stderr, "%s: failed to create test\n", argv0 );
72: exit( EXIT_FAILURE );
73: }
74: iperf_defaults( test );
75: iperf_set_test_role( test, 'c' );
76: iperf_set_test_server_hostname( test, host );
77: iperf_set_test_server_port( test, port );
78: if ( iperf_run_client( test ) < 0 ) {
79: fprintf( stderr, "%s: error - %s\n", argv0, iperf_strerror( i_errno ) );
80: exit( EXIT_FAILURE );
81: }
82: iperf_free_test( test );
83: .fi
84: And here's a server:
85: .nf
86: struct iperf_test *test;
87: test = iperf_new_test();
88: if ( test == NULL ) {
89: fprintf( stderr, "%s: failed to create test\n", argv0 );
90: exit( EXIT_FAILURE );
91: }
92: iperf_defaults( test );
93: iperf_set_test_role( test, 's' );
94: iperf_set_test_server_port( test, port );
95: for (;;) {
96: if ( iperf_run_server( test ) < 0 )
97: fprintf( stderr, "%s: error - %s\n\n", argv0, iperf_strerror( i_errn
98: o ) );
99: iperf_reset_test( test );
100: }
101: iperf_free_test( test );
102: .fi
103: These are not complete programs, just excerpts.
104: The full runnable source code can be found in the examples subdirectory
105: of the iperf3 source tree.
106:
107: .SH AUTHORS
108: A list of the contributors to iperf3 can be found within the
109: documentation located at
1.1.1.2 misho 110: \fChttps://software.es.net/iperf/dev.html#authors\fR.
1.1 misho 111:
112: .SH "SEE ALSO"
113: iperf3(1),
1.1.1.2 misho 114: https://software.es.net/iperf/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>