@Test public void testSerialize() { EncapSecurityPayload esp = new EncapSecurityPayload(); esp.setSecurityParamIndex(0x13572468); esp.setSequence(0xffff00); esp.setPayload(data); assertArrayEquals(esp.serialize(), bytePacket); }
@Override public byte[] serialize() { byte[] payloadData = null; if (this.payload != null) { this.payload.setParent(this); payloadData = this.payload.serialize(); } int payloadLength = 0; if (payloadData != null) { payloadLength = payloadData.length; } final byte[] data = new byte[HEADER_LENGTH + payloadLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(this.securityParamIndex); bb.putInt(this.sequence); if (payloadData != null) { bb.put(payloadData); } if (this.parent != null && this.parent instanceof IExtensionHeader) { ((IExtensionHeader) this.parent).setNextHeader(IPv6.PROTOCOL_ESP); } return data; }
EncapSecurityPayload extends BasePacket { @Override public byte[] serialize() { byte[] payloadData = null; if (this.payload != null) { this.payload.setParent(this); payloadData = this.payload.serialize(); } int payloadLength = 0; if (payloadData != null) { payloadLength = payloadData.length; } final byte[] data = new byte[HEADER_LENGTH + payloadLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(this.securityParamIndex); bb.putInt(this.sequence); if (payloadData != null) { bb.put(payloadData); } if (this.parent != null && this.parent instanceof IExtensionHeader) { ((IExtensionHeader) this.parent).setNextHeader(IPv6.PROTOCOL_ESP); } return data; } }
EncapSecurityPayload extends BasePacket { @Override public byte[] serialize() { byte[] payloadData = null; if (this.payload != null) { this.payload.setParent(this); payloadData = this.payload.serialize(); } int payloadLength = 0; if (payloadData != null) { payloadLength = payloadData.length; } final byte[] data = new byte[HEADER_LENGTH + payloadLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(this.securityParamIndex); bb.putInt(this.sequence); if (payloadData != null) { bb.put(payloadData); } if (this.parent != null && this.parent instanceof IExtensionHeader) { ((IExtensionHeader) this.parent).setNextHeader(IPv6.PROTOCOL_ESP); } return data; }  }
EncapSecurityPayload extends BasePacket { @Override public byte[] serialize() { byte[] payloadData = null; if (this.payload != null) { this.payload.setParent(this); payloadData = this.payload.serialize(); } int payloadLength = 0; if (payloadData != null) { payloadLength = payloadData.length; } final byte[] data = new byte[HEADER_LENGTH + payloadLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(this.securityParamIndex); bb.putInt(this.sequence); if (payloadData != null) { bb.put(payloadData); } if (this.parent != null && this.parent instanceof IExtensionHeader) { ((IExtensionHeader) this.parent).setNextHeader(IPv6.PROTOCOL_ESP); } return data; }  int getSecurityParamIndex(); EncapSecurityPayload setSecurityParamIndex(final int securityParamIndex); int getSequence(); EncapSecurityPayload setSequence(final int sequence); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<EncapSecurityPayload> deserializer(); @Override String toString(); }
EncapSecurityPayload extends BasePacket { @Override public byte[] serialize() { byte[] payloadData = null; if (this.payload != null) { this.payload.setParent(this); payloadData = this.payload.serialize(); } int payloadLength = 0; if (payloadData != null) { payloadLength = payloadData.length; } final byte[] data = new byte[HEADER_LENGTH + payloadLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(this.securityParamIndex); bb.putInt(this.sequence); if (payloadData != null) { bb.put(payloadData); } if (this.parent != null && this.parent instanceof IExtensionHeader) { ((IExtensionHeader) this.parent).setNextHeader(IPv6.PROTOCOL_ESP); } return data; }  int getSecurityParamIndex(); EncapSecurityPayload setSecurityParamIndex(final int securityParamIndex); int getSequence(); EncapSecurityPayload setSequence(final int sequence); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<EncapSecurityPayload> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }