Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/jingle/rawudp.c @ 26373:30cc73d99789
Fix a bunch of memsets.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 19 Mar 2009 01:28:34 +0000 |
parents | 44684f0d2e42 |
children | 5631378c68c8 |
rev | line source |
---|---|
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
1 /** |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file rawudp.c |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
4 * purple |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
5 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
9 * (at your option) any later version. |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
10 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
15 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
19 */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
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:
26033
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:
26033
diff
changeset
|
22 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
23 #include "rawudp.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
24 #include "jingle.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
25 #include "debug.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
26 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
27 #include <string.h> |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
28 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
29 struct _JingleRawUdpPrivate |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
30 { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
31 GList *local_candidates; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
32 GList *remote_candidates; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
33 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
34 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
35 #define JINGLE_RAWUDP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RAWUDP, JingleRawUdpPrivate)) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
36 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
37 static void jingle_rawudp_class_init (JingleRawUdpClass *klass); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
38 static void jingle_rawudp_init (JingleRawUdp *rawudp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
39 static void jingle_rawudp_finalize (GObject *object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
40 static void jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
41 static void jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
42 static JingleTransport *jingle_rawudp_parse_internal(xmlnode *rawudp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
43 static xmlnode *jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
44 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
45 static JingleTransportClass *parent_class = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
46 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
47 enum { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
48 PROP_0, |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
49 PROP_LOCAL_CANDIDATES, |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
50 PROP_REMOTE_CANDIDATES, |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
51 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
52 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
53 static JingleRawUdpCandidate * |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
54 jingle_rawudp_candidate_copy(JingleRawUdpCandidate *candidate) |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
55 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
56 JingleRawUdpCandidate *new_candidate = g_new0(JingleRawUdpCandidate, 1); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
57 new_candidate->generation = candidate->generation; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
58 new_candidate->component = candidate->component; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
59 new_candidate->id = g_strdup(candidate->id); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
60 new_candidate->ip = g_strdup(candidate->ip); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
61 new_candidate->port = candidate->port; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
62 return new_candidate; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
63 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
64 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
65 static void |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
66 jingle_rawudp_candidate_free(JingleRawUdpCandidate *candidate) |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
67 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
68 g_free(candidate->id); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
69 g_free(candidate->ip); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
70 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
71 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
72 GType |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
73 jingle_rawudp_candidate_get_type() |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
74 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
75 static GType type = 0; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
76 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
77 if (type == 0) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
78 type = g_boxed_type_register_static("JingleRawUdpCandidate", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
79 (GBoxedCopyFunc)jingle_rawudp_candidate_copy, |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
80 (GBoxedFreeFunc)jingle_rawudp_candidate_free); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
81 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
82 return type; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
83 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
84 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
85 JingleRawUdpCandidate * |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
86 jingle_rawudp_candidate_new(const gchar *id, guint generation, guint component, const gchar *ip, guint port) |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
87 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
88 JingleRawUdpCandidate *candidate = g_new0(JingleRawUdpCandidate, 1); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
89 candidate->generation = generation; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
90 candidate->component = component; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
91 candidate->id = g_strdup(id); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
92 candidate->ip = g_strdup(ip); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
93 candidate->port = port; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
94 return candidate; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
95 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
96 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
97 GType |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
98 jingle_rawudp_get_type() |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
99 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
100 static GType type = 0; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
101 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
102 if (type == 0) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
103 static const GTypeInfo info = { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
104 sizeof(JingleRawUdpClass), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
105 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
106 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
107 (GClassInitFunc) jingle_rawudp_class_init, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
108 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
109 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
110 sizeof(JingleRawUdp), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
111 0, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
112 (GInstanceInitFunc) jingle_rawudp_init, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
113 NULL |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
114 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
115 type = g_type_register_static(JINGLE_TYPE_TRANSPORT, "JingleRawUdp", &info, 0); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
116 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
117 return type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
118 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
119 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
120 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
121 jingle_rawudp_class_init (JingleRawUdpClass *klass) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
122 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
123 GObjectClass *gobject_class = (GObjectClass*)klass; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
124 parent_class = g_type_class_peek_parent(klass); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
125 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
126 gobject_class->finalize = jingle_rawudp_finalize; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
127 gobject_class->set_property = jingle_rawudp_set_property; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
128 gobject_class->get_property = jingle_rawudp_get_property; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
129 klass->parent_class.to_xml = jingle_rawudp_to_xml_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
130 klass->parent_class.parse = jingle_rawudp_parse_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
131 klass->parent_class.transport_type = JINGLE_TRANSPORT_RAWUDP; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
132 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
133 g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES, |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
134 g_param_spec_pointer("local-candidates", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
135 "Local candidates", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
136 "The local candidates for this transport.", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
137 G_PARAM_READABLE)); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
138 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
139 g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES, |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
140 g_param_spec_pointer("remote-candidates", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
141 "Remote candidates", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
142 "The remote candidates for this transport.", |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
143 G_PARAM_READABLE)); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
144 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
145 g_type_class_add_private(klass, sizeof(JingleRawUdpPrivate)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
146 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
147 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
148 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
149 jingle_rawudp_init (JingleRawUdp *rawudp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
150 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
151 rawudp->priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); |
26373
30cc73d99789
Fix a bunch of memsets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26372
diff
changeset
|
152 rawudp->priv->local_candidates = NULL; |
30cc73d99789
Fix a bunch of memsets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26372
diff
changeset
|
153 rawudp->priv->remote_candidates = NULL; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
154 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
155 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
156 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
157 jingle_rawudp_finalize (GObject *rawudp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
158 { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
159 /* JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); */ |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
160 purple_debug_info("jingle","jingle_rawudp_finalize\n"); |
26372
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26370
diff
changeset
|
161 |
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26370
diff
changeset
|
162 G_OBJECT_CLASS(parent_class)->finalize(rawudp); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
163 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
164 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
165 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
166 jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
167 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
168 JingleRawUdp *rawudp; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
169 g_return_if_fail(JINGLE_IS_RAWUDP(object)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
170 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
171 rawudp = JINGLE_RAWUDP(object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
172 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
173 switch (prop_id) { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
174 case PROP_LOCAL_CANDIDATES: |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
175 rawudp->priv->local_candidates = |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
176 g_value_get_pointer(value); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
177 break; |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
178 case PROP_REMOTE_CANDIDATES: |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
179 rawudp->priv->remote_candidates = |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
180 g_value_get_pointer(value); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
181 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
182 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
183 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
184 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
185 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
186 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
187 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
188 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
189 jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
190 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
191 JingleRawUdp *rawudp; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
192 g_return_if_fail(JINGLE_IS_RAWUDP(object)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
193 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
194 rawudp = JINGLE_RAWUDP(object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
195 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
196 switch (prop_id) { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
197 case PROP_LOCAL_CANDIDATES: |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
198 g_value_set_pointer(value, rawudp->priv->local_candidates); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
199 break; |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
200 case PROP_REMOTE_CANDIDATES: |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
201 g_value_set_pointer(value, rawudp->priv->remote_candidates); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
202 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
203 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
204 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
205 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
206 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
207 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
208 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
209 void |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
210 jingle_rawudp_add_local_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate) |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
211 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
212 GList *iter = rawudp->priv->local_candidates; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
213 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
214 for (; iter; iter = g_list_next(iter)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
215 JingleRawUdpCandidate *c = iter->data; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
216 if (!strcmp(c->id, candidate->id)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
217 guint generation = c->generation + 1; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
218 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
219 g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, c); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
220 rawudp->priv->local_candidates = g_list_delete_link( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
221 rawudp->priv->local_candidates, iter); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
222 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
223 candidate->generation = generation; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
224 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
225 rawudp->priv->local_candidates = g_list_append( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
226 rawudp->priv->local_candidates, candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
227 return; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
228 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
229 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
230 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
231 rawudp->priv->local_candidates = g_list_append( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
232 rawudp->priv->local_candidates, candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
233 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
234 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
235 GList * |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
236 jingle_rawudp_get_remote_candidates(JingleRawUdp *rawudp) |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
237 { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
238 return g_list_copy(rawudp->priv->remote_candidates); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
239 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
240 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
241 static JingleRawUdpCandidate * |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
242 jingle_rawudp_get_remote_candidate_by_id(JingleRawUdp *rawudp, gchar *id) |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
243 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
244 GList *iter = rawudp->priv->remote_candidates; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
245 for (; iter; iter = g_list_next(iter)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
246 JingleRawUdpCandidate *candidate = iter->data; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
247 if (!strcmp(candidate->id, id)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
248 return candidate; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
249 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
250 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
251 return NULL; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
252 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
253 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
254 static void |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
255 jingle_rawudp_add_remote_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate) |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
256 { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
257 JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
258 JingleRawUdpCandidate *rawudp_candidate = |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
259 jingle_rawudp_get_remote_candidate_by_id(rawudp, candidate->id); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
260 if (rawudp_candidate != NULL) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
261 priv->remote_candidates = g_list_remove( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
262 priv->remote_candidates, rawudp_candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
263 g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
264 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
265 priv->remote_candidates = g_list_append(priv->remote_candidates, candidate); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
266 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
267 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
268 static JingleTransport * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
269 jingle_rawudp_parse_internal(xmlnode *rawudp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
270 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
271 JingleTransport *transport = parent_class->parse(rawudp); |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
272 JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
273 xmlnode *candidate = xmlnode_get_child(rawudp, "candidate"); |
26033 | 274 JingleRawUdpCandidate *rawudp_candidate = NULL; |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
275 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
276 for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
277 rawudp_candidate = jingle_rawudp_candidate_new( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
278 xmlnode_get_attrib(candidate, "id"), |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
279 atoi(xmlnode_get_attrib(candidate, "generation")), |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
280 atoi(xmlnode_get_attrib(candidate, "component")), |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
281 xmlnode_get_attrib(candidate, "ip"), |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
282 atoi(xmlnode_get_attrib(candidate, "port"))); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
283 jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
284 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
285 |
26033 | 286 if (rawudp_candidate != NULL && |
287 g_list_length(priv->remote_candidates) == 1) { | |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
288 /* manufacture rtcp candidate */ |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
289 rawudp_candidate = g_boxed_copy(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
290 rawudp_candidate->component = 2; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
291 rawudp_candidate->port = rawudp_candidate->port + 1; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
292 jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
293 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
294 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
295 return transport; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
296 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
297 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
298 static xmlnode * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
299 jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
300 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
301 xmlnode *node = parent_class->to_xml(transport, content, action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
302 |
26370
c8d8624efd04
Make Jingle Raw-Udp send candidates in session-accept packet.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26092
diff
changeset
|
303 if (action == JINGLE_SESSION_INITIATE || |
c8d8624efd04
Make Jingle Raw-Udp send candidates in session-accept packet.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26092
diff
changeset
|
304 action == JINGLE_TRANSPORT_INFO || |
c8d8624efd04
Make Jingle Raw-Udp send candidates in session-accept packet.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26092
diff
changeset
|
305 action == JINGLE_SESSION_ACCEPT) { |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
306 JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
307 GList *iter = priv->local_candidates; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
308 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
309 for (; iter; iter = g_list_next(iter)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
310 JingleRawUdpCandidate *candidate = iter->data; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
311 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
312 xmlnode *xmltransport = xmlnode_new_child(node, "candidate"); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
313 gchar *generation = g_strdup_printf("%d", candidate->generation); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
314 gchar *component = g_strdup_printf("%d", candidate->component); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
315 gchar *port = g_strdup_printf("%d", candidate->port); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
316 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
317 xmlnode_set_attrib(xmltransport, "generation", generation); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
318 xmlnode_set_attrib(xmltransport, "component", component); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
319 xmlnode_set_attrib(xmltransport, "id", candidate->id); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
320 xmlnode_set_attrib(xmltransport, "ip", candidate->ip); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
321 xmlnode_set_attrib(xmltransport, "port", port); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
322 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
323 g_free(port); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
324 g_free(generation); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
325 } |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
326 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
327 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
328 return node; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
329 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
330 |