Changeset 6d479b506f0a614d42d75f1389dce6d911bcf492
- Timestamp:
- 21/08/07 19:15:51
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1187716551 +0000
- git-parent:
[0ac8f78a85937b98141662c449bd0cd45af36689]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1187716551 +0000
- Message:
Use hostname as SDP origin, as the spec says.
(Oh, I am well aware that this is often not correctly set, but then again,
why the heck would someone wants to parse the SDP origin in real life?)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r0e39834 |
r6d479b5 |
|
| 599 | 599 | |
|---|
| 600 | 600 | char *head = StartSDP (p_session->psz_name, p_session->description, |
|---|
| 601 | | p_session->url, p_session->email, p_session->phone, b_ssm, |
|---|
| | 601 | p_session->url, p_session->email, p_session->phone, |
|---|
| 602 | 602 | (const struct sockaddr *)&p_session->orig, p_session->origlen, |
|---|
| 603 | 603 | (const struct sockaddr *)&p_session->addr, p_session->addrlen); |
|---|
| r74afcf6 |
r6d479b5 |
|
| 88 | 88 | |
|---|
| 89 | 89 | char *StartSDP (const char *name, const char *description, const char *url, |
|---|
| 90 | | const char *email, const char *phone, vlc_bool_t ssm, |
|---|
| 91 | | const struct sockaddr *orig, socklen_t origlen, |
|---|
| | 90 | const char *email, const char *phone, |
|---|
| | 91 | const struct sockaddr *src, socklen_t srclen, |
|---|
| 92 | 92 | const struct sockaddr *addr, socklen_t addrlen) |
|---|
| 93 | 93 | { |
|---|
| 94 | | uint64_t t = NTPtime64 (); |
|---|
| 95 | | char *sdp, machine[MAXSDPADDRESS], conn[MAXSDPADDRESS], |
|---|
| | 94 | uint64_t now = NTPtime64 (); |
|---|
| | 95 | char *sdp; |
|---|
| | 96 | char connection[MAXSDPADDRESS], hostname[256], |
|---|
| 96 | 97 | sfilter[MAXSDPADDRESS + sizeof ("\r\na=source-filter: incl * ")]; |
|---|
| 97 | 98 | const char *preurl = "\r\nu=", *premail = "\r\ne=", *prephone = "\r\np="; |
|---|
| | 99 | |
|---|
| | 100 | gethostname (hostname, sizeof (hostname)); |
|---|
| 98 | 101 | |
|---|
| 99 | 102 | if (name == NULL) |
|---|
| … | … | |
| 110 | 113 | if (!IsSDPString (name) || !IsSDPString (description) |
|---|
| 111 | 114 | || !IsSDPString (url) || !IsSDPString (email) || !IsSDPString (phone) |
|---|
| 112 | | || (AddressToSDP (orig, origlen, machine) == NULL) |
|---|
| 113 | | || (AddressToSDP (addr, addrlen, conn) == NULL)) |
|---|
| 114 | | return NULL; |
|---|
| 115 | | |
|---|
| 116 | | if (ssm) |
|---|
| 117 | | sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s", |
|---|
| 118 | | machine[5], machine + 7); |
|---|
| 119 | | else |
|---|
| 120 | | *sfilter = '\0'; |
|---|
| | 115 | || (AddressToSDP (addr, addrlen, connection) == NULL)) |
|---|
| | 116 | return NULL; |
|---|
| | 117 | |
|---|
| | 118 | strcpy (sfilter, ""); |
|---|
| | 119 | if (srclen > 0) |
|---|
| | 120 | { |
|---|
| | 121 | char machine[MAXSDPADDRESS]; |
|---|
| | 122 | |
|---|
| | 123 | if (AddressToSDP (src, srclen, machine) != NULL) |
|---|
| | 124 | sprintf (sfilter, "\r\na=source-filter: incl IN IP%c * %s", |
|---|
| | 125 | machine[5], machine + 7); |
|---|
| | 126 | } |
|---|
| 121 | 127 | |
|---|
| 122 | 128 | if (asprintf (&sdp, "v=0" |
|---|
| 123 | | "\r\no=- "I64Fu" "I64Fu" %s" |
|---|
| | 129 | "\r\no=- "I64Fu" "I64Fu" IN IP%c %s" |
|---|
| 124 | 130 | "\r\ns=%s" |
|---|
| 125 | 131 | "\r\ni=%s" |
|---|
| … | … | |
| 139 | 145 | "%s" // optional source filter |
|---|
| 140 | 146 | "\r\n", |
|---|
| 141 | | /* o= */ t, t, machine, |
|---|
| | 147 | /* o= */ now, now, connection[5], hostname, |
|---|
| 142 | 148 | /* s= */ name, |
|---|
| 143 | 149 | /* i= */ description, |
|---|
| … | … | |
| 145 | 151 | /* e= */ premail, email, |
|---|
| 146 | 152 | /* p= */ prephone, phone, |
|---|
| 147 | | /* c= */ conn, |
|---|
| | 153 | /* c= */ connection, |
|---|
| 148 | 154 | /* source-filter */ sfilter) == -1) |
|---|
| 149 | 155 | return NULL; |
|---|
| r88148cb |
r6d479b5 |
|
| 119 | 119 | |
|---|
| 120 | 120 | char *StartSDP (const char *name, const char *description, const char *url, |
|---|
| 121 | | const char *email, const char *phone, vlc_bool_t ssm, |
|---|
| | 121 | const char *email, const char *phone, |
|---|
| 122 | 122 | const struct sockaddr *orig, socklen_t origlen, |
|---|
| 123 | 123 | const struct sockaddr *addr, socklen_t addrlen); |
|---|