1. /*
  2. * @(#)Message.java 1.11 04/06/21
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.protocol.giopmsgheaders;
  8. import java.io.IOException;
  9. import java.nio.ByteBuffer;
  10. import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
  11. /**
  12. * This is the base interface for different message type interfaces.
  13. *
  14. * @author Ram Jeyaraman 05/14/2000
  15. * @version 1.0
  16. */
  17. public interface Message {
  18. // Generic constants
  19. int defaultBufferSize = 1024;
  20. int GIOPBigEndian = 0;
  21. int GIOPLittleEndian = 1;
  22. int GIOPBigMagic = 0x47494F50;
  23. int GIOPLittleMagic = 0x504F4947;
  24. int GIOPMessageHeaderLength = 12;
  25. // Other useful constants
  26. byte LITTLE_ENDIAN_BIT = 0x01;
  27. byte MORE_FRAGMENTS_BIT = 0x02;
  28. byte FLAG_NO_FRAG_BIG_ENDIAN = 0x00;
  29. static final byte TRAILING_TWO_BIT_BYTE_MASK = 0x3;
  30. static final byte THREAD_POOL_TO_USE_MASK = 0x3F;
  31. // Encoding related constants
  32. byte CDR_ENC_VERSION = 0x00;
  33. byte JAVA_ENC_VERSION = 0x01;
  34. // Message types
  35. byte GIOPRequest = 0;
  36. byte GIOPReply = 1;
  37. byte GIOPCancelRequest = 2;
  38. byte GIOPLocateRequest = 3;
  39. byte GIOPLocateReply = 4;
  40. byte GIOPCloseConnection = 5;
  41. byte GIOPMessageError = 6;
  42. byte GIOPFragment = 7; // 1.1 & 1.2:
  43. // Accessor methods
  44. GIOPVersion getGIOPVersion();
  45. byte getEncodingVersion();
  46. boolean isLittleEndian();
  47. boolean moreFragmentsToFollow();
  48. int getType();
  49. int getSize();
  50. ByteBuffer getByteBuffer();
  51. int getThreadPoolToUse();
  52. // Mutator methods
  53. void read(org.omg.CORBA.portable.InputStream istream);
  54. void write(org.omg.CORBA.portable.OutputStream ostream);
  55. void setSize(ByteBuffer byteBuffer, int size);
  56. FragmentMessage createFragmentMessage();
  57. void callback(MessageHandler handler) throws IOException;
  58. void setByteBuffer(ByteBuffer byteBuffer);
  59. void setEncodingVersion(byte version);
  60. }