Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
27e278ee
Commit
27e278ee
authored
Sep 09, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net_SetCSCov: sets checksum coverages of a socket
parent
8e6998b0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
1 deletion
+93
-1
include/vlc_network.h
include/vlc_network.h
+2
-0
src/libvlc.sym
src/libvlc.sym
+1
-0
src/network/udp.c
src/network/udp.c
+90
-1
No files found.
include/vlc_network.h
View file @
27e278ee
...
@@ -116,6 +116,8 @@ VLC_EXPORT( void, net_ListenClose, ( int *fd ) );
...
@@ -116,6 +116,8 @@ VLC_EXPORT( void, net_ListenClose, ( int *fd ) );
int
net_Subscribe
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
sockaddr
*
addr
,
int
net_Subscribe
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
socklen_t
addrlen
);
VLC_EXPORT
(
int
,
net_SetCSCov
,
(
int
fd
,
int
sendcov
,
int
recvcov
)
);
/* Functions to read from or write to the networking layer */
/* Functions to read from or write to the networking layer */
struct
virtual_socket_t
struct
virtual_socket_t
{
{
...
...
src/libvlc.sym
View file @
27e278ee
...
@@ -22,6 +22,7 @@ vlc_b64_encode
...
@@ -22,6 +22,7 @@ vlc_b64_encode
__net_Connect
__net_Connect
__net_ConnectDgram
__net_ConnectDgram
__net_OpenDgram
__net_OpenDgram
net_SetCSCov
vlc_module_set
vlc_module_set
vlc_submodule_create
vlc_submodule_create
libvlc_InternalCleanup
libvlc_InternalCleanup
...
...
src/network/udp.c
View file @
27e278ee
...
@@ -60,7 +60,34 @@
...
@@ -60,7 +60,34 @@
# define SOL_IPV6 IPPROTO_IPV6
# define SOL_IPV6 IPPROTO_IPV6
#endif
#endif
#ifndef IPPROTO_IPV6
#ifndef IPPROTO_IPV6
# define IPPROTO_IPV6 41
# define IPPROTO_IPV6 41
/* IANA */
#endif
#ifndef SOL_DCCP
# define SOL_DCCP IPPROTO_DCCP
#endif
#ifndef IPPROTO_DCCP
# define IPPROTO_DCCP 33
/* IANA */
#endif
#ifndef SOL_UDPLITE
# define SOL_UDPLITE IPPROTO_UDPLITE
#endif
#ifndef IPPROTO_UDPLITE
# define IPPROTO_UDPLITE 136
/* IANA */
#endif
#ifdef __linux__
# include <linux/dccp.h>
# ifndef SOCK_DCCP
/* provisional API */
# define SOCK_DCCP 6
# endif
#endif
#if defined (HAVE_NETINET_UDPLITE_H)
# include <netinet/udplite.h>
#elif defined (__linux__)
/* still missing from glibc 2.6 */
# define UDPLITE_SEND_CSCOV 10
# define UDPLITE_RECV_CSCOV 11
#endif
#endif
extern
int
net_Socket
(
vlc_object_t
*
p_this
,
int
i_family
,
int
i_socktype
,
extern
int
net_Socket
(
vlc_object_t
*
p_this
,
int
i_family
,
int
i_socktype
,
...
@@ -802,3 +829,65 @@ int __net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
...
@@ -802,3 +829,65 @@ int __net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
return
val
;
return
val
;
}
}
/**
* net_SetCSCov:
* Sets the send and receive checksum coverage of a socket:
* @param fd socket
* @param sendcov payload coverage of sent packets (bytes), -1 for full
* @param recvcov minimum payload coverage of received packets, -1 for full
*/
int
net_SetCSCov
(
int
fd
,
int
sendcov
,
int
recvcov
)
{
int
type
;
if
(
getsockopt
(
fd
,
SOL_SOCKET
,
SO_TYPE
,
&
type
,
&
(
socklen_t
){
sizeof
(
type
)
}))
return
VLC_EGENERIC
;
switch
(
type
)
{
#ifdef UDPLITE_RECV_CSCOV
case
SOCK_DGRAM
:
/* UDP-Lite */
if
(
sendcov
==
-
1
)
sendcov
=
0
;
else
sendcov
+=
8
;
/* partial */
if
(
setsockopt
(
fd
,
SOL_UDPLITE
,
UDPLITE_SEND_CSCOV
,
&
sendcov
,
sizeof
(
sendcov
)))
return
VLC_EGENERIC
;
if
(
recvcov
==
-
1
)
recvcov
=
0
;
else
recvcov
+=
8
;
if
(
setsockopt
(
fd
,
SOL_UDPLITE
,
UDPLITE_RECV_CSCOV
,
&
recvcov
,
sizeof
(
recvcov
)))
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
#endif
#ifdef DCCP_SOCKOPT_SEND_CSCOV
case
SOCK_DCCP
:
/* DCCP and its ill-named socket type */
if
((
sendcov
==
-
1
)
||
(
sendcov
>
56
))
sendcov
=
0
;
else
sendcov
=
(
sendcov
+
3
)
/
4
;
if
(
setsockopt
(
fd
,
SOL_DCCP
,
DCCP_SOCKOPT_SEND_CSCOV
,
&
sendcov
,
sizeof
(
sendcov
)))
return
VLC_EGENERIC
;
if
((
sendcov
==
-
1
)
||
(
sendcov
>
56
))
sendcov
=
0
;
else
sendcov
=
(
sendcov
+
3
)
/
4
;
if
(
setsockopt
(
fd
,
SOL_DCCP
,
DCCP_SOCKOPT_RECV_CSCOV
,
&
recvcov
,
sizeof
(
recvcov
)))
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
#endif
}
return
VLC_EGENERIC
;
}
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