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