@Test public void testDeserializeBadInput() throws Exception { PacketTestUtils.testDeserializeBadInput(ICMP6.deserializer()); }
public static Deserializer<ICMP6> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); ICMP6 icmp6 = new ICMP6(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); icmp6.icmpType = bb.get(); icmp6.icmpCode = bb.get(); icmp6.checksum = bb.getShort(); Deserializer<? extends IPacket> deserializer; if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmp6.icmpType)) { deserializer = TYPE_DESERIALIZER_MAP.get(icmp6.icmpType); } else { deserializer = Data.deserializer(); } icmp6.payload = deserializer.deserialize(data, bb.position(), bb.limit() - bb.position()); icmp6.payload.setParent(icmp6); return icmp6; }; }
ICMP6 extends BasePacket { public static Deserializer<ICMP6> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); ICMP6 icmp6 = new ICMP6(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); icmp6.icmpType = bb.get(); icmp6.icmpCode = bb.get(); icmp6.checksum = bb.getShort(); Deserializer<? extends IPacket> deserializer; if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmp6.icmpType)) { deserializer = TYPE_DESERIALIZER_MAP.get(icmp6.icmpType); } else { deserializer = Data.deserializer(); } icmp6.payload = deserializer.deserialize(data, bb.position(), bb.limit() - bb.position()); icmp6.payload.setParent(icmp6); return icmp6; }; } }
ICMP6 extends BasePacket { public static Deserializer<ICMP6> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); ICMP6 icmp6 = new ICMP6(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); icmp6.icmpType = bb.get(); icmp6.icmpCode = bb.get(); icmp6.checksum = bb.getShort(); Deserializer<? extends IPacket> deserializer; if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmp6.icmpType)) { deserializer = TYPE_DESERIALIZER_MAP.get(icmp6.icmpType); } else { deserializer = Data.deserializer(); } icmp6.payload = deserializer.deserialize(data, bb.position(), bb.limit() - bb.position()); icmp6.payload.setParent(icmp6); return icmp6; }; }  }
ICMP6 extends BasePacket { public static Deserializer<ICMP6> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); ICMP6 icmp6 = new ICMP6(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); icmp6.icmpType = bb.get(); icmp6.icmpCode = bb.get(); icmp6.checksum = bb.getShort(); Deserializer<? extends IPacket> deserializer; if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmp6.icmpType)) { deserializer = TYPE_DESERIALIZER_MAP.get(icmp6.icmpType); } else { deserializer = Data.deserializer(); } icmp6.payload = deserializer.deserialize(data, bb.position(), bb.limit() - bb.position()); icmp6.payload.setParent(icmp6); return icmp6; }; }  byte getIcmpType(); ICMP6 setIcmpType(final byte icmpType); byte getIcmpCode(); ICMP6 setIcmpCode(final byte icmpCode); short getChecksum(); ICMP6 setChecksum(final short checksum); @Override byte[] serialize(); @Override IPacket deserialize(final byte[] data, final int offset,
                               final int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<ICMP6> deserializer(); @Override String toString(); }
ICMP6 extends BasePacket { public static Deserializer<ICMP6> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); ICMP6 icmp6 = new ICMP6(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); icmp6.icmpType = bb.get(); icmp6.icmpCode = bb.get(); icmp6.checksum = bb.getShort(); Deserializer<? extends IPacket> deserializer; if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmp6.icmpType)) { deserializer = TYPE_DESERIALIZER_MAP.get(icmp6.icmpType); } else { deserializer = Data.deserializer(); } icmp6.payload = deserializer.deserialize(data, bb.position(), bb.limit() - bb.position()); icmp6.payload.setParent(icmp6); return icmp6; }; }  byte getIcmpType(); ICMP6 setIcmpType(final byte icmpType); byte getIcmpCode(); ICMP6 setIcmpCode(final byte icmpCode); short getChecksum(); ICMP6 setChecksum(final short checksum); @Override byte[] serialize(); @Override IPacket deserialize(final byte[] data, final int offset,
                               final int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<ICMP6> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; static final byte DEST_UNREACH; static final byte PKT_TOO_BIG; static final byte TIME_EXCEED; static final byte PARAM_ERR; static final byte ECHO_REQUEST; static final byte ECHO_REPLY; static final byte MCAST_QUERY; static final byte MCAST_REPORT; static final byte MCAST_DONE; static final byte ROUTER_SOLICITATION; static final byte ROUTER_ADVERTISEMENT; static final byte NEIGHBOR_SOLICITATION; static final byte NEIGHBOR_ADVERTISEMENT; static final byte REDIRECT; static final byte NO_ROUTE; static final byte COMM_PROHIBIT; static final byte BEYOND_SCOPE; static final byte ADDR_UNREACH; static final byte PORT_UNREACH; static final byte FAIL_POLICY; static final byte REJECT_ROUTE; static final byte SRC_ROUTING_HEADER_ERR; static final byte HOP_LIMIT_EXCEED; static final byte DEFRAG_TIME_EXCEED; static final byte HDR_FIELD_ERR; static final byte NEXT_HEADER_ERR; static final byte IPV6_OPT_ERR; static final Map<Byte, Deserializer<? extends IPacket>> TYPE_DESERIALIZER_MAP; }