Commit 63fb7a79 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Fix service flags returned from TCP and UDP protocols.

parent 7944ca48
...@@ -96,7 +96,7 @@ static INT WINSOCK_EnterSingleProtocolW( INT protocol, WSAPROTOCOL_INFOW* info ) ...@@ -96,7 +96,7 @@ static INT WINSOCK_EnterSingleProtocolW( INT protocol, WSAPROTOCOL_INFOW* info )
switch (protocol) switch (protocol)
{ {
case WS_IPPROTO_TCP: case WS_IPPROTO_TCP:
info->dwServiceFlags1 = XP1_PARTIAL_MESSAGE | XP1_EXPEDITED_DATA | info->dwServiceFlags1 = XP1_IFS_HANDLES | XP1_EXPEDITED_DATA |
XP1_GRACEFUL_CLOSE | XP1_GUARANTEED_ORDER | XP1_GRACEFUL_CLOSE | XP1_GUARANTEED_ORDER |
XP1_GUARANTEED_DELIVERY; XP1_GUARANTEED_DELIVERY;
info->ProviderId = ProviderIdIP; info->ProviderId = ProviderIdIP;
...@@ -111,7 +111,7 @@ static INT WINSOCK_EnterSingleProtocolW( INT protocol, WSAPROTOCOL_INFOW* info ) ...@@ -111,7 +111,7 @@ static INT WINSOCK_EnterSingleProtocolW( INT protocol, WSAPROTOCOL_INFOW* info )
break; break;
case WS_IPPROTO_UDP: case WS_IPPROTO_UDP:
info->dwServiceFlags1 = XP1_PARTIAL_MESSAGE | XP1_SUPPORT_BROADCAST | info->dwServiceFlags1 = XP1_IFS_HANDLES | XP1_SUPPORT_BROADCAST |
XP1_SUPPORT_MULTIPOINT | XP1_MESSAGE_ORIENTED | XP1_SUPPORT_MULTIPOINT | XP1_MESSAGE_ORIENTED |
XP1_CONNECTIONLESS; XP1_CONNECTIONLESS;
info->ProviderId = ProviderIdIP; info->ProviderId = ProviderIdIP;
......
...@@ -26,22 +26,55 @@ ...@@ -26,22 +26,55 @@
#include "wine/test.h" #include "wine/test.h"
/* TCP and UDP over IP fixed set of service flags */
#define TCPIP_SERVICE_FLAGS (XP1_GUARANTEED_DELIVERY \
| XP1_GUARANTEED_ORDER \
| XP1_GRACEFUL_CLOSE \
| XP1_EXPEDITED_DATA \
| XP1_IFS_HANDLES)
#define UDPIP_SERVICE_FLAGS (XP1_CONNECTIONLESS \
| XP1_MESSAGE_ORIENTED \
| XP1_SUPPORT_BROADCAST \
| XP1_SUPPORT_MULTIPOINT \
| XP1_IFS_HANDLES)
static void test_service_flags(int family, int version, int socktype, int protocol, DWORD testflags)
{
DWORD expectedflags = 0;
if (socktype == SOCK_STREAM && protocol == IPPROTO_TCP)
expectedflags = TCPIP_SERVICE_FLAGS;
if (socktype == SOCK_DGRAM && protocol == IPPROTO_UDP)
expectedflags = UDPIP_SERVICE_FLAGS;
/* check if standard TCP and UDP protocols are offering the correct service flags */
if ((family == AF_INET || family == AF_INET6) && version == 2 && expectedflags)
{
/* QOS may or may not be installed */
testflags &= ~XP1_QOS_SUPPORTED;
ok(expectedflags == testflags,
"Incorrect flags, expected 0x%x, received 0x%x\n",
expectedflags, testflags);
}
}
static void test_WSAEnumProtocolsA(void) static void test_WSAEnumProtocolsA(void)
{ {
INT ret; INT ret;
DWORD len = 0; DWORD len = 0, error;
WSAPROTOCOL_INFOA info, *buffer; WSAPROTOCOL_INFOA info, *buffer;
ret = WSAEnumProtocolsA( NULL, NULL, &len ); ret = WSAEnumProtocolsA( NULL, NULL, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n", ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly\n");
WSAGetLastError() ); error = WSAGetLastError();
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
len = 0; len = 0;
ret = WSAEnumProtocolsA( NULL, &info, &len ); ret = WSAEnumProtocolsA( NULL, &info, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n", ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly\n");
WSAGetLastError() ); error = WSAGetLastError();
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = HeapAlloc( GetProcessHeap(), 0, len );
...@@ -56,6 +89,9 @@ static void test_WSAEnumProtocolsA(void) ...@@ -56,6 +89,9 @@ static void test_WSAEnumProtocolsA(void)
for (i = 0; i < ret; i++) for (i = 0; i < ret; i++)
{ {
ok( strlen( buffer[i].szProtocol ), "No protocol name found\n" ); ok( strlen( buffer[i].szProtocol ), "No protocol name found\n" );
test_service_flags( buffer[i].iAddressFamily, buffer[i].iVersion,
buffer[i].iSocketType, buffer[i].iProtocol,
buffer[i].dwServiceFlags1);
} }
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
...@@ -65,18 +101,20 @@ static void test_WSAEnumProtocolsA(void) ...@@ -65,18 +101,20 @@ static void test_WSAEnumProtocolsA(void)
static void test_WSAEnumProtocolsW(void) static void test_WSAEnumProtocolsW(void)
{ {
INT ret; INT ret;
DWORD len = 0; DWORD len = 0, error;
WSAPROTOCOL_INFOW info, *buffer; WSAPROTOCOL_INFOW info, *buffer;
ret = WSAEnumProtocolsW( NULL, NULL, &len ); ret = WSAEnumProtocolsW( NULL, NULL, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n", ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly\n");
WSAGetLastError() ); error = WSAGetLastError();
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
len = 0; len = 0;
ret = WSAEnumProtocolsW( NULL, &info, &len ); ret = WSAEnumProtocolsW( NULL, &info, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n", ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly\n");
WSAGetLastError() ); error = WSAGetLastError();
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = HeapAlloc( GetProcessHeap(), 0, len );
...@@ -91,6 +129,9 @@ static void test_WSAEnumProtocolsW(void) ...@@ -91,6 +129,9 @@ static void test_WSAEnumProtocolsW(void)
for (i = 0; i < ret; i++) for (i = 0; i < ret; i++)
{ {
ok( lstrlenW( buffer[i].szProtocol ), "No protocol name found\n" ); ok( lstrlenW( buffer[i].szProtocol ), "No protocol name found\n" );
test_service_flags( buffer[i].iAddressFamily, buffer[i].iVersion,
buffer[i].iSocketType, buffer[i].iProtocol,
buffer[i].dwServiceFlags1);
} }
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment