From f9650b95d8e1b0c30aea602d2cb1e31f5188c257 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 2 Apr 2020 11:30:16 +0200 Subject: [PATCH] create stub JingleRTPConnection --- .../generator/AbstractGenerator.java | 9 ++++++++ .../eu/siacs/conversations/xml/Namespace.java | 3 +++ .../xmpp/jingle/JingleConnectionManager.java | 2 ++ .../xmpp/jingle/JingleRtpConnection.java | 19 +++++++++++++++ .../xmpp/jingle/stanzas/RtpDescription.java | 23 +++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java create mode 100644 src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 5d6c15aa9..7be008491 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -25,6 +25,8 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription; public abstract class AbstractGenerator { private final String[] FEATURES = { Namespace.JINGLE, + + //Jingle File Transfer FileTransferDescription.Version.FT_3.getNamespace(), FileTransferDescription.Version.FT_4.getNamespace(), FileTransferDescription.Version.FT_5.getNamespace(), @@ -32,6 +34,13 @@ public abstract class AbstractGenerator { Namespace.JINGLE_TRANSPORTS_IBB, Namespace.JINGLE_ENCRYPTED_TRANSPORT, Namespace.JINGLE_ENCRYPTED_TRANSPORT_OMEMO, + + //VoIP + Namespace.JINGLE_TRANSPORT_ICE_UDP, + Namespace.JINGLE_FEATURE_AUDIO, + Namespace.JINGLE_FEATURE_VIDEO, + Namespace.JINGLE_APP_RTP, + "http://jabber.org/protocol/muc", "jabber:x:conference", Namespace.OOB, diff --git a/src/main/java/eu/siacs/conversations/xml/Namespace.java b/src/main/java/eu/siacs/conversations/xml/Namespace.java index 755de7fa5..a15103126 100644 --- a/src/main/java/eu/siacs/conversations/xml/Namespace.java +++ b/src/main/java/eu/siacs/conversations/xml/Namespace.java @@ -30,6 +30,9 @@ public final class Namespace { public static final String JINGLE_TRANSPORTS_S5B = "urn:xmpp:jingle:transports:s5b:1"; public static final String JINGLE_TRANSPORTS_IBB = "urn:xmpp:jingle:transports:ibb:1"; public static final String JINGLE_TRANSPORT_ICE_UDP = "urn:xmpp:jingle:transports:ice-udp:1"; + public static final String JINGLE_APP_RTP = "urn:xmpp:jingle:apps:rtp:1"; + public static final String JINGLE_FEATURE_AUDIO = "urn:xmpp:jingle:apps:rtp:audio"; + public static final String JINGLE_FEATURE_VIDEO = "urn:xmpp:jingle:apps:rtp:video"; public static final String IBB = "http://jabber.org/protocol/ibb"; public static final String PING = "urn:xmpp:ping"; public static final String PUSH = "urn:xmpp:push:0"; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index f63f31253..d73968783 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -41,6 +41,8 @@ public class JingleConnectionManager extends AbstractConnectionManager { final AbstractJingleConnection connection; if (FileTransferDescription.NAMESPACES.contains(descriptionNamespace)) { connection = new JingleFileTransferConnection(this, id); + } else if (Namespace.JINGLE_APP_RTP.equals(descriptionNamespace)) { + connection = new JingleRtpConnection(this, id); } else { //TODO return feature-not-implemented return; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java new file mode 100644 index 000000000..fc7bd14f4 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -0,0 +1,19 @@ +package eu.siacs.conversations.xmpp.jingle; + +import android.util.Log; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; + +public class JingleRtpConnection extends AbstractJingleConnection { + + + public JingleRtpConnection(JingleConnectionManager jingleConnectionManager, Id id) { + super(jingleConnectionManager, id); + } + + @Override + void deliverPacket(final JinglePacket jinglePacket) { + Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": packet delivered to JingleRtpConnection"); + } +} diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java new file mode 100644 index 000000000..5ecb6fa15 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java @@ -0,0 +1,23 @@ +package eu.siacs.conversations.xmpp.jingle.stanzas; + +import com.google.common.base.Preconditions; + +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Namespace; + +public class RtpDescription extends GenericDescription { + + + private RtpDescription(String name, String namespace) { + super(name, namespace); + } + + public static RtpDescription upgrade(final Element element) { + Preconditions.checkArgument("description".equals(element.getName()), "Name of provided element is not description"); + Preconditions.checkArgument(Namespace.JINGLE_APP_RTP.equals(element.getNamespace()), "Element does not match the jingle rtp namespace"); + final RtpDescription description = new RtpDescription("description", Namespace.JINGLE_APP_RTP); + description.setAttributes(element.getAttributes()); + description.setChildren(element.getChildren()); + return description; + } +}