private byte[] createV4PseudoHeader(EncodeContext cxt, IContainerValue udpPrtl,
IRecordSetValue ipv4Header, int upperPrtlBytes, int startOffset)
throws BitBufferException {
byte[] pseudoBlock = new byte[V4_PSEUDO_HEADER_BYTES + upperPrtlBytes];
ByteBuffer pseudoBuffer = ByteBuffer.wrap(pseudoBlock);
//填充虚头部数据
IOctetstringValue oStr;
//ipv4 source address
oStr = (IOctetstringValue)ipv4Header.getField(
Ipv4TypeEVExtFactory.IPV4_HEADER_SOURCE_ADDRESS);
pseudoBuffer.put(oStr.getValue());
//ipv4 destination address
oStr = (IOctetstringValue)ipv4Header.getField(
Ipv4TypeEVExtFactory.IPV4_HEADER_DESTINATION_ADDRESS);
pseudoBuffer.put(oStr.getValue());
//zero
pseudoBuffer.position(pseudoBuffer.position() + 1);
//ipv4 protocol
IIntegerValue iValue = (IIntegerValue)ipv4Header.getField(
Ipv4TypeEVExtFactory.IPV4_HEADER_PROTOCOL);
pseudoBuffer.put((byte)iValue.getInteger());
//segment length
pseudoBuffer.putShort((short)upperPrtlBytes);
//取得UDP数据并填充
IReadWritableBitBuffer encodeBuffer = cxt.getBuffer();
encodeBuffer.position(startOffset);
encodeBuffer.getByte(pseudoBlock, V4_PSEUDO_HEADER_BYTES, upperPrtlBytes);
return pseudoBlock;