Sedona

inet::IpAddr


sys::Obj
  inet::IpAddr

public class IpAddr

IpAddr models an Internet IPv4 or IPv6 address.


equals

public bool equals(IpAddr that)

Return if this address is equivalent to that address.

isIPv4

public bool isIPv4()

Return if this is a IPv4 mapped address. IPv4 addresses have the first 80 bits set to zero, the next 16 set to one, and the last 32 bits represent the IPv4 address.

loadBuf

public bool loadBuf(Buf addr)

Convenience for loadBytes(addr.bytes, addr.size)

loadBytes

public bool loadBytes(byte[] addr, int len)

Set the IpAddr using a raw byte array. Returns true if the length of the addr is 4-bytes (IPv4) or 16 bytes (IPv6). No validation is done on the raw addr.

parse

public bool parse(Str notation)

Parse the specified string from an IPv4 dotted-quad notation or IPv6 colon-hexdecimal notation into this IpAddr. This method will not resolve a hostname. Return true on success, or false on failure (if the address is illegally formatted).

set

public void set(IpAddr addr)

This method is used to copy the address of "addr" into this instance.

toStr

public Str toStr()

Get the address in string format - dotted-quad notation for IPv4 or colon-hexidecimal notation for IPv6. The string is stored in a static shared buffer.