Skip to main content

OuiDb

Struct OuiDb 

Source
pub struct OuiDb { /* private fields */ }
Expand description

In-memory OUI database backed by locally cached IEEE CSV files.

Implementations§

Source§

impl OuiDb

Source

pub fn new(data_dir: &Path) -> Self

Creates a new OuiDb pointing at data_dir for cached CSV files.

Source

pub fn age(&self) -> Option<SystemTime>

Returns the modification time of the oldest cached CSV file, or None if any file is missing or its mtime is unavailable.

Source

pub fn load_data(&mut self) -> Result<()>

Loads all cached CSV files into the in-memory lookup table.

Source

pub fn update(&self) -> Result<()>

Downloads fresh OUI data from all IEEE sources and writes them to data_dir.

Trait Implementations§

Source§

impl Oui for OuiDb

Source§

fn lookup(&self, mac: MacAddr) -> Option<OuiData>

Retrieve the OUI record for a given MAC address.

IEEE assigns OUI prefixes at three granularities:

  • MA-L (MAC Address Large, oui.csv): 24-bit prefix → 6 hex chars
  • MA-M (MAC Address Medium, mam.csv): 28-bit prefix → 7 hex chars
  • MA-S (MAC Address Small, oui36.csv/iab.csv): 36-bit prefix → 9 hex chars

We try the most-specific prefix first so that a narrower assignment (e.g. MA-S) takes precedence over a broader one (e.g. MA-L) for the same MAC address.

Auto Trait Implementations§

§

impl Freeze for OuiDb

§

impl RefUnwindSafe for OuiDb

§

impl Send for OuiDb

§

impl Sync for OuiDb

§

impl Unpin for OuiDb

§

impl UnsafeUnpin for OuiDb

§

impl UnwindSafe for OuiDb

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.