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_error;
68/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
69pub mod starttls;
70/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
71pub mod stream;
72/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
73pub mod stream_error;
74/// RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core
75pub mod stream_features;
76
77/// RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence
78pub mod roster;
79
80/// RFC 7395: An Extensible Messaging and Presence Protocol (XMPP) Subprotocol for WebSocket
81pub mod websocket;
82
83/// XEP-0004: Data Forms
84pub mod data_forms;
85
86/// XEP-0030: Service Discovery
87pub mod disco;
88
89/// XEP-0045: Multi-User Chat
90pub mod muc;
91
92/// XEP-0047: In-Band Bytestreams
93pub mod ibb;
94
95/// XEP-0048: Bookmarks
96pub mod bookmarks;
97
98/// XEP-0049: Private XML storage
99pub mod private;
100
101/// XEP-0054: vcard-temp
102pub mod vcard;
103
104/// XEP-0059: Result Set Management
105pub mod rsm;
106
107/// XEP-0060: Publish-Subscribe
108pub mod pubsub;
109
110/// XEP-0066: OOB
111pub mod oob;
112
113/// XEP-0070: Verifying HTTP Requests via XMPP
114pub mod confirm;
115
116/// XEP-0071: XHTML-IM
117pub mod xhtml;
118
119/// XEP-0077: In-Band Registration
120pub mod ibr;
121
122/// XEP-0082: XMPP Date and Time Profiles
123pub mod date;
124
125/// XEP-0084: User Avatar
126pub mod avatar;
127
128/// XEP-0085: Chat State Notifications
129pub mod chatstates;
130
131/// XEP-0092: Software Version
132pub mod version;
133
134/// XEP-0107: User Mood
135pub mod mood;
136
137/// XEP-0114: Jabber Component Protocol
138pub mod component;
139
140/// XEP-0115: Entity Capabilities
141pub mod caps;
142
143/// XEP-0118: User Tune
144pub mod tune;
145
146/// XEP-0122: Data Forms Validation
147pub mod data_forms_validate;
148
149///XEP-0153: vCard-Based Avatars
150pub mod vcard_update;
151
152/// XEP-0157: Contact Addresses for XMPP Services
153pub mod server_info;
154
155/// XEP-0166: Jingle
156pub mod jingle;
157
158/// XEP-0167: Jingle RTP Sessions
159pub mod jingle_rtp;
160
161/// XEP-0172: User Nickname
162pub mod nick;
163
164/// XEP-0176: Jingle ICE-UDP Transport Method
165pub mod jingle_ice_udp;
166
167/// XEP-0177: Jingle Raw UDP Transport Method
168pub mod jingle_raw_udp;
169
170/// XEP-0184: Message Delivery Receipts
171pub mod receipts;
172
173/// XEP-0191: Blocking Command
174pub mod blocking;
175
176/// XEP-0198: Stream Management
177pub mod sm;
178
179/// XEP-0199: XMPP Ping
180pub mod ping;
181
182/// XEP-0202: Entity Time
183pub mod time;
184
185/// XEP-0203: Delayed Delivery
186pub mod delay;
187
188/// XEP-0215: External Service Discovery
189pub mod extdisco;
190
191/// XEP-0221: Data Forms Media Element
192pub mod media_element;
193
194/// XEP-0224: Attention
195pub mod attention;
196
197/// XEP-0231: Bits of Binary
198pub mod bob;
199
200/// XEP-0234: Jingle File Transfer
201pub mod jingle_ft;
202
203/// XEP-0257: Client Certificate Management for SASL EXTERNAL
204pub mod cert_management;
205
206/// XEP-0260: Jingle SOCKS5 Bytestreams Transport Method
207pub mod jingle_s5b;
208
209/// XEP-0261: Jingle In-Band Bytestreams Transport Method
210pub mod jingle_ibb;
211
212/// XEP-0264: Jingle Content Thumbnails
213pub mod jingle_thumbnails;
214
215/// XEP-0280: Message Carbons
216pub mod carbons;
217
218/// XEP-0293: Jingle RTP Feedback Negotiation
219pub mod jingle_rtcp_fb;
220
221/// XEP-0294: Jingle RTP Header Extensions Negotiation
222pub mod jingle_rtp_hdrext;
223
224/// XEP-0297: Stanza Forwarding
225pub mod forwarding;
226
227/// XEP-0300: Use of Cryptographic Hash Functions in XMPP
228pub mod hashes;
229
230/// XEP-0301: In-Band Real Time Text
231pub mod rtt;
232
233/// XEP-0308: Last Message Correction
234pub mod message_correct;
235
236/// XEP-0313: Message Archive Management
237pub mod mam;
238
239/// XEP-0319: Last User Interaction in Presence
240pub mod idle;
241
242/// XEP-0320: Use of DTLS-SRTP in Jingle Sessions
243pub mod jingle_dtls_srtp;
244
245/// XEP-0328: JID Prep
246pub mod jid_prep;
247
248/// XEP-0335: JSON Containers
249pub mod json_containers;
250
251/// XEP-0338: Jingle Grouping Framework
252pub mod jingle_grouping;
253
254/// XEP-0339: Source-Specific Media Attributes in Jingle
255pub mod jingle_ssma;
256
257/// XEP-0352: Client State Indication
258pub mod csi;
259
260/// XEP-0353: Jingle Message Initiation
261pub mod jingle_message;
262
263/// XEP-0357: Push Notifications
264pub mod push;
265
266/// XEP-0359: Unique and Stable Stanza IDs
267pub mod stanza_id;
268
269/// XEP-0363: HTTP File Upload
270pub mod http_upload;
271
272/// XEP-0373: OpenPGP for XMPP
273pub mod openpgp;
274
275/// XEP-0377: Spam Reporting
276pub mod spam_reporting;
277
278/// XEP-0380: Explicit Message Encryption
279pub mod eme;
280
281/// XEP-0380: OMEMO Encryption (experimental version 0.3.0)
282pub mod legacy_omemo;
283
284/// XEP-0386: Bind 2
285pub mod bind2;
286
287/// XEP-0388: Extensible SASL Profile
288pub mod sasl2;
289
290/// XEP-0390: Entity Capabilities 2.0
291pub mod ecaps2;
292
293/// XEP-0402: PEP Native Bookmarks
294pub mod bookmarks2;
295
296/// XEP-0421: Anonymous unique occupant identifiers for MUCs
297pub mod occupant_id;
298
299/// XEP-0441: Message Archive Management Preferences
300pub mod mam_prefs;
301
302/// XEP-0440: SASL Channel-Binding Type Capability
303pub mod sasl_cb;
304
305/// XEP-0444: Message Reactions
306pub mod reactions;
307
308/// XEP-0478: Stream Limits Advertisement
309pub mod stream_limits;
310
311/// XEP-0484: Fast Authentication Streamlining Tokens
312pub mod fast;
313
314/// XEP-0490: Message Displayed Synchronization
315pub mod message_displayed;
316
317#[cfg(test)]
318mod tests {
319 #[test]
320 fn reexports() {
321 #[allow(unused_imports)]
322 use crate::blake2;
323 #[allow(unused_imports)]
324 use crate::jid;
325 #[allow(unused_imports)]
326 use crate::minidom;
327 #[allow(unused_imports)]
328 use crate::sha1;
329 #[allow(unused_imports)]
330 use crate::sha2;
331 #[allow(unused_imports)]
332 use crate::sha3;
333 }
334}