mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
jingle: Document most of this module.
This commit is contained in:
parent
f3366b94bb
commit
709666bb91
1 changed files with 199 additions and 48 deletions
247
src/jingle.rs
247
src/jingle.rs
|
@ -16,64 +16,170 @@ use error::Error;
|
||||||
use ns;
|
use ns;
|
||||||
use iq::IqSetPayload;
|
use iq::IqSetPayload;
|
||||||
|
|
||||||
generate_attribute!(Action, "action", {
|
generate_attribute!(
|
||||||
ContentAccept => "content-accept",
|
/// The action attribute.
|
||||||
ContentAdd => "content-add",
|
Action, "action", {
|
||||||
ContentModify => "content-modify",
|
/// Accept a content-add action received from another party.
|
||||||
ContentReject => "content-reject",
|
ContentAccept => "content-accept",
|
||||||
ContentRemove => "content-remove",
|
|
||||||
DescriptionInfo => "description-info",
|
|
||||||
SecurityInfo => "security-info",
|
|
||||||
SessionAccept => "session-accept",
|
|
||||||
SessionInfo => "session-info",
|
|
||||||
SessionInitiate => "session-initiate",
|
|
||||||
SessionTerminate => "session-terminate",
|
|
||||||
TransportAccept => "transport-accept",
|
|
||||||
TransportInfo => "transport-info",
|
|
||||||
TransportReject => "transport-reject",
|
|
||||||
TransportReplace => "transport-replace",
|
|
||||||
});
|
|
||||||
|
|
||||||
generate_attribute!(Creator, "creator", {
|
/// Add one or more new content definitions to the session.
|
||||||
Initiator => "initiator",
|
ContentAdd => "content-add",
|
||||||
Responder => "responder",
|
|
||||||
});
|
|
||||||
|
|
||||||
generate_attribute!(Senders, "senders", {
|
/// Change the directionality of media sending.
|
||||||
Both => "both",
|
ContentModify => "content-modify",
|
||||||
Initiator => "initiator",
|
|
||||||
None => "none",
|
|
||||||
Responder => "responder",
|
|
||||||
}, Default = Both);
|
|
||||||
|
|
||||||
// From https://www.iana.org/assignments/cont-disp/cont-disp.xhtml
|
/// Reject a content-add action received from another party.
|
||||||
generate_attribute!(Disposition, "disposition", {
|
ContentReject => "content-reject",
|
||||||
Inline => "inline",
|
|
||||||
Attachment => "attachment",
|
|
||||||
FormData => "form-data",
|
|
||||||
Signal => "signal",
|
|
||||||
Alert => "alert",
|
|
||||||
Icon => "icon",
|
|
||||||
Render => "render",
|
|
||||||
RecipientListHistory => "recipient-list-history",
|
|
||||||
Session => "session",
|
|
||||||
Aib => "aib",
|
|
||||||
EarlySession => "early-session",
|
|
||||||
RecipientList => "recipient-list",
|
|
||||||
Notification => "notification",
|
|
||||||
ByReference => "by-reference",
|
|
||||||
InfoPackage => "info-package",
|
|
||||||
RecordingSession => "recording-session",
|
|
||||||
}, Default = Session);
|
|
||||||
|
|
||||||
generate_id!(ContentId);
|
/// Remove one or more content definitions from the session.
|
||||||
|
ContentRemove => "content-remove",
|
||||||
|
|
||||||
|
/// Exchange information about parameters for an application type.
|
||||||
|
DescriptionInfo => "description-info",
|
||||||
|
|
||||||
|
/// Exchange information about security preconditions.
|
||||||
|
SecurityInfo => "security-info",
|
||||||
|
|
||||||
|
/// Definitively accept a session negotiation.
|
||||||
|
SessionAccept => "session-accept",
|
||||||
|
|
||||||
|
/// Send session-level information, such as a ping or a ringing message.
|
||||||
|
SessionInfo => "session-info",
|
||||||
|
|
||||||
|
/// Request negotiation of a new Jingle session.
|
||||||
|
SessionInitiate => "session-initiate",
|
||||||
|
|
||||||
|
/// End an existing session.
|
||||||
|
SessionTerminate => "session-terminate",
|
||||||
|
|
||||||
|
/// Accept a transport-replace action received from another party.
|
||||||
|
TransportAccept => "transport-accept",
|
||||||
|
|
||||||
|
/// Exchange transport candidates.
|
||||||
|
TransportInfo => "transport-info",
|
||||||
|
|
||||||
|
/// Reject a transport-replace action received from another party.
|
||||||
|
TransportReject => "transport-reject",
|
||||||
|
|
||||||
|
/// Redefine a transport method or replace it with a different method.
|
||||||
|
TransportReplace => "transport-replace",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
generate_attribute!(
|
||||||
|
/// Which party originally generated the content type.
|
||||||
|
Creator, "creator", {
|
||||||
|
/// This content was created by the initiator of this session.
|
||||||
|
Initiator => "initiator",
|
||||||
|
|
||||||
|
/// This content was created by the responder of this session.
|
||||||
|
Responder => "responder",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
generate_attribute!(
|
||||||
|
/// Which parties in the session will be generating content.
|
||||||
|
Senders, "senders", {
|
||||||
|
/// Both parties can send for this content.
|
||||||
|
Both => "both",
|
||||||
|
|
||||||
|
/// Only the initiator can send for this content.
|
||||||
|
Initiator => "initiator",
|
||||||
|
|
||||||
|
/// No one can send for this content.
|
||||||
|
None => "none",
|
||||||
|
|
||||||
|
/// Only the responder can send for this content.
|
||||||
|
Responder => "responder",
|
||||||
|
}, Default = Both
|
||||||
|
);
|
||||||
|
|
||||||
|
generate_attribute!(
|
||||||
|
/// How the content definition is to be interpreted by the recipient. The
|
||||||
|
/// meaning of this attribute matches the "Content-Disposition" header as
|
||||||
|
/// defined in RFC 2183 and applied to SIP by RFC 3261.
|
||||||
|
///
|
||||||
|
/// Possible values are defined here:
|
||||||
|
/// https://www.iana.org/assignments/cont-disp/cont-disp.xhtml
|
||||||
|
Disposition, "disposition", {
|
||||||
|
/// Displayed automatically.
|
||||||
|
Inline => "inline",
|
||||||
|
|
||||||
|
/// User controlled display.
|
||||||
|
Attachment => "attachment",
|
||||||
|
|
||||||
|
/// Process as form response.
|
||||||
|
FormData => "form-data",
|
||||||
|
|
||||||
|
/// Tunneled content to be processed silently.
|
||||||
|
Signal => "signal",
|
||||||
|
|
||||||
|
/// The body is a custom ring tone to alert the user.
|
||||||
|
Alert => "alert",
|
||||||
|
|
||||||
|
/// The body is displayed as an icon to the user.
|
||||||
|
Icon => "icon",
|
||||||
|
|
||||||
|
/// The body should be displayed to the user.
|
||||||
|
Render => "render",
|
||||||
|
|
||||||
|
/// The body contains a list of URIs that indicates the recipients of
|
||||||
|
/// the request.
|
||||||
|
RecipientListHistory => "recipient-list-history",
|
||||||
|
|
||||||
|
/// The body describes a communications session, for example, an
|
||||||
|
/// RFC2327 SDP body.
|
||||||
|
Session => "session",
|
||||||
|
|
||||||
|
/// Authenticated Identity Body.
|
||||||
|
Aib => "aib",
|
||||||
|
|
||||||
|
/// The body describes an early communications session, for example,
|
||||||
|
/// and [RFC2327] SDP body.
|
||||||
|
EarlySession => "early-session",
|
||||||
|
|
||||||
|
/// The body includes a list of URIs to which URI-list services are to
|
||||||
|
/// be applied.
|
||||||
|
RecipientList => "recipient-list",
|
||||||
|
|
||||||
|
/// The payload of the message carrying this Content-Disposition header
|
||||||
|
/// field value is an Instant Message Disposition Notification as
|
||||||
|
/// requested in the corresponding Instant Message.
|
||||||
|
Notification => "notification",
|
||||||
|
|
||||||
|
/// The body needs to be handled according to a reference to the body
|
||||||
|
/// that is located in the same SIP message as the body.
|
||||||
|
ByReference => "by-reference",
|
||||||
|
|
||||||
|
/// The body contains information associated with an Info Package.
|
||||||
|
InfoPackage => "info-package",
|
||||||
|
|
||||||
|
/// The body describes either metadata about the RS or the reason for
|
||||||
|
/// the metadata snapshot request as determined by the MIME value
|
||||||
|
/// indicated in the Content-Type.
|
||||||
|
RecordingSession => "recording-session",
|
||||||
|
}, Default = Session
|
||||||
|
);
|
||||||
|
|
||||||
|
generate_id!(
|
||||||
|
/// An unique identifier in a session, referencing a
|
||||||
|
/// [struct.Content.html](Content element).
|
||||||
|
ContentId
|
||||||
|
);
|
||||||
|
|
||||||
generate_element!(
|
generate_element!(
|
||||||
Content, "content", JINGLE,
|
Content, "content", JINGLE,
|
||||||
attributes: [
|
attributes: [
|
||||||
|
/// Who created this content.
|
||||||
creator: Creator = "creator" => required,
|
creator: Creator = "creator" => required,
|
||||||
|
|
||||||
|
/// How the content definition is to be interpreted by the recipient.
|
||||||
disposition: Disposition = "disposition" => default,
|
disposition: Disposition = "disposition" => default,
|
||||||
|
|
||||||
|
/// A per-session unique identifier for this content.
|
||||||
name: ContentId = "name" => required,
|
name: ContentId = "name" => required,
|
||||||
|
|
||||||
|
/// Who can send data for this content.
|
||||||
senders: Senders = "senders" => default
|
senders: Senders = "senders" => default
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
|
@ -124,22 +230,64 @@ impl Content {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Reason {
|
pub enum Reason {
|
||||||
|
/// The party prefers to use an existing session with the peer rather than
|
||||||
|
/// initiate a new session; the Jingle session ID of the alternative
|
||||||
|
/// session SHOULD be provided as the XML character data of the <sid/>
|
||||||
|
/// child.
|
||||||
AlternativeSession, //(String),
|
AlternativeSession, //(String),
|
||||||
|
|
||||||
|
/// The party is busy and cannot accept a session.
|
||||||
Busy,
|
Busy,
|
||||||
|
|
||||||
|
/// The initiator wishes to formally cancel the session initiation request.
|
||||||
Cancel,
|
Cancel,
|
||||||
|
|
||||||
|
/// The action is related to connectivity problems.
|
||||||
ConnectivityError,
|
ConnectivityError,
|
||||||
|
|
||||||
|
/// The party wishes to formally decline the session.
|
||||||
Decline,
|
Decline,
|
||||||
|
|
||||||
|
/// The session length has exceeded a pre-defined time limit (e.g., a
|
||||||
|
/// meeting hosted at a conference service).
|
||||||
Expired,
|
Expired,
|
||||||
|
|
||||||
|
/// The party has been unable to initialize processing related to the
|
||||||
|
/// application type.
|
||||||
FailedApplication,
|
FailedApplication,
|
||||||
|
|
||||||
|
/// The party has been unable to establish connectivity for the transport
|
||||||
|
/// method.
|
||||||
FailedTransport,
|
FailedTransport,
|
||||||
|
|
||||||
|
/// The action is related to a non-specific application error.
|
||||||
GeneralError,
|
GeneralError,
|
||||||
|
|
||||||
|
/// The entity is going offline or is no longer available.
|
||||||
Gone,
|
Gone,
|
||||||
|
|
||||||
|
/// The party supports the offered application type but does not support
|
||||||
|
/// the offered or negotiated parameters.
|
||||||
IncompatibleParameters,
|
IncompatibleParameters,
|
||||||
|
|
||||||
|
/// The action is related to media processing problems.
|
||||||
MediaError,
|
MediaError,
|
||||||
|
|
||||||
|
/// The action is related to a violation of local security policies.
|
||||||
SecurityError,
|
SecurityError,
|
||||||
|
|
||||||
|
/// The action is generated during the normal course of state management
|
||||||
|
/// and does not reflect any error.
|
||||||
Success,
|
Success,
|
||||||
|
|
||||||
|
/// A request has not been answered so the sender is timing out the
|
||||||
|
/// request.
|
||||||
Timeout,
|
Timeout,
|
||||||
|
|
||||||
|
/// The party supports none of the offered application types.
|
||||||
UnsupportedApplications,
|
UnsupportedApplications,
|
||||||
|
|
||||||
|
/// The party supports none of the offered transport methods.
|
||||||
UnsupportedTransports,
|
UnsupportedTransports,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +392,10 @@ impl From<ReasonElement> for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_id!(SessionId);
|
generate_id!(
|
||||||
|
/// Unique identifier for a session between two JIDs.
|
||||||
|
SessionId
|
||||||
|
);
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Jingle {
|
pub struct Jingle {
|
||||||
|
|
Loading…
Reference in a new issue