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
e3ddaa28
Commit
e3ddaa28
authored
Jun 21, 2017
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent: Adjust the nice_agent_new_full() to use flags
This makes it easier to read and more extensible.
parent
c7a5a92b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
13 deletions
+31
-13
agent/agent.c
agent/agent.c
+5
-4
agent/agent.h
agent/agent.h
+22
-5
tests/test-nomination.c
tests/test-nomination.c
+4
-4
No files found.
agent/agent.c
View file @
e3ddaa28
...
@@ -1168,14 +1168,15 @@ nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat)
...
@@ -1168,14 +1168,15 @@ nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat)
NICEAPI_EXPORT
NiceAgent
*
NICEAPI_EXPORT
NiceAgent
*
nice_agent_new_full
(
GMainContext
*
ctx
,
nice_agent_new_full
(
GMainContext
*
ctx
,
NiceCompatibility
compat
,
NiceCompatibility
compat
,
gboolean
reliable
,
NiceAgentOption
flags
)
NiceNominationMode
nomination
)
{
{
NiceAgent
*
agent
=
g_object_new
(
NICE_TYPE_AGENT
,
NiceAgent
*
agent
=
g_object_new
(
NICE_TYPE_AGENT
,
"compatibility"
,
compat
,
"compatibility"
,
compat
,
"main-context"
,
ctx
,
"main-context"
,
ctx
,
"reliable"
,
reliable
,
"reliable"
,
(
flags
&
NICE_AGENT_OPTION_RELIABLE
)
?
TRUE
:
FALSE
,
"nomination-mode"
,
nomination
,
"nomination-mode"
,
(
flags
&
NICE_AGENT_OPTION_REGULAR_NOMINATION
)
?
NICE_NOMINATION_MODE_REGULAR
:
NICE_NOMINATION_MODE_AGGRESSIVE
,
"full-mode"
,
(
flags
&
NICE_AGENT_OPTION_LITE_MODE
)
?
FALSE
:
TRUE
,
NULL
);
NULL
);
return
agent
;
return
agent
;
...
...
agent/agent.h
View file @
e3ddaa28
...
@@ -398,6 +398,25 @@ typedef enum
...
@@ -398,6 +398,25 @@ typedef enum
NICE_NOMINATION_MODE_AGGRESSIVE
,
NICE_NOMINATION_MODE_AGGRESSIVE
,
}
NiceNominationMode
;
}
NiceNominationMode
;
/**
* NiceAgentOption:
* @NICE_AGENT_OPTION_REGULAR_NOMINATION: Enables regular nomination, default
* is aggrssive mode (see #NiceNominationMode).
* @NICE_AGENT_OPTION_RELIABLE: Enables reliable mode, possibly using PseudoTCP, * see nice_agent_new_reliable().
* @NICE_AGENT_OPTION_LITE_MODE: Enable lite mode
*
* These are options that can be passed to nice_agent_new_full(). They set
* various properties on the agent. Not including them sets the property to
* the other value.
*
* Since: UNRELEASED
*/
typedef
enum
{
NICE_AGENT_OPTION_REGULAR_NOMINATION
=
1
<<
0
,
NICE_AGENT_OPTION_RELIABLE
=
1
<<
1
,
NICE_AGENT_OPTION_LITE_MODE
=
1
<<
2
,
}
NiceAgentOption
;
/**
/**
* NiceAgentRecvFunc:
* NiceAgentRecvFunc:
* @agent: The #NiceAgent Object
* @agent: The #NiceAgent Object
...
@@ -452,13 +471,12 @@ nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat);
...
@@ -452,13 +471,12 @@ nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat);
* nice_agent_new_full:
* nice_agent_new_full:
* @ctx: The Glib Mainloop Context to use for timers
* @ctx: The Glib Mainloop Context to use for timers
* @compat: The compatibility mode of the agent
* @compat: The compatibility mode of the agent
* @reliable: The reliability mode of the agent
* @flags: Flags to set the properties
* @nomination: The nomination mode of the agent
*
*
* Create a new #NiceAgent with parameters that must be be defined at
* Create a new #NiceAgent with parameters that must be be defined at
* construction time.
* construction time.
* The returned object must be freed with g_object_unref()
* The returned object must be freed with g_object_unref()
* <para> See also: #NiceNominationMode </para>
* <para> See also: #NiceNominationMode
and #NiceAgentOption
</para>
*
*
* Since: UNRELEASED
* Since: UNRELEASED
*
*
...
@@ -467,8 +485,7 @@ nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat);
...
@@ -467,8 +485,7 @@ nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat);
NiceAgent
*
NiceAgent
*
nice_agent_new_full
(
GMainContext
*
ctx
,
nice_agent_new_full
(
GMainContext
*
ctx
,
NiceCompatibility
compat
,
NiceCompatibility
compat
,
gboolean
reliable
,
NiceAgentOption
flags
);
NiceNominationMode
nomination
);
/**
/**
* nice_agent_add_local_address:
* nice_agent_add_local_address:
...
...
tests/test-nomination.c
View file @
e3ddaa28
...
@@ -140,13 +140,13 @@ run_test(NiceNominationMode l_nomination_mode,
...
@@ -140,13 +140,13 @@ run_test(NiceNominationMode l_nomination_mode,
lagent
=
nice_agent_new_full
(
NULL
,
lagent
=
nice_agent_new_full
(
NULL
,
NICE_COMPATIBILITY_RFC5245
,
NICE_COMPATIBILITY_RFC5245
,
FALSE
,
/* reliable */
l_nomination_mode
==
NICE_NOMINATION_MODE_REGULAR
?
l_nomination_mode
);
NICE_AGENT_OPTION_REGULAR_NOMINATION
:
0
);
ragent
=
nice_agent_new_full
(
NULL
,
ragent
=
nice_agent_new_full
(
NULL
,
NICE_COMPATIBILITY_RFC5245
,
NICE_COMPATIBILITY_RFC5245
,
FALSE
,
/* reliable */
r_nomination_mode
==
NICE_NOMINATION_MODE_REGULAR
?
r_nomination_mode
);
NICE_AGENT_OPTION_REGULAR_NOMINATION
:
0
);
g_object_set
(
G_OBJECT
(
lagent
),
"ice-tcp"
,
FALSE
,
NULL
);
g_object_set
(
G_OBJECT
(
lagent
),
"ice-tcp"
,
FALSE
,
NULL
);
g_object_set
(
G_OBJECT
(
ragent
),
"ice-tcp"
,
FALSE
,
NULL
);
g_object_set
(
G_OBJECT
(
ragent
),
"ice-tcp"
,
FALSE
,
NULL
);
...
...
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