DarkChannel Protocol Specification

6. Finite State Machines

This section describes the DarkChannel protocol state machines of the different listeners and connectors the DarkChannel protocol specifies.

6.1 Listeners

The DarkChannel protocol uses different listener state machines for the different listeners on the different nodes specified within the protocol.

Every message received by a node MUST contain a valid DarkChanell command accepted in the current state of the protocol statemachine. Either side of a connection MUST terminate the connection should they receive an unexpected command for the current state of their protocol state machines.

Each one is described in the following sections.

6.1.1 Channel Server

The following shows the protocol state machine for a channel server's listener (normally listening on port 26667 of the target machine):

'v1' => {
    'Channel Server' =>
    {
        'initialization' => {
            always               => [ 'WELCOME', 'welcome-sent' ],
        },

        'welcome-sent' => {
            'HELLO'              => [ 'HELLO', 'connected' ],
            else                 => [ 'NOP, 'disconnected' ],
        },

        'connected' => {
            'JOIN'               => [ 'JOIN', 'connected' ],
            'PART'               => [ 'PART', 'connected' ],
            'RELAY'              => [ 'RELAY', 'connected' ],
            'PING'               => [ 'PONG', 'connected' ],
            'LIST'               => [ 'LIST', 'connected' ],
            'CHANNELSERVER'      => [ 'NOP', 'connected' ],
            else                 => [ 'NOP', 'disconnected' ],
        },

        'disconnected' => { # end state
            else                 => [ 'NOP', 'disconnected' ],
        },
    }

6.1.2 Client

XXX: TBD

6.2 Connectors

The DarkChannel protocol uses different connector state machines for the different connectors on the different nodes to connect to other nodes specified within the protocol.

Every message received by a node MUST contain a valid DarkChanell command accepted in the current state of the protocol statemachine. Either side of a connection MUST terminate the connection should they receive an unexpected command for the current state of their protocol state machines.

Each one is described in the following sections.

6.2.1 Client

XXX: TBD

6.2.2 Channel Server

The following shows the protocol state machine for a client's channel server connector (normally connecting to port 26667 of the target channel server):

'v1' => {
    'Client' =>
    {
        'initialization' => {
            'WELCOME'            => [ 'HELLO', 'welcome-received' ],
            else                 => [ 'NOP', 'disconnected' ],
        },

        'welcome-received'       => {
            'HELLO'              => [ 'NOP', 'connected' ],
            else                 => [ 'NOP', 'disconnected' ],
        },

        'connected' => {
            'JOIN'               => [ 'NOP', 'connected' ],
            'PART'               => [ 'NOP', 'connected' ],
            'RELAY'              => [ 'NOP', 'connected' ],
            'PONG'               => [ 'NOP', 'connected' ],
            'LIST'               => [ 'NOP', 'connected' ],
            'cmd_JOIN'           => [ 'JOIN', 'connected' ],
            'cmd_PART'           => [ 'PART', 'connected' ],
            'cmd_RELAY'          => [ 'RELAY', 'connected' ],
            'cmd_PING'           => [ 'PING', 'connected' ],
            'cmd_LIST'           => [ 'LIST', 'connected' ],
            'cmd_CHANNELSERVER'  => [ 'CHANNELSERVER', 'connected' ],
            else                 => [ 'NOP', 'disconnected' ],
        },

        'disconnected' => {
            else                 => [ 'NOP', 'disconnected' ],
        },
    }
}
Updated July 9, 2015  
Powered by FileWiki