Annotation of embedaddon/iperf/src/t_api.c, revision 1.1.1.2

1.1       misho       1: /*
                      2:  * iperf, Copyright (c) 2017-2020, The Regents of the University of
                      3:  * California, through Lawrence Berkeley National Laboratory (subject
                      4:  * to receipt of any required approvals from the U.S. Dept. of
                      5:  * Energy).  All rights reserved.
                      6:  *
                      7:  * If you have questions about your rights to use or distribute this
                      8:  * software, please contact Berkeley Lab's Technology Transfer
                      9:  * Department at TTD@lbl.gov.
                     10:  *
                     11:  * NOTICE.  This software is owned by the U.S. Department of Energy.
                     12:  * As such, the U.S. Government has been granted for itself and others
                     13:  * acting on its behalf a paid-up, nonexclusive, irrevocable,
                     14:  * worldwide license in the Software to reproduce, prepare derivative
                     15:  * works, and perform publicly and display publicly.  Beginning five
                     16:  * (5) years after the date permission to assert copyright is obtained
                     17:  * from the U.S. Department of Energy, and subject to any subsequent
                     18:  * five (5) year renewals, the U.S. Government is granted for itself
                     19:  * and others acting on its behalf a paid-up, nonexclusive,
                     20:  * irrevocable, worldwide license in the Software to reproduce,
                     21:  * prepare derivative works, distribute copies to the public, perform
                     22:  * publicly and display publicly, and to permit others to do so.
                     23:  *
                     24:  * This code is distributed under a BSD style license, see the LICENSE
                     25:  * file for complete information.
                     26:  */
                     27: 
                     28: 
                     29: #include <assert.h>
                     30: #ifdef HAVE_STDINT_H
                     31: #include <stdint.h>
                     32: #endif
                     33: #include <stdio.h>
                     34: #include <string.h>
                     35: 
                     36: #include "iperf.h"
                     37: #include "iperf_api.h"
                     38: 
                     39: #include "version.h"
                     40: 
                     41: #include "units.h"
                     42: 
1.1.1.2 ! misho      43: int test_iperf_set_test_bind_port(struct iperf_test *test)
        !            44: {
        !            45:     int port;
        !            46:     port = iperf_get_test_bind_port(test);
        !            47:     iperf_set_test_bind_port(test, 5202);
        !            48:     port = iperf_get_test_bind_port(test);
        !            49:     assert(port == 5202);
        !            50:     return 0;
        !            51: }
        !            52: 
        !            53: int test_iperf_set_mss(struct iperf_test *test)
        !            54: {
        !            55:     int mss = iperf_get_test_mss(test);
        !            56:     iperf_set_test_mss(test, 535);
        !            57:     mss = iperf_get_test_mss(test);
        !            58:     assert(mss == 535);
        !            59:     return 0;
        !            60: }
1.1       misho      61: 
                     62: int
                     63: main(int argc, char **argv)
                     64: {
                     65:     const char *ver;
                     66:     struct iperf_test *test;
                     67:     int sint, gint;
                     68: 
                     69:     ver = iperf_get_iperf_version();
                     70:     assert(strcmp(ver, IPERF_VERSION) == 0);
                     71: 
                     72:     test = iperf_new_test();
                     73:     assert(test != NULL);
                     74: 
                     75:     iperf_defaults(test);
                     76: 
                     77:     sint = 10;
                     78:     iperf_set_test_connect_timeout(test, sint);
                     79:     gint = iperf_get_test_connect_timeout(test);
                     80:     assert(sint == gint);
                     81: 
1.1.1.2 ! misho      82:     int ret;
        !            83:     ret = test_iperf_set_test_bind_port(test);
        !            84: 
        !            85:     ret += test_iperf_set_mss(test);
        !            86: 
        !            87:     if (ret < 0)
        !            88:     {
        !            89:         return -1;
        !            90:     }
1.1       misho      91:     return 0;
                     92: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>