This document is "work in progress" and being continually updated :)
2. General concepts and background
2.2 Token Table.
2. General concepts and background
The undernet P10 protocol uses a scheme of "Numerics" to uniquenly identify a client or server within the network. Each server has its own unique numeric (0 -> 4095) and each client has its own numeric within that server (0->262,143).
The numerics are encoded into a Base64 stream to maintain human readable data flow and reduce the size of the messages. The Base64 character set used in ircu is included below, this defines all valid characters allowed in a Base64 numeric with "A" representing 0 and "]" representing 63.
Server numerics consist of 2 characters, with the minimum, 0, being represented by "AA", and the maximum, 4095, being represented by "]]". Client numerics are 3 characters long, with the minimum, 0, being represented by "AAA", and the maximum, 262,143, being represented by "]]]". The unique identifier of a client on the network consists of a combination of both the server and client numeric in the format SSCCC.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
As an example, consider a server "irc.undernet.org" which has a numeric of 2, translating to "AC" in Base64. On this server exists a client, whom has been allocated the numeric 63 (which translates to "AA]" in Base64). Therefore, the unique identifier of this client on the network is "ACAA]". From this, we can determine which server the message came from, aswell as the client who sent it.
These numerics are used to prefix every message issued on the stream except for the initial "PASS" or "SERVER" message, which are not prefixed. Therefore, every message that can be recieved from a server will consist of the format:
For Example:[NUMERIC PREFIX] [TOKEN] [DATA]
2.2 Token TableA[A5j P ABAAA :Foo.
The following table lists all the acceptable messages, along with their
relevant "Token", which is used in the server<>server protocol. The
aim of tokenisation is to reduce the bandwidth used during network communication
by reducing the length of common message identifiers.
3. Registration and syncronisation
3.1 Server registration and authentication
After a TCP connection has been established, the server initally introduces itself via a "PASS" message as follows:
"PASSWORD" is simply compared with the password present in the destination servers config file, and is used to confirm credentials after the "SERVER" message has been recieved, as follows:PASS :[PASSWORD]
For Example:SERVER [SERVERNAME] [HOPCOUNT] [START TIME] [LINK TIME] [PROTOCOL] [NUMERIC/MAXCONN] :[DESCRIPTION]
Notes:1 2 3 4 5 6 7 8 SERVER irc.undernet.org 1 933022556 947908144 J10 AA]]] :[127.0.0.1] A Undernet Server.
After the connection has been established and verified, the next step is to syncronise the database of client/server/channel information between the two servers.
3.2.1 - SERVER Messages
Server details are transmitted via "SERVER" messages similar to the initial introduction message, with the following format:
[OWNING SERVER PREFIX] S [SERVERNAME] [HOPCOUNT] [START TIME] [LINK TIME] [PROTOCOL] [NUMERIC/MAXCONN] 0 :[DESCRIPTION]The syntax of this message is almost identical to the originally recieved server message, with the only exception being that the message is numeric prefixed, to indicate which server sent this message (and also therefore, which hub this new server is linked too). There is also a fixed "0" present before the Description field, this is a placeholder for future use and currently unused. [Isomer: Question, what IS this reserved for?]
3.2.2 - NICK Messages
Client information is transmitted via "NICK" messages, of the following format:
For Example:[NUMERIC PREFIX] N [NICK] [HOPCOUNT] [TIMESTAMP] [USERNAME] [HOST] <+modes> [BASE64 IP] [NUMERIC] :[USERINFO]1 2 3 4 5 6 7 8 9 10 11Notes:
AF N Client1 1 947957573 User userhost.net +oiwg DAqAoB AFAAA :Generic Client.
- The numeric of the server sending this message. (And hence, owning this client).
- The "NICK" token.
- The nickname of this client, currently m