Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
976b9f6d
Commit
976b9f6d
authored
May 03, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide sendmsg and recvmsg replacements
parent
832088e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
include/vlc_network.h
include/vlc_network.h
+21
-0
src/network/winsock.c
src/network/winsock.c
+57
-0
No files found.
include/vlc_network.h
View file @
976b9f6d
...
...
@@ -41,6 +41,27 @@
# define ENETUNREACH WSAENETUNREACH
# define net_errno (WSAGetLastError())
extern
const
char
*
net_strerror
(
int
val
);
struct
iovec
{
void
*
iov_base
;
size_t
iov_len
;
};
struct
msghdr
{
void
*
msg_name
;
size_t
msg_namelen
;
struct
iovec
*
msg_iov
;
size_t
msg_iovlen
;
void
*
msg_control
;
size_t
msg_controllen
;
int
msg_flags
;
};
VLC_EXPORT
(
ssize_t
,
sendmsg
,
(
int
,
struct
msghdr
*
,
int
)
);
VLC_EXPORT
(
ssize_t
,
recvmsg
,
(
int
,
struct
msghdr
*
,
int
)
);
# ifndef IPV6_V6ONLY
# define IPV6_V6ONLY 27
# endif
...
...
src/network/winsock.c
View file @
976b9f6d
...
...
@@ -147,3 +147,60 @@ const char *net_strerror( int value )
/* Remember to update src/misc/messages.c if you change this one */
return
"Unknown network stack error"
;
}
ssize_t
sendmsg
(
int
s
,
struct
msghdr
*
hdr
,
int
flags
)
{
/* WSASendMsg would be more straightforward, and would support ancilliary
* data, but it's not yet in mingw32. */
if
((
hdr
->
msg_iovlen
>
100
)
||
(
hdr
->
msg_controllen
>
0
))
{
errno
=
EINVAL
;
return
-
1
;
}
WSABUF
buf
[
hdr
->
msg_iovlen
];
for
(
size_t
i
=
0
;
i
<
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]);
i
++
)
buf
[
i
].
buf
=
hdr
->
msg_iov
[
i
].
iov_base
,
buf
[
i
].
len
=
hdr
->
msg_iov
[
i
].
iov_len
;
DWORD
sent
;
if
(
WSASendTo
(
s
,
buf
,
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]),
&
sent
,
flags
,
hdr
->
msg_name
,
hdr
->
msg_namelen
,
NULL
,
NULL
)
==
0
)
return
sent
;
return
-
1
;
}
ssize_t
recvmsg
(
int
s
,
struct
msghdr
*
hdr
,
int
flags
)
{
/* WSARecvMsg would be more straightforward, and would support ancilliary
* data, but it's not yet in mingw32. */
if
(
hdr
->
msg_iovlen
>
100
)
{
errno
=
EINVAL
;
return
-
1
;
}
WSABUF
buf
[
hdr
->
msg_iovlen
];
for
(
size_t
i
=
0
;
i
<
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]);
i
++
)
buf
[
i
].
buf
=
hdr
->
msg_iov
[
i
].
iov_base
,
buf
[
i
].
len
=
hdr
->
msg_iov
[
i
].
iov_len
;
DWORD
recvd
;
hdr
->
msg_controllen
=
0
;
hdr
->
msg_flags
=
0
;
if
(
WSARecvFrom
(
s
,
buf
,
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]),
&
recvd
,
flags
,
hdr
->
msg_name
,
hdr
->
msg_namelen
,
NULL
,
NULL
)
==
0
)
return
recvd
;
#ifdef MSG_TRUNC
if
(
WSAGetLastError
()
==
WSAEMSGSIZE
)
{
hdr
->
msg_flags
|=
MSG_TRUNC
;
return
recvd
;
}
#else
# warning Out-of-date Winsock header files!
#endif
return
-
1
;
}
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