1 /* 2 * Copyright (c) 2009-2011, The Regents of the University of California, 3 * through Lawrence Berkeley National Laboratory (subject to receipt of any 4 * required approvals from the U.S. Dept. of Energy). All rights reserved. 5 * 6 * This code is distributed under a BSD style license, see the LICENSE file 7 * for complete information. 8 */ 9 10 #ifndef __IPERF_API_H 11 #define __IPERF_API_H 12 13 #include <setjmp.h> 14 #include "iperf.h" 15 16 /** 17 * exchange_parameters - handles the param_Exchange part for client 18 * 19 */ 20 int iperf_exchange_parameters(struct iperf_test * test); 21 22 /** 23 * add_to_interval_list -- adds new interval to the interval_list 24 * 25 */ 26 void add_to_interval_list(struct iperf_stream_result * rp, struct iperf_interval_results *temp); 27 28 /** 29 * connect_msg -- displays connection message 30 * denoting senfer/receiver details 31 * 32 */ 33 void connect_msg(struct iperf_stream * sp); 34 35 /** 36 * iperf_stats_callback -- handles the statistic gathering 37 * 38 */ 39 void iperf_stats_callback(struct iperf_test * test); 40 41 42 /** 43 * iperf_reporter_callback -- handles the report printing 44 * 45 */ 46 void iperf_reporter_callback(struct iperf_test * test); 47 48 49 /** 50 * iperf_new_test -- return a new iperf_test with default values 51 * 52 * returns NULL on failure 53 * 54 */ 55 struct iperf_test *iperf_new_test(); 56 57 int iperf_defaults(struct iperf_test * testp); 58 59 60 /** 61 * iperf_free_test -- free resources used by test, calls iperf_free_stream to 62 * free streams 63 * 64 */ 65 void iperf_free_test(struct iperf_test * testp); 66 67 68 /** 69 * iperf_new_stream -- return a net iperf_stream with default values 70 * 71 * returns NULL on failure 72 * 73 */ 74 struct iperf_stream *iperf_new_stream(struct iperf_test *, int); 75 76 /** 77 * iperf_add_stream -- add a stream to a test 78 * 79 */ 80 void iperf_add_stream(struct iperf_test * test, struct iperf_stream * stream); 81 82 /** 83 * iperf_init_stream -- init resources associated with test 84 * 85 */ 86 int iperf_init_stream(struct iperf_stream *, struct iperf_test *); 87 88 /** 89 * iperf_free_stream -- free resources associated with test 90 * 91 */ 92 void iperf_free_stream(struct iperf_stream * sp); 93 94 void get_tcpinfo(struct iperf_stream *, struct iperf_interval_results *); 95 void print_tcpinfo(struct iperf_test *); 96 void build_tcpinfo_message(struct iperf_interval_results *r, char *message); 97 98 void print_interval_results(struct iperf_test * test, struct iperf_stream *sp); 99 int iperf_send(struct iperf_test *); 100 int iperf_recv(struct iperf_test *); 101 void sig_handler(int); 102 void usage(); 103 void usage_long(); 104 void warning(char *); 105 int all_data_sent(struct iperf_test *); 106 int package_parameters(struct iperf_test *); 107 int parse_parameters(struct iperf_test *); 108 int iperf_exchange_results(struct iperf_test *); 109 int parse_results(struct iperf_test *, char *); 110 int iperf_init_test(struct iperf_test *); 111 int iperf_parse_arguments(struct iperf_test *, int, char **); 112 void iperf_reset_test(struct iperf_test *); 113 114 struct protocol *get_protocol(struct iperf_test *, int); 115 int set_protocol(struct iperf_test *, int); 116 117 void iperf_on_new_stream(struct iperf_stream *); 118 void iperf_on_test_start(struct iperf_test *); 119 void iperf_on_connect(struct iperf_test *); 120 void iperf_on_test_finish(struct iperf_test *); 121 122 extern jmp_buf env; 123 124 #endif 125 126