Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]
Protocols
Protocols.IPv6

Method Protocols.IPv6.normalize_addr_short()


Method normalize_addr_short

string normalize_addr_short(string addr)

Description

Normalizes a formatted IPv6 address to a canonical shortest form. addr is parsed according to the hexadecimal "x:x:x:x:x:x:x:x" syntax or any of its shorthand varieties (see RFC 2373, section 2.2).

The returned address is normalized as follows: The longest sequence of zeroes is shortened using "::". If there are several of equal length then the leftmost is shortened. All hexadecimal letters are lower-case. There are no superfluous leading zeroes in the fields.

Zero is returned if addr is incorrectly formatted.

See also

normalize_addr_basic