wlan_sme/ap/
authenticator.rs

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
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use fidl_fuchsia_wlan_mlme::EapolResultCode;
use wlan_rsn::rsna::UpdateSink;
use wlan_rsn::{Error, NegotiatedProtection};

// Trait has to be Send because wlanstack wraps SME into a Future
pub trait Authenticator: std::fmt::Debug + std::marker::Send {
    fn get_negotiated_protection(&self) -> &NegotiatedProtection;
    fn reset(&mut self);
    fn initiate(&mut self, update_sink: &mut UpdateSink) -> Result<(), Error>;
    fn on_eapol_frame(
        &mut self,
        update_sink: &mut UpdateSink,
        frame: eapol::Frame<&[u8]>,
    ) -> Result<(), Error>;
    fn on_eapol_conf(
        &mut self,
        update_sink: &mut UpdateSink,
        result: EapolResultCode,
    ) -> Result<(), Error>;
}

impl Authenticator for wlan_rsn::Authenticator {
    fn get_negotiated_protection(&self) -> &NegotiatedProtection {
        wlan_rsn::Authenticator::get_negotiated_protection(self)
    }

    fn reset(&mut self) {
        wlan_rsn::Authenticator::reset(self)
    }

    fn initiate(&mut self, update_sink: &mut UpdateSink) -> Result<(), Error> {
        wlan_rsn::Authenticator::initiate(self, update_sink)
    }

    fn on_eapol_frame(
        &mut self,
        update_sink: &mut UpdateSink,
        frame: eapol::Frame<&[u8]>,
    ) -> Result<(), Error> {
        wlan_rsn::Authenticator::on_eapol_frame(self, update_sink, frame)
    }

    fn on_eapol_conf(
        &mut self,
        update_sink: &mut UpdateSink,
        result: EapolResultCode,
    ) -> Result<(), Error> {
        wlan_rsn::Authenticator::on_eapol_conf(self, update_sink, result)
    }
}