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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! # AUTOSAR E2E Protection Library
//!
//! This library implements the AUTOSAR E2E (End-to-End) protection mechanism
//! as specified in the AUTOSAR standard.
//!
//! ## Overview
//!
//! The E2E protection mechanism provides end-to-end data protection for
//! safety-critical automotive communication. It detects errors in data
//! transmission including:
//! - Data corruption (via CRC)
//! - Message loss, duplication, or reordering (via sequence counter)
//! - Incorrect addressing (via Data ID)
//!
//! ## Example
//!
//! ```rust
//! use autosar_e2e::{E2EProfile, E2EResult};
//! use autosar_e2e::profile11::{Profile11, Profile11Config, Profile11IdMode};
//!
//! # fn main() -> E2EResult<()> {
//! // Create a Profile 11 configuration
//! let config = Profile11Config {
//! mode: Profile11IdMode::Nibble,
//! max_delta_counter: 1,
//! data_length: 40,
//! ..Default::default()
//! };
//!
//! // Create the profile instance
//! let mut profile = Profile11::new(config)?;
//!
//! // Protect data
//! let mut data = vec![0x00, 0x00, 0x12, 0x34, 0x56]; //[CRC, counter, user data ..]
//! profile.protect(&mut data)?;
//!
//! // Check protected data
//! let status = profile.check(&data)?;
//! # Ok(())
//! # }
//! ```
use Error;
pub use profile11;
pub use profile22;
pub use profile4;
pub use profile4m;
pub use profile5;
pub use profile6;
pub use profile7;
pub use profile7m;
pub use profile8;
/// Result type for E2E operations
pub type E2EResult<T> = ;
/// E2E Protection status enumeration
/// E2E Error types
// Main trait for E2E Profile implementations
///
/// This trait defines the common interface that all E2E profiles must implement.
/// Each profile provides three main operations:
/// - `protect`: Add E2E protection to data
/// - `check`: Verify E2E protection on received data
/// - `forward`: Forward protected data (Profile 11 specific)