diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2012-09-14 16:37:32 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2012-09-14 16:37:32 -0400 |
commit | 23376fd825bf8aaa9181e9217edbb82189ee07d9 (patch) | |
tree | 4dce411e8894a141b3ee644ffb151dc0c8f82121 | |
parent | 143aff0c4420f517f9ac2258f1fefbeddd5fbf37 (diff) | |
download | farstream-23376fd825bf8aaa9181e9217edbb82189ee07d9.tar.gz |
candidate: Add fs_candidate_new_full()
Without it, introspection can not set the other field
-rw-r--r-- | docs/libs/farstream-libs-sections.txt | 1 | ||||
-rw-r--r-- | farstream/fs-candidate.c | 59 | ||||
-rw-r--r-- | farstream/fs-candidate.h | 25 |
3 files changed, 79 insertions, 6 deletions
diff --git a/docs/libs/farstream-libs-sections.txt b/docs/libs/farstream-libs-sections.txt index 453136cd..5a410841 100644 --- a/docs/libs/farstream-libs-sections.txt +++ b/docs/libs/farstream-libs-sections.txt @@ -115,6 +115,7 @@ FsCandidateType FsNetworkProtocol FsComponentType fs_candidate_new +fs_candidate_new_full fs_candidate_destroy fs_candidate_copy fs_candidate_list_destroy diff --git a/farstream/fs-candidate.c b/farstream/fs-candidate.c index 627ef0b2..acdc5d46 100644 --- a/farstream/fs-candidate.c +++ b/farstream/fs-candidate.c @@ -177,7 +177,7 @@ fs_candidate_list_copy (const GList *candidate_list) * @port: the UDP/TCP port * * Allocates a new #FsCandidate, the rest of the fields can be optionally - * filled manually. + * filled manually. See also fs_candidate_new_full() * * Returns: a newly-allocated #FsCandidate */ @@ -202,3 +202,60 @@ fs_candidate_new ( return candidate; } + +/** + * fs_candidate_new_full: + * @foundation: The foundation of the candidate + * @component_id: The component this candidate is for + * @ip: The IP address of this component (can be NULL for local candidate to + * mean any address) + * @port: the UDP/TCP port + * @base_ip: IP of base in dotted format as defined in ICE-19. + * @base_port: Port of base as defined in ICE-19. + * @proto: The protocol this component is for + * @priority: Value between 0 and (2^31 - 1) representing the priority + * @type: The type of candidate + * @username: Username to use to connect to client if necessary, + * NULL otherwise + * @password: Username to use to connect to client if necessary, + * NULL otherwise + * @ttl: The TTL used when sending Multicast packet (0 = auto) + * + * Allocates a new #FsCandidate, filling all the fields. See also + * fs_candidate_new() + * + * Returns: a newly-allocated #FsCandidate + */ + +FsCandidate * +fs_candidate_new_full ( + const gchar *foundation, + guint component_id, + const gchar *ip, + guint16 port, + const gchar *base_ip, + guint16 base_port, + FsNetworkProtocol proto, + guint32 priority, + FsCandidateType type, + const gchar *username, + const gchar *password, + guint ttl) +{ + FsCandidate *candidate = g_slice_new (FsCandidate); + + candidate->foundation = g_strdup (foundation); + candidate->component_id = component_id; + candidate->ip = g_strdup (ip); + candidate->port = port; + candidate->base_ip = g_strdup (base_ip); + candidate->base_port = base_port; + candidate->proto = proto; + candidate->priority = priority; + candidate->type = type; + candidate->username = g_strdup (username); + candidate->password = g_strdup (password); + candidate->ttl = ttl; + + return candidate; +} diff --git a/farstream/fs-candidate.h b/farstream/fs-candidate.h index 20866a85..361bf25f 100644 --- a/farstream/fs-candidate.h +++ b/farstream/fs-candidate.h @@ -111,15 +111,15 @@ struct _FsCandidate { gchar *foundation; guint component_id; - const gchar *ip; + gchar *ip; guint16 port; - const gchar *base_ip; + gchar *base_ip; guint16 base_port; FsNetworkProtocol proto; guint32 priority; FsCandidateType type; - const gchar *username; - const gchar *password; + gchar *username; + gchar *password; guint ttl; }; @@ -134,7 +134,7 @@ void fs_candidate_list_destroy (GList *candidate_list); GList *fs_candidate_list_copy (const GList *candidate_list); -FsCandidate * fs_candidate_new ( +FsCandidate *fs_candidate_new ( const gchar *foundation, guint component_id, FsCandidateType type, @@ -142,5 +142,20 @@ FsCandidate * fs_candidate_new ( const gchar *ip, guint port); +FsCandidate *fs_candidate_new_full ( + const gchar *foundation, + guint component_id, + const gchar *ip, + guint16 port, + const gchar *base_ip, + guint16 base_port, + FsNetworkProtocol proto, + guint32 priority, + FsCandidateType type, + const gchar *username, + const gchar *password, + guint ttl); + + G_END_DECLS #endif /* __FS_CANDIDATE_H__ */ |