/// <summary> /// creates a giop header from buffer /// </summary> /// <param name="buffer">first 12 byte of array are used to parse a giop-header from</param> internal GiopHeader(byte[] readBuffer) { if ((readBuffer == null) || (readBuffer.Length < 12)) { throw new ArgumentException("can't create giop header from buffer"); } if (!((readBuffer[0] == m_giop_magic[0]) && (readBuffer[1] == m_giop_magic[1]) && (readBuffer[2] == m_giop_magic[2]) && (readBuffer[3] == m_giop_magic[3]))) { // no GIOP Trace.WriteLine("received non GIOP-Message"); throw new omg.org.CORBA.MARSHAL(19, omg.org.CORBA.CompletionStatus.Completed_No); } m_version = new GiopVersion(readBuffer[4], readBuffer[5]); if (m_version.Major != 1) { Trace.WriteLine("unknown GIOP Verision: " + m_version); throw new omg.org.CORBA.MARSHAL(20, omg.org.CORBA.CompletionStatus.Completed_No); } m_flags = readBuffer[6]; m_type = ConvertType(readBuffer[7]); if (BitConverter.IsLittleEndian == IsLittleEndian()) { m_msgLength = BitConverter.ToUInt32(readBuffer, 8); } else { // BitConverter uses a different endian, convert to other endian variant byte[] msgLengthBuffer = new byte[4]; // make sure to not change input array msgLengthBuffer[0] = readBuffer[11]; msgLengthBuffer[1] = readBuffer[10]; msgLengthBuffer[2] = readBuffer[9]; msgLengthBuffer[3] = readBuffer[8]; m_msgLength = BitConverter.ToUInt32(msgLengthBuffer, 0); } }
internal GiopHeader(byte GIOP_major, byte GIOP_minor, byte flags, GiopMsgTypes type) { m_version = new GiopVersion(GIOP_major, GIOP_minor); m_flags = flags; m_type = type; }