/** * @param array array * @param offset offset * @return a new Inet6Address object. */ public static Inet6Address getInet6Address(byte[] array, int offset) { return getInet6Address(array, offset, ByteOrder.BIG_ENDIAN); }
private DnsRDataAaaa(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < INET6_ADDRESS_SIZE_IN_BYTES) { StringBuilder sb = new StringBuilder(200); sb.append("The data is too short to build a DnsRDataAaaa (") .append(INET6_ADDRESS_SIZE_IN_BYTES) .append(" bytes). data: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.address = ByteArrays.getInet6Address(rawData, offset); }
private IcmpV6HomeAgentAddressDiscoveryReplyHeader(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < ICMPV6_HOME_AGENT_ADDRESS_DISCOVERY_REPLY_HEADER_MIN_SIZE) { StringBuilder sb = new StringBuilder(); sb.append( "The data is too short to build an ICMPv6 Home Agent Address Discovery Reply Header(") .append(ICMPV6_HOME_AGENT_ADDRESS_DISCOVERY_REPLY_HEADER_MIN_SIZE) .append(" bytes). data: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.identifier = ByteArrays.getShort(rawData, IDENTIFIER_OFFSET + offset); this.reserved = ByteArrays.getShort(rawData, RESERVED_OFFSET + offset); this.homeAgentAddresses = new ArrayList<Inet6Address>(); for (int i = HOME_AGENT_ADDRESSES_OFFSET; i < length; i += INET6_ADDRESS_SIZE_IN_BYTES) { homeAgentAddresses.add(ByteArrays.getInet6Address(rawData, i + offset)); } }
private IpV6RoutingSourceRouteData(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < 4) { StringBuilder sb = new StringBuilder(100); sb.append("rawData length must be more than 3. rawData: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } if (((length - 4) % INET6_ADDRESS_SIZE_IN_BYTES) != 0) { StringBuilder sb = new StringBuilder(100); sb.append("(length -4 ) % ") .append(INET6_ADDRESS_SIZE_IN_BYTES) .append(" must be 0. rawData: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.reserved = ByteArrays.getInt(rawData, offset); this.addresses = new ArrayList<Inet6Address>(); for (int i = INT_SIZE_IN_BYTES; i < length; i += INET6_ADDRESS_SIZE_IN_BYTES) { addresses.add(ByteArrays.getInet6Address(rawData, i + offset)); } }
this.targetAddress = ByteArrays.getInet6Address(rawData, TARGET_ADDRESS_OFFSET + offset); this.destinationAddress = ByteArrays.getInet6Address(rawData, DESTINATION_ADDRESS_OFFSET + offset); this.options = new ArrayList<IpV6NeighborDiscoveryOption>();
this.targetAddress = ByteArrays.getInet6Address(rawData, TARGET_ADDRESS_OFFSET + offset); this.options = new ArrayList<IpV6NeighborDiscoveryOption>(); int currentOffsetInHeader = OPTIONS_OFFSET;
this.overrideFlag = (tmp & 0x20000000) != 0; this.reserved = 0x1FFFFFFF & tmp; this.targetAddress = ByteArrays.getInet6Address(rawData, TARGET_ADDRESS_OFFSET + offset); this.options = new ArrayList<IpV6NeighborDiscoveryOption>(); int currentOffsetInHeader = OPTIONS_OFFSET;
IpNumber.getInstance(ByteArrays.getByte(rawData, NEXT_HEADER_OFFSET + offset)); this.hopLimit = ByteArrays.getByte(rawData, HOP_LIMIT_OFFSET + offset); this.srcAddr = ByteArrays.getInet6Address(rawData, SRC_ADDR_OFFSET + offset); this.dstAddr = ByteArrays.getInet6Address(rawData, DST_ADDR_OFFSET + offset);
this.preferredLifetime = ByteArrays.getInt(rawData, PREFERRED_LIFETIME_OFFSET + offset); this.reserved2 = ByteArrays.getInt(rawData, RESERVED2_OFFSET + offset); this.prefix = ByteArrays.getInet6Address(rawData, PREFIX_OFFSET + offset);
/** * @param array array * @param offset offset * @return a new Inet6Address object. */ public static Inet6Address getInet6Address(byte[] array, int offset) { return getInet6Address(array, offset, ByteOrder.BIG_ENDIAN); }
private DnsRDataAaaa(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < INET6_ADDRESS_SIZE_IN_BYTES) { StringBuilder sb = new StringBuilder(200); sb.append("The data is too short to build a DnsRDataAaaa (") .append(INET6_ADDRESS_SIZE_IN_BYTES) .append(" bytes). data: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.address = ByteArrays.getInet6Address(rawData, offset); }
private IcmpV6HomeAgentAddressDiscoveryReplyHeader(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < ICMPV6_HOME_AGENT_ADDRESS_DISCOVERY_REPLY_HEADER_MIN_SIZE) { StringBuilder sb = new StringBuilder(); sb.append( "The data is too short to build an ICMPv6 Home Agent Address Discovery Reply Header(") .append(ICMPV6_HOME_AGENT_ADDRESS_DISCOVERY_REPLY_HEADER_MIN_SIZE) .append(" bytes). data: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.identifier = ByteArrays.getShort(rawData, IDENTIFIER_OFFSET + offset); this.reserved = ByteArrays.getShort(rawData, RESERVED_OFFSET + offset); this.homeAgentAddresses = new ArrayList<Inet6Address>(); for (int i = HOME_AGENT_ADDRESSES_OFFSET; i < length; i += INET6_ADDRESS_SIZE_IN_BYTES) { homeAgentAddresses.add(ByteArrays.getInet6Address(rawData, i + offset)); } }
private IpV6RoutingSourceRouteData(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < 4) { StringBuilder sb = new StringBuilder(100); sb.append("rawData length must be more than 3. rawData: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } if (((length - 4) % INET6_ADDRESS_SIZE_IN_BYTES) != 0) { StringBuilder sb = new StringBuilder(100); sb.append("(length -4 ) % ") .append(INET6_ADDRESS_SIZE_IN_BYTES) .append(" must be 0. rawData: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.reserved = ByteArrays.getInt(rawData, offset); this.addresses = new ArrayList<Inet6Address>(); for (int i = INT_SIZE_IN_BYTES; i < length; i += INET6_ADDRESS_SIZE_IN_BYTES) { addresses.add(ByteArrays.getInet6Address(rawData, i + offset)); } }
this.targetAddress = ByteArrays.getInet6Address(rawData, TARGET_ADDRESS_OFFSET + offset); this.destinationAddress = ByteArrays.getInet6Address(rawData, DESTINATION_ADDRESS_OFFSET + offset); this.options = new ArrayList<IpV6NeighborDiscoveryOption>();
this.targetAddress = ByteArrays.getInet6Address(rawData, TARGET_ADDRESS_OFFSET + offset); this.options = new ArrayList<IpV6NeighborDiscoveryOption>(); int currentOffsetInHeader = OPTIONS_OFFSET;
this.overrideFlag = (tmp & 0x20000000) != 0; this.reserved = 0x1FFFFFFF & tmp; this.targetAddress = ByteArrays.getInet6Address(rawData, TARGET_ADDRESS_OFFSET + offset); this.options = new ArrayList<IpV6NeighborDiscoveryOption>(); int currentOffsetInHeader = OPTIONS_OFFSET;
IpNumber.getInstance(ByteArrays.getByte(rawData, NEXT_HEADER_OFFSET + offset)); this.hopLimit = ByteArrays.getByte(rawData, HOP_LIMIT_OFFSET + offset); this.srcAddr = ByteArrays.getInet6Address(rawData, SRC_ADDR_OFFSET + offset); this.dstAddr = ByteArrays.getInet6Address(rawData, DST_ADDR_OFFSET + offset);
this.preferredLifetime = ByteArrays.getInt(rawData, PREFERRED_LIFETIME_OFFSET + offset); this.reserved2 = ByteArrays.getInt(rawData, RESERVED2_OFFSET + offset); this.prefix = ByteArrays.getInet6Address(rawData, PREFIX_OFFSET + offset);