#EUI-48 #MAC #networking #MAC-48 #MACADDR

eui48

A library to generate and parse IEEE EUI-48 and EUI-64, also known as MAC-48 media access control addresses. The IEEE claims trademarks on the names EUI-48 and EUI-64, in which EUI is an abbreviation for Extended Unique Identifier.

11 releases

✓ Uses Rust 2018 edition

0.4.6 Jan 28, 2019
0.4.5 Jan 24, 2019
0.4.1 Nov 28, 2018
0.3.2 Mar 3, 2018
0.1.0 Feb 13, 2016

#52 in Network programming

Download history 3610/week @ 2019-07-27 3945/week @ 2019-08-03 2223/week @ 2019-08-10 2448/week @ 2019-08-17 1614/week @ 2019-08-24 2502/week @ 2019-08-31 2435/week @ 2019-09-07 1857/week @ 2019-09-14 2049/week @ 2019-09-21 2449/week @ 2019-09-28 2610/week @ 2019-10-05 2265/week @ 2019-10-12 1580/week @ 2019-10-19 1216/week @ 2019-10-26 1689/week @ 2019-11-02

7,035 downloads per month
Used in 17 crates (12 directly)

MIT/Apache

30KB
631 lines

Crates.io docs.rs Build Status Build Status Build Status Coverage Status

eui48

A Rust library to represent and parse IEEE EUI-48 also known as MAC-48 media access control addresses. The IEEE claims trademarks on the names EUI-48 and EUI-64, in which EUI is an abbreviation for Extended Unique Identifier.

Usage

Add this to your Cargo.toml:

[dependencies]

eui48 = "0.4.6"

and this to your crate root:

extern crate eui48;

Examples

To create a new MAC address and print it out in canonical form:

extern crate eui48;
use eui48::{MacAddress, Eui48};

fn main() {
	let eui: Eui48 = [ 0x12, 0x34, 0x56, 0xAB, 0xCD, 0xEF ];
	let mac = MacAddress::new( eui );

	println!("{}", mac.to_canonical());
	println!("{}", mac.to_hex_string());
	println!("{}", mac.to_dot_string());
	println!("{}", mac.to_hexadecimal());
	println!("{}", mac.to_interfaceid());
	println!("{}", mac.to_link_local());

	let mac = MacAddress::parse_str( "01-02-03-0A-0b-0f" ).expect("Parse error {}");
	let mac = MacAddress::parse_str( "01:02:03:0A:0b:0f" ).expect("Parse error {}");
	let mac = MacAddress::parse_str( "0102.030A.0b0f" ).expect("Parse error {}");
	let mac = MacAddress::parse_str( "0x1234567890ab" ).expect("Parse error {}");
}

References

Wikipedia: MAC address

Authors

  • 0.1 Andrew Baumhauer - Initial design
  • 0.2 rlcomstock3 - Added support for btree keys
  • 0.3 Michal 'vorner' Vaner vorner+github@vorner.cz - Serde 1.0 support
  • 0.3.1 Michal 'vorner' Vaner vorner+github@vorner.cz - Derive useful traits
  • 0.4.0 Rainer Stademann - Define ABI as repr(C)
  • 0.4.1 Andrew Baumhauer - Add IPv6 Interface ID and Link Local conversions
  • 0.4.2 Andrew Baumhauer / Eric Clone - Bug fix in is_local() and is_unicast() functions
  • 0.4.3 Andrew Baumhauer - Update travis-ci, appveyor, codecov
  • 0.4.4 Andrew Baumhauer - Update documentation
  • 0.4.5 Andrew Baumhauer - Improve code coverage and tests
  • 0.4.6 Jiwoong Lee - Add to_array() for compatibility, add feature disp_hexstring

Dependencies

~210KB