Pfx.multicast

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

Specs

multicast(prefix()) :: map() | nil

Returns a map with multicast address components for given pfx.

Returns nil if pfx is not a multicast address.

For IPv6, the following fields are extracted:

 |   8    |  4 |  4 |                  112 bits                   |
 +------ -+----+----+---------------------------------------------+
 |11111111|flgs|scop|                  group ID                   |
 +--------+----+----+---------------------------------------------+
  • preamble, the first 8 bits as an integer (255)
  • flags, the 4 flgs-bits as a 4-element tuple
  • scope, the 4 scop-bits as an integer 0..15
  • groupID, the 112 bits as an integer
  • prefix, the prefix with prefix length 16
  • address, the original link-local address

Examples

iex> multicast("ff02::1")
%{
  address: "ff02::1",
  flags: {0, 0, 0, 0},
  groupID: 1,
  preamble: 255,
  prefix: "ff02:0:0:0:0:0:0:0/16",
  scope: 2
}

iex> multicast("224.0.0.1")
%{
  address: "224.0.0.1",
  digits: {224, 0, 0, 1},
  groupID: 1
}