KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > kernel > IDatagram


1 package com.ubermq.kernel;
2
3 /**
4  * The datagram is the fundamental quantum in the UberMQ message kernel. All
5  * information sent between peers is in the form of a datagram.
6  */

7 public interface IDatagram
8 {
9     /**
10      * Returns the type of the datagram. Intended for use with a datagram factory.
11      * @return the type value that can be used to instantiate the correct
12      * datagram implementation when reading datagrams from a buffer.
13      */

14     public int getDatagramType();
15     
16     /**
17      * returns flags for this datagram.<P>
18      * Since we are trying to keep our wire format small,
19      * datagram flags can be used in various ways depending on the dgram type.
20      *
21      * <P>
22      * ------MSB----<BR>
23      * datagram class-specific flags 16 bits<br>
24      * -------------<br>
25      * server-specific flags 8 bits<br>
26      * -------------<br>
27      * IDatagram reserved<br> 8 bits<br>
28      * ------LSB----<br>
29      *
30      * @return the flags for the datagram
31      */

32     public int getDatagramFlags();
33     
34     /**
35      * adds flags (bitwise OR)
36      */

37     public void setDatagramFlagBits(int f);
38     
39     /**
40      * removes flags (bitwise AND the complement)
41      */

42     public void unsetDatagramFlagBits(int f);
43     
44     /**
45      * Returns a bitmask representing fields present in the
46      * LSB of this datagram flag value. Used to provide backward compatibility
47      * as flags become used in future versions.
48      *<P>
49      * This mask should always mask out implementation and server specific
50      * datagram flags.<p>
51      *
52      * In this version, should return FIELDS_BASIC.
53      * @see FIELDS_BASIC
54      */

55     public int getDatagramFieldMask();
56
57     /**
58      * Indicates the flags of IDatagram that are being actively used in
59      * the version of the code running on the datagram producer.
60      */

61     public static final int FIELDS_BASIC = 0x0;
62     
63     /**
64      * Loads the datagram from a ByteBuffer.
65      * The position need not be zero, but should be set to the beginning
66      * of the datagram's data. The limit should represent the end of the
67      * datagram's data.
68      */

69     public void incoming(java.nio.ByteBuffer JavaDoc bb)
70         throws java.io.IOException JavaDoc;
71     
72     /**
73      * outputs the datagram to a ByteBuffer, usually for output into
74      * a channel.
75      */

76     public void outgoing(java.nio.ByteBuffer JavaDoc bb);
77     
78 }
79
Popular Tags