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 26 package com.sun.corba.se.impl.protocol.giopmsgheaders; 27 28 import java.io.IOException; 29 import java.nio.ByteBuffer; 30 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 31 32 /** 33 * This is the base interface for different message type interfaces. 34 * 35 * @author Ram Jeyaraman 05/14/2000 36 */ 37 38 public interface Message { 39 40 // Generic constants 41 42 int defaultBufferSize = 1024; 43 int GIOPBigEndian = 0; 44 int GIOPLittleEndian = 1; 45 int GIOPBigMagic = 0x47494F50; 46 int GIOPLittleMagic = 0x504F4947; 47 int GIOPMessageHeaderLength = 12; 48 49 // Other useful constants 50 51 byte LITTLE_ENDIAN_BIT = 0x01; 52 byte MORE_FRAGMENTS_BIT = 0x02; 53 byte FLAG_NO_FRAG_BIG_ENDIAN = 0x00; 54 static final byte TRAILING_TWO_BIT_BYTE_MASK = 0x3; 55 static final byte THREAD_POOL_TO_USE_MASK = 0x3F; 56 57 // Encoding related constants 58 59 byte CDR_ENC_VERSION = 0x00; 60 byte JAVA_ENC_VERSION = 0x01; 61 62 // Message types 63 64 byte GIOPRequest = 0; 65 byte GIOPReply = 1; 66 byte GIOPCancelRequest = 2; 67 byte GIOPLocateRequest = 3; 68 byte GIOPLocateReply = 4; 69 byte GIOPCloseConnection = 5; 70 byte GIOPMessageError = 6; 71 byte GIOPFragment = 7; // 1.1 & 1.2: 72 73 // Accessor methods 74 75 GIOPVersion getGIOPVersion(); 76 byte getEncodingVersion(); 77 boolean isLittleEndian(); 78 boolean moreFragmentsToFollow(); 79 int getType(); 80 int getSize(); 81 ByteBuffer getByteBuffer(); 82 int getThreadPoolToUse(); 83 84 // Mutator methods 85 86 void read(org.omg.CORBA.portable.InputStream istream); 87 void write(org.omg.CORBA.portable.OutputStream ostream); 88 89 void setSize(ByteBuffer byteBuffer, int size); 90 91 FragmentMessage createFragmentMessage(); 92 93 void callback(MessageHandler handler) throws IOException; 94 95 void setByteBuffer(ByteBuffer byteBuffer); 96 void setEncodingVersion(byte version); 97 }