Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d7794826
Commit
d7794826
authored
Mar 05, 2012
by
Sébastien Escudier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SAP : handle legacy v0 where the hash is not set (I forgot this case in
c495d676
)
parent
880d2ee8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
modules/services_discovery/sap.c
modules/services_discovery/sap.c
+25
-1
No files found.
modules/services_discovery/sap.c
View file @
d7794826
...
@@ -256,6 +256,7 @@ struct demux_sys_t
...
@@ -256,6 +256,7 @@ struct demux_sys_t
static
const
char
*
FindAttribute
(
const
sdp_t
*
sdp
,
unsigned
media
,
static
const
char
*
FindAttribute
(
const
sdp_t
*
sdp
,
unsigned
media
,
const
char
*
name
);
const
char
*
name
);
static
bool
IsSameSession
(
sdp_t
*
p_sdp1
,
sdp_t
*
p_sdp2
);
static
int
InitSocket
(
services_discovery_t
*
p_sd
,
const
char
*
psz_address
,
int
i_port
);
static
int
InitSocket
(
services_discovery_t
*
p_sd
,
const
char
*
psz_address
,
int
i_port
);
static
int
Decompress
(
const
unsigned
char
*
psz_src
,
unsigned
char
**
_dst
,
int
i_len
);
static
int
Decompress
(
const
unsigned
char
*
psz_src
,
unsigned
char
**
_dst
,
int
i_len
);
static
void
FreeSDP
(
sdp_t
*
p_sdp
);
static
void
FreeSDP
(
sdp_t
*
p_sdp
);
...
@@ -788,7 +789,9 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
...
@@ -788,7 +789,9 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
{
{
sap_announce_t
*
p_announce
=
p_sd
->
p_sys
->
pp_announces
[
i
];
sap_announce_t
*
p_announce
=
p_sd
->
p_sys
->
pp_announces
[
i
];
/* FIXME: slow */
/* FIXME: slow */
if
(
p_announce
->
i_hash
==
i_hash
&&
!
memcmp
(
p_announce
->
i_source
,
i_source
,
sizeof
(
i_source
))
)
if
(
(
!
i_hash
&&
IsSameSession
(
p_announce
->
p_sdp
,
p_sdp
)
)
||
(
i_hash
&&
p_announce
->
i_hash
==
i_hash
&&
!
memcmp
(
p_announce
->
i_source
,
i_source
,
sizeof
(
i_source
))
)
)
{
{
/* We don't support delete announcement as they can easily
/* We don't support delete announcement as they can easily
* Be used to highjack an announcement by a third party.
* Be used to highjack an announcement by a third party.
...
@@ -1543,6 +1546,27 @@ static int RemoveAnnounce( services_discovery_t *p_sd,
...
@@ -1543,6 +1546,27 @@ static int RemoveAnnounce( services_discovery_t *p_sd,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*
* Compare two sessions, when hash is not set (SAP v0)
*/
static
bool
IsSameSession
(
sdp_t
*
p_sdp1
,
sdp_t
*
p_sdp2
)
{
/* A session is identified by
* - username,
* - session_id,
* - network type (which is always IN),
* - address type (currently, this means IP version),
* - and hostname.
*/
if
(
strcmp
(
p_sdp1
->
username
,
p_sdp2
->
username
)
||
(
p_sdp1
->
session_id
!=
p_sdp2
->
session_id
)
||
(
p_sdp1
->
orig_ip_version
!=
p_sdp2
->
orig_ip_version
)
||
strcmp
(
p_sdp1
->
orig_host
,
p_sdp2
->
orig_host
))
return
false
;
return
true
;
}
static
inline
attribute_t
*
MakeAttribute
(
const
char
*
str
)
static
inline
attribute_t
*
MakeAttribute
(
const
char
*
str
)
{
{
attribute_t
*
a
=
malloc
(
sizeof
(
*
a
)
+
strlen
(
str
)
+
1
);
attribute_t
*
a
=
malloc
(
sizeof
(
*
a
)
+
strlen
(
str
)
+
1
);
...
...
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