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