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