annotate libpurple/protocols/jabber/jingle/iceudp.c @ 27198:d3b6776186ce

Eagle eyes McMarq S. caught two other typo. Now I'm wondering if this was some kind of inside joke.
author Mark Doliner <mark@kingant.net>
date Thu, 18 Jun 2009 22:21:59 +0000
parents cfde0f7fd54f
children c585572e80dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26042
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 *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
6 * 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
7 * 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
8 * 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
9 * (at your option) any later version.
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
10 *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
11 * 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
12 * 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
13 * 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
14 * GNU General Public License for more details.
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
15 *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
16 * 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
17 * 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
18 * 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
19 */
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
20
26092
db517c55c508 Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26042
diff changeset
21 #include "internal.h"
db517c55c508 Make it compile in Windows with the equivalent of --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26042
diff changeset
22
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
23 #include "iceudp.h"
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
24 #include "jingle.h"
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
25 #include "debug.h"
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
26
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
27 #include <string.h>
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
28
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
29 struct _JingleIceUdpPrivate
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 GList *local_candidates;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
32 GList *remote_candidates;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
33 };
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 #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
36
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
37 static void jingle_iceudp_class_init (JingleIceUdpClass *klass);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
38 static void jingle_iceudp_init (JingleIceUdp *iceudp);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
39 static void jingle_iceudp_finalize (GObject *object);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
40 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
41 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
42 static JingleTransport *jingle_iceudp_parse_internal(xmlnode *iceudp);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
43 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
44
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
45 static JingleTransportClass *parent_class = NULL;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
46
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
47 enum {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
48 PROP_0,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
49 PROP_LOCAL_CANDIDATES,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
50 PROP_REMOTE_CANDIDATES,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
51 };
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
52
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
53 static JingleIceUdpCandidate *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
54 jingle_iceudp_candidate_copy(JingleIceUdpCandidate *candidate)
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 JingleIceUdpCandidate *new_candidate = g_new0(JingleIceUdpCandidate, 1);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
57 new_candidate->component = candidate->component;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
58 new_candidate->foundation = g_strdup(candidate->foundation);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
59 new_candidate->generation = candidate->generation;
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
60 new_candidate->id = g_strdup(candidate->id);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
61 new_candidate->ip = g_strdup(candidate->ip);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
62 new_candidate->network = candidate->network;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
63 new_candidate->port = candidate->port;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
64 new_candidate->priority = candidate->priority;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
65 new_candidate->protocol = g_strdup(candidate->protocol);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
66 new_candidate->type = g_strdup(candidate->type);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
67
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
68 new_candidate->username = g_strdup(candidate->username);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
69 new_candidate->password = g_strdup(candidate->password);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
70
26376
1ac93927e7f5 Don't forget to copy the rem_know attribute of IceUdp candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26375
diff changeset
71 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: 26375
diff changeset
72
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
73 return new_candidate;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
74 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
75
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
76 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
77 jingle_iceudp_candidate_free(JingleIceUdpCandidate *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 g_free(candidate->foundation);
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
80 g_free(candidate->id);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
81 g_free(candidate->ip);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
82 g_free(candidate->protocol);
26201
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
83 g_free(candidate->reladdr);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
84 g_free(candidate->type);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
85
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
86 g_free(candidate->username);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
87 g_free(candidate->password);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
88 }
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 GType
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
91 jingle_iceudp_candidate_get_type()
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 static GType type = 0;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
94
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
95 if (type == 0) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
96 type = g_boxed_type_register_static("JingleIceUdpCandidate",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
97 (GBoxedCopyFunc)jingle_iceudp_candidate_copy,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
98 (GBoxedFreeFunc)jingle_iceudp_candidate_free);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
99 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
100 return type;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
101 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
102
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
103 JingleIceUdpCandidate *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
104 jingle_iceudp_candidate_new(guint component, const gchar *foundation,
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
105 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: 26092
diff changeset
106 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: 26092
diff changeset
107 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: 26092
diff changeset
108 const gchar *username, const gchar *password)
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
109 {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
110 JingleIceUdpCandidate *candidate = g_new0(JingleIceUdpCandidate, 1);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
111 candidate->component = component;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
112 candidate->foundation = g_strdup(foundation);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
113 candidate->generation = generation;
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
114 candidate->id = g_strdup(id);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
115 candidate->ip = g_strdup(ip);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
116 candidate->network = network;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
117 candidate->port = port;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
118 candidate->priority = priority;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
119 candidate->protocol = g_strdup(protocol);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
120 candidate->type = g_strdup(type);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
121
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
122 candidate->username = g_strdup(username);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
123 candidate->password = g_strdup(password);
26375
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
124
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
125 candidate->rem_known = FALSE;
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
126 return candidate;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
127 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
128
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
129 GType
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
130 jingle_iceudp_get_type()
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 static GType type = 0;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
133
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
134 if (type == 0) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
135 static const GTypeInfo info = {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
136 sizeof(JingleIceUdpClass),
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
137 NULL,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
138 NULL,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
139 (GClassInitFunc) jingle_iceudp_class_init,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
140 NULL,
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 sizeof(JingleIceUdp),
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
143 0,
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
144 (GInstanceInitFunc) jingle_iceudp_init,
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 };
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
147 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
148 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
149 return type;
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
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
152 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
153 jingle_iceudp_class_init (JingleIceUdpClass *klass)
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 GObjectClass *gobject_class = (GObjectClass*)klass;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
156 parent_class = g_type_class_peek_parent(klass);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
157
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
158 gobject_class->finalize = jingle_iceudp_finalize;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
159 gobject_class->set_property = jingle_iceudp_set_property;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
160 gobject_class->get_property = jingle_iceudp_get_property;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
161 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
162 klass->parent_class.parse = jingle_iceudp_parse_internal;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
163 klass->parent_class.transport_type = JINGLE_TRANSPORT_ICEUDP;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
164
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
165 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
166 g_param_spec_pointer("local-candidates",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
167 "Local candidates",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
168 "The local candidates for this transport.",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
169 G_PARAM_READABLE));
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
170
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
171 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
172 g_param_spec_pointer("remote-candidates",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
173 "Remote candidates",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
174 "The remote candidates for this transport.",
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
175 G_PARAM_READABLE));
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
176
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
177 g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate));
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
178 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
179
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
180 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
181 jingle_iceudp_init (JingleIceUdp *iceudp)
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 iceudp->priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp);
26373
30cc73d99789 Fix a bunch of memsets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
184 iceudp->priv->local_candidates = NULL;
30cc73d99789 Fix a bunch of memsets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
185 iceudp->priv->remote_candidates = NULL;
26042
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
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
188 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
189 jingle_iceudp_finalize (GObject *iceudp)
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 /* JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); */
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
192 purple_debug_info("jingle","jingle_iceudp_finalize\n");
26372
44684f0d2e42 Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
193
44684f0d2e42 Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
194 G_OBJECT_CLASS(parent_class)->finalize(iceudp);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
195 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
196
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
197 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
198 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
199 {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
200 JingleIceUdp *iceudp;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
201 g_return_if_fail(JINGLE_IS_ICEUDP(object));
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
202
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
203 iceudp = JINGLE_ICEUDP(object);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
204
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
205 switch (prop_id) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
206 case PROP_LOCAL_CANDIDATES:
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
207 iceudp->priv->local_candidates =
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
208 g_value_get_pointer(value);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
209 break;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
210 case PROP_REMOTE_CANDIDATES:
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
211 iceudp->priv->remote_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 default:
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
215 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
216 break;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
217 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
218 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
219
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
220 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
221 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
222 {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
223 JingleIceUdp *iceudp;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
224 g_return_if_fail(JINGLE_IS_ICEUDP(object));
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
225
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
226 iceudp = JINGLE_ICEUDP(object);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
227
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
228 switch (prop_id) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
229 case PROP_LOCAL_CANDIDATES:
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
230 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
231 break;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
232 case PROP_REMOTE_CANDIDATES:
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
233 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
234 break;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
235 default:
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
236 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
237 break;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
238 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
239 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
240
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
241 void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
242 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
243 {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
244 GList *iter = iceudp->priv->local_candidates;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
245
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
246 for (; iter; iter = g_list_next(iter)) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
247 JingleIceUdpCandidate *c = iter->data;
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
248 if (!strcmp(c->id, candidate->id)) {
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
249 guint generation = c->generation + 1;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
250
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
251 g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, c);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
252 iceudp->priv->local_candidates = g_list_delete_link(
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
253 iceudp->priv->local_candidates, iter);
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 candidate->generation = generation;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
256
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
257 iceudp->priv->local_candidates = g_list_append(
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
258 iceudp->priv->local_candidates, candidate);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
259 return;
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 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
262
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
263 iceudp->priv->local_candidates = g_list_append(
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
264 iceudp->priv->local_candidates, candidate);
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 GList *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
268 jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp)
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 return g_list_copy(iceudp->priv->remote_candidates);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
271 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
272
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
273 static JingleIceUdpCandidate *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
274 jingle_iceudp_get_remote_candidate_by_id(JingleIceUdp *iceudp,
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
275 const gchar *id)
26042
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 GList *iter = iceudp->priv->remote_candidates;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
278 for (; iter; iter = g_list_next(iter)) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
279 JingleIceUdpCandidate *candidate = iter->data;
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
280 if (!strcmp(candidate->id, id)) {
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
281 return candidate;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
282 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
283 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
284 return NULL;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
285 }
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 static void
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
288 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
289 {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
290 JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
291 JingleIceUdpCandidate *iceudp_candidate =
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
292 jingle_iceudp_get_remote_candidate_by_id(iceudp,
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
293 candidate->id);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
294 if (iceudp_candidate != NULL) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
295 priv->remote_candidates = g_list_remove(
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
296 priv->remote_candidates, iceudp_candidate);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
297 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
298 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
299 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
300 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
301
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
302 static JingleTransport *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
303 jingle_iceudp_parse_internal(xmlnode *iceudp)
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 JingleTransport *transport = parent_class->parse(iceudp);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
306 xmlnode *candidate = xmlnode_get_child(iceudp, "candidate");
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
307 JingleIceUdpCandidate *iceudp_candidate = NULL;
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 const gchar *username = xmlnode_get_attrib(iceudp, "ufrag");
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
310 const gchar *password = xmlnode_get_attrib(iceudp, "pwd");
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
311
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
312 for (; candidate; candidate = xmlnode_get_next_twin(candidate)) {
26838
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
313 const gchar *relport = xmlnode_get_attrib(candidate, "rel-port");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
314 const gchar *component = xmlnode_get_attrib(candidate, "component");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
315 const gchar *foundation = xmlnode_get_attrib(candidate, "foundation");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
316 const gchar *generation = xmlnode_get_attrib(candidate, "generation");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
317 const gchar *id = xmlnode_get_attrib(candidate, "id");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
318 const gchar *ip = xmlnode_get_attrib(candidate, "ip");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
319 const gchar *network = xmlnode_get_attrib(candidate, "network");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
320 const gchar *port = xmlnode_get_attrib(candidate, "port");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
321 const gchar *priority = xmlnode_get_attrib(candidate, "priority");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
322 const gchar *protocol = xmlnode_get_attrib(candidate, "protocol");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
323 const gchar *type = xmlnode_get_attrib(candidate, "type");
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
324
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
325 if (!component || !foundation || !generation || !id || !ip ||
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
326 !network || !port || !priority || !protocol || !type)
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
327 continue;
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
328
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
329 iceudp_candidate = jingle_iceudp_candidate_new(
26838
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
330 atoi(component),
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
331 foundation,
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
332 atoi(generation),
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
333 id,
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
334 ip,
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
335 atoi(network),
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
336 atoi(port),
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
337 atoi(priority),
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
338 protocol,
cfde0f7fd54f Don't crash on malicious candidates missing attributes
Paul Aurich <paul@darkrain42.org>
parents: 26376
diff changeset
339 type,
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
340 username, password);
26201
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
341 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: 26179
diff changeset
342 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: 26179
diff changeset
343 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: 26179
diff changeset
344 relport != NULL ? atoi(relport) : 0;
26375
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
345 iceudp_candidate->rem_known = TRUE;
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
346 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
347 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
348
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
349 return transport;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
350 }
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 static xmlnode *
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
353 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
354 {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
355 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
356
26369
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
357 if (action == JINGLE_SESSION_INITIATE ||
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
358 action == JINGLE_SESSION_ACCEPT ||
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
359 action == JINGLE_TRANSPORT_INFO ||
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
360 action == JINGLE_CONTENT_ADD ||
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
361 action == JINGLE_TRANSPORT_REPLACE) {
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
362 JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(transport);
26cf297796a5 Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26210
diff changeset
363 GList *iter = priv->local_candidates;
26375
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
364 gboolean used_candidate = FALSE;
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
365
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
366 for (; iter; iter = g_list_next(iter)) {
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
367 JingleIceUdpCandidate *candidate = iter->data;
26375
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
368 xmlnode *xmltransport;
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
369 gchar *component, *generation, *network,
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
370 *port, *priority;
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
371
26375
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
372 if (candidate->rem_known == TRUE)
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
373 continue;
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
374
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
375 used_candidate = TRUE;
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
376 candidate->rem_known = TRUE;
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
377
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
378 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: 26373
diff changeset
379 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: 26373
diff changeset
380 generation = g_strdup_printf("%d",
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
381 candidate->generation);
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
382 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: 26373
diff changeset
383 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: 26373
diff changeset
384 priority = g_strdup_printf("%d", candidate->priority);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
385
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
386 xmlnode_set_attrib(xmltransport, "component", component);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
387 xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
388 xmlnode_set_attrib(xmltransport, "generation", generation);
26179
84ea07648377 Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26092
diff changeset
389 xmlnode_set_attrib(xmltransport, "id", candidate->id);
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
390 xmlnode_set_attrib(xmltransport, "ip", candidate->ip);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
391 xmlnode_set_attrib(xmltransport, "network", network);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
392 xmlnode_set_attrib(xmltransport, "port", port);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
393 xmlnode_set_attrib(xmltransport, "priority", priority);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
394 xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
395
26201
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
396 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: 26179
diff changeset
397 (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: 26179
diff changeset
398 (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: 26179
diff changeset
399 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: 26179
diff changeset
400 candidate->relport);
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
401 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: 26179
diff changeset
402 candidate->reladdr);
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
403 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: 26179
diff changeset
404 relport);
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
405 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: 26179
diff changeset
406 }
36c7efb85220 Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26179
diff changeset
407
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
408 xmlnode_set_attrib(xmltransport, "type", candidate->type);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
409
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
410 g_free(component);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
411 g_free(generation);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
412 g_free(network);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
413 g_free(port);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
414 g_free(priority);
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
415 }
26375
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
416
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
417 if (used_candidate == TRUE) {
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
418 JingleIceUdpCandidate *candidate =
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
419 priv->local_candidates->data;
06693083f668 Make IceUdp candidates know whether the remote side knows about them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26373
diff changeset
420 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: 26373
diff changeset
421 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: 26373
diff changeset
422 }
26042
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
423 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
424
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
425 return node;
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
426 }
bee5ab815291 Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff changeset
427