@Test public void testDeserialize() throws DeserializationException { NeighborAdvertisement na = deserializer.deserialize(bytePacket, 0, bytePacket.length); assertThat(na.getRouterFlag(), is((byte) 1)); assertThat(na.getSolicitedFlag(), is((byte) 1)); assertThat(na.getOverrideFlag(), is((byte) 1)); assertArrayEquals(na.getTargetAddress(), TARGET_ADDRESS); assertThat(na.getOptions().size(), is(1)); NeighborDiscoveryOptions.Option option = na.getOptions().get(0); assertThat(option.type(), is(NeighborDiscoveryOptions.TYPE_TARGET_LL_ADDRESS)); assertArrayEquals(option.data(), MAC_ADDRESS.toBytes()); }
@Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int iscratch; iscratch = bb.getInt(); this.routerFlag = (byte) (iscratch >> 31 & 0x1); this.solicitedFlag = (byte) (iscratch >> 30 & 0x1); this.overrideFlag = (byte) (iscratch >> 29 & 0x1); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }
NeighborAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int iscratch; iscratch = bb.getInt(); this.routerFlag = (byte) (iscratch >> 31 & 0x1); this.solicitedFlag = (byte) (iscratch >> 30 & 0x1); this.overrideFlag = (byte) (iscratch >> 29 & 0x1); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; } }
NeighborAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int iscratch; iscratch = bb.getInt(); this.routerFlag = (byte) (iscratch >> 31 & 0x1); this.solicitedFlag = (byte) (iscratch >> 30 & 0x1); this.overrideFlag = (byte) (iscratch >> 29 & 0x1); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  }
NeighborAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int iscratch; iscratch = bb.getInt(); this.routerFlag = (byte) (iscratch >> 31 & 0x1); this.solicitedFlag = (byte) (iscratch >> 30 & 0x1); this.overrideFlag = (byte) (iscratch >> 29 & 0x1); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  byte getRouterFlag(); NeighborAdvertisement setRouterFlag(final byte routerFlag); byte getSolicitedFlag(); NeighborAdvertisement setSolicitedFlag(final byte solicitedFlag); byte getOverrideFlag(); NeighborAdvertisement setOverrideFlag(final byte overrideFlag); byte[] getTargetAddress(); NeighborAdvertisement setTargetAddress(final byte[] targetAddress); List<NeighborDiscoveryOptions.Option> getOptions(); NeighborAdvertisement 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<NeighborAdvertisement> deserializer(); @Override String toString(); }
NeighborAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int iscratch; iscratch = bb.getInt(); this.routerFlag = (byte) (iscratch >> 31 & 0x1); this.solicitedFlag = (byte) (iscratch >> 30 & 0x1); this.overrideFlag = (byte) (iscratch >> 29 & 0x1); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  byte getRouterFlag(); NeighborAdvertisement setRouterFlag(final byte routerFlag); byte getSolicitedFlag(); NeighborAdvertisement setSolicitedFlag(final byte solicitedFlag); byte getOverrideFlag(); NeighborAdvertisement setOverrideFlag(final byte overrideFlag); byte[] getTargetAddress(); NeighborAdvertisement setTargetAddress(final byte[] targetAddress); List<NeighborDiscoveryOptions.Option> getOptions(); NeighborAdvertisement 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<NeighborAdvertisement> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }