1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//! # MQTT Protocol Implementation
//!
//! This module provides complete implementations of MQTT protocol versions 3.1, 3.1.1, and 5.0,
//! with shared components for packet handling and protocol logic.
//!
//! The implementation follows the official MQTT specification for each version and provides
//! type-safe APIs for building, parsing, and handling MQTT packets.
//!
//! ## Examples
//!
//! ### Working with different protocol versions
//! ```rust
//! use std::time::Duration;
//! use mqute_codec::protocol::{v4, v5, Protocol};
//! use mqute_codec::protocol::QoS;
//!
//! // Create v3.1.1 CONNECT packet
//! let connect_v4 = v4::Connect::new(
//! "client_id",
//! None,
//! None,
//! Duration::from_secs(30),
//! true
//! );
//! assert_eq!(connect_v4.protocol(), Protocol::V4);
//!
//! // Create v5 CONNECT with properties
//! let connect_v5 = v5::Connect::new(
//! "client_id",
//! None,
//! None,
//! Duration::from_secs(30),
//! true
//! );
//! assert_eq!(connect_v5.protocol(), Protocol::V5);
//! ```
/// # Common Protocol Components
///
/// Shared types and utilities used across all MQTT protocol versions.
/// Includes connection credentials, payload handling, and frame interfaces.
/// # Packet Header Implementation
///
/// Handles fixed header parsing and construction for MQTT packets.
/// Manages packet type, flags, and remaining length encoding.
/// # Core Packet Types
///
/// Defines the fundamental MQTT packet types and their implementations.
/// Includes packet encoding, decoding, and validation logic.
/// # Quality of Service Levels
///
/// Implements MQTT Quality of Service (QoS) levels with full specification
/// compliance.
/// # Protocol Utilities
///
/// Contains utility functions for MQTT protocol handling including:
/// - Topic validation and filtering
/// - Variable byte integer encoding
/// - System topic detection
/// # Protocol Version Handling
///
/// Manages protocol version negotiation and feature detection.
/// Provides version-specific behavior and compatibility handling.
/// # MQTT v3.1 Implementation
///
/// Complete implementation of the MQTT 3.1 specification (IBM version).
///
/// ## Key Features
/// - Basic QoS 0-2 support with acknowledged delivery
/// - Clean session handling for persistent connections
/// - Last Will and Testament (LWT) message support
/// - Basic authentication username/password support
/// # MQTT v3.1.1 Implementation
///
/// Implementation of MQTT 3.1.1 (OASIS Standard, most widely deployed version).
///
/// ## Differences from v3.1
/// - Enhanced error handling with specific return codes
/// - Improved session management with persistent sessions
/// - Standardized protocol name and version identification
/// - Clarified specification semantics and edge cases
/// # MQTT v5.0 Implementation
///
/// Complete implementation of MQTT 5.0 with modern features and enhancements.
///
/// ## Key Features
/// - Enhanced authentication and authorization mechanisms
/// - User properties for extensible metadata
/// - Reason codes for detailed error reporting
/// - Shared subscriptions for load balancing
/// - Message expiry and topic aliasing
/// - Flow control and quota management
/// # Auxiliary Packet Traits
///
/// Provides generic traits for MQTT packet functionality across protocol versions.
/// These auxiliary traits enable version-agnostic code while maintaining type safety.
/// Authentication credentials for MQTT connection
pub use Credentials;
/// Re-export common protocol types and payload handlers
pub use *;
/// Packet header types and fixed header implementation
pub use *;
/// MQTT packet type definitions and identifiers
pub use PacketType;
/// Quality of Service level enumeration and functionality
pub use QoS;
/// Protocol version handling and negotiation
pub use *;