diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2011-11-07 21:15:04 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-28 16:08:12 +0100 |
commit | 50462e1f31c66ff2bcd941b8942d9020ade0ca23 (patch) | |
tree | 03623d857086872793725ef5904873e84eaa1abc /telepathy-farstream | |
parent | b3f1ba43b545087490ad1054ce62078f48fe64e4 (diff) | |
download | telepathy-farstream-50462e1f31c66ff2bcd941b8942d9020ade0ca23.tar.gz |
Set all the attributes from FsCandidate to Call candidates
Diffstat (limited to 'telepathy-farstream')
-rw-r--r-- | telepathy-farstream/call-stream.c | 65 |
1 files changed, 60 insertions, 5 deletions
diff --git a/telepathy-farstream/call-stream.c b/telepathy-farstream/call-stream.c index 9c8e7eb..59a86c3 100644 --- a/telepathy-farstream/call-stream.c +++ b/telepathy-farstream/call-stream.c @@ -1222,24 +1222,79 @@ tf_call_stream_new (TfCallChannel *call_channel, return self; } +static TpCallStreamCandidateType +fscandidatetype_to_tp (FsCandidateType type) +{ + switch(type) + { + case FS_CANDIDATE_TYPE_HOST: + return TP_CALL_STREAM_CANDIDATE_TYPE_HOST; + case FS_CANDIDATE_TYPE_SRFLX: + return TP_CALL_STREAM_CANDIDATE_TYPE_SERVER_REFLEXIVE; + case FS_CANDIDATE_TYPE_PRFLX: + return TP_CALL_STREAM_CANDIDATE_TYPE_PEER_REFLEXIVE; + case FS_CANDIDATE_TYPE_RELAY: + return TP_CALL_STREAM_CANDIDATE_TYPE_RELAY; + case FS_CANDIDATE_TYPE_MULTICAST: + return TP_CALL_STREAM_CANDIDATE_TYPE_MULTICAST; + default: + g_warning ("Unkown candidate type, assigning type NONE"); + return TP_CALL_STREAM_CANDIDATE_TYPE_NONE; + } +} + + +static TpMediaStreamBaseProto +fs_network_proto_to_tp (FsNetworkProtocol proto) +{ + switch (proto) + { + case FS_NETWORK_PROTOCOL_UDP: + return TP_MEDIA_STREAM_BASE_PROTO_UDP; + case FS_NETWORK_PROTOCOL_TCP: + return TP_MEDIA_STREAM_BASE_PROTO_TCP; + default: + g_warning ("Invalid protocl, assigning to UDP"); + return TP_MEDIA_STREAM_BASE_PROTO_UDP; + } +} + + static GValueArray * fscandidate_to_tpcandidate (TfCallStream *stream, FsCandidate *candidate) { GHashTable *extra_info; extra_info = tp_asv_new (NULL, NULL); - if (candidate->priority) - tp_asv_set_uint32 (extra_info, "Priority", candidate->priority); + + tp_asv_set_uint32 (extra_info, "type", + fscandidatetype_to_tp (candidate->type)); if (candidate->foundation) - tp_asv_set_string (extra_info, "Foundation", candidate->foundation); + tp_asv_set_string (extra_info, "foundation", candidate->foundation); + + tp_asv_set_uint32 (extra_info, "protocol", + fs_network_proto_to_tp (candidate->proto)); + + if (candidate->base_ip) + { + tp_asv_set_string (extra_info, "base-ip", candidate->base_ip); + tp_asv_set_uint32 (extra_info, "base-port", candidate->base_port); + } + + if (candidate->priority) + tp_asv_set_uint32 (extra_info, "priority", candidate->priority); + + + if (candidate->type == FS_CANDIDATE_TYPE_MULTICAST) + tp_asv_set_uint32 (extra_info, "ttl", candidate->ttl); if (stream->multiple_usernames) { if (candidate->username) - tp_asv_set_string (extra_info, "Username", candidate->username); + tp_asv_set_string (extra_info, "username", candidate->username); if (candidate->password) - tp_asv_set_string (extra_info, "Password", candidate->password); + tp_asv_set_string (extra_info, "password", candidate->password); } |