@Test public void testDeserialize() throws DeserializationException { RouterAdvertisement ra = deserializer.deserialize(bytePacket, 0, bytePacket.length); assertThat(ra.getCurrentHopLimit(), is((byte) 3)); assertThat(ra.getMFlag(), is((byte) 1)); assertThat(ra.getOFlag(), is((byte) 1)); assertThat(ra.getRouterLifetime(), is((short) 0x258)); assertThat(ra.getReachableTime(), is(0x3e8)); assertThat(ra.getRetransmitTimer(), is(0x1f4)); assertThat(ra.getOptions().size(), is(1)); NeighborDiscoveryOptions.Option option = ra.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 bscratch; this.currentHopLimit = bb.get(); bscratch = bb.get(); this.mFlag = (byte) ((bscratch >> 7) & 0x1); this.oFlag = (byte) ((bscratch >> 6) & 0x1); this.routerLifetime = bb.getShort(); this.reachableTime = bb.getInt(); this.retransmitTimer = bb.getInt(); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }
RouterAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int bscratch; this.currentHopLimit = bb.get(); bscratch = bb.get(); this.mFlag = (byte) ((bscratch >> 7) & 0x1); this.oFlag = (byte) ((bscratch >> 6) & 0x1); this.routerLifetime = bb.getShort(); this.reachableTime = bb.getInt(); this.retransmitTimer = bb.getInt(); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; } }
RouterAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int bscratch; this.currentHopLimit = bb.get(); bscratch = bb.get(); this.mFlag = (byte) ((bscratch >> 7) & 0x1); this.oFlag = (byte) ((bscratch >> 6) & 0x1); this.routerLifetime = bb.getShort(); this.reachableTime = bb.getInt(); this.retransmitTimer = bb.getInt(); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  }
RouterAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int bscratch; this.currentHopLimit = bb.get(); bscratch = bb.get(); this.mFlag = (byte) ((bscratch >> 7) & 0x1); this.oFlag = (byte) ((bscratch >> 6) & 0x1); this.routerLifetime = bb.getShort(); this.reachableTime = bb.getInt(); this.retransmitTimer = bb.getInt(); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  byte getCurrentHopLimit(); RouterAdvertisement setCurrentHopLimit(final byte currentHopLimit); byte getMFlag(); RouterAdvertisement setMFlag(final byte mFlag); byte getOFlag(); RouterAdvertisement setOFlag(final byte oFlag); short getRouterLifetime(); RouterAdvertisement setRouterLifetime(final short routerLifetime); int getReachableTime(); RouterAdvertisement setReachableTime(final int reachableTime); int getRetransmitTimer(); RouterAdvertisement setRetransmitTimer(final int retransmitTimer); List<NeighborDiscoveryOptions.Option> getOptions(); RouterAdvertisement 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<RouterAdvertisement> deserializer(); @Override String toString(); }
RouterAdvertisement extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); int bscratch; this.currentHopLimit = bb.get(); bscratch = bb.get(); this.mFlag = (byte) ((bscratch >> 7) & 0x1); this.oFlag = (byte) ((bscratch >> 6) & 0x1); this.routerLifetime = bb.getShort(); this.reachableTime = bb.getInt(); this.retransmitTimer = bb.getInt(); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  byte getCurrentHopLimit(); RouterAdvertisement setCurrentHopLimit(final byte currentHopLimit); byte getMFlag(); RouterAdvertisement setMFlag(final byte mFlag); byte getOFlag(); RouterAdvertisement setOFlag(final byte oFlag); short getRouterLifetime(); RouterAdvertisement setRouterLifetime(final short routerLifetime); int getReachableTime(); RouterAdvertisement setReachableTime(final int reachableTime); int getRetransmitTimer(); RouterAdvertisement setRetransmitTimer(final int retransmitTimer); List<NeighborDiscoveryOptions.Option> getOptions(); RouterAdvertisement 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<RouterAdvertisement> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }