1
1
/*
2
- * iperf, Copyright (c) 2014-2022 , The Regents of the University of
2
+ * iperf, Copyright (c) 2014-2023 , The Regents of the University of
3
3
* California, through Lawrence Berkeley National Laboratory (subject
4
4
* to receipt of any required approvals from the U.S. Dept. of
5
5
* Energy). All rights reserved.
38
38
extern "C" { /* open extern "C" */
39
39
#endif
40
40
41
+ /*
42
+ * Atomic types highly desired, but if not, we approximate what we need
43
+ * with normal integers and warn.
44
+ */
45
+ #ifdef HAVE_STDATOMIC_H
46
+ #include <stdatomic.h>
47
+ #else
48
+ #warning "No <stdatomic.h> available"
49
+ typedef u_int64_t atomic_uint_fast64_t ;
50
+ #endif // HAVE_STDATOMIC_H
41
51
42
52
struct iperf_test ;
43
53
struct iperf_stream_result ;
@@ -46,7 +56,8 @@ struct iperf_stream;
46
56
struct iperf_time ;
47
57
48
58
#if !defined(__IPERF_H )
49
- typedef uint64_t iperf_size_t ;
59
+ typedef uint_fast64_t iperf_size_t ;
60
+ typedef atomic_uint_fast64_t atomic_iperf_size_t ;
50
61
#endif // __IPERF_H
51
62
52
63
/* default settings */
@@ -200,6 +211,10 @@ void iperf_set_dont_fragment( struct iperf_test* ipt, int dont_fragment );
200
211
void iperf_set_test_congestion_control (struct iperf_test * ipt , char * cc );
201
212
void iperf_set_test_mss (struct iperf_test * ipt , int mss );
202
213
void iperf_set_mapped_v4 (struct iperf_test * ipt , const int val );
214
+ void iperf_set_on_new_stream_callback (struct iperf_test * ipt , void (* callback )());
215
+ void iperf_set_on_test_start_callback (struct iperf_test * ipt , void (* callback )());
216
+ void iperf_set_on_test_connect_callback (struct iperf_test * ipt , void (* callback )());
217
+ void iperf_set_on_test_finish_callback (struct iperf_test * ipt , void (* callback )());
203
218
204
219
#if defined(HAVE_SSL )
205
220
void iperf_set_test_client_username (struct iperf_test * ipt , const char * client_username );
@@ -306,8 +321,8 @@ void build_tcpinfo_message(struct iperf_interval_results *r, char *message);
306
321
307
322
int iperf_set_send_state (struct iperf_test * test , signed char state );
308
323
void iperf_check_throttle (struct iperf_stream * sp , struct iperf_time * nowP );
309
- int iperf_send (struct iperf_test * , fd_set * ) /* __attribute__((hot)) */ ;
310
- int iperf_recv (struct iperf_test * , fd_set * );
324
+ int iperf_send_mt (struct iperf_stream * ) /* __attribute__((hot)) */ ;
325
+ int iperf_recv_mt (struct iperf_stream * );
311
326
void iperf_catch_sigend (void (* handler )(int ));
312
327
void iperf_got_sigend (struct iperf_test * test ) __attribute__ ((noreturn ));
313
328
void usage (void );
@@ -402,6 +417,7 @@ enum {
402
417
IERVRSONLYRCVTIMEOUT = 32 , // Client receive timeout is valid only in reverse mode
403
418
IESNDTIMEOUT = 33 , // Illegal message send timeout
404
419
IEUDPFILETRANSFER = 34 , // Cannot transfer file using UDP
420
+ IESERVERAUTHUSERS = 35 , // Cannot access authorized users file
405
421
/* Test errors */
406
422
IENEWTEST = 100 , // Unable to create a new test (check perror)
407
423
IEINITTEST = 101 , // Test initialization failed (check perror)
@@ -452,6 +468,11 @@ enum {
452
468
IEBINDDEVNOSUPPORT = 146 , // `ip%%dev` is not supported as system does not support bind to device
453
469
IEHOSTDEV = 147 , // host device name (ip%%<dev>) is supported (and required) only for IPv6 link-local address
454
470
IESETUSERTIMEOUT = 148 , // Unable to set TCP USER_TIMEOUT (check perror)
471
+ IEPTHREADCREATE = 150 , // Unable to create thread (check perror)
472
+ IEPTHREADCANCEL = 151 , // Unable to cancel thread (check perror)
473
+ IEPTHREADJOIN = 152 , // Unable to join thread (check perror)
474
+ IEPTHREADATTRINIT = 153 , // Unable to initialize thread attribute (check perror)
475
+ IEPTHREADATTRDESTROY = 154 , // Unable to destroy thread attribute (check perror)
455
476
/* Stream errors */
456
477
IECREATESTREAM = 200 , // Unable to create a new stream (check herror/perror)
457
478
IEINITSTREAM = 201 , // Unable to initialize stream (check herror/perror)
0 commit comments