Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c15c7a49
Commit
c15c7a49
authored
Apr 03, 2014
by
Erich E. Hoover
Committed by
Alexandre Julliard
Feb 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add an interactive test for interface change notifications.
parent
67c47e40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
sock.c
dlls/ws2_32/tests/sock.c
+68
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
c15c7a49
...
...
@@ -7058,6 +7058,73 @@ static void test_sioRoutingInterfaceQuery(void)
closesocket
(
sock
);
}
static
void
test_sioAddressListChange
(
void
)
{
struct
sockaddr_in
bindAddress
;
struct
in_addr
net_address
;
WSAOVERLAPPED
overlapped
;
struct
hostent
*
h
;
DWORD
num_bytes
;
SOCKET
sock
;
int
acount
;
int
ret
;
if
(
!
winetest_interactive
)
{
skip
(
"Cannot test SIO_ADDRESS_LIST_CHANGE, interactive tests must be enabled
\n
"
);
return
;
}
/* Use gethostbyname to find the list of local network interfaces */
h
=
gethostbyname
(
""
);
if
(
!
h
)
{
skip
(
"Cannot test SIO_ADDRESS_LIST_CHANGE, gethostbyname failed with %u
\n
"
,
WSAGetLastError
());
return
;
}
for
(
acount
=
0
;
h
->
h_addr_list
[
acount
];
acount
++
);
if
(
acount
==
0
)
{
skip
(
"Cannot test SIO_ADDRESS_LIST_CHANGE, test requires a network card.
\n
"
);
return
;
}
net_address
.
s_addr
=
*
(
ULONG
*
)
h
->
h_addr_list
[
0
];
/* Bind an overlapped socket to the first found network interface */
sock
=
WSASocketW
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
,
NULL
,
0
,
WSA_FLAG_OVERLAPPED
);
ok
(
sock
!=
INVALID_SOCKET
,
"Expected socket to return a valid socket
\n
"
);
if
(
sock
==
INVALID_SOCKET
)
{
skip
(
"Cannot test SIO_ADDRESS_LIST_CHANGE, socket creation failed with %u
\n
"
,
WSAGetLastError
());
return
;
}
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_addr
.
s_addr
=
net_address
.
s_addr
;
ret
=
bind
(
sock
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
if
(
ret
!=
0
)
{
skip
(
"Cannot test SIO_ADDRESS_LIST_CHANGE, failed to bind, error %u
\n
"
,
WSAGetLastError
());
goto
end
;
}
/* Wait for address changes, request that the user connect/disconnect an interface */
memset
(
&
overlapped
,
0
,
sizeof
(
overlapped
));
overlapped
.
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ret
=
WSAIoctl
(
sock
,
SIO_ADDRESS_LIST_CHANGE
,
NULL
,
0
,
NULL
,
0
,
&
num_bytes
,
&
overlapped
,
NULL
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAIoctl succeeded unexpectedly
\n
"
);
ok
(
WSAGetLastError
()
==
WSA_IO_PENDING
,
"Expected pending last error %d
\n
"
,
WSAGetLastError
());
trace
(
"Testing socket-based ipv4 address list change notification. Please connect/disconnect or"
" change the ipv4 address of any of the local network interfaces (10 second timeout).
\n
"
);
ret
=
WaitForSingleObject
(
overlapped
.
hEvent
,
10000
);
ok
(
ret
==
WAIT_OBJECT_0
,
"failed to get overlapped event %u
\n
"
,
ret
);
end:
closesocket
(
sock
);
}
static
void
test_synchronous_WSAIoctl
(
void
)
{
HANDLE
previous_port
,
io_port
;
...
...
@@ -8204,6 +8271,7 @@ START_TEST( sock )
test_ConnectEx
();
test_sioRoutingInterfaceQuery
();
test_sioAddressListChange
();
test_WSALookupService
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment