Project Fairdice |
[Home] [Docs] [Users] [Gaming] [Crypto] [Devel] [Download] [Help] |
Letter | Name | Description |
---|---|---|
M | Mode | Negotiate the encryption and authentication mode |
R | Remote | Remote tunneling to connect User and Host |
V | Version | Negotiate which version of the protocol to use |
[Definition]
NEGOTIATION_MESSAGE
=
("M " MODE_STR) |
("R " REMOTE_STR) |
("V " VERSION_STR)
;
these are defined in this file
[Definition]
MODE_STR
=
ENCRYPTION_MODE | ENCRYPTION_TYPE |
AUTHENTICATION_MODE | AUTHENTICATION_TYPE |
ENCODING_MODE | ENCODING_TYPE
ENCRYPTION_MODE
=
"encryption mode " MODE_ORDER [ " " ENCRYPTION_NAME ]
ENCRYPTION_TYPE
=
"encryption type " ENCRYPTION_NAME OPAQUE
;
In this case OPAQUE is a method specific argument
AUTHENTICATION_MODE
=
"authentication mode " MODE_ORDER [ " " AUTHENTICATION_NAME ]
AUTHENTICATION_TYPE
=
"authentication type " AUTHENTICATION_NAME OPAQUE
ENCODING_MODE
=
"encoding mode " MODE_ORDER [ " " ENCODING_NAME ]
ENCODING_TYPE
=
"encoding type " ENCODING_NAME OPAQUE
ENCRYPTION_NAME
=
<a short text string, identifying a particular
encryption system>
;
the only method named so far is "none"
AUTHENTICATION_NAME
=
<a short text string, identifying a particular
authentication system>
;
the only system named so far is "pass"
ENCODING_NAME
=
<a short text string, identifying a particular
encoding system>
;
the only method named so far is "ascii-hex"
MODE_ORDER
=
"require " | "confirm " | "failure"
[Sequence]
A mode negotiation happens after version sequence and before description.
It only happens once.
The sequence of orders for each aspect is:
- mode require X
- mode confirm X
- type X foo
- type X bar
- ...
or
- mode require X
- mode failure
(in which case the connection fails)
[Example]
SERVER --> CLIENT M encryption mode require none
CLIENT --> SERVER M encryption mode confirm none
SERVER --> CLIENT M authentication mode require pass
CLIENT --> SERVER M authentication mode confirm pass
CLIENT --> SERVER M authentication type pass NAME=WilliamGladstone
CLIENT --> SERVER M authentication type pass PASS=CantGuess
CLIENT --> SERVER M authentication type pass HOST=Harry.Com
SERVER --> CLIENT M encoding mode require ascii-hex
CLIENT --> SERVER M encoding mode confirm ascii-hex
[Definition]
REMOTE_STR
=
OPAQUE_STR
[Sequence]
A remote string may be sent or received any time after version
and mode negotiation.
The opaque data is sent and received, unedited.
[Example]
USER1 --> CLIENT1 R localhost:22201 ^ Harry.Com | [CHAT] Hi Steve, want to play a game?
CLIENT1 --> SERVER R [CHAT] Hi Ben, want to play a game?
SERVER --> HOST R WilliamGladstone | [CHAT] Hi Ben, want to play a game?
HOST --> SERVER R BenjaminDisraeli | [CHAT] Bill says: Hi Ben, want to play a game?
SERVER --> CLIENT2 R [CHAT] Bill says: Hi Ben, want to play a game?
CLIENT2 --> USER2 R localhost:22201 ^ Harry.Com | [CHAT] Bill says: Hi Ben, want to play a game?
[Definition]
VERSION_STR
=
VERSION_REQUEST | VERSION_OFFER | VERSION_SELECT |
VERSION_DECLINE | VERSION_ACCEPT
VERSION_REQUEST
=
"request"
VERSION_OFFER
=
"offer " VERSION_RANGE
VERSION_SELECT
=
"select " VERSION_NUMBER
VERSION_DECLINE
=
"decline " VERSION_NUMBER
VERSION_ACCEPT
=
"accept " VERSION_NUMBER
VERSION_RANGE
=
INT_RANGE
VERSION_NUMBER
=
SMALLINT
[Sequence]
The version sequence happens once, immediately after the link
open sequence.
The version sequence will be initiated by the party initiating
the connection.
It finishes either successfully with a selection being accepted
or unsuccessfully, with the link being closed after an offer is
not responded to (because the app understands none of the versions
on offer).
X may follow Y
none : VERSION_REQUEST
VERSION_REQUEST : VERSION_OFFER
none : VERSION_OFFER
VERSION_OFFER : none
VERSION_OFFER : VERSION_SELECT
none : VERSION_SELECT
VERSION_SELECT : VERSION_ACCEPT
VERSION_ACCEPT : none
VERSION_SELECT : VERSION_DECLINE
VERSION_DECLINE : VERSION_SELECT
VERSION_DECLINE : VERSION_REQUEST
[Example]
CLIENT --> SERVER V select 1
SERVER --> CLIENT V decline 1
CLIENT --> SERVER V request
SERVER --> CLIENT V offer 2,4-7
CLIENT --> SERVER V select 2
SERVER --> CLIENT V accept 2