diff options
author | Jason Greene <jason@php.net> | 2003-08-16 06:34:36 +0000 |
---|---|---|
committer | Jason Greene <jason@php.net> | 2003-08-16 06:34:36 +0000 |
commit | 90289924c031c5b0b2aa1f99ecf317640c926a62 (patch) | |
tree | d08435172a40ac3831ba4a80892be6aae2cdeabe /ext/sockets/php_sockets_win.c | |
parent | 78a3fe8fca8aff9a034a4300edc01f0b0f4ed4a5 (diff) | |
download | php-git-90289924c031c5b0b2aa1f99ecf317640c926a62.tar.gz |
Remove all vector based functions for the following reasons:
- This solves alot of platform compatibility problems
- The possible security issue of allocating an incredibly large vector
pool is prevented
- They are of little to no benefit in a high level language
- 99% of all things done with these functions can be done using
sendto/recvfrom
Diffstat (limited to 'ext/sockets/php_sockets_win.c')
-rw-r--r-- | ext/sockets/php_sockets_win.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/ext/sockets/php_sockets_win.c b/ext/sockets/php_sockets_win.c index b5407a748b..9a749b64aa 100644 --- a/ext/sockets/php_sockets_win.c +++ b/ext/sockets/php_sockets_win.c @@ -31,78 +31,6 @@ #include "php_sockets.h" #include "php_sockets_win.h" -ssize_t readv(SOCKET sock, const struct iovec *iov, int iovcnt) { - size_t bytes, remain, len, pos = 0; - ssize_t retval; - int i; - char *buffer = NULL; - - for(bytes=0, i=0; i<iovcnt; i++) { - bytes += iov[i].iov_len; - } - - buffer = (char*)emalloc(bytes); - if (buffer == NULL) { - return -1; - } - - retval = recv(sock, buffer, bytes, 0); - - if(retval < 0) { - efree(buffer); - return retval; - } - - remain = bytes = (size_t) retval; - - for(i=0; i<iovcnt; i++) { - len = ((unsigned int)iov[i].iov_len < remain) ? iov[i].iov_len : remain; - memcpy(iov[i].iov_base, buffer+pos, len); - pos += len; - remain -= len; - } - - efree(buffer); - return bytes; -} - -ssize_t writev(SOCKET sock, const struct iovec *iov, int iovcnt) { - size_t bytes, pos = 0; - ssize_t retval; - int i; - char *buffer = NULL; - - for(bytes=0, i=0; i<iovcnt; i++) { - bytes += iov[i].iov_len; - } - - buffer = (char*)emalloc(bytes); - - if(buffer == NULL) { - return -1; - } - - for(i=0; i<iovcnt; i++) { - memcpy(buffer+pos, iov[i].iov_base, iov[i].iov_len); - pos += iov[i].iov_len; - } - - retval = send(sock, buffer, bytes, 0); - efree(buffer); - - return retval; -} - -ssize_t recvmsg(SOCKET sock, struct msghdr *msg, int flags) { - set_errno(WSAEOPNOTSUPP); - return -1; -} - -ssize_t sendmsg(SOCKET sock, struct msghdr *msg, int flags) { - set_errno(WSAEOPNOTSUPP); - return -1; -} - int socketpair(int domain, int type, int protocol, SOCKET sock[2]) { struct sockaddr_in address; SOCKET redirect; |