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