@Override public IpV6FlowLabel newInstance(byte[] rawData, int offset, int length) { ByteArrays.validateBounds(rawData, offset, length); if (length < INT_SIZE_IN_BYTES) { StringBuilder sb = new StringBuilder(100); sb.append("rawData is too short: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalArgumentException(sb.toString()); } return IpV6SimpleFlowLabel.newInstance(ByteArrays.getInt(rawData, offset)); }
/** * @param value value * @return a new IpV6SimpleFlowLabel object. */ public static IpV6SimpleFlowLabel newInstance(int value) { return new IpV6SimpleFlowLabel(value); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!this.getClass().isInstance(obj)) { return false; } return (getClass().cast(obj)).value() == this.value; }
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.IPV6_FRAG) .hopLimit((byte) 100)
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!this.getClass().isInstance(obj)) { return false; } return (getClass().cast(obj)).value() == this.value; }
/** * @param value value * @return a new IpV6SimpleFlowLabel object. */ public static IpV6SimpleFlowLabel newInstance(int value) { return new IpV6SimpleFlowLabel(value); }
@Override protected Packet getWholePacket() { Inet6Address srcAddr; Inet6Address dstAddr; try { srcAddr = (Inet6Address) InetAddress.getByName("2001:db8::3:2:1"); dstAddr = (Inet6Address) InetAddress.getByName("2001:db8::3:2:2"); } catch (UnknownHostException e) { throw new AssertionError(); } IpV6Packet.Builder IpV6b = new IpV6Packet.Builder(); IpV6b.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.SCTP) .hopLimit((byte) 100) .srcAddr(srcAddr) .dstAddr(dstAddr) .payloadBuilder(packet.getBuilder()) .correctLengthAtBuild(true); EthernetPacket.Builder eb = new EthernetPacket.Builder(); eb.dstAddr(MacAddress.getByName("fe:00:00:00:00:02")) .srcAddr(MacAddress.getByName("fe:00:00:00:00:01")) .type(EtherType.IPV6) .payloadBuilder(IpV6b) .paddingAtBuild(true); return eb.build(); }
@Override public IpV6FlowLabel newInstance(byte[] rawData, int offset, int length) { ByteArrays.validateBounds(rawData, offset, length); if (length < INT_SIZE_IN_BYTES) { StringBuilder sb = new StringBuilder(100); sb.append("rawData is too short: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalArgumentException(sb.toString()); } return IpV6SimpleFlowLabel.newInstance(ByteArrays.getInt(rawData, offset)); }
public IpV6PacketTest() throws Exception { this.version = IpVersion.IPV6; this.trafficClass = IpV6SimpleTrafficClass.newInstance((byte) 0x12); this.flowLabel = IpV6SimpleFlowLabel.newInstance(0x12345); this.payloadLength = (short) 12; this.nextHeader = IpNumber.UDP;
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)
.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100)