Skip to content

Ethernet vendor codes, and well-known MAC addresses

License

Notifications You must be signed in to change notification settings

DmitrySamoylov/rust-manuf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-manuf LICENSE Crates.io Version Document Build Status Codecov

rust-manuf is rust library provides Ethernet vendor codes, and well-known MAC addresses

Usage

To use rust-manuf, first add this to your Cargo.toml:

[dependencies]
manuf = "0.1"

Then, add this to your crate root:

extern crate manuf;

Use vendor function to find name and description base on an ethernet (MAC) address.

assert_eq!(
    manuf::vendor([0x8c, 0x85, 0x90, 0x0b, 0xcb, 0x9e]),
    Some(("Apple", "Apple, Inc."))
);

Use prefix function to find vendor's prefix and mask for the ethernet (MAC) address.

assert!(
    manuf::prefix("Apple")
        .any(|prefix| prefix == ([0x8c, 0x85, 0x90, 0x00, 0x00, 0x00], 24))
);

use parse function to extract verdor's ((prefix, prefix_length), (name, description)) from a manuf file.

let f = File::open("manuf").unwrap();
let r = BufReader::new(f);

for ((prefix, prefix_len), (name, desc)) in manuf::parse(r) {
    println!("{:?}/{}\t{}\t{}", prefix, prefix_len, name, desc)
}

Note: The manuf file was generated by the Wireshark project.

License

Released under the terms of the MIT license.

About

Ethernet vendor codes, and well-known MAC addresses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%