Pfx.eui64_encode

You're seeing just the function eui64_encode, go back to Pfx module for more information.

Specs

eui64_encode(prefix()) :: prefix()

Create a modified EUI-64 out of eui48 (an EUI-48 address).

Despite rfc7217, modified EUI-64's are still used in the wild. This flips the 7-th bit and inserts 0xFFFE in the middle. EUI's in tuple form, should be encoded by Pfx.from_mac/1 first. That always yields, pending any encoding errors, a Pfx-struct, so to get the result in tuple-form, reroute it through Pfx.digits/2.

Example

iex> eui64_encode("0088.8888.8888")
"02-88-88-FF-FE-88-88-88"

iex> eui64_encode("0288.8888.8888")
"00-88-88-FF-FE-88-88-88"

iex> from_mac({0x00, 0x88, 0x88, 0x88, 0x88, 0x88}) |> eui64_encode() |> digits(8)
{{0x02, 0x88, 0x88, 0xFF, 0xFE, 0x88, 0x88, 0x88}, 64}