swpchat.protocol
Interface ChatTokens

All Known Subinterfaces:
ControlTokens, FileTransferTokens, NotificationTokens, ProtocolTokens, ReceiverTokens, SenderReceiverTokens, SenderTokens, UserInfoTokens
All Known Implementing Classes:
ClientControls

public interface ChatTokens

General tokens used both in the communication between chat receiver and chat sender communication. A communication stream consists of messages, with each message beginning with a command word and ending in an end character (CHAR_MSG_END). Arguments may follow the command word and are separated by Argument separators (CHAR_ARG_SEP).

The argument types for now are the booleans and string. Booleans are encoded in fixed strings (STR_POSITIVE, STR_NEGATIVE). Strings are enclosed in string delimiters (CHAR_STRING_DELIMITER). In order to send string delimiter characters themselves in strings, a quoting (CHAR_QUOTE) mechanism is applied.

Command words in the server Reply are built by appending a reply appendix (STR_REPLY) to the initial command word.

So, the general message format is

CommandWord[Reply]{':'(Boolean|('"'quotedText'"'))}'.'

The command words are defined in more specific protocols.

For convenience and to work around some compiler bugs (the language spec says that operands of `+' expressions involving a String are promoted to Strings, which should mean for characters: the respective character. At least the blackdown jdk 1.2 inserts the numeric value.), STR_ constants are defined for all CHAR_ constants, containing the same character, just in a String.


Field Summary
static char CHAR_ARG_SEP
          The character that separates arguments from each other and from the command word.
static char CHAR_MSG_END
          The character that terminates each message.
static char CHAR_MSG_EOL
          An End-of-line character is appended to the messages.
static char CHAR_QUOTE
          The quoting character.
static char CHAR_STRING_DELIMITER
          The String bounding character.
static java.lang.String STR_ARG_SEP
           
static java.lang.String STR_AUTHORIZE
          Acknowledgement to send password
static java.lang.String STR_MSG_END
           
static java.lang.String STR_MSG_EOL
           
static java.lang.String STR_NEG_ARG
          Boolean reply, negative
static java.lang.String STR_NEGATIVE
          Negative acknowledgement
static java.lang.String STR_POS_ARG
          Boolean reply, positive
static java.lang.String STR_POSITIVE
          Positive acknowledgement
static java.lang.String STR_QUOTE
           
static java.lang.String STR_REPLY
          The string appended to the command word in the reply
static java.lang.String STR_STRING_DELIMITER
           
static java.lang.String STR_WAIT
          Acknowledgement to wait
 

Field Detail

CHAR_ARG_SEP

public static final char CHAR_ARG_SEP
The character that separates arguments from each other and from the command word.

STR_ARG_SEP

public static final java.lang.String STR_ARG_SEP

CHAR_MSG_END

public static final char CHAR_MSG_END
The character that terminates each message. For readability, a MSG_EOL is expected to follow each message.

STR_MSG_END

public static final java.lang.String STR_MSG_END

CHAR_MSG_EOL

public static final char CHAR_MSG_EOL
An End-of-line character is appended to the messages. This allows usage of readln.

STR_MSG_EOL

public static final java.lang.String STR_MSG_EOL

CHAR_STRING_DELIMITER

public static final char CHAR_STRING_DELIMITER
The String bounding character. A string spans from odd occurences to even occurences of this character. Occurences quoted with MSG_QUOTE do not count here.

STR_STRING_DELIMITER

public static final java.lang.String STR_STRING_DELIMITER

CHAR_QUOTE

public static final char CHAR_QUOTE
The quoting character. Special characters in Strings may be made unspecial by prefixing them with this one. In the future, regular characters may also be made special by prefixing this character.

STR_QUOTE

public static final java.lang.String STR_QUOTE

STR_POSITIVE

public static final java.lang.String STR_POSITIVE
Positive acknowledgement

STR_NEGATIVE

public static final java.lang.String STR_NEGATIVE
Negative acknowledgement

STR_WAIT

public static final java.lang.String STR_WAIT
Acknowledgement to wait

STR_AUTHORIZE

public static final java.lang.String STR_AUTHORIZE
Acknowledgement to send password

STR_REPLY

public static final java.lang.String STR_REPLY
The string appended to the command word in the reply

STR_POS_ARG

public static final java.lang.String STR_POS_ARG
Boolean reply, positive

STR_NEG_ARG

public static final java.lang.String STR_NEG_ARG
Boolean reply, negative