Changeset 209a00c674b57f182fb47fca9b1ad306a7165793
- Timestamp:
- 06/11/06 18:29:07
(2 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1162834147 +0000
- git-parent:
[0dc1ef3e1d35207d7ae301ee04e4dea5210694c2]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1162834147 +0000
- Message:
Cleanup
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r704c851 |
r209a00c |
|
| 90 | 90 | VLC_EXPORT( int, __net_ConnectTCP, ( vlc_object_t *p_this, const char *psz_host, int i_port ) ); |
|---|
| 91 | 91 | |
|---|
| 92 | | int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port, |
|---|
| 93 | | int family, int socktype, int protocol); |
|---|
| | 92 | /*int *net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, |
|---|
| | 93 | int family, int socktype, int protocol);*/ |
|---|
| | 94 | VLC_EXPORT( int, net_ListenSingle, (vlc_object_t *p_this, const char *psz_host, int i_port, |
|---|
| | 95 | int family, int socktype, int protocol) ); |
|---|
| 94 | 96 | |
|---|
| 95 | 97 | #define net_ListenTCP(a, b, c) __net_ListenTCP(VLC_OBJECT(a), b, c) |
|---|
| … | … | |
| 102 | 104 | VLC_EXPORT( int, __net_ConnectUDP, ( vlc_object_t *p_this, const char *psz_host, int i_port, int hlim ) ); |
|---|
| 103 | 105 | |
|---|
| 104 | | VLC_EXPORT( int, net_ListenUDP1, (vlc_object_t *obj, const char *host, int port) ); |
|---|
| | 106 | static inline int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port) |
|---|
| | 107 | { |
|---|
| | 108 | return net_ListenSingle (obj, host, port, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP); |
|---|
| | 109 | } |
|---|
| 105 | 110 | |
|---|
| 106 | 111 | #define net_OpenUDP(a, b, c, d, e ) __net_OpenUDP(VLC_OBJECT(a), b, c, d, e) |
|---|
| r704c851 |
r209a00c |
|
| 555 | 555 | char * (*config_ChainCreate_inner) (char **, config_chain_t **, char *); |
|---|
| 556 | 556 | int (*utf8_open_inner) (const char *filename, int flags, mode_t mode); |
|---|
| 557 | | int (*net_ListenUDP1_inner) (vlc_object_t *obj, const char *host, int port); |
|---|
| 558 | 557 | }; |
|---|
| 559 | 558 | # if defined (__PLUGIN__) |
|---|
| … | … | |
| 1033 | 1032 | # define config_ChainCreate (p_symbols)->config_ChainCreate_inner |
|---|
| 1034 | 1033 | # define utf8_open (p_symbols)->utf8_open_inner |
|---|
| 1035 | | # define net_ListenUDP1 (p_symbols)->net_ListenUDP1_inner |
|---|
| 1036 | 1034 | # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) |
|---|
| 1037 | 1035 | /****************************************************************** |
|---|
| … | … | |
| 1514 | 1512 | ((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \ |
|---|
| 1515 | 1513 | ((p_symbols)->utf8_open_inner) = utf8_open; \ |
|---|
| 1516 | | ((p_symbols)->net_ListenUDP1_inner) = net_ListenUDP1; \ |
|---|
| 1517 | 1514 | (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ |
|---|
| 1518 | 1515 | (p_symbols)->__sout_CfgParse_deprecated = NULL; \ |
|---|
| r8c2241f |
r209a00c |
|
| 115 | 115 | |
|---|
| 116 | 116 | |
|---|
| 117 | | int *net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port, |
|---|
| 118 | | int family, int socktype, int protocol) |
|---|
| | 117 | static int *net_Listen (vlc_object_t *p_this, const char *psz_host, |
|---|
| | 118 | int i_port, int family, int socktype, int protocol) |
|---|
| 119 | 119 | { |
|---|
| 120 | 120 | struct addrinfo hints, *res; |
|---|
| … | … | |
| 234 | 234 | |
|---|
| 235 | 235 | |
|---|
| | 236 | int net_ListenSingle (vlc_object_t *obj, const char *host, int port, |
|---|
| | 237 | int family, int socktype, int protocol) |
|---|
| | 238 | { |
|---|
| | 239 | int *fdv = net_Listen (obj, host, port, family, socktype, protocol); |
|---|
| | 240 | if (fdv == NULL) |
|---|
| | 241 | return -1; |
|---|
| | 242 | |
|---|
| | 243 | for (unsigned i = 1; fdv[i] != -1; i++) |
|---|
| | 244 | { |
|---|
| | 245 | msg_Warn (obj, "A socket has been dropped!"); |
|---|
| | 246 | net_Close (fdv[i]); |
|---|
| | 247 | } |
|---|
| | 248 | |
|---|
| | 249 | int fd = fdv[0]; |
|---|
| | 250 | assert (fd != -1); |
|---|
| | 251 | |
|---|
| | 252 | free (fdv); |
|---|
| | 253 | return fd; |
|---|
| | 254 | } |
|---|
| | 255 | |
|---|
| | 256 | |
|---|
| | 257 | |
|---|
| 236 | 258 | /***************************************************************************** |
|---|
| 237 | 259 | * __net_Close: |
|---|
| r1ed9a7d |
r209a00c |
|
| 403 | 403 | |
|---|
| 404 | 404 | |
|---|
| 405 | | static inline |
|---|
| 406 | | int *__net_ListenUDP (vlc_object_t *obj, const char *host, int port) |
|---|
| 407 | | { |
|---|
| 408 | | int *fdv = net_Listen (obj, host, port, 0, SOCK_DGRAM, IPPROTO_UDP); |
|---|
| 409 | | if (fdv == NULL) |
|---|
| 410 | | return NULL; |
|---|
| 411 | | |
|---|
| 412 | | /* FIXME: handle multicast subscription */ |
|---|
| 413 | | return fdv; |
|---|
| 414 | | } |
|---|
| 415 | | |
|---|
| 416 | | |
|---|
| 417 | | int net_ListenUDP1 (vlc_object_t *obj, const char *host, int port) |
|---|
| 418 | | { |
|---|
| 419 | | int *fdv = __net_ListenUDP (obj, host, port); |
|---|
| 420 | | if (fdv == NULL) |
|---|
| 421 | | return -1; |
|---|
| 422 | | |
|---|
| 423 | | for (unsigned i = 1; fdv[i] != -1; i++) |
|---|
| 424 | | { |
|---|
| 425 | | msg_Warn (obj, "A socket has been dropped!"); |
|---|
| 426 | | net_Close (fdv[i]); |
|---|
| 427 | | } |
|---|
| 428 | | |
|---|
| 429 | | int fd = fdv[0]; |
|---|
| 430 | | assert (fd != -1); |
|---|
| 431 | | |
|---|
| 432 | | free (fdv); |
|---|
| 433 | | return fd; |
|---|
| 434 | | } |
|---|
| 435 | | |
|---|
| 436 | | |
|---|
| 437 | 405 | /***************************************************************************** |
|---|
| 438 | 406 | * __net_OpenUDP: |
|---|