Commit bddeefdf authored by Juan Navarro's avatar Juan Navarro Committed by Olivier Crête

agent: Unify constructors into nice_agent_new_full

Instead of having 3 independent implementations, make the simpler
versions delegate into the full one.

The simplest constructor needs to pass "no option", for which no
constant exists in the NiceAgentOption enum. Thus the new
NICE_AGENT_OPTION_NONE constant is added to reflect this possibility.
parent 48a8a498
...@@ -1298,26 +1298,14 @@ nice_agent_init (NiceAgent *agent) ...@@ -1298,26 +1298,14 @@ nice_agent_init (NiceAgent *agent)
NICEAPI_EXPORT NiceAgent * NICEAPI_EXPORT NiceAgent *
nice_agent_new (GMainContext *ctx, NiceCompatibility compat) nice_agent_new (GMainContext *ctx, NiceCompatibility compat)
{ {
NiceAgent *agent = g_object_new (NICE_TYPE_AGENT, return nice_agent_new_full (ctx, compat, NICE_AGENT_OPTION_NONE);
"compatibility", compat,
"main-context", ctx,
"reliable", FALSE,
NULL);
return agent;
} }
NICEAPI_EXPORT NiceAgent * NICEAPI_EXPORT NiceAgent *
nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat) nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat)
{ {
NiceAgent *agent = g_object_new (NICE_TYPE_AGENT, return nice_agent_new_full (ctx, compat, NICE_AGENT_OPTION_RELIABLE);
"compatibility", compat,
"main-context", ctx,
"reliable", TRUE,
NULL);
return agent;
} }
......
...@@ -400,6 +400,7 @@ typedef enum ...@@ -400,6 +400,7 @@ typedef enum
/** /**
* NiceAgentOption: * NiceAgentOption:
* @NICE_AGENT_OPTION_NONE: No enabled options (Since: 0.1.19)
* @NICE_AGENT_OPTION_REGULAR_NOMINATION: Enables regular nomination, default * @NICE_AGENT_OPTION_REGULAR_NOMINATION: Enables regular nomination, default
* is aggrssive mode (see #NiceNominationMode). * is aggrssive mode (see #NiceNominationMode).
* @NICE_AGENT_OPTION_RELIABLE: Enables reliable mode, possibly using PseudoTCP, * see nice_agent_new_reliable(). * @NICE_AGENT_OPTION_RELIABLE: Enables reliable mode, possibly using PseudoTCP, * see nice_agent_new_reliable().
...@@ -416,6 +417,7 @@ typedef enum ...@@ -416,6 +417,7 @@ typedef enum
* Since: 0.1.15 * Since: 0.1.15
*/ */
typedef enum { typedef enum {
NICE_AGENT_OPTION_NONE = 0,
NICE_AGENT_OPTION_REGULAR_NOMINATION = 1 << 0, NICE_AGENT_OPTION_REGULAR_NOMINATION = 1 << 0,
NICE_AGENT_OPTION_RELIABLE = 1 << 1, NICE_AGENT_OPTION_RELIABLE = 1 << 1,
NICE_AGENT_OPTION_LITE_MODE = 1 << 2, NICE_AGENT_OPTION_LITE_MODE = 1 << 2,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment