Module Ipaddr.V6Source

A collection of functions for IPv6 addresses.

Sourcetype t

Type of the internet protocol v6 address of a host

include Ppx_sexp_conv_lib.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0__.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0__.Sexp.t
Sourceval make : int -> int -> int -> int -> int -> int -> int -> int -> t

Converts the low bytes of eight int values into an abstract V6.t.

Text string conversion

Sourceval of_string_exn : string -> t

of_string_exn ipv6_string is the address represented by ipv6_string. Raises Parse_error if ipv6_string is not a valid representation of an IPv6 address.

Sourceval of_string : string -> t option

Same as of_string_exn but returns an option type instead of raising an exception.

Sourceval of_string_raw : string -> int ref -> t

Same as of_string_exn but takes as an extra argument the offset into the string for reading.

Sourceval to_string : ?v4:bool -> t -> string

to_string ipv6 is the string representation of ipv6, i.e. XXX:XX:X::XXX:XX.

Sourceval to_buffer : ?v4:bool -> Buffer.t -> t -> unit

to_buffer buf ipv6 writes the string representation of ipv6 into the buffer buf.

Sourceval pp : Format.formatter -> t -> unit

pp f ipv6 outputs a human-readable representation of ipv6 to the formatter f.

Sourceval pp_hum : Format.formatter -> t -> unit

pp_hum f ipv6 outputs a human-readable representation of ipv6 to the formatter f.

  • deprecated

    This function will be deprecated in a future version of this library. Please use pp instead.

Bytestring conversion

Sourceval of_bytes_exn : string -> t

of_bytes_exn ipv6_octets is the address represented by ipv6_octets. Raises Parse_error if ipv6_octets is not a valid representation of an IPv6 address.

Sourceval of_bytes : string -> t option

Same as of_bytes_exn but returns an option type instead of raising an exception.

Sourceval of_bytes_raw : string -> int -> t

Same as of_bytes_exn but takes an extra paramenter, the offset into the bytes for reading.

Sourceval to_bytes : t -> string

to_bytes ipv6 is a string of length 16 encoding ipv6.

Sourceval to_bytes_raw : t -> Bytes.t -> int -> unit

to_bytes_raw ipv6 bytes offset writes the 16 bytes encoding of ipv6 into bytes at offset offset.

Int conversion

Sourceval of_int64 : (int64 * int64) -> t

of_int64 (ho, lo) is the IPv6 address represented by two int64.

to_int64 ipv6 is the 128-bit packed encoding of ipv6.

Sourceval to_int64 : t -> int64 * int64

to_int64 ipv6 is the 128-bit packed encoding of ipv6.

Sourceval of_int32 : (int32 * int32 * int32 * int32) -> t

of_int32 (a, b, c, d) is the IPv6 address represented by four int32.

to_int32 ipv6 is the 128-bit packed encoding of ipv6.

Sourceval to_int32 : t -> int32 * int32 * int32 * int32

to_int32 ipv6 is the 128-bit packed encoding of ipv6.

Sourceval of_int16 : (int * int * int * int * int * int * int * int) -> t

of_int16 (a, b, c, d, e, f, g, h) is the IPv6 address represented by eight 16-bit int.

to_int16 ipv6 is the 128-bit packed encoding of ipv6.

Sourceval to_int16 : t -> int * int * int * int * int * int * int * int

to_int16 ipv6 is the 128-bit packed encoding of ipv6.

MAC conversion

Sourceval multicast_to_mac : t -> Macaddr.t

multicast_to_mac ipv6 is the MAC address corresponding to the multicast address ipv6. Described by RFC 2464.

Host conversion

Sourceval to_domain_name : t -> string list

to_domain_name ipv6 is the domain name label list for reverse lookups of ipv6. This includes the .ip6.arpa. suffix.

Common addresses

Sourceval unspecified : t

unspecified is ::.

Sourceval localhost : t

localhost is ::1.

Sourceval interface_nodes : t

interface_nodes is ff01::01.

link_nodes is ff02::01.

Sourceval interface_routers : t

interface_routers is ff01::02.

link_routers is ff02::02.

Sourceval site_routers : t

site_routers is ff05::02.

Sourcemodule Prefix : sig ... end

A module for manipulating IPv6 network prefixes.

Sourceval scope : t -> scope

scope ipv6 is the classification of ipv6 by the scope hierarchy.

link_address_of_mac mac is the link-local address for an Ethernet interface derived by the IEEE MAC -> EUI-64 map with the Universal/Local bit complemented for IPv6.

Sourceval is_global : t -> bool

is_global ipv6 is a predicate indicating whether ipv6 globally addresses a node.

Sourceval is_multicast : t -> bool

is_multicast ipv6 is a predicate indicating whether ipv6 is a multicast address.

Sourceval is_private : t -> bool

is_private ipv6 is a predicate indicating whether ipv6 privately addresses a node.

include Map.OrderedType with type t := t
Sourceval compare : t -> t -> int

A total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.