mqute_codec/protocol/mod.rs
1//! # MQTT Protocol Implementation
2//!
3//! This module provides complete implementations of MQTT protocol versions 3.1, 3.1.1, and 5.0,
4//! with shared components for packet handling and protocol logic.
5//!
6//! ## Examples
7//!
8//! ### Working with different protocol versions
9//! ```rust
10//! use std::time::Duration;
11//! use mqute_codec::protocol::{v4, v5, Protocol};
12//! use mqute_codec::protocol::QoS;
13//!
14//! // Create v3.1.1 CONNECT packet
15//! let connect_v4 = v4::Connect::new(
16//! "client_id",
17//! None,
18//! None,
19//! Duration::from_secs(30),
20//! true
21//! );
22//! assert_eq!(connect_v4.protocol(), Protocol::V4);
23//!
24//! // Create v5 CONNECT with properties
25//! let connect_v5 = v5::Connect::new(
26//! "client_id",
27//! None,
28//! None,
29//! Duration::from_secs(30),
30//! true
31//! );
32//! assert_eq!(connect_v5.protocol(), Protocol::V5);
33//! ```
34
35/// # Common Protocol Components
36mod common;
37
38/// # Packet Header Implementation
39mod header;
40
41/// # Core Packet Types
42mod packet;
43
44/// # Quality of Service Levels
45mod qos;
46
47/// # Protocol Utilities
48pub(crate) mod util;
49
50/// # Protocol Version Handling
51mod version;
52
53/// # MQTT v3.1 Implementation
54///
55/// Complete implementation of the MQTT 3.1 specification.
56///
57/// ## Key Features
58/// - Basic QoS 0-2 support
59/// - Clean session handling
60/// - Will message support
61pub mod v3;
62
63/// # MQTT v3.1.1 Implementation
64///
65/// Implementation of MQTT 3.1.1 (OASIS Standard).
66///
67/// ## Differences from v3.1
68/// - Enhanced error handling
69/// - Improved session management
70pub mod v4;
71
72/// # MQTT v5.0 Implementation
73///
74/// Complete implementation of MQTT 5.0 with:
75/// - Enhanced authentication
76/// - User properties
77/// - Reason codes
78/// - Shared subscriptions
79pub mod v5;
80
81/// Re-export common protocol types
82pub use common::payload::*;
83pub use common::Credentials;
84pub use header::*;
85pub use packet::PacketType;
86pub use qos::QoS;
87pub use version::*;