|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.sgs.protocol.simple.SimpleSgsProtocol
public class SimpleSgsProtocol
SGS Protocol constants.
A protocol message is constructed as follows:
A ByteArray
is encoded in a context dependent fashion. If the
ByteArray is the only content, or if the ByteArray is the last piece of
content (that is, if the length of the ByteArray can be determined by the
payload length and the length of what has come before), the ByteArray is
encoded as
A String
is encoded as follows:
DataInput
The total length of a message must not be greater than 65535 bytes; given the header information this means that the payload of a message cannot be greater than 65532 bytes. If a message larger than this must be sent, it is the responsibility of the sender to break the message into pieces and of the receiver to re-assemble those pieces.
Behavior not specified in this document is left as an implementation decision for the particular client and server. Information on the implementation characteristics of the Project Darkstar server can be found in the overview for the implementation.
Field Summary | |
---|---|
static byte |
CHANNEL_JOIN
Channel join. |
static byte |
CHANNEL_LEAVE
Channel leave. |
static byte |
CHANNEL_MESSAGE
Channel message. |
static byte |
LOGIN_FAILURE
Login failure. |
static byte |
LOGIN_REDIRECT
Login redirect. |
static byte |
LOGIN_REQUEST
Login request from a client to a server. |
static byte |
LOGIN_SUCCESS
Login success. |
static byte |
LOGOUT_REQUEST
Logout request from a client to a server. |
static byte |
LOGOUT_SUCCESS
Logout success. |
static int |
MAX_MESSAGE_LENGTH
The maximum length of a protocol message: 65535 bytes. |
static int |
MAX_PAYLOAD_LENGTH
The maximum payload length: 65532 bytes. |
static byte |
RECONNECT_FAILURE
Reconnect failure. |
static byte |
RECONNECT_REQUEST
Reconnection request. |
static byte |
RECONNECT_SUCCESS
Reconnect success. |
static byte |
SESSION_MESSAGE
Session message. |
static byte |
VERSION
The version number, currently 0x04 . |
Method Summary |
---|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_MESSAGE_LENGTH
public static final int MAX_PAYLOAD_LENGTH
public static final byte VERSION
0x04
.
public static final byte LOGIN_REQUEST
0x10
protocol version
will be checked by the server to insure that
the client and server are using the same protocol or versions of the
protocol that are compatible. If the server determines that the protocol
version used by the sender and the protocol version or versions required
by the server are not compatible, the server will disconnect the client.
In cases where the protocols being used are not compatible, no other
communication between the client and the server is guaranteed to be
understood.
The name
and password
strings are passed to the server's
authentication mechanism. After the server processes the login request,
the server sends one of the following acknowledgments to the client:
LOGIN_SUCCESS
, if user authentication succeeds and
invoking the loggedIn
' method on the application's
AppListener
with the user's ClientSession
returns a
non-null, serializable ClientSessionListener
;
LOGIN_REDIRECT
, if user authentication succeeds, but the
server requests that the client redirect the login request to another
node; or
LOGIN_FAILURE
, if user authentication fails, or if the
user is already logged in and the server is configured to reject new
logins for the same user, or if invoking the loggedIn
method on
the application's AppListener
with the user's
ClientSession
returns a null, or non-serializable
ClientSessionListener
or the method does not complete
successfully.
If a client is currently logged in, the result of receiving a LOGIN_REQUEST is not defined by the protocol, but is an implementation-dependent detail of the server.
public static final byte LOGIN_SUCCESS
LOGIN_REQUEST
.
0x11
reconnectionKey
is an opaque reference that can be held by
the client for use in case the client is disconnected and wishes to
reconnect to the server with the same identity using a
RECONNECT_REQUEST
.
public static final byte LOGIN_FAILURE
LOGIN_REQUEST
.
0x12
LOGIN_REQUEST
for some reason, for example
public static final byte LOGIN_REDIRECT
LOGIN_REQUEST
.
0x13
LOGIN_REQUEST
was sent to another node. The client receiving
this request should shut down the connection to the original node and
establish a connection to the node indicated by the hostname
and
port
in the payload. The client should then attempt to log in to
the node to which it has been redirected by sending a
LOGIN_REQUEST
to that node.
public static final byte RECONNECT_REQUEST
0x20
reconnectionKey
must match
the one that the client received in the previous LOGIN_SUCCESS
or RECONNECT_SUCCESS
message (if reconnection was performed
subsequent to login). If reconnection is successful, the server
acknowledges the request with a RECONNECT_SUCCESS
message
containing a new reconnectionKey
. If reconnection is not
successful, a RECONNECT_FAILURE
message is sent to the client.
If the client receives a RECONNECT_FAILURE
message, the client
should disconnect from the server.
public static final byte RECONNECT_SUCCESS
RECONNECT_REQUEST
. 0x21
RECONNECT_REQUEST
has been successful. The
message will include a reconnectionKey
that can be used in a
subsequent reconnect requests from the client. Reciept of this message
indicates that the client session has been re-established.
public static final byte RECONNECT_FAILURE
RECONNECT_REQUEST
.
0x22
public static final byte SESSION_MESSAGE
0x30
public static final byte LOGOUT_REQUEST
0x40
LOGIN_REQUEST
) sent by the client after sending this
message will be ignored, and any message will need to be sent on a new
connection to the server.
public static final byte LOGOUT_SUCCESS
LOGOUT_REQUEST
.
0x41
LOGOUT_REQUEST
has been received and that the client has been
logged out of the current session. On receipt of this message, the client
should shut down any networking resources that are used to communicate
with the server.
public static final byte CHANNEL_JOIN
0x50
channel
name
and channel ID
contained in the message.
public static final byte CHANNEL_LEAVE
0x51
channel ID
. The client can no longer send messages on the channel.
public static final byte CHANNEL_MESSAGE
channel ID
size and two bytes (the size of the unsigned short indicating
the channel Id
size). Larger messages require fragmentation and
reassembly above this protocol layer.
0x52
|
Project Darkstar, Version 0.9.9.6 2009-05-08 15:39:40 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |