Mercurial > pidgin
annotate libpurple/protocols/jabber/jingle/iceudp.c @ 28442:e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Multiple similar to:
==21150== 412 (32 direct, 380 indirect) bytes in 2 blocks are definitely lost in loss record 12,416 of 13,348
==21150== at 0x4C221A7: malloc (vg_replace_malloc.c:195)
==21150== by 0x90AA552: g_malloc (gmem.c:131)
==21150== by 0x90C03C7: g_slice_alloc (gslice.c:824)
==21150== by 0x90C0E05: g_slist_append (gslist.c:117)
==21150== by 0x93AE56F: purple_privacy_permit_add (privacy.c:58)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 26 Oct 2009 04:21:28 +0000 |
parents | c585572e80dd |
children | a8cc50c2279f |
rev | line source |
---|---|
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
1 /** |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file iceudp.c |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
4 * purple |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
5 * |
28048
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26756
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26756
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26756
diff
changeset
|
8 * source distribution. |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
26756
diff
changeset
|
9 * |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
13 * (at your option) any later version. |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
14 * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
19 * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
23 */ |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
24 |
26010
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
25 #include "internal.h" |
db517c55c508
Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
26 |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
27 #include "iceudp.h" |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
28 #include "jingle.h" |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
29 #include "debug.h" |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
30 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
31 #include <string.h> |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
32 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
33 struct _JingleIceUdpPrivate |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
34 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
35 GList *local_candidates; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
36 GList *remote_candidates; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
37 }; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
38 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
39 #define JINGLE_ICEUDP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_ICEUDP, JingleIceUdpPrivate)) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
40 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
41 static void jingle_iceudp_class_init (JingleIceUdpClass *klass); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
42 static void jingle_iceudp_init (JingleIceUdp *iceudp); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
43 static void jingle_iceudp_finalize (GObject *object); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
44 static void jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
45 static void jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
46 static JingleTransport *jingle_iceudp_parse_internal(xmlnode *iceudp); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
47 static xmlnode *jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
48 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
49 static JingleTransportClass *parent_class = NULL; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
50 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
51 enum { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
52 PROP_0, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
53 PROP_LOCAL_CANDIDATES, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
54 PROP_REMOTE_CANDIDATES, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
55 }; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
56 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
57 static JingleIceUdpCandidate * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
58 jingle_iceudp_candidate_copy(JingleIceUdpCandidate *candidate) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
59 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
60 JingleIceUdpCandidate *new_candidate = g_new0(JingleIceUdpCandidate, 1); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
61 new_candidate->component = candidate->component; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
62 new_candidate->foundation = g_strdup(candidate->foundation); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
63 new_candidate->generation = candidate->generation; |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
64 new_candidate->id = g_strdup(candidate->id); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
65 new_candidate->ip = g_strdup(candidate->ip); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
66 new_candidate->network = candidate->network; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
67 new_candidate->port = candidate->port; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
68 new_candidate->priority = candidate->priority; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
69 new_candidate->protocol = g_strdup(candidate->protocol); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
70 new_candidate->type = g_strdup(candidate->type); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
71 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
72 new_candidate->username = g_strdup(candidate->username); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
73 new_candidate->password = g_strdup(candidate->password); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
74 |
26294
1ac93927e7f5
Don't forget to copy the rem_know attribute of IceUdp candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26293
diff
changeset
|
75 new_candidate->rem_known = candidate->rem_known; |
1ac93927e7f5
Don't forget to copy the rem_know attribute of IceUdp candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26293
diff
changeset
|
76 |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
77 return new_candidate; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
78 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
79 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
80 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
81 jingle_iceudp_candidate_free(JingleIceUdpCandidate *candidate) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
82 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
83 g_free(candidate->foundation); |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
84 g_free(candidate->id); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
85 g_free(candidate->ip); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
86 g_free(candidate->protocol); |
26119
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
87 g_free(candidate->reladdr); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
88 g_free(candidate->type); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
89 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
90 g_free(candidate->username); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
91 g_free(candidate->password); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
92 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
93 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
94 GType |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
95 jingle_iceudp_candidate_get_type() |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
96 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
97 static GType type = 0; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
98 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
99 if (type == 0) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
100 type = g_boxed_type_register_static("JingleIceUdpCandidate", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
101 (GBoxedCopyFunc)jingle_iceudp_candidate_copy, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
102 (GBoxedFreeFunc)jingle_iceudp_candidate_free); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
103 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
104 return type; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
105 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
106 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
107 JingleIceUdpCandidate * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
108 jingle_iceudp_candidate_new(guint component, const gchar *foundation, |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
109 guint generation, const gchar *id, const gchar *ip, |
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
110 guint network, guint port, guint priority, |
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
111 const gchar *protocol, const gchar *type, |
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
112 const gchar *username, const gchar *password) |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
113 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
114 JingleIceUdpCandidate *candidate = g_new0(JingleIceUdpCandidate, 1); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
115 candidate->component = component; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
116 candidate->foundation = g_strdup(foundation); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
117 candidate->generation = generation; |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
118 candidate->id = g_strdup(id); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
119 candidate->ip = g_strdup(ip); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
120 candidate->network = network; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
121 candidate->port = port; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
122 candidate->priority = priority; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
123 candidate->protocol = g_strdup(protocol); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
124 candidate->type = g_strdup(type); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
125 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
126 candidate->username = g_strdup(username); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
127 candidate->password = g_strdup(password); |
26293
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
128 |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
129 candidate->rem_known = FALSE; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
130 return candidate; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
131 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
132 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
133 GType |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
134 jingle_iceudp_get_type() |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
135 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
136 static GType type = 0; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
137 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
138 if (type == 0) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
139 static const GTypeInfo info = { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
140 sizeof(JingleIceUdpClass), |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
141 NULL, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
142 NULL, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
143 (GClassInitFunc) jingle_iceudp_class_init, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
144 NULL, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
145 NULL, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
146 sizeof(JingleIceUdp), |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
147 0, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
148 (GInstanceInitFunc) jingle_iceudp_init, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
149 NULL |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
150 }; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
151 type = g_type_register_static(JINGLE_TYPE_TRANSPORT, "JingleIceUdp", &info, 0); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
152 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
153 return type; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
154 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
155 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
156 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
157 jingle_iceudp_class_init (JingleIceUdpClass *klass) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
158 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
159 GObjectClass *gobject_class = (GObjectClass*)klass; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
160 parent_class = g_type_class_peek_parent(klass); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
161 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
162 gobject_class->finalize = jingle_iceudp_finalize; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
163 gobject_class->set_property = jingle_iceudp_set_property; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
164 gobject_class->get_property = jingle_iceudp_get_property; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
165 klass->parent_class.to_xml = jingle_iceudp_to_xml_internal; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
166 klass->parent_class.parse = jingle_iceudp_parse_internal; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
167 klass->parent_class.transport_type = JINGLE_TRANSPORT_ICEUDP; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
168 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
169 g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
170 g_param_spec_pointer("local-candidates", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
171 "Local candidates", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
172 "The local candidates for this transport.", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
173 G_PARAM_READABLE)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
174 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
175 g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES, |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
176 g_param_spec_pointer("remote-candidates", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
177 "Remote candidates", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
178 "The remote candidates for this transport.", |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
179 G_PARAM_READABLE)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
180 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
181 g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
182 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
183 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
184 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
185 jingle_iceudp_init (JingleIceUdp *iceudp) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
186 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
187 iceudp->priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); |
26291
30cc73d99789
Fix a bunch of memsets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
188 iceudp->priv->local_candidates = NULL; |
30cc73d99789
Fix a bunch of memsets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
189 iceudp->priv->remote_candidates = NULL; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
190 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
191 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
192 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
193 jingle_iceudp_finalize (GObject *iceudp) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
194 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
195 /* JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); */ |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
196 purple_debug_info("jingle","jingle_iceudp_finalize\n"); |
26290
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26287
diff
changeset
|
197 |
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26287
diff
changeset
|
198 G_OBJECT_CLASS(parent_class)->finalize(iceudp); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
199 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
200 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
201 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
202 jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
203 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
204 JingleIceUdp *iceudp; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
205 g_return_if_fail(JINGLE_IS_ICEUDP(object)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
206 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
207 iceudp = JINGLE_ICEUDP(object); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
208 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
209 switch (prop_id) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
210 case PROP_LOCAL_CANDIDATES: |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
211 iceudp->priv->local_candidates = |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
212 g_value_get_pointer(value); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
213 break; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
214 case PROP_REMOTE_CANDIDATES: |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
215 iceudp->priv->remote_candidates = |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
216 g_value_get_pointer(value); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
217 break; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
218 default: |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
219 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
220 break; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
221 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
222 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
223 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
224 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
225 jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
226 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
227 JingleIceUdp *iceudp; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
228 g_return_if_fail(JINGLE_IS_ICEUDP(object)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
229 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
230 iceudp = JINGLE_ICEUDP(object); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
231 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
232 switch (prop_id) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
233 case PROP_LOCAL_CANDIDATES: |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
234 g_value_set_pointer(value, iceudp->priv->local_candidates); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
235 break; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
236 case PROP_REMOTE_CANDIDATES: |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
237 g_value_set_pointer(value, iceudp->priv->remote_candidates); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
238 break; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
239 default: |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
240 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
241 break; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
242 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
243 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
244 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
245 void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
246 jingle_iceudp_add_local_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
247 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
248 GList *iter = iceudp->priv->local_candidates; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
249 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
250 for (; iter; iter = g_list_next(iter)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
251 JingleIceUdpCandidate *c = iter->data; |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
252 if (!strcmp(c->id, candidate->id)) { |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
253 guint generation = c->generation + 1; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
254 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
255 g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, c); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
256 iceudp->priv->local_candidates = g_list_delete_link( |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
257 iceudp->priv->local_candidates, iter); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
258 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
259 candidate->generation = generation; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
260 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
261 iceudp->priv->local_candidates = g_list_append( |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
262 iceudp->priv->local_candidates, candidate); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
263 return; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
264 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
265 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
266 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
267 iceudp->priv->local_candidates = g_list_append( |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
268 iceudp->priv->local_candidates, candidate); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
269 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
270 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
271 GList * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
272 jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
273 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
274 return g_list_copy(iceudp->priv->remote_candidates); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
275 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
276 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
277 static JingleIceUdpCandidate * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
278 jingle_iceudp_get_remote_candidate_by_id(JingleIceUdp *iceudp, |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
279 const gchar *id) |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
280 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
281 GList *iter = iceudp->priv->remote_candidates; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
282 for (; iter; iter = g_list_next(iter)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
283 JingleIceUdpCandidate *candidate = iter->data; |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
284 if (!strcmp(candidate->id, id)) { |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
285 return candidate; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
286 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
287 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
288 return NULL; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
289 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
290 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
291 static void |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
292 jingle_iceudp_add_remote_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
293 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
294 JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
295 JingleIceUdpCandidate *iceudp_candidate = |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
296 jingle_iceudp_get_remote_candidate_by_id(iceudp, |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
297 candidate->id); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
298 if (iceudp_candidate != NULL) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
299 priv->remote_candidates = g_list_remove( |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
300 priv->remote_candidates, iceudp_candidate); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
301 g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, iceudp_candidate); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
302 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
303 priv->remote_candidates = g_list_append(priv->remote_candidates, candidate); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
304 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
305 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
306 static JingleTransport * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
307 jingle_iceudp_parse_internal(xmlnode *iceudp) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
308 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
309 JingleTransport *transport = parent_class->parse(iceudp); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
310 xmlnode *candidate = xmlnode_get_child(iceudp, "candidate"); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
311 JingleIceUdpCandidate *iceudp_candidate = NULL; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
312 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
313 const gchar *username = xmlnode_get_attrib(iceudp, "ufrag"); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
314 const gchar *password = xmlnode_get_attrib(iceudp, "pwd"); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
315 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
316 for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { |
26756
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
317 const gchar *relport = xmlnode_get_attrib(candidate, "rel-port"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
318 const gchar *component = xmlnode_get_attrib(candidate, "component"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
319 const gchar *foundation = xmlnode_get_attrib(candidate, "foundation"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
320 const gchar *generation = xmlnode_get_attrib(candidate, "generation"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
321 const gchar *id = xmlnode_get_attrib(candidate, "id"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
322 const gchar *ip = xmlnode_get_attrib(candidate, "ip"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
323 const gchar *network = xmlnode_get_attrib(candidate, "network"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
324 const gchar *port = xmlnode_get_attrib(candidate, "port"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
325 const gchar *priority = xmlnode_get_attrib(candidate, "priority"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
326 const gchar *protocol = xmlnode_get_attrib(candidate, "protocol"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
327 const gchar *type = xmlnode_get_attrib(candidate, "type"); |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
328 |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
329 if (!component || !foundation || !generation || !id || !ip || |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
330 !network || !port || !priority || !protocol || !type) |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
331 continue; |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
332 |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
333 iceudp_candidate = jingle_iceudp_candidate_new( |
26756
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
334 atoi(component), |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
335 foundation, |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
336 atoi(generation), |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
337 id, |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
338 ip, |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
339 atoi(network), |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
340 atoi(port), |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
341 atoi(priority), |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
342 protocol, |
cfde0f7fd54f
Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents:
26294
diff
changeset
|
343 type, |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
344 username, password); |
26119
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
345 iceudp_candidate->reladdr = g_strdup( |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
346 xmlnode_get_attrib(candidate, "rel-addr")); |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
347 iceudp_candidate->relport = |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
348 relport != NULL ? atoi(relport) : 0; |
26293
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
349 iceudp_candidate->rem_known = TRUE; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
350 jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
351 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
352 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
353 return transport; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
354 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
355 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
356 static xmlnode * |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
357 jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
358 { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
359 xmlnode *node = parent_class->to_xml(transport, content, action); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
360 |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
361 if (action == JINGLE_SESSION_INITIATE || |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
362 action == JINGLE_SESSION_ACCEPT || |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
363 action == JINGLE_TRANSPORT_INFO || |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
364 action == JINGLE_CONTENT_ADD || |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
365 action == JINGLE_TRANSPORT_REPLACE) { |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
366 JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(transport); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26128
diff
changeset
|
367 GList *iter = priv->local_candidates; |
26293
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
368 gboolean used_candidate = FALSE; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
369 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
370 for (; iter; iter = g_list_next(iter)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
371 JingleIceUdpCandidate *candidate = iter->data; |
26293
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
372 xmlnode *xmltransport; |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
373 gchar *component, *generation, *network, |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
374 *port, *priority; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
375 |
26293
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
376 if (candidate->rem_known == TRUE) |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
377 continue; |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
378 |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
379 used_candidate = TRUE; |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
380 candidate->rem_known = TRUE; |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
381 |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
382 xmltransport = xmlnode_new_child(node, "candidate"); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
383 component = g_strdup_printf("%d", candidate->component); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
384 generation = g_strdup_printf("%d", |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
385 candidate->generation); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
386 network = g_strdup_printf("%d", candidate->network); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
387 port = g_strdup_printf("%d", candidate->port); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
388 priority = g_strdup_printf("%d", candidate->priority); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
389 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
390 xmlnode_set_attrib(xmltransport, "component", component); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
391 xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
392 xmlnode_set_attrib(xmltransport, "generation", generation); |
26097
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26010
diff
changeset
|
393 xmlnode_set_attrib(xmltransport, "id", candidate->id); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
394 xmlnode_set_attrib(xmltransport, "ip", candidate->ip); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
395 xmlnode_set_attrib(xmltransport, "network", network); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
396 xmlnode_set_attrib(xmltransport, "port", port); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
397 xmlnode_set_attrib(xmltransport, "priority", priority); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
398 xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
399 |
26119
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
400 if (candidate->reladdr != NULL && |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
401 (strcmp(candidate->ip, candidate->reladdr) || |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
402 (candidate->port != candidate->relport))) { |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
403 gchar *relport = g_strdup_printf("%d", |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
404 candidate->relport); |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
405 xmlnode_set_attrib(xmltransport, "rel-addr", |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
406 candidate->reladdr); |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
407 xmlnode_set_attrib(xmltransport, "rel-port", |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
408 relport); |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
409 g_free(relport); |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
410 } |
36c7efb85220
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26097
diff
changeset
|
411 |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
412 xmlnode_set_attrib(xmltransport, "type", candidate->type); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
413 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
414 g_free(component); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
415 g_free(generation); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
416 g_free(network); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
417 g_free(port); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
418 g_free(priority); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
419 } |
26293
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
420 |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
421 if (used_candidate == TRUE) { |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
422 JingleIceUdpCandidate *candidate = |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
423 priv->local_candidates->data; |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
424 xmlnode_set_attrib(node, "pwd", candidate->password); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
425 xmlnode_set_attrib(node, "ufrag", candidate->username); |
06693083f668
Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26291
diff
changeset
|
426 } |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
427 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
428 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
429 return node; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
430 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
431 |