wlan_sme/ap/
authenticator.rs

1// Copyright 2018 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use fidl_fuchsia_wlan_mlme::EapolResultCode;
6use wlan_rsn::rsna::UpdateSink;
7use wlan_rsn::{Error, NegotiatedProtection};
8
9// Trait has to be Send because wlanstack wraps SME into a Future
10pub trait Authenticator: std::fmt::Debug + std::marker::Send {
11    fn get_negotiated_protection(&self) -> &NegotiatedProtection;
12    fn reset(&mut self);
13    #[allow(clippy::result_large_err)] // TODO(https://fxbug.dev/401255153)
14    fn initiate(&mut self, update_sink: &mut UpdateSink) -> Result<(), Error>;
15    #[allow(clippy::result_large_err)] // TODO(https://fxbug.dev/401255153)
16    fn on_eapol_frame(
17        &mut self,
18        update_sink: &mut UpdateSink,
19        frame: eapol::Frame<&[u8]>,
20    ) -> Result<(), Error>;
21    #[allow(clippy::result_large_err)] // TODO(https://fxbug.dev/401255153)
22    fn on_eapol_conf(
23        &mut self,
24        update_sink: &mut UpdateSink,
25        result: EapolResultCode,
26    ) -> Result<(), Error>;
27}
28
29impl Authenticator for wlan_rsn::Authenticator {
30    fn get_negotiated_protection(&self) -> &NegotiatedProtection {
31        wlan_rsn::Authenticator::get_negotiated_protection(self)
32    }
33
34    fn reset(&mut self) {
35        wlan_rsn::Authenticator::reset(self)
36    }
37
38    fn initiate(&mut self, update_sink: &mut UpdateSink) -> Result<(), Error> {
39        wlan_rsn::Authenticator::initiate(self, update_sink)
40    }
41
42    fn on_eapol_frame(
43        &mut self,
44        update_sink: &mut UpdateSink,
45        frame: eapol::Frame<&[u8]>,
46    ) -> Result<(), Error> {
47        wlan_rsn::Authenticator::on_eapol_frame(self, update_sink, frame)
48    }
49
50    fn on_eapol_conf(
51        &mut self,
52        update_sink: &mut UpdateSink,
53        result: EapolResultCode,
54    ) -> Result<(), Error> {
55        wlan_rsn::Authenticator::on_eapol_conf(self, update_sink, result)
56    }
57}