Module Core_unix.Cidr

module Cidr: sig .. end
A representation of CIDR netmasks (e.g. "192.168.0.0/24") and functions to match if a given address is inside the range or not. Only IPv4 addresses are supported.

type t 
include Comparable.S_binable
include Stringable.S
of_string Generates a Cidr.t based on a string like "10.0.0.0/8". Addresses are not expanded, i.e. "10/8" is invalid.
val create : base_address:Core_unix.Inet_addr.t -> bits:int -> t
val base_address : t -> Core_unix.Inet_addr.t
Accessors.
val bits : t -> int
val all_matching_addresses : t -> Core_unix.Inet_addr.t Core_kernel.Std.Sequence.t
Generate a sequence of all addresses in the block.
val multicast : t
IPv4 multicast address can be represented by the CIDR prefix 224.0.0.0/4, (i.e. addresses from 224.0.0.0 to 239.255.255.255, inclusive)
val does_match : t -> Core_unix.Inet_addr.t -> bool
Is the given address inside the given Cidr.t? Note that the broadcast and network addresses are considered valid so does_match 10.0.0.0/8 10.0.0.0 is true.
val netmask_of_bits : t -> Core_unix.Inet_addr.t
Return the netmask corresponding to the number of network bits in the CIDR. For example, the netmask for a CIDR with 24 network bits (e.g. 1.2.3.0/24) is 255.255.255.0.
val bin_t : t Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_t : t Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_t : t Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_t : t Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_t : t Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_t : t Core_kernel.Std.Bin_prot.Type_class.writer
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t

of_string Generates a Cidr.t based on a string like "10.0.0.0/8". Addresses are not expanded, i.e. "10/8" is invalid.

Accessors.

Generate a sequence of all addresses in the block.

IPv4 multicast address can be represented by the CIDR prefix 224.0.0.0/4, (i.e. addresses from 224.0.0.0 to 239.255.255.255, inclusive)

Is the given address inside the given Cidr.t? Note that the broadcast and network addresses are considered valid so does_match 10.0.0.0/8 10.0.0.0 is true.

Return the netmask corresponding to the number of network bits in the CIDR. For example, the netmask for a CIDR with 24 network bits (e.g. 1.2.3.0/24) is 255.255.255.0.