@Override public IpV6TrafficClass newInstance(byte[] rawData, int offset, int length) { ByteArrays.validateBounds(rawData, offset, length); return IpV6SimpleTrafficClass.newInstance(rawData[offset]); }
@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(); }
public IpV6PacketTest() throws Exception { this.version = IpVersion.IPV6; this.trafficClass = IpV6SimpleTrafficClass.newInstance((byte) 0x12); this.flowLabel = IpV6SimpleFlowLabel.newInstance(0x12345); this.payloadLength = (short) 12;
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6)
@Override protected Packet getWholePacket() { IpV6Packet.Builder IpV6b = new IpV6Packet.Builder(); IpV6b.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.IPV6_HOPOPT) .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); eb.get(UdpPacket.Builder.class).dstAddr(dstAddr).srcAddr(srcAddr); return eb.build(); }
@Override protected Packet getWholePacket() { IpV6Packet.Builder IpV6b = new IpV6Packet.Builder(); IpV6b.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.IPV6_ROUTE) .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); eb.get(UdpPacket.Builder.class).dstAddr(dstAddr).srcAddr(srcAddr); return eb.build(); }
@Override protected Packet getWholePacket() { IpV6Packet.Builder IpV6b = new IpV6Packet.Builder(); IpV6b.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.IPV6_DST_OPTS) .hopLimit((byte) 100) .srcAddr(srcAddr) .dstAddr(dstAddr) .payloadBuilder(packet.getBuilder().correctLengthAtBuild(true)) .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); eb.get(UdpPacket.Builder.class).dstAddr(dstAddr).srcAddr(srcAddr); return eb.build(); }
@Override protected Packet getWholePacket() { IpV6Packet.Builder ipv6b = new IpV6Packet.Builder(); ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.ICMPV6) .hopLimit((byte) 100) .srcAddr(srcAddr) .dstAddr(dstAddr) .correctLengthAtBuild(true) .payloadBuilder( packet.getBuilder().srcAddr(srcAddr).dstAddr(dstAddr).correctChecksumAtBuild(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 protected Packet getWholePacket() { IpV6Packet.Builder IpV6b = new IpV6Packet.Builder(); IpV6b.version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .nextHeader(IpNumber.UDP) .hopLimit((byte) 100) .srcAddr(srcAddr) .dstAddr(dstAddr) .payloadBuilder(packet.getBuilder().correctChecksumAtBuild(true).correctLengthAtBuild(true)) .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); eb.get(UdpPacket.Builder.class).dstAddr(dstAddr).srcAddr(srcAddr); return eb.build(); }
@Override protected Packet getWholePacket() { IpV6Packet.Builder ipv6b = new IpV6Packet.Builder(); ipv6b .version(IpVersion.IPV6) .trafficClass(IpV6SimpleTrafficClass.newInstance((byte) 0x12)) .flowLabel(IpV6SimpleFlowLabel.newInstance(0x12345)) .payloadLength((short) 28) .nextHeader(IpNumber.getInstance((byte) 254)) .hopLimit((byte) 100) .srcAddr(srcAddr) .dstAddr(dstAddr) .correctLengthAtBuild(false) .payloadBuilder(packet.getBuilder()); 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); eb.get(UdpPacket.Builder.class).dstAddr(srcAddr).srcAddr(dstAddr); return eb.build(); }