private void fillPseudoHeader(EncodeContext cxt, byte[] pseudoBlock, int icmpPrtlBytes)
throws EncodeException {
ByteBuffer byteBuffer = ByteBuffer.wrap(pseudoBlock);
//取得上层IPV6协议的头部字段
IRecordSetValue ipv6Header = (IRecordSetValue)cxt.getFieldStackMap().peekField(
Ipv6TypeEVExtFactory.HEADER_FIELD);
if (ipv6Header == null) {
throw new EncodeException(targetTypeMeta,
MetaException.CODE.FIELD_NOT_FOUND_IN_STACK_ERROR,
Ipv6TypeEVExtFactory.HEADER_FIELD);
}
IOctetstringValue address;
//Source Address
address = (IOctetstringValue)ipv6Header.getField(
Ipv6TypeEVExtFactory.IPV6_HEADER_SOURCE_ADDRESS);
assert address != null;
byteBuffer.put(address.getValue());
//Destination Address
address = (IOctetstringValue)ipv6Header.getField(
Ipv6TypeEVExtFactory.IPV6_HEADER_DESTINATION_ADDRESS);
assert address != null;
byteBuffer.put(address.getValue());
//Upper Layer Packet Length
byteBuffer.putInt(icmpPrtlBytes);