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
// Copyright 2019 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.

pub mod akm;
pub mod cipher;
pub mod fake_rsnes;
mod pmkid;
pub mod rsne;
pub mod suite_filter;
pub mod suite_selector;

pub use {fake_rsnes::*, suite_selector::OUI};

use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("unexpected IO error: {}", _0)]
    UnexpectedIoError(std::io::Error),
    #[error("invalid OUI length; expected 3 bytes but received {}", _0)]
    InvalidOuiLength(usize),
    #[error("invalid PMKID length; expected 16 bytes but received {}", _0)]
    InvalidPmkidLength(usize),
}

impl From<std::io::Error> for Error {
    fn from(e: std::io::Error) -> Self {
        Error::UnexpectedIoError(e)
    }
}