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