Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
cpp-libs
libnice
Commits
bfb9f532
Commit
bfb9f532
authored
Feb 07, 2007
by
Dafydd Harries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nice_agent_component_recv ()
darcs-hash:20070207202421-c9803-463794ea6a58b78e2aaace04618e64d0ac0ec682.gz
parent
7912c79d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
0 deletions
+101
-0
agent/agent.c
agent/agent.c
+92
-0
agent/agent.h
agent/agent.h
+8
-0
nice/libnice.symbols
nice/libnice.symbols
+1
-0
No files found.
agent/agent.c
View file @
bfb9f532
...
...
@@ -348,6 +348,23 @@ _local_candidate_lookup (NiceAgent *agent, guint candidate_id)
}
static
NiceCandidate
*
_local_candidate_lookup_by_fd
(
NiceAgent
*
agent
,
guint
fd
)
{
GSList
*
i
;
for
(
i
=
agent
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
c
=
i
->
data
;
if
(
c
->
sock
.
fileno
==
fd
)
return
c
;
}
return
NULL
;
}
static
Stream
*
_stream_lookup
(
NiceAgent
*
agent
,
guint
stream_id
)
{
...
...
@@ -723,6 +740,81 @@ nice_agent_recv (
}
/**
* nice_agent_component_recv:
* @agent: a NiceAgent
* @stream_id: the ID of the stream to recieve data from
* @component_id: the ID of the component to receive data from
* @buf_len: the size of @buf
* @buf: the buffer to read data into
*
* Recieve data on a particular component.
*
* Returns: the amount of data read into @buf
**/
guint
nice_agent_component_recv
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
guint
buf_len
,
gchar
*
buf
)
{
guint
len
=
0
;
fd_set
fds
;
guint
max_fd
=
0
;
gint
num_readable
;
GSList
*
i
;
for
(
i
=
agent
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
candidate
;
candidate
=
i
->
data
;
if
(
candidate
->
stream_id
==
stream_id
&&
candidate
->
component_id
==
component_id
)
{
FD_SET
(
candidate
->
sock
.
fileno
,
&
fds
);
max_fd
=
MAX
(
candidate
->
sock
.
fileno
,
max_fd
);
}
}
/* Loop on candidate sockets until we find one that has non-STUN data
* waiting on it.
*/
for
(;;)
{
num_readable
=
select
(
max_fd
+
1
,
&
fds
,
NULL
,
NULL
,
0
);
g_assert
(
num_readable
>=
0
);
if
(
num_readable
>
0
)
{
guint
j
;
for
(
j
=
0
;
j
<=
max_fd
;
j
++
)
if
(
FD_ISSET
(
j
,
&
fds
))
{
NiceCandidate
*
candidate
;
Stream
*
stream
;
candidate
=
_local_candidate_lookup_by_fd
(
agent
,
j
);
g_assert
(
candidate
);
stream
=
_stream_lookup
(
agent
,
candidate
->
stream_id
);
len
=
_nice_agent_recv
(
agent
,
stream
,
candidate
,
buf_len
,
buf
);
if
(
len
>
0
)
return
len
;
}
}
}
g_assert_not_reached
();
}
/**
* nice_agent_poll_read:
* @agent: A NiceAgent
...
...
agent/agent.h
View file @
bfb9f532
...
...
@@ -67,6 +67,14 @@ nice_agent_recv (
NiceAgent
*
agent
,
guint
candidate_id
);
guint
nice_agent_component_recv
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
guint
buf_len
,
gchar
*
buf
);
GSList
*
nice_agent_poll_read
(
NiceAgent
*
agent
,
...
...
nice/libnice.symbols
View file @
bfb9f532
...
...
@@ -9,6 +9,7 @@ T nice_address_to_string
T nice_agent_add_local_address
T nice_agent_add_remote_candidate
T nice_agent_add_stream
T nice_agent_component_recv
T nice_agent_free
T nice_agent_get_local_candidates
T nice_agent_new
...
...
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