added mac_to_string
This commit is contained in:
parent
ea5d463216
commit
b7aafc68d6
@ -3,3 +3,10 @@ pub type Mac = [u8; 6];
|
|||||||
pub const BROADCAST_MAC: Mac = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff];
|
pub const BROADCAST_MAC: Mac = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff];
|
||||||
pub const MULTICAST_MAC: Mac = [0x01, 0x00, 0x5E, 0x00, 0x00, 0x00]; /* First 3 bytes are meaningful */
|
pub const MULTICAST_MAC: Mac = [0x01, 0x00, 0x5E, 0x00, 0x00, 0x00]; /* First 3 bytes are meaningful */
|
||||||
pub const IPV6_MULTICAST_MAC: Mac = [0x33, 0x33, 0x00, 0x00, 0x00, 0x00]; /* First 2 bytes are meaningful */
|
pub const IPV6_MULTICAST_MAC: Mac = [0x33, 0x33, 0x00, 0x00, 0x00, 0x00]; /* First 2 bytes are meaningful */
|
||||||
|
|
||||||
|
pub fn mac_to_string(mac: &Mac) -> String {
|
||||||
|
format!(
|
||||||
|
"[{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}]",
|
||||||
|
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user