All packets consist of a length byte, followed by that number of bytes of data, and then a zero-byte terminator (hex 00). Zeroes do not occur anywhere else in the stream, except at the ends of packets.
The data-section of the packet consists of a single byte opcode, and then multiple
fields separated by control-A's (hex 01).
Things The Client Sends To The ICB Server
Operation Op Fields
--------- -- ------
Login 'a' (4) ID, nick, group,
command ("w" (who) or "login").
(A 5th obsolete field, password,
is ignored if sent.)
Open Message 'b' (1) Text of message.
Private (/m) 'c' (2) User name, text of message.
Status (/status) 'd' (2) What, description.
Exit 'g' None.
Command 'h' ?
Beep 'k' (1) User name.
Operation Op Fields --------- -- ------ Open Message 'b' (1) Text of message. Private (/m) 'c' (2) User name, text of message. Error 'e' (1) Text of error message. Urgent Error 'f' (1) Text of error message. Beep 'k' (1) User name.
/* limits */ #define MAX_BUFLEN 500 /* size of buffer */ #define BUF_PKTLEN 256 /* size of buffer packets */ #define MAX_FIELDS 20 /* fields in a packet */ /*#define MAX_TEXTLEN 80 default column width */ #define MAX_LINES 24 /* default lines per page */ #define MAX_SCREENLINES 24 /* lines on a screen */ #define MAX_FIELDS 20 /* fields in a packet */ #define MAX_GROUPLEN 8 /* chars in a group name */ #define MAX_GROUPUSERS 25 /* people in the same group */ #define MAX_IDLEN 12 /* chars in a login id */ #define MAX_INPUTSTR (250 - MAX_NICKLEN - MAX_NICKLEN - 6) /* input line */ stdin #define MAX_INVITES 10 /* invitations in a group */ #define MAX_NICKLEN 12 /* chars in a username */ #define MAX_NODELEN 64 /* chars in a node name */ #define MAX_NOPONG 600 /* seconds a client may not PONG a PING */ #define MAX_PASSWDLEN 12 /* chars in a user password */ #define MAX_REALLEN 64 /* chars in a real life name */ #define MAX_TEXTLEN (80 - MAX_NICKLEN - 5) /* max chars in a message */ #define MAX_TOPICLEN 32 /* chars in a group topic */ #define MAX_IDLE 3600 /* maximum idle seconds before disconnect */ #define IDLE_POLLWAIT 30000 /* polltimeout (msecs) when users = 0 */ #define BUSY_POLLWAIT 10000 /* polltimeout (msecs) when users >= 1 */ #define POLL_DELAY 1000 /* min wait through each poll */ /* message types */ /* note: changing these necessitates upgrading the protocol number */ #define M_LOGIN 'a' /* login packet */ #define M_LOGINOK 'a' /* login packet */ #define M_OPEN 'b' /* open msg to group */ #define M_PERSONAL 'c' /* personal msg */ #define M_STATUS 'd' /* status update message */ #define M_ERROR 'e' /* error message */ #define M_IMPORTANT 'f' /* special important announcement */ #define M_EXIT 'g' /* tell other side to exit */ #define M_COMMAND 'h' /* send a command from user */ #define M_CMDOUT 'i' /* output from a command */ #define M_PROTO 'j' /* protocol version information */ #define M_BEEP 'k' /* beeps */ #define M_PING 'l' /* ping packet */ #define M_PONG 'm' /* return for ping packet */