diff --git a/parsers/src/extdisco.rs b/parsers/src/extdisco.rs index 9a9626e0..7697abf9 100644 --- a/parsers/src/extdisco.rs +++ b/parsers/src/extdisco.rs @@ -56,47 +56,57 @@ generate_attribute!( bool ); -generate_element!( - /// Structure representing a `` element. - Service, "service", EXT_DISCO, - attributes: [ - /// When sending a push update, the action value indicates if the service is being added or - /// deleted from the set of known services (or simply being modified). - action: Default = "action", +/// Structure representing a `` element. +#[derive(FromXml, AsXml, Debug, PartialEq, Clone)] +#[xml(namespace = ns::EXT_DISCO, name = "service")] +pub struct Service { + /// When sending a push update, the action value indicates if the service is being added or + /// deleted from the set of known services (or simply being modified). + #[xml(attribute(default))] + action: Action, - /// A timestamp indicating when the provided username and password credentials will expire. - expires: Option = "expires", + /// A timestamp indicating when the provided username and password credentials will expire. + #[xml(attribute(default))] + expires: Option, - /// Either a fully qualified domain name (FQDN) or an IP address (IPv4 or IPv6). - host: Required = "host", + /// Either a fully qualified domain name (FQDN) or an IP address (IPv4 or IPv6). + #[xml(attribute)] + host: String, - /// A friendly (human-readable) name or label for the service. - name: Option = "name", + /// A friendly (human-readable) name or label for the service. + #[xml(attribute(default))] + name: Option, - /// A service- or server-generated password for use at the service. - password: Option = "password", + /// A service- or server-generated password for use at the service. + #[xml(attribute(default))] + password: Option, - /// The communications port to be used at the host. - port: Option = "port", + /// The communications port to be used at the host. + #[xml(attribute(default))] + port: Option, - /// A boolean value indicating that username and password credentials are required and will - /// need to be requested if not already provided. - restricted: Default = "restricted", + /// A boolean value indicating that username and password credentials are required and will + /// need to be requested if not already provided. + #[xml(attribute(default))] + restricted: Restricted, - /// The underlying transport protocol to be used when communicating with the service (typically - /// either TCP or UDP). - transport: Option = "transport", + /// The underlying transport protocol to be used when communicating with the service (typically + /// either TCP or UDP). + #[xml(attribute(default))] + transport: Option, - /// The service type as registered with the XMPP Registrar. - type_: Required = "type", + /// The service type as registered with the XMPP Registrar. + #[xml(attribute = "type")] + type_: Type, - /// A service- or server-generated username for use at the service. - username: Option = "username", - ], children: [ - /// Extended information - ext_info: Vec = ("x", DATA_FORMS) => DataForm - ] -); + /// A service- or server-generated username for use at the service. + #[xml(attribute(default))] + username: Option, + + /// Extended information + #[xml(child(n = ..))] + ext_info: Vec, +} impl IqGetPayload for Service {} diff --git a/parsers/src/jingle_ice_udp.rs b/parsers/src/jingle_ice_udp.rs index faf23e4d..a847af74 100644 --- a/parsers/src/jingle_ice_udp.rs +++ b/parsers/src/jingle_ice_udp.rs @@ -11,25 +11,26 @@ use xso::{AsXml, FromXml}; use crate::jingle_dtls_srtp::Fingerprint; use crate::ns; -generate_element!( - /// Wrapper element for an ICE-UDP transport. - #[derive(Default)] - Transport, "transport", JINGLE_ICE_UDP, - attributes: [ - /// A Password as defined in ICE-CORE. - pwd: Option = "pwd", +/// Wrapper element for an ICE-UDP transport. +#[derive(FromXml, AsXml, Debug, PartialEq, Clone, Default)] +#[xml(namespace = ns::JINGLE_ICE_UDP, name = "transport")] +pub struct Transport { + /// A Password as defined in ICE-CORE. + #[xml(attribute(default))] + pwd: Option, - /// A User Fragment as defined in ICE-CORE. - ufrag: Option = "ufrag", - ], - children: [ - /// List of candidates for this ICE-UDP session. - candidates: Vec = ("candidate", JINGLE_ICE_UDP) => Candidate, + /// A User Fragment as defined in ICE-CORE. + #[xml(attribute(default))] + ufrag: Option, - /// Fingerprint of the key used for the DTLS handshake. - fingerprint: Option = ("fingerprint", JINGLE_DTLS) => Fingerprint - ] -); + /// List of candidates for this ICE-UDP session. + #[xml(child(n = ..))] + candidates: Vec, + + /// Fingerprint of the key used for the DTLS handshake. + #[xml(child(default))] + fingerprint: Option, +} impl Transport { /// Create a new ICE-UDP transport.