diff options
author | Jef Poskanzer <jef@mail.acme.com> | 2013-03-04 15:55:16 -0800 |
---|---|---|
committer | Jef Poskanzer <jef@mail.acme.com> | 2013-03-04 15:55:16 -0800 |
commit | 987b4323164fb83d1f9adcb9a9339ec3495e558c (patch) | |
tree | a2f0705223d37619c22f082491a0efde3c27d203 /src/net.h | |
parent | 358985eb580b9141808385053da41e12df619de9 (diff) | |
download | iperf3-987b4323164fb83d1f9adcb9a9339ec3495e558c.tar.gz |
A bunch of changes mixed together in this commit, but the significant
one is the new -Z flag.
- Fixed potential bug in net.c's Nread and Nwrite routines. If they
had ever needed to loop they would have read/written the wrong address,
due to incorrect pointer arithmetic - sizeof(void) is not 1. Fix
was to change the type of the buffer pointer to char*, which also
meant adding casts to some callers.
- Better checking for conflicts between command-line flags - now they
should no longer be order-dependent.
- Added a new -Z / --zerocopy flag, to use a "zero copy" method of
sending data, such as sendfile(2) instead of the usual write(2).
- Renumbered error enum to make inserting new ones easier.
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -10,12 +10,14 @@ #ifndef __NET_H #define __NET_H -int netdial(int, int, char *, char *, int); -int netannounce(int, int, char *, int); -int Nwrite(int, void *, int, int) /* __attribute__((hot)) */; -int Nread(int, void *, int, int); -int getsock_tcp_mss(int); -int set_tcp_options(int, int, int); +int netdial(int domain, int proto, char *local, char *server, int port); +int netannounce(int domain, int proto, char *local, int port); +int Nread(int fd, char *buf, size_t count, int prot); +int Nwrite(int fd, const char *buf, size_t count, int prot) /* __attribute__((hot)) */; +int has_sendfile(void); +int Nsendfile(int fromfd, int tofd, const char *buf, size_t count) /* __attribute__((hot)) */; +int getsock_tcp_mss(int inSock); +int set_tcp_options(int sock, int no_delay, int mss); int setnonblocking(int fd); #define NET_SOFTERROR -1 |