[telepathy-gabble/master] Split transport::produce_node() in two.
Will Thompson
will.thompson at collabora.co.uk
Sat Jun 27 03:57:24 PDT 2009
It turns out not to be enough to have a single method on transports to
add a <transport/> stanza to some other action, because for
backwards-compatibility with older Gabbles we have to send RTP and RTCP
candidates in separate transport-info stanzas, and that knowledge
belongs in the gtalkp2p transport rather than anywhere else.
So this patch gives transports two methods:
* inject_candidates, which should add candidates to the given
<transport/> node, assumed to be part of a session-{initiate,accept}
or content-{add,accept}; and
* send_candidates, which instructs the transport that it should now send
any outstanding candidates it may have.
---
src/jingle-transport-iface.c | 42 ++++++++++++++++++++++++++++--------------
src/jingle-transport-iface.h | 21 ++++++++++++++++-----
2 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/src/jingle-transport-iface.c b/src/jingle-transport-iface.c
index 86b220a..a605272 100644
--- a/src/jingle-transport-iface.c
+++ b/src/jingle-transport-iface.c
@@ -51,20 +51,6 @@ gabble_jingle_transport_iface_parse_candidates (GabbleJingleTransportIface *self
return virtual_method (self, node, error);
}
-/* Appends <transport /> node under parent, to be used with the
- * specified jingle action. Returns the new node. */
-LmMessageNode *
-gabble_jingle_transport_iface_produce_node (GabbleJingleTransportIface *self,
- LmMessageNode *parent, JingleAction action)
-{
- LmMessageNode *(*virtual_method)(GabbleJingleTransportIface *,
- LmMessageNode *, JingleAction) =
- GABBLE_JINGLE_TRANSPORT_IFACE_GET_CLASS (self)->produce_node;
-
- g_assert (virtual_method != NULL);
- return virtual_method (self, parent, action);
-}
-
/* Takes in a list of slice-allocated JingleCandidate structs */
void
gabble_jingle_transport_iface_new_local_candidates (GabbleJingleTransportIface *self,
@@ -78,6 +64,34 @@ gabble_jingle_transport_iface_new_local_candidates (GabbleJingleTransportIface *
virtual_method (self, candidates);
}
+/* Inserts candidates into the given <transport/> node, or equivalent, of a
+ * session-initiate, session-accept, content-add or content-accept action.
+ */
+void
+gabble_jingle_transport_iface_inject_candidates (
+ GabbleJingleTransportIface *self,
+ LmMessageNode *transport_node)
+{
+ void (*virtual_method)(GabbleJingleTransportIface *, LmMessageNode *) =
+ GABBLE_JINGLE_TRANSPORT_IFACE_GET_CLASS (self)->inject_candidates;
+
+ if (virtual_method != NULL)
+ virtual_method (self, transport_node);
+}
+
+/* Transmits outstanding or all candidates (if applicable and @all is set). */
+void
+gabble_jingle_transport_iface_send_candidates (
+ GabbleJingleTransportIface *self,
+ gboolean all)
+{
+ void (*virtual_method) (GabbleJingleTransportIface *, gboolean) =
+ GABBLE_JINGLE_TRANSPORT_IFACE_GET_CLASS (self)->send_candidates;
+
+ if (virtual_method != NULL)
+ virtual_method (self, all);
+}
+
GList *
gabble_jingle_transport_iface_get_remote_candidates (
GabbleJingleTransportIface *self)
diff --git a/src/jingle-transport-iface.h b/src/jingle-transport-iface.h
index ac6d68c..810da0b 100644
--- a/src/jingle-transport-iface.h
+++ b/src/jingle-transport-iface.h
@@ -43,9 +43,12 @@ struct _GabbleJingleTransportIfaceClass {
void (*parse_candidates) (GabbleJingleTransportIface *,
LmMessageNode *, GError **);
+
void (*new_local_candidates) (GabbleJingleTransportIface *, GList *);
- LmMessageNode * (*produce_node) (GabbleJingleTransportIface *,
- LmMessageNode *, JingleAction);
+ void (*inject_candidates) (GabbleJingleTransportIface *,
+ LmMessageNode *transport_node);
+ void (*send_candidates) (GabbleJingleTransportIface *, gboolean all);
+
GList * (*get_remote_candidates) (GabbleJingleTransportIface *);
JingleTransportType (*get_transport_type) (void);
};
@@ -65,9 +68,17 @@ GType gabble_jingle_transport_iface_get_type (void);
void gabble_jingle_transport_iface_parse_candidates (GabbleJingleTransportIface *,
LmMessageNode *, GError **);
-void gabble_jingle_transport_iface_new_local_candidates (GabbleJingleTransportIface *, GList *);
-LmMessageNode *gabble_jingle_transport_iface_produce_node (GabbleJingleTransportIface *,
- LmMessageNode *, JingleAction);
+
+void gabble_jingle_transport_iface_new_local_candidates (
+ GabbleJingleTransportIface *self,
+ GList *candidates);
+void gabble_jingle_transport_iface_inject_candidates (
+ GabbleJingleTransportIface *self,
+ LmMessageNode *transport_node);
+void gabble_jingle_transport_iface_send_candidates (
+ GabbleJingleTransportIface *self,
+ gboolean all);
+
GList *gabble_jingle_transport_iface_get_remote_candidates (GabbleJingleTransportIface *);
JingleTransportType gabble_jingle_transport_iface_get_transport_type (GabbleJingleTransportIface *);
--
1.5.6.5
More information about the telepathy-commits
mailing list