Page
Library
Module
Module type
Parameter
Class
Class type
Source
Ipaddr.V4
SourceA collection of functions for IPv4 addresses.
Type of the internet protocol v4 address of a host
Converts the low bytes of four int values into an abstract V4.t
.
These manipulate human-readable IPv4 addresses (for example 192.168.1.2
).
of_string s
is the address t
represented by the human-readable IPv4 address s
. Returns a human-readable error string if parsing failed.
of_string_exn s
is the address t
represented as a human-readable IPv4 address s
. Raises Parse_error
if s
is invalid or truncated.
of_string_raw s off
acts as of_string_exn
but takes as an extra argument the offset into the string for reading. off
will be mutated to an unspecified value during the function call. s
will a Parse_error
exception if it is an invalid or truncated IP address.
with_port_of_string ~default s
is the address t
represented by the human-readble IPv4 address s
with a possibly port :<port>
(otherwise, we take the default
value).
to_string ipv4
is the dotted decimal string representation of ipv4
, i.e. XXX.XX.X.XXX
.
to_buffer buf ipv4
writes the string representation of ipv4
into the buffer buf
.
pp f ipv4
outputs a human-readable representation of ipv4
to the formatter f
.
These manipulate IPv4 addresses represented as a sequence of four bytes. (e.g for example 0xc0a80102
will be the representation of the human-readable 192.168.1.2
address.
of_octets ?off s
is the IPv4 address t
represented by the octets in s
starting from offset off
within the string. Returns a human-readable error string if s
is not at least off+4
bytes long. off
defaults to 0.
of_octets_exn ipv4_octets
is the IPv4 address represented by ipv4_octets
starting from offset off
. Raises Parse_error
if ipv4_octets
is not at least off+4
bytes long. off
defaults to 0.
write_octets ?off ipv4 b
writes the ipv4
as octets to b
starting from offset off
. b
must be at least off+4
long or an error is returned.
write_octets_exn ?off ipv4 b
writes the ipv4
as octets to b
starting from offset off
. b
must be at least off+4
long or a Parse_error
is raised.
of_int16 ipv4_packed
is the address represented by ipv4_packed
.
multicast_to_mac ipv4
is the MAC address corresponding to the multicast address ipv4
. Described by RFC 1112.
to_domain_name ipv4
is the domain name label list for reverse lookups of ipv4
. This includes the .in-addr.arpa
suffix.
of_domain_name name
is Some t
if the name
has an .in-addr.arpa
suffix, and an IPv4 address prefixed.
succ ipv4
is ip address next to ipv4
. Returns a human-readable error string if it's already the highest address.
pred ipv4
is ip address before ipv4
. Returns a human-readable error string if it's already the lowest address.
is_global ipv4
is a predicate indicating whether ipv4
globally addresses a node.
is_multicast ipv4
is a predicate indicating whether ipv4
is a multicast address.
is_private ipv4
is a predicate indicating whether ipv4
privately addresses a node.
include Map.OrderedType with type t := t
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
.