Module ip_addr

A IP library based on: IP Version 6 Addressing Architecture (rfc4291) A Recommendation for IPv6 Address Text Representation (rfc5952) Classless Inter-domain Routing (CIDR): (rfc4632) The Internet Address Assignment and Aggregation Plan.

Copyright © (C) 2016-2020, Jan Henry Nystrom <JanHenryNystrom@gmail.com> -------------------------------------------------------------------

Authors: Jan Henry Nystrom (JanHenryNystrom@gmail.com).

Description

A IP library based on: IP Version 6 Addressing Architecture (rfc4291) A Recommendation for IPv6 Address Text Representation (rfc5952) Classless Inter-domain Routing (CIDR): (rfc4632) The Internet Address Assignment and Aggregation Plan

Data Types

ip()

ip() = ipv4() | ipv6()

ipv4()

ipv4() = integer() | {integer(), integer(), integer(), integer()}

ipv6()

ipv6() = integer() | {integer(), integer(), integer(), integer(), integer(), integer(), integer(), integer()} | {integer(), integer(), integer(), integer(), integer(), integer(), {integer(), integer(), integer(), integer()}}

opt()

opt() = term()

range()

range() = integer()

Function Index

bounds/1 Determines the IP bounds for a range Equivalent of bounds(IOData, []).
bounds/2 Determines the IP bounds for a range Bounds will give an exception if the binary is not well formed IP.
decode/1 Decodes the binary into an Integer.
decode/2 Decodes the binary into a structured Erlang.
encode/1 Encodes the structured Erlang term as an iolist.
encode/2 Encodes the structured Erlang term as an iolist or binary.

Function Details

bounds/1

bounds(Range::iodata() | {ip(), range()}) -> {integer(), integer()}

Determines the IP bounds for a range Equivalent of bounds(IOData, []).

bounds/2

bounds(Binary::iodata() | {ip(), range()}, Opts::[opt()] | #opts{format = ipv4 | ipv6, ipv6ipv4 = boolean(), continue = boolean(), range = boolean(), compact = boolean(), return_type = iolist | list | binary}) -> {ip(), ip()}

Determines the IP bounds for a range Bounds will give an exception if the binary is not well formed IP. Options are: integer -> an integer is returned (Default) tuple -> a tuple of integers is returned ipv6ipv4 -> with tuple the two last parts are returned as an IPv4 tuple

decode/1

decode(Binary::iodata()) -> ip() | {ip(), iodata()}

Decodes the binary into an Integer. Equivalent of decode(IOData, []) -> Integer.

decode/2

decode(Binary::iodata(), Opts::[opt()] | #opts{format = ipv4 | ipv6, ipv6ipv4 = boolean(), continue = boolean(), range = boolean(), compact = boolean(), return_type = iolist | list | binary}) -> ip() | {ip(), range()} | {ip(), iodata()} | {ip(), range(), iodata()}

Decodes the binary into a structured Erlang. Decode will give an exception if the binary is not well formed IP. Options are: integer -> an integer is returned (Default) tuple -> a tuple of integers is returned ipv6ipv4 -> with tuple the two last parts are returned as an IPv4 tuple range -> a IP range is being decoded continue -> all remaining indata is returned

encode/1

encode(Term::ip() | {ip(), range()}) -> iolist()

Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> IP.

encode/2

encode(Term::ip() | {ip(), range()}, Opts::[opt()] | #opts{format = ipv4 | ipv6, ipv6ipv4 = boolean(), continue = boolean(), range = boolean(), compact = boolean(), return_type = iolist | list | binary}) -> iolist() | binary()

Encodes the structured Erlang term as an iolist or binary. Encode will give an exception if the erlang term is not well formed. Options are: binary -> a binary is returned list -> a flat list is returned iolist -> an iolist is returned (Default) ipv4 -> an ipv4 address is encoded when the Term is an integer ipv6 -> an ipv6 address is encoded when the Term is an integer ipv6ipv4 -> encoded IPv6 host address has the two least sigificant segments repesented in IPv4 address format compact -> the most compact encoding of IPv6 used (collapsed zeros)


Generated by EDoc