V6.Prefix
A module for manipulating IPv6 network prefixes (CIDR).
type addr = t
val mask : int -> addr
mask n
is the pseudo-address of an n
bit subnet mask.
network_address cidr addr
is the address with prefix cidr
and suffix from addr
. See <http://tools.ietf.org/html/rfc4291#section-2.3>.
val of_string_exn : string -> t
of_string_exn cidr
is the subnet prefix represented by the CIDR string, cidr
. Raises Parse_error
if cidr
is not a valid representation of a CIDR notation routing prefix.
val of_string : string -> (t, [> `Msg of string ]) Stdlib.result
Same as of_string_exn
but returns a result type instead of raising an exception.
val of_string_raw : string -> int Stdlib.ref -> t
Same as of_string_exn
but takes as an extra argument the offset into the string for reading.
val to_string : t -> string
to_string cidr
is the CIDR notation string representation of cidr
, i.e. XXX:XX:X::XXX/XX.
val pp : Stdlib.Format.formatter -> t -> unit
pp f cidr
outputs a human-readable representation of cidr
to the formatter f
.
val to_buffer : Stdlib.Buffer.t -> t -> unit
to_buffer buf cidr
writes the string representation of cidr
to the buffer buf
.
of_netmask_exn ~netmask ~address
is the subnet prefix of address
with netmask netmask
.
of_netmask ~netmask ~address
is the cidr of address
with netmask netmask
.
subset ~subnet ~network
checks whether subnet
is contained within network
.
of_addr ip
create a subnet composed of only one address, ip
. It is the same as make 128 ip
.
val global_unicast_001 : t
Global Unicast 001, 2000::/3.
val unique_local : t
The Unique Local Unicast (ULA), fc00::/7.
val link : t
Link-Local Unicast, fe80::/64.
val multicast : t
The multicast network, ff00::/8.
val ipv4_mapped : t
IPv4-mapped addresses, ::ffff:0:0/96.
val noneui64_interface : t
Global Unicast addresses that don't use Modified EUI64 interface identifiers, ::/3.
val solicited_node : t
Solicited-Node multicast addresses
val bits : t -> int
bits subnet
is the bit size of the subnet
prefix.
hosts subnet
is the sequence of host addresses in this subnet
. By default the Subnet-Router anycast address is omitted. This can be changed by setting usable
to false.
subnets n subnet
is the sequence of subnets of subnet
with a prefix length of n
.