This class encapsulates an IP address which may be either IPv4 (32 bit) or IPv6 (128 bit). The JDK does not yet support IPv6 addresses, but the Swift packet format uses 128 bit addresses (in preparation for IPv6) and therefore we need this class. Internally everything is kept as an IPv6 address. If an IPv4 address is set (which will be the typical case until IPv6 is adopted), then it is converted to an IPv4-mapped IPv6 address. See RFC 2373 for more info on IPv6. Additionally we have added a third format called IPv4+MAC. In iMQ IP addresses are simply used as a unique identifier for clients. Since an IPv4 address is not suitably unique (for example when NAT is used) we add the ability to embedded a 40 bit MAC address (or psuedo MAC address) along with an IPv4 address in the 128 bits an IPv6 address gives us. The format is: +--------+--------+--------+--------+ |11111111|00000000|00000000|00000000| +--------+--------+--------+--------+ | 48 bit MAC address . . . +--------+--------+--------+--------+ . . . |11111111|11111111| +--------+--------+--------+--------+ | 32 bit IPv4 address | +--------+--------+--------+--------+ The leading 11111111 is used in IPv6 to signify an IPv6 multicast address. Since a client will never be assigned a multicast address we can use this prefix to indicate an IPv4+MAC address.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.