Undernet P10 Protocol and Interface Specification
(As of ircu 2.10.11)
Undernet Coder-com, coder-com@undernet.org
$Id: p10.html,v 1.5.4.1 2002/01/11 16:02:13 kev Exp $
This document aims to be a practical
guide for implementing and maintaining the protocol, not just a reference
manual.
This document is "work in progress" and being continually updated :)
1. Introduction
2. General concepts and background
2.1 Concepts.
2.2 Token Table.
4. Programmers reference: Function headers
-
4.1 ms_nick
-
4.2 m_burst
-
4.3 ..etc
7. Acknowledgements and disclaimer
TODO List
1. Introduction
[Back]
2. General concepts and background
2.1 Concepts
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.
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]
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.
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:
[NUMERIC PREFIX] [TOKEN] [DATA]
For Example:
A[A5j P ABAAA :Foo.
2.2 Token Table
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.
| Message |
Token |
| PRIVMSG |
P |
| WHO |
H |
| WHOIS |
W |
| WHOWAS |
X |
| USER |
USER |
| NICK |
N |
| SERVER |
S |
| LIST |
LIST |
| TOPIC |
T |
| INVITE |
I |
| VERSION |
V |
| QUIT |
Q |
| SQUIT |
SQ |
| KILL |
D |
| INFO |
F |
| LINKS |
LI |
| STATS |
R |
| HELP |
HELP |
| ERROR |
Y |
| AWAY |
A |
| CONNECT |
CO |
| MAP |
MAP |
| PING |
G |
| PONG |
Z |
| OPER |
OPER |
| PASS |
PA |
| WALLOPS |
WA |
| DESYNCH |
DS |
| TIME |
TI |
| SETTIME |
SE |
| RPING |
RI |
| RPONG |
RO |
| NAMES |
E |
| ADMIN |
AD |
| TRACE |
TR |
| NOTICE |
O |
| WALLCHOPS |
WC |
| CPRIVMSG |
CP |
| CNOTICE |
CN |
| JOIN |
J |
| PART |
L |
| LUSERS |
LU |
| MOTD |
MO |
| MODE |
M |
| KICK |
K |
| USERHOST |
USERHOST |
| USERIP |
USERIP |
| ISON |
ISON |
| SQUERY |
SQUERY |
| SERVLIST |
SERVLIST |
| SERVSET |
SERVSET |
| REHASH |
REHASH |
| RESTART |
RESTART |
| CLOSE |
CLOSE |
| DIE |
DIE |
| HASH |
HASH |
| DNS |
DNS |
| SILENCE |
U |
| GLINE |
GL |
| BURST |
B |
| CREATE |
C |
| DESTRUCT |
DE |
| END_OF_BURST |
EB |
| END_OF_BURST_ACK |
EA |
| PROTO |
PROTO |
| JUPE |
JU |
| OPMODE |
OM |
| CLEARMODE |
CM |
| ACCOUNT |
AC |
[Back]
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:
PASS :[PASSWORD]
"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:
SERVER [SERVERNAME] [HOPCOUNT] [START TIME] [LINK TIME] [PROTOCOL] [NUMERIC/MAXCONN] :[DESCRIPTION]
For Example:
1 2 3 4 5 6 7 8
SERVER irc.undernet.org 1 933022556 947908144 J10 AA]]] :[127.0.0.1] A Undernet Server.
Notes:
-
The SERVER message, indicating this connection wishes to introduce a new
server to the network.
-
The name of the server you are introducing, a valid server name consists
of [..defn..].
-
The hop count of the server you are introducing, this is always 1
when you are introducing yourself.
-
The epoch timestamp specifying when the ircd was started.
-
The epoch timestamp specifying the time the server initiated the
link to the network.
-
The Protocol identifier of this server.
-
This token informs the network which protocol it is compliant with, eg:
If it is a P10 compliant server, then the token will be "P10".
-
If the server being introduced has not yet successfully synced its
database with the network (Completed its net.burst - see 3.2), then the
Protocol token should be prefixed with a J, instead of a P (Eg: J10) to
indicate it is currently still joining the network.
-
The protocol token should always be JXX when the server is introducing
itself.
-
The numeric, and maximum connections identifier for this server.
-
This token is formatted exactly the same as a client numeric is formatted.
The first 2 characters identify the server's numeric, whilst in this situation,
the final 3 characters define the maximum number of clients that this server
can hold (and more importantly, the maximum number of numerics it will
generate). This is always one less than a power of two, because the server
uses this as a bitmask. A server can give out a higher numeric than this,
however it will be "anded" with this number to find it's entry slot. The
reason for this is so a server which is near the maximum number of clients
can give out more numerics than it's using to prevent a new client getting a
numeric that was used only seconds ago and maybe get messages destined to
the old user.
-
The example "AA]]]" shows that this is a server with numeric 0, which
will generate client numerics up to 262,143.
-
This final parameter simply consists of a textual description of the server
prefixed by a colon. This is displayed in a clients WHOIS line, aswell
as in the LINKS reply. By convention, if this is a leaf server it contains
the servers IP in square brackets at the beginning of the string,
3.2 Network Database resyncronisation
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:
[NUMERIC PREFIX] N [NICK] [HOPCOUNT] [TIMESTAMP] [USERNAME] [HOST] <+modes> [BASE64 IP] [NUMERIC] :[USERINFO]
For Example:
1 2 3
4 5 6
7 8
9 10 11
AF N Client1 1 947957573 User userhost.net
+oiwg DAqAoB AFAAA :Generic Client.
Notes:
-
The numeric of the server sending this message. (And hence, owning this
client).
-
The "NICK" token.
-
The nickname of this client, currently max 9 chars.
-
The "Hopcount" of this client, Ie: how many servers away it is on.
-
The epoch timestamp indicating when the user was created.
-
The "User" part of the user@host mask.
-
the "Host" part of the user@host mask.
-
[Optional]: User modes. If present, this is always +<user modes
for this client>. Note that the special +r usermode is followed by the
client's account name; see the documentation for ACCOUNT.
-
The real IP address of this client, a Base64 encoded 32bit int.
-
This client's numeric, in SSCCC format.
-
Free format user info line.
3.2.3 - BURST Messages
Channel details and membership information is synchronised
in one (or more) BURST messages for each channel that exists, formatted
as follows:
[NUMERIC PREFIX] B [CHANNEL] [CREATION TIMESTAMP] <+MODES> <ARG1> <ARG2> [MEMBER LIST] <:%BANS>
For Example:
1 2 3 4 5 6 7 8 9
AZ B #coder-com 949217470 +tinkl key 56 AAAAA,AAAAB,AAAAC,ABAAA,ABAAB,ABAAC,ACAAA :%*!*@*.net
Notes:
-
The numeric of the server sending this message.
-
The "BURST" token.
-
The name of the channel to which this data belongs. Currently #Channel
and +Channel names can be sent in a BURST message, &Channels are not
because by definition they are local to the server.
-
The epoch timestamp indicating when the channel was created.
-
[Optional]: Channel Modes.
-
The channel may have a number of modes set, aswell as relevant mode arguments
in the following 2 parameters.
-
[Optional]: Channel Key, this parameter is present if the channel
modes contain a "k" mode.
-
[Optional]: Channel Limit, this parameter is present if the channel
modes contain a "l" mode.
-
A comma seperated list of client numerics, with the following
specific formatting rules to indicate +o, +v and +ov channel members.
-
Numerics can have the following symbols appended on them; ":ov",
":v" or ":o". These indicate that this numeric is either
Opped (:o), Voiced (:v) or both (:ov). This state
applies to the numeric it is attached too, and all subsequent numerics
until another state is encountered. For Example:
-
AAABA:ov, AAABB:o,AAABC,AAABD,AAABE:v,AAABZ
Here, AAABA is both opped, and voiced, AAABB, AAABC and AAABD are opped
leaving AAABE and AAABZ voiced.
-
The first numeric of the member list will always contain a state
symbol.
-
A space seperated list of bans present in the channel. The start
of the ban stream is indicated by a ":%", everything following the ":%"
is the ban list.
For Example:
:%*!*@*.foobar.net another!ban@*.com *!*fred@a.host.co.uk
Would add the following bans to the channel:
*!*@*.foobar.net
another!ban@*.com
*!*fred@a.host.co.uk
If the length of a BURST message exceeds the maximum lenght
of a line (512 characters) then the remaining channel members/bans are
sent in subsequent BURST lines. The subsequent burst lines are only
used to add additional members to the channel, and if neccessary, channel
bans. There will be no "Mode" parameters present. A sample additional burst
line would be:
AZ BURST #coder-com 949217470 ACAAB:o,ACAAD :%*!*another@*.ban.com
Which adds two more opped members and a ban to the channel.
3.2.4 - JUPE Messages
Any currently unexpired JUPEs are transmitted via "JUPE" messages
with the following format:
[NUMERIC PREFIX] JU * (+|-)[SERVER
NAME] [LIFETIME] [LAST MOD] :[REASON]
For example:
1 2 3 4
5 6
7
AZ JU * +juped.undernet.org 000003593 955419707
:Juped Server
Notes:
-
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this message.
-
The "
The numeric of the server sending this