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
14324fec
Commit
14324fec
authored
Dec 04, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Dec 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add SO_BSP_STATE tests.
parent
9668dddf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
1 deletion
+99
-1
sock.c
dlls/ws2_32/tests/sock.c
+99
-1
No files found.
dlls/ws2_32/tests/sock.c
View file @
14324fec
...
...
@@ -1235,7 +1235,7 @@ static const LINGER linger_testvals[] = {
static
void
test_set_getsockopt
(
void
)
{
SOCKET
s
;
SOCKET
s
,
s2
;
int
i
,
err
,
lasterr
;
int
timeout
;
LINGER
lingval
;
...
...
@@ -1252,6 +1252,11 @@ static void test_set_getsockopt(void)
{
AF_INET6
,
SOCK_STREAM
,
IPPROTO_TCP
},
{
AF_INET6
,
SOCK_DGRAM
,
IPPROTO_UDP
}
};
union
_csspace
{
CSADDR_INFO
cs
;
char
space
[
128
];
}
csinfoA
,
csinfoB
;
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
s
!=
INVALID_SOCKET
,
"socket() failed error: %d
\n
"
,
WSAGetLastError
());
...
...
@@ -1462,6 +1467,99 @@ todo_wine
closesocket
(
s
);
}
/* Test SO_BSP_STATE - Present only in >= Win 2008 */
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
s
!=
INVALID_SOCKET
,
"Failed to create socket
\n
"
);
s2
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
s2
!=
INVALID_SOCKET
,
"Failed to create socket
\n
"
);
SetLastError
(
0xdeadbeef
);
size
=
sizeof
(
csinfoA
);
err
=
getsockopt
(
s
,
SOL_SOCKET
,
SO_BSP_STATE
,
(
char
*
)
&
csinfoA
,
&
size
);
if
(
!
err
)
{
struct
sockaddr_in
saddr
;
memset
(
&
saddr
,
0
,
sizeof
(
saddr
));
saddr
.
sin_family
=
AF_INET
;
saddr
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
/* Socket is not bound, no information provided */
ok
(
!
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
,
"Expected 0, got %d
\n
"
,
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
);
ok
(
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
==
NULL
,
"Expected NULL, got %p
\n
"
,
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
);
/* Socket is not connected, no information provided */
ok
(
!
csinfoA
.
cs
.
RemoteAddr
.
iSockaddrLength
,
"Expected 0, got %d
\n
"
,
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
);
ok
(
csinfoA
.
cs
.
RemoteAddr
.
lpSockaddr
==
NULL
,
"Expected NULL, got %p
\n
"
,
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
);
err
=
bind
(
s
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
));
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
size
=
sizeof
(
csinfoA
);
err
=
getsockopt
(
s
,
SOL_SOCKET
,
SO_BSP_STATE
,
(
char
*
)
&
csinfoA
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
/* Socket is bound */
ok
(
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
,
"Expected non-zero
\n
"
);
ok
(
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
!=
NULL
,
"Expected non-null
\n
"
);
/* Socket is not connected, no information provided */
ok
(
!
csinfoA
.
cs
.
RemoteAddr
.
iSockaddrLength
,
"Expected 0, got %d
\n
"
,
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
);
ok
(
csinfoA
.
cs
.
RemoteAddr
.
lpSockaddr
==
NULL
,
"Expected NULL, got %p
\n
"
,
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
);
err
=
bind
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
));
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
err
=
getsockname
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
err
=
listen
(
s2
,
1
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
err
=
connect
(
s
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
));
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
size
=
sizeof
(
saddr
);
err
=
accept
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
err
!=
INVALID_SOCKET
,
"Failed to accept socket
\n
"
);
closesocket
(
s2
);
s2
=
err
;
size
=
sizeof
(
csinfoA
);
err
=
getsockopt
(
s
,
SOL_SOCKET
,
SO_BSP_STATE
,
(
char
*
)
&
csinfoA
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
err
=
getsockopt
(
s2
,
SOL_SOCKET
,
SO_BSP_STATE
,
(
char
*
)
&
csinfoB
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
ok
(
size
==
sizeof
(
csinfoA
),
"Got %d
\n
"
,
size
);
size
=
sizeof
(
saddr
);
ok
(
size
==
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
,
"Expected %d, got %d
\n
"
,
size
,
csinfoA
.
cs
.
LocalAddr
.
iSockaddrLength
);
ok
(
size
==
csinfoA
.
cs
.
RemoteAddr
.
iSockaddrLength
,
"Expected %d, got %d
\n
"
,
size
,
csinfoA
.
cs
.
RemoteAddr
.
iSockaddrLength
);
ok
(
!
memcmp
(
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
,
csinfoB
.
cs
.
RemoteAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
ok
(
!
memcmp
(
csinfoB
.
cs
.
LocalAddr
.
lpSockaddr
,
csinfoA
.
cs
.
RemoteAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
ok
(
csinfoA
.
cs
.
iSocketType
==
SOCK_STREAM
,
"Wrong socket type
\n
"
);
ok
(
csinfoB
.
cs
.
iSocketType
==
SOCK_STREAM
,
"Wrong socket type
\n
"
);
ok
(
csinfoA
.
cs
.
iProtocol
==
IPPROTO_TCP
,
"Wrong socket protocol
\n
"
);
ok
(
csinfoB
.
cs
.
iProtocol
==
IPPROTO_TCP
,
"Wrong socket protocol
\n
"
);
err
=
getpeername
(
s
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
ok
(
!
memcmp
(
&
saddr
,
csinfoA
.
cs
.
RemoteAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
ok
(
!
memcmp
(
&
saddr
,
csinfoB
.
cs
.
LocalAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
err
=
getpeername
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
ok
(
!
memcmp
(
&
saddr
,
csinfoB
.
cs
.
RemoteAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
ok
(
!
memcmp
(
&
saddr
,
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
err
=
getsockname
(
s
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
ok
(
!
memcmp
(
&
saddr
,
csinfoA
.
cs
.
LocalAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
ok
(
!
memcmp
(
&
saddr
,
csinfoB
.
cs
.
RemoteAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
err
=
getsockname
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
!
err
,
"Expected 0, got %d
\n
"
,
err
);
ok
(
!
memcmp
(
&
saddr
,
csinfoB
.
cs
.
LocalAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
ok
(
!
memcmp
(
&
saddr
,
csinfoA
.
cs
.
RemoteAddr
.
lpSockaddr
,
size
),
"Expected matching addresses
\n
"
);
}
else
ok
(
GetLastError
()
==
WSAENOPROTOOPT
,
"Expected 10042, got %d
\n
"
,
GetLastError
());
closesocket
(
s
);
closesocket
(
s2
);
}
static
void
test_so_reuseaddr
(
void
)
...
...
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