When I moved some stuff from sockets.c to multicast.c, I did not copy
some conditional defines for systems without the RFC 3678 API.
I moved such defines to multicast.h so both sockets.c and multicast.c
can benefit from them and I prefixed them with PHP_ so that it's less
confusing: now PHP_MCAST_* are defined to either the MCAST_* RFC 3678
APIs or to legacy APIs and MCAST_* always mean the (possibly undefined)
system definitions.
Windows complains of invalid parameters because the socket is not bound.
The test expected the error to be EAGAIN/EWOULDBLOCK. Moved the call down,
after the socket is bound.
There build was failing on rmtools on the sockets extension for two reasons:
1. IPV6_TCLASS and IPV6_RECVTCLASS not being defined. These are probably
recent additions to SDK. Windows 7 doesn't event seem to have complete
support for IPV6_TCLASS, not accepting in WSASendMsg(). The parts that
needed this constant were not guarded by #ifdefs. They are now.
2. The constants EWOULDBLOCK and EINPROGRESS not being defined. These
were only defined in php_network.h, outside of the extension, and not
all source files included this header. Nevertheless, a macro defined in
php_sockets.h needed these constants. When this macro was used in files
that did not include php_network.h, the compilation would fail.
Surprisingly, the build did not fail when using the 7.1 Windows SDK
(more likely, the CRT headers used in VC10), as somehow errno.h was
being included through some other standard header. This would make the
constant EWOULDBLOCK defined; however, it would be defined to the wrong
value. In the winsock context, WSAEWOULDBLOCK should be used instead.
Because we have difficulty using Windows-only constants in the code, we
(re)define EWOULDBLOCK to WSAEWOULDBLOCK. This has the obvious
disavantage we may miss problems like this again in the future.
* sendrecvmsg_rebase_55: (31 commits)
Fix multicast.c not defining errno on Windows
Fix non-Windows build
send/recvmsg() support for Windows
Remove some pre-vista code
Revert "Payload of HOPLIMIT/TCLASS are 8-bit"
Ensure memory is initialized
Payload of HOPLIMIT/TCLASS are 8-bit
Fix buf in string -> int conv.
Build fixes; accept names for if_index
Refactoring: move stuff to new conversions.c
Support sticky IPV6_PKTINFO
Rename some functions for consistency
Destroy ancillary registry on shutdown
Move some multicast stuff to multicast.c
Fix mcast_ipv6_send test
Check return of fstat()
Fix build on Mac OS X
Register extra MSG_* constants
Add test for CMSG_RIGHTS
Add test for CMSG_CREDENTIALS message
...
This reverts commit 61a5ec7381ba5388a52926779fe3f58af0caea83.
I checked Linux and OpenBSD and both use integers to write the
IPV6_TCLASS messages and they don't force any endianness. This is
despite RFC 3542 explicitly saying the first byte of cmsg_data will
have the result. In any case, it doesn't make any difference in
little-endian archs.
Added constants: SCM_RIGHTS, SCM_CREDENTIALS and SO_PASSCRED.
The function socket_cmsg_space() was modified to support message types with
variable size. Its new signature is:
int socket_cmsg_space(int $level, int $type, int $n)
where $n is the number of repetable elements that the message is composed of.
This introduces two new functions:
int socket_recvmsg(resource $socket, array &$msghdr, int $flags)
int socket_sendmsg(resource $socket, array $msghdr, int $flags)
The arrays representing struct msghdr follow the native counterpart
closely: structs are mapped to arrays, fields to array elements whose
key is the name of the field without the prefix (e.g. "name" instead
of "msg_name") and array are mapped to sequential numeric PHP arrays.
Right now the only type of ancillary data supported is fot the
level/type pair IPPROTO_IPV6/IPV6_PKTINFO.
I also refactored out the name resolution functions and made
sockets_strerror() a global function.
* PHP-5.4:
Fix wrong blocking state being set
Fix tests (Windows)
Remove a Windows only warning
Move & improve PHP_SOCKET_ERROR def
Move some declarations to sockets.c
Fix overbroad skipif include