-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f5aacf
commit 6551a0a
Showing
14 changed files
with
95 additions
and
240 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
//! MAC address policy management for the Proton access point management library. | ||
//! MAC address data structure for the Proton access point management library. | ||
#![deny(warnings)] | ||
#![deny(missing_docs)] | ||
mod mac; | ||
|
||
mod error; | ||
mod mac_addr_policy; | ||
|
||
pub use error::MacAddrPolicyError; | ||
pub use mac_addr_policy::MacAddrPolicy; | ||
pub use mac::MacAddr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//! MAC address type. | ||
use std::fmt::{ | ||
Display, | ||
Debug, | ||
Formatter, | ||
Result, | ||
}; | ||
|
||
use serde::Serialize; | ||
|
||
#[derive(Serialize, PartialEq, Eq, Clone, Copy)] | ||
/// A hardware (MAC) address consisting of six octets. | ||
pub struct MacAddr ([u8; 6]); | ||
|
||
impl Display for MacAddr { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> Result { | ||
write!( | ||
f, | ||
"{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", | ||
self.0[0], | ||
self.0[1], | ||
self.0[2], | ||
self.0[3], | ||
self.0[4], | ||
self.0[5], | ||
) | ||
} | ||
} | ||
|
||
impl Debug for MacAddr { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> Result { | ||
write!(f, "{}", self) | ||
} | ||
} | ||
|
||
impl From<[u8; 6]> for MacAddr { | ||
fn from(octets: [u8; 6]) -> Self { | ||
Self (octets) | ||
} | ||
} | ||
|
||
impl From<pnet::datalink::MacAddr> for MacAddr { | ||
fn from(mac: pnet::datalink::MacAddr) -> Self { | ||
Self ([ | ||
mac.0, | ||
mac.1, | ||
mac.2, | ||
mac.3, | ||
mac.4, | ||
mac.5, | ||
]) | ||
} | ||
} |
Oops, something went wrong.