1 /* 2 * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package com.sun.corba.se.impl.protocol.giopmsgheaders; 26 27 import java.nio.ByteBuffer; 28 29 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 30 31 public class Message_1_2 extends Message_1_1 32 { 33 protected int request_id = (int) 0; 34 35 Message_1_2() {} 36 37 Message_1_2(int _magic, GIOPVersion _GIOP_version, byte _flags, 38 byte _message_type, int _message_size) { 39 40 super(_magic, 41 _GIOP_version, 42 _flags, 43 _message_type, 44 _message_size); 45 } 46 47 /** 48 * The byteBuffer is presumed to have contents of the message already 49 * read in. It must have 12 bytes of space at the beginning for the GIOP header, 50 * but the header doesn't have to be copied in. 51 */ 52 public void unmarshalRequestID(ByteBuffer byteBuffer) { 53 int b1, b2, b3, b4; 54 55 if (!isLittleEndian()) { 56 b1 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 24) & 0xFF000000; 57 b2 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 16) & 0x00FF0000; 58 b3 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 8) & 0x0000FF00; 59 b4 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 0) & 0x000000FF; 60 } else { 61 b1 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 24) & 0xFF000000; 62 b2 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 16) & 0x00FF0000; 63 b3 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 8) & 0x0000FF00; 64 b4 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 0) & 0x000000FF; 65 } 66 67 this.request_id = (b1 | b2 | b3 | b4); 68 } 69 70 public void write(org.omg.CORBA.portable.OutputStream ostream) { 71 if (this.encodingVersion == Message.CDR_ENC_VERSION) { 72 super.write(ostream); 73 return; 74 } 75 GIOPVersion gv = this.GIOP_version; // save 76 this.GIOP_version = GIOPVersion.getInstance((byte)13, 77 this.encodingVersion); 78 super.write(ostream); 79 this.GIOP_version = gv; // restore 80 } 81 }