[telepathy-gabble/master] JingleCandidate struct: added "id" field

Senko Rasic senko.rasic at collabora.co.uk
Mon Jun 29 04:43:13 PDT 2009


---
 src/jingle-content.h          |    8 +++++---
 src/jingle-transport-google.c |    4 ++--
 src/jingle-transport-iceudp.c |    4 ++--
 src/jingle-transport-iface.c  |   26 +++++++++++++++-----------
 src/jingle-transport-iface.h  |    9 +++++----
 src/jingle-transport-rawudp.c |    8 ++++----
 6 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/src/jingle-content.h b/src/jingle-content.h
index 0fdea17..3335cb8 100644
--- a/src/jingle-content.h
+++ b/src/jingle-content.h
@@ -43,14 +43,16 @@ typedef enum {
 } JingleContentState;
 
 struct _JingleCandidate {
+  JingleTransportProtocol protocol;
+  JingleCandidateType type;
+
+  gchar *id;
   gchar *address;
-  int component;
   int port;
+  int component;
   int generation;
 
-  JingleTransportProtocol protocol;
   gdouble preference;
-  JingleCandidateType type;
   gchar *username;
   gchar *password;
   int network;
diff --git a/src/jingle-transport-google.c b/src/jingle-transport-google.c
index 5028c70..a67bc64 100644
--- a/src/jingle-transport-google.c
+++ b/src/jingle-transport-google.c
@@ -373,8 +373,8 @@ parse_candidates (GabbleJingleTransportIface *obj,
       if (str != NULL)
           component = atoi (str);
 
-      c = jingle_candidate_new (component, address, port, proto,
-          pref, ctype, user, pass, net, gen);
+      c = jingle_candidate_new (proto, ctype, NULL, component,
+          address, port, gen, pref, user, pass, net);
 
       candidates = g_list_append (candidates, c);
     }
diff --git a/src/jingle-transport-iceudp.c b/src/jingle-transport-iceudp.c
index 807fc12..6ecabd9 100644
--- a/src/jingle-transport-iceudp.c
+++ b/src/jingle-transport-iceudp.c
@@ -340,8 +340,8 @@ parse_candidates (GabbleJingleTransportIface *obj,
       if (str != NULL)
           component = atoi (str);
 
-      c = jingle_candidate_new (component, address, port, proto,
-          pref, ctype, user, pass, net, gen);
+      c = jingle_candidate_new (proto, ctype, NULL, component,
+          address, port, gen, pref, user, pass, net);
 
       candidates = g_list_append (candidates, c);
     }
diff --git a/src/jingle-transport-iface.c b/src/jingle-transport-iface.c
index 07bf916..8c29c88 100644
--- a/src/jingle-transport-iface.c
+++ b/src/jingle-transport-iface.c
@@ -173,21 +173,24 @@ gabble_jingle_transport_iface_get_type (void)
 }
 
 JingleCandidate *
-jingle_candidate_new (guint component, const gchar *address, guint port,
-    JingleTransportProtocol proto, gdouble pref, JingleCandidateType type,
-    const gchar *user, const gchar *pass, guint net, guint gen)
+jingle_candidate_new (JingleTransportProtocol protocol,
+    JingleCandidateType type, const gchar *id, int component,
+    const gchar *address, int port, int generation, gdouble preference,
+    const gchar *username, const gchar *password, int network)
 {
   JingleCandidate *c = g_slice_new0 (JingleCandidate);
-  c->component = component;
+
+  c->protocol = protocol;
+  c->type = type;
+  c->id = g_strdup (id);
   c->address = g_strdup (address);
+  c->component = component;
   c->port = port;
-  c->protocol = proto;
-  c->preference = pref;
-  c->type = type;
-  c->username = g_strdup (user);
-  c->password = g_strdup (pass);
-  c->network = net;
-  c->generation = gen;
+  c->generation = generation;
+  c->preference = preference;
+  c->username = g_strdup (username);
+  c->password = g_strdup (password);
+  c->network = network;
 
   return c;
 }
@@ -195,6 +198,7 @@ jingle_candidate_new (guint component, const gchar *address, guint port,
 void
 jingle_candidate_free (JingleCandidate *c)
 {
+    g_free (c->id);
     g_free (c->address);
     g_free (c->username);
     g_free (c->password);
diff --git a/src/jingle-transport-iface.h b/src/jingle-transport-iface.h
index 15edcb2..8322bc8 100644
--- a/src/jingle-transport-iface.h
+++ b/src/jingle-transport-iface.h
@@ -73,10 +73,11 @@ JingleTransportType gabble_jingle_transport_iface_get_transport_type (GabbleJing
 GabbleJingleTransportIface *gabble_jingle_transport_iface_new (
     GType type, GabbleJingleContent *content, const gchar *transport_ns);
 
-JingleCandidate *jingle_candidate_new (guint component, const gchar *address,
-    guint port, JingleTransportProtocol proto, gdouble pref,
-    JingleCandidateType type, const gchar *user, const gchar *pass, guint net,
-    guint gen);
+JingleCandidate *jingle_candidate_new (JingleTransportProtocol protocol,
+    JingleCandidateType type, const gchar *id, int component,
+    const gchar *address, int port, int generation, gdouble preference,
+    const gchar *username, const gchar *password, int network);
+
 void jingle_candidate_free (JingleCandidate *c);
 void jingle_transport_free_candidates (GList *candidates);
 
diff --git a/src/jingle-transport-rawudp.c b/src/jingle-transport-rawudp.c
index efeed90..2b8c6bc 100644
--- a/src/jingle-transport-rawudp.c
+++ b/src/jingle-transport-rawudp.c
@@ -281,10 +281,10 @@ parse_candidates (GabbleJingleTransportIface *obj,
           break;
       gen = atoi (str);
 
-      /* FIXME: we're using "user" Tp field for the candidate ID */
-      c = jingle_candidate_new (component, ip, port,
-          JINGLE_TRANSPORT_PROTOCOL_UDP,
-          1.0, JINGLE_CANDIDATE_TYPE_LOCAL, id, NULL, 0, gen);
+      /* Fixme: candidate might be STUN instead of LOCAL, can we know that? */
+      c = jingle_candidate_new (JINGLE_TRANSPORT_PROTOCOL_UDP,
+          JINGLE_CANDIDATE_TYPE_LOCAL, id, component, ip, port,
+          gen, 1.0, NULL, NULL, 0);
 
       candidates = g_list_append (candidates, c);
     }
-- 
1.5.6.5




More information about the telepathy-commits mailing list