Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Thursday, June 13, 2019
 
 

libiperf (3)

Name

libiperf - API for iperf3 network throughput tester

Synopsis

#include <iperf_api.h>
-liperf

Description

LIBIPERF(3)                      User Manuals                      LIBIPERF(3)



NAME
       libiperf - API for iperf3 network throughput tester


SYNOPSIS
       #include <iperf_api.h>
       -liperf


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


CALLS
       Initialization / termination:
           struct iperf_test *iperf_new_test();
           int iperf_defaults(struct iperf_test *t);
           void iperf_free_test(struct iperf_test *t);
       Setting test parameters:
           void iperf_set_test_role( struct iperf_test *pt, char role );
           void iperf_set_test_bind_address( struct iperf_test *t, char *bind_address );
           void iperf_set_test_server_hostname( struct iperf_test *t, char *server_host );
           void iperf_set_test_server_port( struct iperf_test *t, int server_port );
           void iperf_set_test_duration( struct iperf_test *t, int duration );
           void iperf_set_test_blksize( struct iperf_test *t, int blksize );
           void iperf_set_test_num_streams( struct iperf_test *t, int num_streams );
           void iperf_set_test_json_output( struct iperf_test *t, int json_output );
           int iperf_has_zerocopy( void );
           void iperf_set_test_zerocopy( struct iperf_test* t, int zerocopy );
       Running a test:
           int iperf_run_client(struct iperf_test *);
           int iperf_run_server(struct iperf_test *);
           void iperf_test_reset(struct iperf_test *);
       Output:
           FILE *iperf_get_test_outfile(struct iperf_test *);
           char* iperf_get_test_json_output_string(struct iperf_test *);
       Error reporting:
           void iperf_err(struct iperf_test *t, const char *format, ...);
           char *iperf_strerror(int);
           extern int i_errno;
       This  is  not  a complete list of the available calls.  See the include
       file for more.


EXAMPLES
       Here's some sample code that runs an iperf client:
           struct iperf_test *test;
           test = iperf_new_test();
           if ( test == NULL ) {
               fprintf( stderr, "%s: failed to create test0, argv0 );
               exit( EXIT_FAILURE );
           }
           iperf_defaults( test );
           iperf_set_test_role( test, 'c' );
           iperf_set_test_server_hostname( test, host );
           iperf_set_test_server_port( test, port );
           if ( iperf_run_client( test ) < 0 ) {
               fprintf( stderr, "%s: error - %s0, argv0, iperf_strerror( i_errno ) );
               exit( EXIT_FAILURE );
           }
           iperf_free_test( test );
       And here's a server:
           struct iperf_test *test;
           test = iperf_new_test();
           if ( test == NULL ) {
               fprintf( stderr, "%s: failed to create test0, argv0 );
               exit( EXIT_FAILURE );
           }
           iperf_defaults( test );
           iperf_set_test_role( test, 's' );
           iperf_set_test_server_port( test, port );
           for (;;) {
               if ( iperf_run_server( test ) < 0 )
                   fprintf( stderr, "%s: error - %s0, argv0, iperf_strerror( i_errn
       o ) );
               iperf_reset_test( test );
           }
           iperf_free_test( test );
       These are not complete programs,  just  excerpts.   The  full  runnable
       source  code  can  be  found in the examples subdirectory of the iperf3
       source tree.


AUTHORS
       A list of the contributors to iperf3 can be found within the documenta-
       tion located at http://software.es.net/iperf/dev.html#authors.



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | benchmark/iperf3 |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+
SEE ALSO
       iperf3(1), http://software.es.net/iperf/



NOTES
       This     software     was    built    from    source    available    at
       https://github.com/oracle/solaris-userland.   The  original   community
       source         was         downloaded         from         http://down-
       loads.es.net/pub/iperf/iperf-3.1.7.tar.gz

       Further information about this software can be found on the open source
       community website at http://software.es.net/iperf/.



ESnet                           September 2015                     LIBIPERF(3)