xmpp-parsers: Convert jingle_rtp_hdrext to xso

This commit is contained in:
Emmanuel Gil Peyrot 2024-07-24 18:00:25 +02:00 committed by Maxime “pep” Buquet
commit 5b5df16ac9

View file

@ -4,6 +4,10 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
use xso::{AsXml, FromXml};
use crate::ns;
generate_attribute!( generate_attribute!(
/// Which party is allowed to send the negotiated RTP Header Extensions. /// Which party is allowed to send the negotiated RTP Header Extensions.
Senders, "senders", { Senders, "senders", {
@ -18,22 +22,24 @@ generate_attribute!(
}, Default = Both }, Default = Both
); );
generate_element!(
/// Header extensions to be used in a RTP description. /// Header extensions to be used in a RTP description.
RtpHdrext, "rtp-hdrext", JINGLE_RTP_HDREXT, #[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
attributes: [ #[xml(namespace = ns::JINGLE_RTP_HDREXT, name = "rtp-hdrext")]
pub struct RtpHdrext {
/// The ID of the extensions. The allowed values are only in the 1-256, 4096-4351 ranges, /// The ID of the extensions. The allowed values are only in the 1-256, 4096-4351 ranges,
/// this isnt enforced by xmpp-parsers yet! /// this isnt enforced by xmpp-parsers yet!
// TODO: make it so. // TODO: make it so.
id: Required<u16> = "id", #[xml(attribute)]
pub id: u16,
/// The URI that defines the extension. /// The URI that defines the extension.
uri: Required<String> = "uri", #[xml(attribute)]
pub uri: String,
/// Which party is allowed to send the negotiated RTP Header Extensions. /// Which party is allowed to send the negotiated RTP Header Extensions.
senders: Default<Senders> = "senders", #[xml(attribute(default))]
] pub senders: Senders,
); }
impl RtpHdrext { impl RtpHdrext {
/// Create a new RTP header extension element. /// Create a new RTP header extension element.