libpurple/protocols/jabber/jingle/rawudp.c

Fri, 01 May 2020 12:13:35 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 01 May 2020 12:13:35 -0500
changeset 40439
e9838d634d5e
parent 40358
e6fe6fc1f516
child 41967
025eee9e6f1d
permissions
-rw-r--r--

Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h

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 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26980
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26980
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26980
diff changeset
8 * source distribution.
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26980
diff changeset
9 *
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
10 * 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
11 * 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
12 * 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
13 * (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
14 *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
15 * 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
16 * 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
17 * 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
18 * 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
19 *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
20 * 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
21 * 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
22 * 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
23 */
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
24
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40358
diff changeset
25 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40358
diff changeset
26
40358
e6fe6fc1f516 move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents: 40195
diff changeset
27 #include <purple.h>
26221
bc5d5d3fe4de Make it compile in Windows with the equivalent of --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26157
diff changeset
28
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
29 #include "rawudp.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
30 #include "jingle.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
31
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32 #include <string.h>
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
33
39552
24d7baa6fcf9 Use G_DECLARE* in Jingle extensions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39495
diff changeset
34 struct _JingleRawUdp
24d7baa6fcf9 Use G_DECLARE* in Jingle extensions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39495
diff changeset
35 {
24d7baa6fcf9 Use G_DECLARE* in Jingle extensions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39495
diff changeset
36 JingleTransport parent;
24d7baa6fcf9 Use G_DECLARE* in Jingle extensions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39495
diff changeset
37 };
24d7baa6fcf9 Use G_DECLARE* in Jingle extensions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39495
diff changeset
38
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
39 typedef struct
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40 {
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
41 GList *local_candidates;
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
42 GList *remote_candidates;
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
43 } JingleRawUdpPrivate;
26147
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 enum {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
46 PROP_0,
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
47 PROP_LOCAL_CANDIDATES,
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
48 PROP_REMOTE_CANDIDATES,
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
49 PROP_LAST
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
50 };
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
51 static GParamSpec *properties[PROP_LAST];
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
52
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
53 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
54 JingleRawUdp,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
55 jingle_rawudp,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
56 JINGLE_TYPE_TRANSPORT,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
57 0,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
58 G_ADD_PRIVATE_DYNAMIC(JingleRawUdp)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
59 );
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
60
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
61 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
62 * JingleRawUdp Transport Implementation
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
63 *****************************************************************************/
33631
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
64 static GList *
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
65 jingle_rawudp_get_remote_candidates(JingleTransport *transport)
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
66 {
33631
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
67 JingleRawUdp *rawudp = JINGLE_RAWUDP(transport);
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
68 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
69 GList *candidates = priv->remote_candidates;
33631
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
70 GList *ret = NULL;
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
71
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
72 for (; candidates; candidates = g_list_next(candidates)) {
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
73 JingleRawUdpCandidate *candidate = candidates->data;
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
74 ret = g_list_append(ret, purple_media_candidate_new("",
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
75 candidate->component,
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
76 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX,
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
77 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
78 candidate->ip, candidate->port));
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
79 }
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
80
21775fb6957a Abstract candidate translation for JingleTransports.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32053
diff changeset
81 return ret;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
82 }
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 static JingleRawUdpCandidate *
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
85 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
86 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
87 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
88
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
89 GList *iter = priv->remote_candidates;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
90 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
91 JingleRawUdpCandidate *candidate = iter->data;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 32053
diff changeset
92 if (purple_strequal(candidate->id, id)) {
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
93 return candidate;
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
94 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
95 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
96 return NULL;
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
97 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
98
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
99 static void
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
100 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
101 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
102 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(rawudp);
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
103 JingleRawUdpCandidate *rawudp_candidate =
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
104 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
105 if (rawudp_candidate != NULL) {
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
106 priv->remote_candidates = g_list_remove(
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
107 priv->remote_candidates, rawudp_candidate);
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
108 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
109 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
110 priv->remote_candidates = g_list_append(priv->remote_candidates, candidate);
35065
2fe1b3f20c3c Added a few missing G_PARAM_STATIC_STRINGS and g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35061
diff changeset
111
35076
cadfc3f9a7cc jabber: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35065
diff changeset
112 g_object_notify_by_pspec(G_OBJECT(rawudp), properties[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
113 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
114
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
115 static PurpleXmlNode *
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
116 jingle_rawudp_to_xml_internal(JingleTransport *transport, PurpleXmlNode *content, JingleActionType action)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
117 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
118 PurpleXmlNode *node = JINGLE_TRANSPORT_CLASS(jingle_rawudp_parent_class)->to_xml(transport, content, action);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
119
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
120 if (action == JINGLE_SESSION_INITIATE ||
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
121 action == JINGLE_TRANSPORT_INFO ||
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
122 action == JINGLE_SESSION_ACCEPT) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
123 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(JINGLE_RAWUDP(transport));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
124 GList *iter = priv->local_candidates;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
125
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
126 for (; iter; iter = g_list_next(iter)) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
127 JingleRawUdpCandidate *candidate = iter->data;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
128 PurpleXmlNode *xmltransport;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
129 gchar *generation, *component, *port;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
130
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
131 if (candidate->rem_known == TRUE)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
132 continue;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
133 candidate->rem_known = TRUE;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
134
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
135 xmltransport = purple_xmlnode_new_child(node, "candidate");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
136 generation = g_strdup_printf("%d", candidate->generation);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
137 component = g_strdup_printf("%d", candidate->component);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
138 port = g_strdup_printf("%d", candidate->port);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
139
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
140 purple_xmlnode_set_attrib(xmltransport, "generation", generation);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
141 purple_xmlnode_set_attrib(xmltransport, "component", component);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
142 purple_xmlnode_set_attrib(xmltransport, "id", candidate->id);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
143 purple_xmlnode_set_attrib(xmltransport, "ip", candidate->ip);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
144 purple_xmlnode_set_attrib(xmltransport, "port", port);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
145
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
146 g_free(port);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
147 g_free(generation);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
148 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
149 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
150
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
151 return node;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
152 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
153
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
154 static JingleTransport *
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
155 jingle_rawudp_parse_internal(PurpleXmlNode *rawudp)
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
156 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
157 JingleTransport *transport = JINGLE_TRANSPORT_CLASS(jingle_rawudp_parent_class)->parse(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
158 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(JINGLE_RAWUDP(transport));
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
159 PurpleXmlNode *candidate = purple_xmlnode_get_child(rawudp, "candidate");
26157
5cb0c7e003c0 Silence warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 26154
diff changeset
160 JingleRawUdpCandidate *rawudp_candidate = NULL;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
161
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
162 for (; candidate; candidate = purple_xmlnode_get_next_twin(candidate)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
163 const gchar *id = purple_xmlnode_get_attrib(candidate, "id");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
164 const gchar *generation = purple_xmlnode_get_attrib(candidate, "generation");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
165 const gchar *component = purple_xmlnode_get_attrib(candidate, "component");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
166 const gchar *ip = purple_xmlnode_get_attrib(candidate, "ip");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33631
diff changeset
167 const gchar *port = purple_xmlnode_get_attrib(candidate, "port");
26980
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
168
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
169 if (!id || !generation || !component || !ip || !port)
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
170 continue;
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
171
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
172 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
173 id,
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
174 atoi(generation),
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
175 atoi(component),
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
176 ip,
42d365c0076f Don't crash on malicious candidates missing attributes
Paul Aurich <darkrain42@pidgin.im>
parents: 26415
diff changeset
177 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
178 rawudp_candidate->rem_known = TRUE;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
179 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
180 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
181
26157
5cb0c7e003c0 Silence warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 26154
diff changeset
182 if (rawudp_candidate != NULL &&
5cb0c7e003c0 Silence warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 26154
diff changeset
183 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
184 /* manufacture rtcp candidate */
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
185 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
186 rawudp_candidate->component = 2;
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
187 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
188 rawudp_candidate->rem_known = TRUE;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
189 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
190 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
191
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
192 return transport;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
193 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
194
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
195 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
196 jingle_rawudp_add_local_candidate(JingleTransport *transport, const gchar *id, guint generation, PurpleMediaCandidate *candidate)
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
197 {
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
198 JingleRawUdp *rawudp = JINGLE_RAWUDP(transport);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
199 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
200 gchar *ip;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
201 JingleRawUdpCandidate *rawudp_candidate;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
202 GList *iter;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
203
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
204 ip = purple_media_candidate_get_ip(candidate);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
205 rawudp_candidate = jingle_rawudp_candidate_new(id, generation,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
206 purple_media_candidate_get_component_id(candidate),
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
207 ip, purple_media_candidate_get_port(candidate));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
208 g_free(ip);
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
209
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
210 for (iter = priv->local_candidates; iter; iter = g_list_next(iter)) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
211 JingleRawUdpCandidate *c = iter->data;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
212 if (purple_strequal(c->id, id)) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
213 generation = c->generation + 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
214
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
215 g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, c);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
216 priv->local_candidates = g_list_delete_link(
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
217 priv->local_candidates, iter);
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
218
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
219 rawudp_candidate->generation = generation;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
220
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
221 priv->local_candidates = g_list_append(
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
222 priv->local_candidates, rawudp_candidate);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
223
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
224 g_object_notify_by_pspec(G_OBJECT(rawudp), properties[PROP_LOCAL_CANDIDATES]);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
225
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
226 return;
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
227 }
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
228 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
229
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
230 priv->local_candidates = g_list_append(
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
231 priv->local_candidates, rawudp_candidate);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
232
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
233 g_object_notify_by_pspec(G_OBJECT(rawudp), properties[PROP_LOCAL_CANDIDATES]);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
234 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
235
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
236 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
237 * JingleRawUdp GObject Stuff
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
238 *****************************************************************************/
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
239 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
240 jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
241 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
242 JingleRawUdp *rawudp = JINGLE_RAWUDP(object);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
243 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
244
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
245 switch (prop_id) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
246 case PROP_LOCAL_CANDIDATES:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
247 priv->local_candidates = g_value_get_pointer(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
248 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
249 case PROP_REMOTE_CANDIDATES:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
250 priv->remote_candidates = g_value_get_pointer(value);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
251 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
252 default:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
253 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
254 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
255 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
256 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
257
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
258 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
259 jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
260 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
261 JingleRawUdp *rawudp = JINGLE_RAWUDP(object);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
262 JingleRawUdpPrivate *priv = jingle_rawudp_get_instance_private(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
263
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
264 switch (prop_id) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
265 case PROP_LOCAL_CANDIDATES:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
266 g_value_set_pointer(value, priv->local_candidates);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
267 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
268 case PROP_REMOTE_CANDIDATES:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
269 g_value_set_pointer(value, priv->remote_candidates);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
270 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
271 default:
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
272 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
273 break;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
274 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
275 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
276
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
277 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
278 jingle_rawudp_init (JingleRawUdp *rawudp)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
279 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
280 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
281
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
282 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
283 jingle_rawudp_finalize (GObject *rawudp)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
284 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
285 /* JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); */
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
286 purple_debug_info("jingle","jingle_rawudp_finalize\n");
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
287
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
288 G_OBJECT_CLASS(jingle_rawudp_parent_class)->finalize(rawudp);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
289 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
290
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
291 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
292 jingle_rawudp_class_finalize(JingleRawUdpClass *klass) {
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
293 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
294
39494
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
295 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
296 jingle_rawudp_class_init (JingleRawUdpClass *klass)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
297 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
298 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
299 JingleTransportClass *transport_class = JINGLE_TRANSPORT_CLASS(klass);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
300
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
301 obj_class->finalize = jingle_rawudp_finalize;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
302 obj_class->set_property = jingle_rawudp_set_property;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
303 obj_class->get_property = jingle_rawudp_get_property;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
304
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
305 transport_class->to_xml = jingle_rawudp_to_xml_internal;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
306 transport_class->parse = jingle_rawudp_parse_internal;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
307 transport_class->transport_type = JINGLE_TRANSPORT_RAWUDP;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
308 transport_class->add_local_candidate = jingle_rawudp_add_local_candidate;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
309 transport_class->get_remote_candidates = jingle_rawudp_get_remote_candidates;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
310
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
311 properties[PROP_LOCAL_CANDIDATES] = g_param_spec_pointer("local-candidates",
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
312 "Local candidates",
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
313 "The local candidates for this transport.",
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
314 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
315
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
316 properties[PROP_REMOTE_CANDIDATES] = g_param_spec_pointer("remote-candidates",
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
317 "Remote candidates",
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
318 "The remote candidates for this transport.",
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
319 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
320
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
321 g_object_class_install_properties(obj_class, PROP_LAST, properties);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
322 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
323
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
324 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
325 * JingleRawUdpCandidate Boxed Type
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
326 *****************************************************************************/
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
327 static JingleRawUdpCandidate *
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
328 jingle_rawudp_candidate_copy(JingleRawUdpCandidate *candidate)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
329 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
330 JingleRawUdpCandidate *new_candidate = g_new0(JingleRawUdpCandidate, 1);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
331 new_candidate->generation = candidate->generation;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
332 new_candidate->component = candidate->component;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
333 new_candidate->id = g_strdup(candidate->id);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
334 new_candidate->ip = g_strdup(candidate->ip);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
335 new_candidate->port = candidate->port;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
336
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
337 new_candidate->rem_known = candidate->rem_known;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
338 return new_candidate;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
339 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
340
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
341 static void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
342 jingle_rawudp_candidate_free(JingleRawUdpCandidate *candidate)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
343 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
344 g_free(candidate->id);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
345 g_free(candidate->ip);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
346 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
347
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
348 G_DEFINE_BOXED_TYPE(JingleRawUdpCandidate, jingle_rawudp_candidate,
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
349 jingle_rawudp_candidate_copy, jingle_rawudp_candidate_free)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
350
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
351 /******************************************************************************
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
352 * Public API
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
353 *****************************************************************************/
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
354 void
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
355 jingle_rawudp_register(PurplePlugin *plugin) {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
356 jingle_rawudp_register_type(G_TYPE_MODULE(plugin));
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
357 }
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
358
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
359 JingleRawUdpCandidate *
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
360 jingle_rawudp_candidate_new(const gchar *id, guint generation, guint component, const gchar *ip, guint port)
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
361 {
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
362 JingleRawUdpCandidate *candidate = g_new0(JingleRawUdpCandidate, 1);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
363 candidate->generation = generation;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
364 candidate->component = component;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
365 candidate->id = g_strdup(id);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
366 candidate->ip = g_strdup(ip);
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
367 candidate->port = port;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
368
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
369 candidate->rem_known = FALSE;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
370 return candidate;
f68a311bc10d Update most things to use G_DEFINE_DYNAMIC_TYPE and a host of other updates
Gary Kramlich <grim@reaperworld.com>
parents: 39430
diff changeset
371 }

mercurial