17d375156SJon Dugan /* 295d40896SBruce A. Mah * iperf, Copyright (c) 2014-2017, The Regents of the University of 3da9f046fSBruce A. Mah * California, through Lawrence Berkeley National Laboratory (subject 4da9f046fSBruce A. Mah * to receipt of any required approvals from the U.S. Dept. of 5da9f046fSBruce A. Mah * Energy). All rights reserved. 67d375156SJon Dugan * 7da9f046fSBruce A. Mah * If you have questions about your rights to use or distribute this 8da9f046fSBruce A. Mah * software, please contact Berkeley Lab's Technology Transfer 9da9f046fSBruce A. Mah * Department at [email protected]. 10da9f046fSBruce A. Mah * 11da9f046fSBruce A. Mah * NOTICE. This software is owned by the U.S. Department of Energy. 12da9f046fSBruce A. Mah * As such, the U.S. Government has been granted for itself and others 13da9f046fSBruce A. Mah * acting on its behalf a paid-up, nonexclusive, irrevocable, 14da9f046fSBruce A. Mah * worldwide license in the Software to reproduce, prepare derivative 15da9f046fSBruce A. Mah * works, and perform publicly and display publicly. Beginning five 16da9f046fSBruce A. Mah * (5) years after the date permission to assert copyright is obtained 17da9f046fSBruce A. Mah * from the U.S. Department of Energy, and subject to any subsequent 18da9f046fSBruce A. Mah * five (5) year renewals, the U.S. Government is granted for itself 19da9f046fSBruce A. Mah * and others acting on its behalf a paid-up, nonexclusive, 20da9f046fSBruce A. Mah * irrevocable, worldwide license in the Software to reproduce, 21da9f046fSBruce A. Mah * prepare derivative works, distribute copies to the public, perform 22da9f046fSBruce A. Mah * publicly and display publicly, and to permit others to do so. 23da9f046fSBruce A. Mah * 24da9f046fSBruce A. Mah * This code is distributed under a BSD style license, see the LICENSE 25da9f046fSBruce A. Mah * file for complete information. 267d375156SJon Dugan */ 278a0b5a5dSsethdelliott #ifndef __IPERF_UTIL_H 288a0b5a5dSsethdelliott #define __IPERF_UTIL_H 29b0b16b86SJon Dugan 3073b02f98SBruce A. Mah #include "iperf_config.h" 31b5e0751fSJef Poskanzer #include "cjson.h" 321ceacc13SFredrik Fornwall #include <sys/select.h> 33e7ab564cSSami Farin #include <stddef.h> 34e7ab564cSSami Farin 35e7ab564cSSami Farin int readentropy(void *out, size_t outsize); 36b5e0751fSJef Poskanzer 37cbea72b6SPhil Levchenko void fill_with_repeating_pattern(void *out, size_t outsize); 38cbea72b6SPhil Levchenko 392ab386bfSjef void make_cookie(char *); 408a0b5a5dSsethdelliott 418a0b5a5dSsethdelliott int is_closed(int); 428a0b5a5dSsethdelliott 439673370fSJef Poskanzer double timeval_to_double(struct timeval *tv); 449673370fSJef Poskanzer 459673370fSJef Poskanzer int timeval_equals(struct timeval *tv0, struct timeval *tv1); 469673370fSJef Poskanzer 479673370fSJef Poskanzer double timeval_diff(struct timeval *tv0, struct timeval *tv1); 489673370fSJef Poskanzer 49056361fcSJef Poskanzer void cpu_util(double pcpu[3]); 509673370fSJef Poskanzer 5140050b7bSBruce A. Mah const char* get_system_info(void); 5240050b7bSBruce A. Mah 5340050b7bSBruce A. Mah const char* get_optional_features(void); 54e96ab740SJef Poskanzer 55b5e0751fSJef Poskanzer cJSON* iperf_json_printf(const char *format, ...); 56b5e0751fSJef Poskanzer 57*3888e044SDavid Bar-On void iperf_dump_fdset(FILE *fp, const char *str, int nfds, fd_set *fds); 58a4c1383aSJef Poskanzer 5973b02f98SBruce A. Mah #ifndef HAVE_DAEMON 6073b02f98SBruce A. Mah extern int daemon(int nochdir, int noclose); 6173b02f98SBruce A. Mah #endif /* HAVE_DAEMON */ 6273b02f98SBruce A. Mah 6395d40896SBruce A. Mah #ifndef HAVE_GETLINE 6495d40896SBruce A. Mah ssize_t getline(char **buf, size_t *bufsiz, FILE *fp); 6595d40896SBruce A. Mah #endif /* HAVE_GETLINE */ 6695d40896SBruce A. Mah 678a0b5a5dSsethdelliott #endif 68