xmpp_parsers/lib.rs
1//! A crate parsing common XMPP elements into Rust structures.
2//!
3//! Each module implements the `TryFrom<Element>` trait, which takes a
4//! minidom [`Element`] and returns a `Result` whose value is `Ok` if the
5//! element parsed correctly, `Err(error::Error)` otherwise.
6//!
7//! The returned structure can be manipulated as any Rust structure, with each
8//! field being public. You can also create the same structure manually, with
9//! some having `new()` and `with_*()` helper methods to create them.
10//!
11//! Once you are happy with your structure, you can serialise it back to an
12//! [`Element`], using either `From` or `Into<Element>`, which give you what
13//! you want to be sending on the wire.
14//!
15//! [`Element`]: ../minidom/element/struct.Element.html
16
17// Copyright (c) 2017-2019 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
18// Copyright (c) 2017-2019 Maxime “pep” Buquet <pep@bouah.net>
19//
20// This Source Code Form is subject to the terms of the Mozilla Public
21// License, v. 2.0. If a copy of the MPL was not distributed with this
22// file, You can obtain one at http://mozilla.org/MPL/2.0/.
23
24#![warn(missing_docs)]
25#![deny(
26 non_camel_case_types,
27 non_snake_case,
28 unsafe_code,
29 unused_variables,
30 unused_mut,
31 dead_code
32)]
33#![cfg_attr(docsrs, feature(doc_cfg))]
34#![cfg_attr(docsrs, doc(auto_cfg))]
35
36extern crate alloc;
37
38pub use blake2;
39pub use jid;
40pub use minidom;
41pub use sha1;
42pub use sha2;
43pub use sha3;
44
45// We normally only reexport entire crates, but xso is a special case since it uses proc macros
46// which require it to be directly imported as a crate. The only useful symbol we have to reexport
47// are its error types, which we expose in our return types.
48pub use xso::error::{Error, FromElementError};
49
50/// XML namespace definitions used through XMPP.
51pub mod ns;
52
53#[macro_use]
54mod util;
55
56/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
57pub mod bind;
58/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
59pub mod iq;
60/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
61pub mod message;
62/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
63pub mod presence;
64/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
65pub mod sasl;
66/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
67pub mod stanza;
68/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
69pub mod stanza_error;
70/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
71pub mod starttls;
72/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
73pub mod stream;
74/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
75pub mod stream_error;
76/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
77pub mod stream_features;
78
79/// RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence
80pub mod roster;
81
82/// RFC 7395: An Extensible Messaging and Presence Protocol (XMPP) Subprotocol for WebSocket
83pub mod websocket;
84
85/// XEP-0004: Data Forms
86pub mod data_forms;
87
88/// XEP-0030: Service Discovery
89pub mod disco;
90
91/// XEP-0045: Multi-User Chat
92pub mod muc;
93
94/// XEP-0047: In-Band Bytestreams
95pub mod ibb;
96
97/// XEP-0048: Bookmarks
98pub mod bookmarks;
99
100/// XEP-0049: Private XML storage
101pub mod private;
102
103/// XEP-0054: vcard-temp
104pub mod vcard;
105
106/// XEP-0059: Result Set Management
107pub mod rsm;
108
109/// XEP-0060: Publish-Subscribe
110pub mod pubsub;
111
112/// XEP-0066: OOB
113pub mod oob;
114
115/// XEP-0070: Verifying HTTP Requests via XMPP
116pub mod confirm;
117
118/// XEP-0071: XHTML-IM
119pub mod xhtml;
120
121/// XEP-0077: In-Band Registration
122pub mod ibr;
123
124/// XEP-0082: XMPP Date and Time Profiles
125pub mod date;
126
127/// XEP-0084: User Avatar
128pub mod avatar;
129
130/// XEP-0085: Chat State Notifications
131pub mod chatstates;
132
133/// XEP-0092: Software Version
134pub mod version;
135
136/// XEP-0107: User Mood
137pub mod mood;
138
139/// XEP-0114: Jabber Component Protocol
140pub mod component;
141
142/// XEP-0115: Entity Capabilities
143pub mod caps;
144
145/// XEP-0118: User Tune
146pub mod tune;
147
148/// XEP-0122: Data Forms Validation
149pub mod data_forms_validate;
150
151///XEP-0153: vCard-Based Avatars
152pub mod vcard_update;
153
154/// XEP-0157: Contact Addresses for XMPP Services
155pub mod server_info;
156
157/// XEP-0166: Jingle
158pub mod jingle;
159
160/// XEP-0167: Jingle RTP Sessions
161pub mod jingle_rtp;
162
163/// XEP-0172: User Nickname
164pub mod nick;
165
166/// XEP-0176: Jingle ICE-UDP Transport Method
167pub mod jingle_ice_udp;
168
169/// XEP-0177: Jingle Raw UDP Transport Method
170pub mod jingle_raw_udp;
171
172/// XEP-0184: Message Delivery Receipts
173pub mod receipts;
174
175/// XEP-0191: Blocking Command
176pub mod blocking;
177
178/// XEP-0198: Stream Management
179pub mod sm;
180
181/// XEP-0199: XMPP Ping
182pub mod ping;
183
184/// XEP-0202: Entity Time
185pub mod time;
186
187/// XEP-0203: Delayed Delivery
188pub mod delay;
189
190/// XEP-0215: External Service Discovery
191pub mod extdisco;
192
193/// XEP-0221: Data Forms Media Element
194pub mod media_element;
195
196/// XEP-0224: Attention
197pub mod attention;
198
199/// XEP-0231: Bits of Binary
200pub mod bob;
201
202/// XEP-0234: Jingle File Transfer
203pub mod jingle_ft;
204
205/// XEP-0257: Client Certificate Management for SASL EXTERNAL
206pub mod cert_management;
207
208/// XEP-0260: Jingle SOCKS5 Bytestreams Transport Method
209pub mod jingle_s5b;
210
211/// XEP-0261: Jingle In-Band Bytestreams Transport Method
212pub mod jingle_ibb;
213
214/// XEP-0264: Jingle Content Thumbnails
215pub mod jingle_thumbnails;
216
217/// XEP-0280: Message Carbons
218pub mod carbons;
219
220/// XEP-0293: Jingle RTP Feedback Negotiation
221pub mod jingle_rtcp_fb;
222
223/// XEP-0294: Jingle RTP Header Extensions Negotiation
224pub mod jingle_rtp_hdrext;
225
226/// XEP-0297: Stanza Forwarding
227pub mod forwarding;
228
229/// XEP-0300: Use of Cryptographic Hash Functions in XMPP
230pub mod hashes;
231
232/// XEP-0301: In-Band Real Time Text
233pub mod rtt;
234
235/// XEP-0308: Last Message Correction
236pub mod message_correct;
237
238/// XEP-0313: Message Archive Management
239pub mod mam;
240
241/// XEP-0319: Last User Interaction in Presence
242pub mod idle;
243
244/// XEP-0320: Use of DTLS-SRTP in Jingle Sessions
245pub mod jingle_dtls_srtp;
246
247/// XEP-0328: JID Prep
248pub mod jid_prep;
249
250/// XEP-0333: Displayed markers
251pub mod displayed_markers;
252
253/// XEP-0335: JSON Containers
254pub mod json_containers;
255
256/// XEP-0338: Jingle Grouping Framework
257pub mod jingle_grouping;
258
259/// XEP-0339: Source-Specific Media Attributes in Jingle
260pub mod jingle_ssma;
261
262/// XEP-0352: Client State Indication
263pub mod csi;
264
265/// XEP-0353: Jingle Message Initiation
266pub mod jingle_message;
267
268/// XEP-0357: Push Notifications
269pub mod push;
270
271/// XEP-0359: Unique and Stable Stanza IDs
272pub mod stanza_id;
273
274/// XEP-0363: HTTP File Upload
275pub mod http_upload;
276
277/// XEP-0373: OpenPGP for XMPP
278pub mod openpgp;
279
280/// XEP-0377: Spam Reporting
281pub mod spam_reporting;
282
283/// XEP-0380: Explicit Message Encryption
284pub mod eme;
285
286/// XEP-0380: OMEMO Encryption (experimental version 0.3.0)
287pub mod legacy_omemo;
288
289/// XEP-0386: Bind 2
290pub mod bind2;
291
292/// XEP-0388: Extensible SASL Profile
293pub mod sasl2;
294
295/// XEP-0390: Entity Capabilities 2.0
296pub mod ecaps2;
297
298/// XEP-0402: PEP Native Bookmarks
299pub mod bookmarks2;
300
301/// XEP-0421: Anonymous unique occupant identifiers for MUCs
302pub mod occupant_id;
303
304/// XEP-0441: Message Archive Management Preferences
305pub mod mam_prefs;
306
307/// XEP-0440: SASL Channel-Binding Type Capability
308pub mod sasl_cb;
309
310/// XEP-0444: Message Reactions
311pub mod reactions;
312
313/// XEP-0478: Stream Limits Advertisement
314pub mod stream_limits;
315
316/// XEP-0484: Fast Authentication Streamlining Tokens
317pub mod fast;
318
319/// XEP-0490: Message Displayed Synchronization
320pub mod message_displayed;
321
322/// XEP-0494: Client Access Management
323pub mod cam;
324
325/// XEP-0507: Jingle Content Category
326pub mod jingle_content;
327
328#[cfg(test)]
329mod tests {
330 #[test]
331 fn reexports() {
332 #[allow(unused_imports)]
333 use crate::blake2;
334 #[allow(unused_imports)]
335 use crate::jid;
336 #[allow(unused_imports)]
337 use crate::minidom;
338 #[allow(unused_imports)]
339 use crate::sha1;
340 #[allow(unused_imports)]
341 use crate::sha2;
342 #[allow(unused_imports)]
343 use crate::sha3;
344 }
345}