diff --git a/doap.xml b/doap.xml index f3f43b13..86c9fdb5 100644 --- a/doap.xml +++ b/doap.xml @@ -361,6 +361,15 @@ 0.15.0 + + + + partial + 1.0.1 + NEXT + Only supported in payload-type, and only for rtcp-fb. + + diff --git a/src/jingle_rtcp_fb.rs b/src/jingle_rtcp_fb.rs new file mode 100644 index 00000000..da52b887 --- /dev/null +++ b/src/jingle_rtcp_fb.rs @@ -0,0 +1,46 @@ +// Copyright (c) 2019 Emmanuel Gil Peyrot +// +// 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_element!( + /// Wrapper element for a rtcp-fb. + RtcpFb, "rtcp-fb", JINGLE_RTCP_FB, + attributes: [ + /// Type of this rtcp-fb. + type_: Required = "type", + + /// Subtype of this rtcp-fb, if relevant. + subtype: Option = "subtype", + ] +); + +#[cfg(test)] +mod tests { + use super::*; + use crate::Element; + use std::convert::TryFrom; + + #[cfg(target_pointer_width = "32")] + #[test] + fn test_size() { + assert_size!(RtcpFb, 24); + } + + #[cfg(target_pointer_width = "64")] + #[test] + fn test_size() { + assert_size!(RtcpFb, 48); + } + + #[test] + fn parse_simple() { + let elem: Element = "" + .parse() + .unwrap(); + let rtcp_fb = RtcpFb::try_from(elem).unwrap(); + assert_eq!(rtcp_fb.type_, "nack"); + assert_eq!(rtcp_fb.subtype.unwrap(), "sli"); + } +} diff --git a/src/jingle_rtp.rs b/src/jingle_rtp.rs index 7f9e5a1a..0e9dcd85 100644 --- a/src/jingle_rtp.rs +++ b/src/jingle_rtp.rs @@ -5,6 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. use crate::jingle_ssma::{Source, Group}; +use crate::jingle_rtcp_fb::RtcpFb; generate_element!( /// Wrapper element describing an RTP session. @@ -76,7 +77,10 @@ generate_element!( /// List of parameters specifying this payload-type. /// /// Their order MUST be ignored. - parameters: Vec = ("parameter", JINGLE_RTP) => Parameter + parameters: Vec = ("parameter", JINGLE_RTP) => Parameter, + + /// List of rtcp-fb parameters from XEP-0293. + rtcp_fbs: Vec = ("rtcp-fb", JINGLE_RTCP_FB) => RtcpFb ] ); @@ -91,6 +95,7 @@ impl PayloadType { name: Some(name), ptime: None, parameters: Vec::new(), + rtcp_fbs: Vec::new(), } } } @@ -126,9 +131,9 @@ mod tests { #[cfg(target_pointer_width = "64")] #[test] fn test_size() { - assert_size!(Description, 72); + assert_size!(Description, 120); assert_size!(Channels, 1); - assert_size!(PayloadType, 80); + assert_size!(PayloadType, 104); assert_size!(Parameter, 48); } diff --git a/src/lib.rs b/src/lib.rs index 7e4f034e..4977a8bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -162,6 +162,9 @@ pub mod jingle_ibb; /// XEP-0280: Message Carbons pub mod carbons; +/// XEP-0293: Jingle RTP Feedback Negotiation +pub mod jingle_rtcp_fb; + /// XEP-0297: Stanza Forwarding pub mod forwarding; diff --git a/src/ns.rs b/src/ns.rs index 46090f09..231d78ed 100644 --- a/src/ns.rs +++ b/src/ns.rs @@ -155,6 +155,9 @@ pub const MICROBLOG: &str = "urn:xmpp:microblog:0"; /// XEP-0280: Message Carbons 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-0297: Stanza Forwarding pub const FORWARD: &str = "urn:xmpp:forward:0";