private uint AddFinishFragment(CdrOutputStreamImpl targetStream, GiopVersion version, byte endianFlags, uint reqId, uint reqContentLength, uint offsetInMsg) { byte giopFlags = endianFlags; // no more fragments GiopHeader fragmentHeader = new GiopHeader(version.Major, version.Minor, endianFlags, GiopMsgTypes.Request); uint contentLength = 0; if (!((version.Major == 1) && (version.Minor <= 1))) { // GIOP 1.2 contentLength = 4 + reqContentLength; } else { contentLength = reqContentLength; } fragmentHeader.WriteToStream(targetStream, contentLength); if (!((version.Major == 1) && (version.Minor <= 1))) { // GIOP 1.2 targetStream.WriteULong(reqId); } // more is not needed to write a correct GIOP-message for this test from here for (uint i = offsetInMsg; i < (offsetInMsg + reqContentLength); i++) { targetStream.WriteOctet((byte)(i % 255)); } return(offsetInMsg + reqContentLength); }
/// <param name="fragmentContentBlocks">the nr of 4 byte blocks in the content; /// must be even for GIOP 1.2</param> private CdrOutputStreamImpl AddStartMsg(Stream targetStream, GiopVersion version, byte endianFlags, uint reqId, uint fragmentContentBlocks, out uint offsetInMsg) { byte giopFlags = (byte)(endianFlags | ((byte)2)); // more fragments CdrOutputStreamImpl cdrOut = new CdrOutputStreamImpl(targetStream, endianFlags, version); GiopHeader startHeader = new GiopHeader(version.Major, version.Minor, giopFlags, GiopMsgTypes.Request); uint contentLength = 0; if (!((version.Major == 1) && (version.Minor <= 1))) { // GIOP 1.2 contentLength = (uint)(4 + (fragmentContentBlocks * 4)); } else { contentLength = (uint)(8 + (fragmentContentBlocks * 4)); } startHeader.WriteToStream(cdrOut, contentLength); if ((version.Major == 1) && (version.Minor == 1)) { // GIOP 1.1: add service context list here cdrOut.WriteULong(0); // no contexts } cdrOut.WriteULong(reqId); // request id // more is not needed to write a correct GIOP-message for this test from here for (uint i = 0; i < fragmentContentBlocks * 4; i++) { cdrOut.WriteOctet((byte)(i % 255)); } offsetInMsg = fragmentContentBlocks * 4; return(cdrOut); }