Annotation of embedaddon/iperf/src/libiperf.3, revision 1.1.1.2
1.1.1.2 ! misho 1: .TH LIBIPERF 3 "June 2018" 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 );
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 );
1.1.1.2 ! misho 36: void iperf_set_test_tos( struct iperf_test* t, int tos );
! 37: .fi
! 38: Authentication functions:
! 39: .nf
! 40: void iperf_set_test_client_username(struct iperf_test *ipt, char *client_username)
! 41: void iperf_set_test_client_password(struct iperf_test *ipt, char *client_password)
! 42: void iperf_set_test_client_rsa_pubkey(struct iperf_test *ipt, char *client_rsa_pubkey_base64)
1.1 misho 43: .fi
44: Running a test:
45: .nf
46: int iperf_run_client(struct iperf_test *);
47: int iperf_run_server(struct iperf_test *);
1.1.1.2 ! misho 48: void iperf_reset_test(struct iperf_test *);
1.1 misho 49: .fi
50: Output:
51: .nf
52: FILE *iperf_get_test_outfile(struct iperf_test *);
53: char* iperf_get_test_json_output_string(struct iperf_test *);
54: .fi
55: Error reporting:
56: .nf
57: void iperf_err(struct iperf_test *t, const char *format, ...);
58: char *iperf_strerror(int);
59: extern int i_errno;
60: .fi
61: This is not a complete list of the available calls.
62: See the include file for more.
63:
64: .SH EXAMPLES
65: Here's some sample code that runs an iperf client:
66: .nf
67: struct iperf_test *test;
68: test = iperf_new_test();
69: if ( test == NULL ) {
70: fprintf( stderr, "%s: failed to create test\n", argv0 );
71: exit( EXIT_FAILURE );
72: }
73: iperf_defaults( test );
74: iperf_set_test_role( test, 'c' );
75: iperf_set_test_server_hostname( test, host );
76: iperf_set_test_server_port( test, port );
77: if ( iperf_run_client( test ) < 0 ) {
78: fprintf( stderr, "%s: error - %s\n", argv0, iperf_strerror( i_errno ) );
79: exit( EXIT_FAILURE );
80: }
81: iperf_free_test( test );
82: .fi
83: And here's a server:
84: .nf
85: struct iperf_test *test;
86: test = iperf_new_test();
87: if ( test == NULL ) {
88: fprintf( stderr, "%s: failed to create test\n", argv0 );
89: exit( EXIT_FAILURE );
90: }
91: iperf_defaults( test );
92: iperf_set_test_role( test, 's' );
93: iperf_set_test_server_port( test, port );
94: for (;;) {
95: if ( iperf_run_server( test ) < 0 )
96: fprintf( stderr, "%s: error - %s\n\n", argv0, iperf_strerror( i_errn
97: o ) );
98: iperf_reset_test( test );
99: }
100: iperf_free_test( test );
101: .fi
102: These are not complete programs, just excerpts.
103: The full runnable source code can be found in the examples subdirectory
104: of the iperf3 source tree.
105:
106: .SH AUTHORS
107: A list of the contributors to iperf3 can be found within the
108: documentation located at
1.1.1.2 ! misho 109: \fChttps://software.es.net/iperf/dev.html#authors\fR.
1.1 misho 110:
111: .SH "SEE ALSO"
112: iperf3(1),
1.1.1.2 ! misho 113: https://software.es.net/iperf/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>