Changeset eb43a637d79cef96542e0e7f2bf52f82fdebcaf4
- Timestamp:
- 05/28/08 17:49:50
(3 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1211989790 +0300
- git-parent:
[0c9a964bf7b8face64b103ad99c1865f85d2bf29]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1211989686 +0300
- Message:
vlc_getaddrinfo -> getaddrinfo, and set sane hints
We really do not want to apply the VLC address family "policy" here.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r5e15258 |
reb43a63 |
|
| 387 | 387 | { |
|---|
| 388 | 388 | /* Create the SDP */ |
|---|
| | 389 | static const struct addrinfo hints = { |
|---|
| | 390 | .ai_family = AF_UNSPEC, |
|---|
| | 391 | .ai_socktype = SOCK_DGRAM, |
|---|
| | 392 | .ai_protocol = 0, |
|---|
| | 393 | .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV |
|---|
| | 394 | }; |
|---|
| 389 | 395 | char *shost = var_GetNonEmptyString (p_access, "src-addr"); |
|---|
| 390 | 396 | char *dhost = var_GetNonEmptyString (p_access, "dst-addr"); |
|---|
| 391 | 397 | int sport = var_GetInteger (p_access, "src-port"); |
|---|
| 392 | 398 | int dport = var_GetInteger (p_access, "dst-port"); |
|---|
| | 399 | char port[6]; |
|---|
| 393 | 400 | struct sockaddr_storage src, dst; |
|---|
| 394 | 401 | socklen_t srclen = 0, dstlen = 0; |
|---|
| 395 | | |
|---|
| 396 | 402 | struct addrinfo *res; |
|---|
| 397 | | if (vlc_getaddrinfo (VLC_OBJECT (p_stream), dhost, dport, NULL, &res) == 0) |
|---|
| | 403 | |
|---|
| | 404 | snprintf (port, sizeof (port), "%d", dport); |
|---|
| | 405 | if (getaddrinfo (dhost, port, &hints, &res) == 0) |
|---|
| 398 | 406 | { |
|---|
| 399 | 407 | memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen); |
|---|
| 400 | | vlc_freeaddrinfo (res); |
|---|
| 401 | | } |
|---|
| 402 | | |
|---|
| 403 | | if (vlc_getaddrinfo (VLC_OBJECT (p_stream), shost, sport, NULL, &res) == 0) |
|---|
| | 408 | freeaddrinfo (res); |
|---|
| | 409 | } |
|---|
| | 410 | |
|---|
| | 411 | snprintf (port, sizeof (port), "%d", sport); |
|---|
| | 412 | if (getaddrinfo (shost, port, &hints, &res) == 0) |
|---|
| 404 | 413 | { |
|---|
| 405 | 414 | memcpy (&src, res->ai_addr, srclen = res->ai_addrlen); |
|---|
| 406 | | vlc_freeaddrinfo (res); |
|---|
| | 415 | freeaddrinfo (res); |
|---|
| 407 | 416 | } |
|---|
| 408 | 417 | |
|---|