[telepathy-gabble/master] Fill in GoogleP2P candidate nodes when remote_transports are passed.
Mike Ruprecht
mike.ruprecht at collabora.co.uk
Tue Dec 29 05:35:31 PST 2009
---
tests/twisted/jingle/jingletest2.py | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/tests/twisted/jingle/jingletest2.py b/tests/twisted/jingle/jingletest2.py
index 2faf73e..653d76e 100644
--- a/tests/twisted/jingle/jingletest2.py
+++ b/tests/twisted/jingle/jingletest2.py
@@ -83,9 +83,31 @@ class JingleProtocol:
"Creates a <parameter> element"
return ('parameter', None, {'name': name, 'value': value}, [])
- def TransportGoogleP2P(self):
- "Creates a <transport> element for Google P2P transport"
- return ('transport', ns.GOOGLE_P2P, {}, [])
+ def TransportGoogleP2P(self, remote_transports=[]):
+ """
+ Creates a <transport> element for Google P2P transport.
+ If remote_transports is present, and of the form
+ [(host, port, proto, subtype, profile, pref, transtype, user, pwd)]
+ (basically a list of Media_Stream_Handler_Transport without the
+ component number) then it will be converted to xml and added.
+ """
+ candidates = []
+ for i, (host, port, proto, subtype, profile, pref, transtype, user, pwd
+ ) in enumerate(remote_transports):
+ candidates.append(("candidate", None, {
+ "name": "rtp",
+ "address": host,
+ "port": str(port),
+ "protocol": ["udp", "tcp"][proto],
+ "preference": str(pref),
+ "type": ["local", "stun", "relay"][transtype],
+ "network": "0",
+ "generation": "0",# Increment this yourself if you care.
+ "component": "1", # 1 is rtp, 2 is rtcp
+ "username": user,
+ "password": pwd,
+ }, [])) #NOTE: subtype and profile are unused
+ return ('transport', ns.GOOGLE_P2P, {}, candidates)
def TransportIceUdp(self, remote_transports=[]):
"""
--
1.5.6.5
More information about the telepathy-commits
mailing list