Changeset e943c0003a271fce0c342fea521cdd7e2e5e3b27
- Timestamp:
- 09/09/07 22:13:17
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1189368797 +0000
- git-parent:
[bd598bbab08a0c207c931f3deac82b649fd8f6ca]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1189368797 +0000
- Message:
Remove UDP-Lite support from access_output_udp.
If someone wants to have it in there, it should probably rather be done
using a dedicated shortcut rather than a boolean configuration.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rcd1ad0c |
re943c00 |
|
| 50 | 50 | #include <vlc_network.h> |
|---|
| 51 | 51 | |
|---|
| 52 | | #if defined (HAVE_NETINET_UDPLITE_H) |
|---|
| 53 | | # include <netinet/udplite.h> |
|---|
| 54 | | #elif defined (__linux__) |
|---|
| 55 | | # define UDPLITE_SEND_CSCOV 10 |
|---|
| 56 | | # define UDPLITE_RECV_CSCOV 11 |
|---|
| 57 | | #endif |
|---|
| 58 | | |
|---|
| 59 | | #ifndef IPPROTO_UDPLITE |
|---|
| 60 | | # define IPPROTO_UDPLITE 136 /* from IANA */ |
|---|
| 61 | | #endif |
|---|
| 62 | | #ifndef SOL_UDPLITE |
|---|
| 63 | | # define SOL_UDPLITE IPPROTO_UDPLITE |
|---|
| 64 | | #endif |
|---|
| 65 | | |
|---|
| 66 | 52 | #define MAX_EMPTY_BLOCKS 200 |
|---|
| 67 | 53 | |
|---|
| … | … | |
| 99 | 85 | #define AUTO_MCAST_LONGTEXT N_("Allocates an outbound multicast address " \ |
|---|
| 100 | 86 | "automatically.") |
|---|
| 101 | | #define UDPLITE_TEXT N_("UDP-Lite") |
|---|
| 102 | | #define UDPLITE_LONGTEXT N_("Use UDP-Lite/IP instead of normal UDP/IP") |
|---|
| 103 | | #define CSCOV_TEXT N_("Checksum coverage") |
|---|
| 104 | | #define CSCOV_LONGTEXT N_("Payload bytes covered by layer-4 checksum") |
|---|
| 105 | 87 | |
|---|
| 106 | 88 | vlc_module_begin(); |
|---|
| … | … | |
| 116 | 98 | add_bool( SOUT_CFG_PREFIX "auto-mcast", VLC_FALSE, NULL, AUTO_MCAST_TEXT, |
|---|
| 117 | 99 | AUTO_MCAST_LONGTEXT, VLC_TRUE ); |
|---|
| 118 | | add_bool( SOUT_CFG_PREFIX "udplite", VLC_FALSE, NULL, UDPLITE_TEXT, UDPLITE_LONGTEXT, VLC_TRUE ); |
|---|
| 119 | | add_integer( SOUT_CFG_PREFIX "cscov", 12, NULL, CSCOV_TEXT, CSCOV_LONGTEXT, VLC_TRUE ); |
|---|
| 120 | 100 | |
|---|
| 121 | 101 | set_capability( "sout access", 100 ); |
|---|
| … | … | |
| 132 | 112 | "caching", |
|---|
| 133 | 113 | "group", |
|---|
| 134 | | "lite", |
|---|
| 135 | | "cscov", |
|---|
| 136 | 114 | NULL |
|---|
| 137 | 115 | }; |
|---|
| … | … | |
| 192 | 170 | |
|---|
| 193 | 171 | char *psz_dst_addr = NULL; |
|---|
| 194 | | int i_dst_port, proto = IPPROTO_UDP; |
|---|
| 195 | | const char *protoname = "UDP"; |
|---|
| | 172 | int i_dst_port; |
|---|
| 196 | 173 | |
|---|
| 197 | 174 | int i_handle; |
|---|
| … | … | |
| 216 | 193 | } |
|---|
| 217 | 194 | p_access->p_sys = p_sys; |
|---|
| 218 | | |
|---|
| 219 | | if (var_GetBool (p_access, SOUT_CFG_PREFIX"lite")) |
|---|
| 220 | | { |
|---|
| 221 | | protoname = "UDP-Lite"; |
|---|
| 222 | | proto = IPPROTO_UDPLITE; |
|---|
| 223 | | } |
|---|
| 224 | 195 | |
|---|
| 225 | 196 | i_dst_port = DEFAULT_PORT; |
|---|
| … | … | |
| 262 | 233 | p_sys->p_thread->p_empty_blocks = block_FifoNew( p_access ); |
|---|
| 263 | 234 | |
|---|
| 264 | | i_handle = net_ConnectDgram( p_this, psz_dst_addr, i_dst_port, -1, proto ); |
|---|
| | 235 | i_handle = net_ConnectDgram( p_this, psz_dst_addr, i_dst_port, -1, |
|---|
| | 236 | IPPROTO_UDP ); |
|---|
| 265 | 237 | free (psz_dst_addr); |
|---|
| 266 | 238 | |
|---|
| 267 | 239 | if( i_handle == -1 ) |
|---|
| 268 | 240 | { |
|---|
| 269 | | msg_Err( p_access, "failed to create %s socket", protoname ); |
|---|
| | 241 | msg_Err( p_access, "failed to create raw UDP socket" ); |
|---|
| 270 | 242 | vlc_object_destroy (p_sys->p_thread); |
|---|
| 271 | 243 | free (p_sys); |
|---|
| … | … | |
| 293 | 265 | p_sys->p_thread->i_handle = i_handle; |
|---|
| 294 | 266 | shutdown( i_handle, SHUT_RD ); |
|---|
| 295 | | |
|---|
| 296 | | int cscov = var_GetInteger (p_access, SOUT_CFG_PREFIX"cscov"); |
|---|
| 297 | | if (cscov) |
|---|
| 298 | | { |
|---|
| 299 | | switch (proto) |
|---|
| 300 | | { |
|---|
| 301 | | #ifdef UDPLITE_SEND_CSCOV |
|---|
| 302 | | case IPPROTO_UDPLITE: |
|---|
| 303 | | cscov += 8; |
|---|
| 304 | | setsockopt (i_handle, SOL_UDPLITE, UDPLITE_SEND_CSCOV, |
|---|
| 305 | | &(int){ cscov }, sizeof (cscov)); |
|---|
| 306 | | break; |
|---|
| 307 | | #endif |
|---|
| 308 | | #ifdef DCCP_SOCKOPT_RECV_CSCOV |
|---|
| 309 | | /* FIXME: ^^is this the right name ? */ |
|---|
| 310 | | /* FIXME: is this inherited by accept() ? */ |
|---|
| 311 | | case IPPROTO_DCCP: |
|---|
| 312 | | cscov = ((cscov + 3) >> 2) + 1; |
|---|
| 313 | | if (cscov > 15) |
|---|
| 314 | | break; /* out of DCCP cscov range */ |
|---|
| 315 | | setsockopt (i_handle, SOL_DCCP, DCCP_SOCKOPT_RECV_CSCOV, |
|---|
| 316 | | &(int){ cscov }, sizeof (cscov)); |
|---|
| 317 | | break; |
|---|
| 318 | | #endif |
|---|
| 319 | | } |
|---|
| 320 | | } |
|---|
| 321 | 267 | |
|---|
| 322 | 268 | p_sys->p_thread->i_caching = |
|---|