View Source jhn_ip_addr (jhn_stdlib v5.1.0)
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
Summary
Functions
Determines the IP bounds for a range Equivalent of bounds(IOData, []).
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
Decodes the binary into an Integer. Equivalent of decode(IOData, []) -> Integer.
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
Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> IP.
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)
Types
Functions
Determines the IP bounds for a range Equivalent of bounds(IOData, []).
-spec bounds(iodata() | {ip(), range()}, [opt()] | #opts{format :: ipv4 | ipv6, ipv6ipv4 :: boolean(), continue :: boolean(), range :: boolean(), compact :: boolean(), return_type :: iolist | list | binary | tuple | integer}) -> {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
Decodes the binary into an Integer. Equivalent of decode(IOData, []) -> Integer.
-spec decode(iodata(), [opt()] | #opts{format :: ipv4 | ipv6, ipv6ipv4 :: boolean(), continue :: boolean(), range :: boolean(), compact :: boolean(), return_type :: iolist | list | binary | tuple | integer}) -> 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
Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> IP.
-spec encode(ip() | {ip(), range()}, [opt()] | #opts{format :: ipv4 | ipv6, ipv6ipv4 :: boolean(), continue :: boolean(), range :: boolean(), compact :: boolean(), return_type :: iolist | list | binary | tuple | integer}) -> 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)