@Test public void testDeserializeBadInput() throws Exception { PacketTestUtils.testDeserializeBadInput(RouterSolicitation.deserializer()); }
public static Deserializer<RouterSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); RouterSolicitation routerSolicitation = new RouterSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { routerSolicitation.addOption(option.type(), option.data()); } } return routerSolicitation; }; }
RouterSolicitation extends BasePacket { public static Deserializer<RouterSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); RouterSolicitation routerSolicitation = new RouterSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { routerSolicitation.addOption(option.type(), option.data()); } } return routerSolicitation; }; } }
RouterSolicitation extends BasePacket { public static Deserializer<RouterSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); RouterSolicitation routerSolicitation = new RouterSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { routerSolicitation.addOption(option.type(), option.data()); } } return routerSolicitation; }; }  }
RouterSolicitation extends BasePacket { public static Deserializer<RouterSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); RouterSolicitation routerSolicitation = new RouterSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { routerSolicitation.addOption(option.type(), option.data()); } } return routerSolicitation; }; }  List<NeighborDiscoveryOptions.Option> getOptions(); RouterSolicitation addOption(final byte type, final byte[] data); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<RouterSolicitation> deserializer(); @Override String toString(); }
RouterSolicitation extends BasePacket { public static Deserializer<RouterSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); RouterSolicitation routerSolicitation = new RouterSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { routerSolicitation.addOption(option.type(), option.data()); } } return routerSolicitation; }; }  List<NeighborDiscoveryOptions.Option> getOptions(); RouterSolicitation addOption(final byte type, final byte[] data); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<RouterSolicitation> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }