1use ieee80211::{Bssid, MacAddr};
6use wlan_common::timer::TimeoutDuration;
7
8pub const RSNA_COMPLETION_TIMEOUT_MILLIS: i64 = 8700;
11
12pub const RSNA_RESPONSE_TIMEOUT_MILLIS: i64 = 4000;
17
18pub const RSNA_RETRANSMISSION_TIMEOUT_MILLIS: i64 = 200;
24
25pub const SAE_RETRANSMISSION_TIMEOUT_MILLIS: i64 = 1000;
28
29pub const DEAUTHENTICATE_TIMEOUT_MILLIS: i64 = 500;
32
33pub const INSPECT_PULSE_CHECK_MINUTES: i64 = 1;
34pub const INSPECT_PULSE_PERSIST_MINUTES: i64 = 5;
35
36#[derive(Debug, Clone)]
37pub enum Event {
38 RsnaCompletionTimeout(RsnaCompletionTimeout),
39 RsnaResponseTimeout(RsnaResponseTimeout),
40 RsnaRetransmissionTimeout(RsnaRetransmissionTimeout),
41 InspectPulseCheck(InspectPulseCheck),
42 InspectPulsePersist(InspectPulsePersist),
44 SaeTimeout(SaeTimeout),
45 DeauthenticateTimeout(DeauthenticateTimeout),
46}
47impl From<RsnaCompletionTimeout> for Event {
48 fn from(timeout: RsnaCompletionTimeout) -> Self {
49 Event::RsnaCompletionTimeout(timeout)
50 }
51}
52impl From<RsnaResponseTimeout> for Event {
53 fn from(timeout: RsnaResponseTimeout) -> Self {
54 Event::RsnaResponseTimeout(timeout)
55 }
56}
57impl From<RsnaRetransmissionTimeout> for Event {
58 fn from(timeout: RsnaRetransmissionTimeout) -> Self {
59 Event::RsnaRetransmissionTimeout(timeout)
60 }
61}
62impl From<InspectPulseCheck> for Event {
63 fn from(this: InspectPulseCheck) -> Self {
64 Event::InspectPulseCheck(this)
65 }
66}
67impl From<InspectPulsePersist> for Event {
68 fn from(this: InspectPulsePersist) -> Self {
69 Event::InspectPulsePersist(this)
70 }
71}
72impl From<SaeTimeout> for Event {
73 fn from(this: SaeTimeout) -> Self {
74 Event::SaeTimeout(this)
75 }
76}
77impl From<DeauthenticateTimeout> for Event {
78 fn from(this: DeauthenticateTimeout) -> Self {
79 Event::DeauthenticateTimeout(this)
80 }
81}
82
83#[derive(Debug, Clone)]
84pub struct RsnaCompletionTimeout;
85impl TimeoutDuration for RsnaCompletionTimeout {
86 fn timeout_duration(&self) -> zx::MonotonicDuration {
87 zx::MonotonicDuration::from_millis(RSNA_COMPLETION_TIMEOUT_MILLIS)
88 }
89}
90
91#[derive(Debug, Clone)]
92pub struct RsnaResponseTimeout;
93impl TimeoutDuration for RsnaResponseTimeout {
94 fn timeout_duration(&self) -> zx::MonotonicDuration {
95 zx::MonotonicDuration::from_millis(RSNA_RESPONSE_TIMEOUT_MILLIS)
96 }
97}
98
99#[derive(Debug, Clone)]
100pub struct RsnaRetransmissionTimeout {
101 pub bssid: Bssid,
102 pub sta_addr: MacAddr,
103}
104impl TimeoutDuration for RsnaRetransmissionTimeout {
105 fn timeout_duration(&self) -> zx::MonotonicDuration {
106 zx::MonotonicDuration::from_millis(RSNA_RETRANSMISSION_TIMEOUT_MILLIS)
107 }
108}
109
110#[derive(Debug, Clone)]
111pub struct InspectPulseCheck;
112impl TimeoutDuration for InspectPulseCheck {
113 fn timeout_duration(&self) -> zx::MonotonicDuration {
114 zx::MonotonicDuration::from_minutes(INSPECT_PULSE_CHECK_MINUTES)
115 }
116}
117
118#[derive(Debug, Clone)]
119pub struct InspectPulsePersist;
120impl TimeoutDuration for InspectPulsePersist {
121 fn timeout_duration(&self) -> zx::MonotonicDuration {
122 zx::MonotonicDuration::from_minutes(INSPECT_PULSE_PERSIST_MINUTES)
123 }
124}
125
126#[derive(Debug, Clone)]
127pub struct SaeTimeout(pub u64);
128impl TimeoutDuration for SaeTimeout {
129 fn timeout_duration(&self) -> zx::MonotonicDuration {
130 zx::MonotonicDuration::from_millis(SAE_RETRANSMISSION_TIMEOUT_MILLIS)
131 }
132}
133
134#[derive(Debug, Clone)]
135pub struct DeauthenticateTimeout;
136impl TimeoutDuration for DeauthenticateTimeout {
137 fn timeout_duration(&self) -> zx::MonotonicDuration {
138 zx::MonotonicDuration::from_millis(DEAUTHENTICATE_TIMEOUT_MILLIS)
139 }
140}