rust-manuf

LICENSE Crates.io Version Document Build Status

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:

toml [dependencies] manuf = "0.1"

Then, add this to your crate root:

rust extern crate manuf;

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

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

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

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

use parse to extract verdor's information from a manuf file.

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

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

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

License

Released under the terms of the MIT license.