@@ -370,6 +370,15 @@
<xmpp:note>Only supported in payload-type, and only for rtcp-fb.</xmpp:note>
</xmpp:SupportedXep>
</implements>
+ <implements>
+ <xmpp:SupportedXep>
+ <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0294.html"/>
+ <xmpp:status>partial</xmpp:status>
+ <xmpp:version>1.0</xmpp:version>
+ <xmpp:since>NEXT</xmpp:since>
+ <xmpp:note>Parameters arenβt yet implemented.</xmpp:note>
+ </xmpp:SupportedXep>
+ </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0297.html"/>
@@ -0,0 +1,86 @@
+// Copyright (c) 2020 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+generate_attribute!(
+ /// Which party is allowed to send the negotiated RTP Header Extensions.
+ Senders, "senders", {
+ /// Both parties can send them.
+ Both => "both",
+
+ /// Only the initiator can send them.
+ Initiator => "initiator",
+
+ /// Only the responder can send them.
+ Responder => "responder",
+ }, Default = Both
+);
+
+generate_element!(
+ /// Header extensions to be used in a RTP description.
+ RtpHdrext, "rtp-hdrext", JINGLE_RTP_HDREXT,
+ attributes: [
+ /// The ID of the extensions.
+ id: Required<String> = "id",
+
+ /// The URI that defines the extension.
+ uri: Required<String> = "uri",
+
+ /// Which party is allowed to send the negotiated RTP Header Extensions.
+ senders: Default<Senders> = "senders",
+ ]
+);
+
+impl RtpHdrext {
+ /// Create a new RTP header extension element.
+ pub fn new(id: String, uri: String) -> RtpHdrext {
+ RtpHdrext {
+ id,
+ uri,
+ senders: Default::default(),
+ }
+ }
+
+ /// Set the senders.
+ pub fn with_senders(mut self, senders: Senders) -> RtpHdrext {
+ self.senders = senders;
+ self
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::Element;
+ use std::convert::TryFrom;
+
+ #[cfg(target_pointer_width = "32")]
+ #[test]
+ fn test_size() {
+ assert_size!(Senders, 1);
+ assert_size!(RtpHdrext, 28);
+ }
+
+ #[cfg(target_pointer_width = "64")]
+ #[test]
+ fn test_size() {
+ assert_size!(Senders, 1);
+ assert_size!(RtpHdrext, 56);
+ }
+
+ #[test]
+ fn parse_exthdr() {
+ let elem: Element = "
+ <rtp-hdrext xmlns='urn:xmpp:jingle:apps:rtp:rtp-hdrext:0'
+ uri='urn:ietf:params:rtp-hdrext:toffset'
+ id='1'/>"
+ .parse()
+ .unwrap();
+ let rtp_hdrext = RtpHdrext::try_from(elem).unwrap();
+ assert_eq!(rtp_hdrext.id, "1");
+ assert_eq!(rtp_hdrext.uri, "urn:ietf:params:rtp-hdrext:toffset");
+ assert_eq!(rtp_hdrext.senders, Senders::Both);
+ }
+}
@@ -165,6 +165,9 @@ pub mod carbons;
/// XEP-0293: Jingle RTP Feedback Negotiation
pub mod jingle_rtcp_fb;
+/// XEP-0294: Jingle RTP Header Extensions Negociation
+pub mod jingle_rtp_hdrext;
+
/// XEP-0297: Stanza Forwarding
pub mod forwarding;
@@ -162,6 +162,9 @@ pub const CARBONS: &str = "urn:xmpp:carbons:2";
/// XEP-0293: Jingle RTP Feedback Negotiation
pub const JINGLE_RTCP_FB: &str = "urn:xmpp:jingle:apps:rtp:rtcp-fb:0";
+/// XEP-0294: Jingle RTP Header Extensions Negociation
+pub const JINGLE_RTP_HDREXT: &str = "urn:xmpp:jingle:apps:rtp:rtp-hdrext:0";
+
/// XEP-0297: Stanza Forwarding
pub const FORWARD: &str = "urn:xmpp:forward:0";