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