solanum/servlink
jilles 64f2a7eb2c [svn] Merge old trunk r2077,r2079:
- Move closing of servlink control fd to close_connection()
  instead of doing it in exit_local_server(), and make sure
  we first close the data fd and then the control fd.
- Have servlink process ready fds in order net, data, ctrl
  instead of ctrl, data, net.  This seems to fix the problem
  that squit reasons do not show up on the other side of a
  ziplink (by making it send any final SQUIT and/or ERROR
  before noticing the closed control fd).
2007-03-29 13:03:06 -07:00
..
.cvsignore [svn] - the new plan: 2007-01-24 22:40:21 -08:00
.indent.pro [svn] - the new plan: 2007-01-24 22:40:21 -08:00
control.c [svn] - the new plan: 2007-01-24 22:40:21 -08:00
control.h [svn] - the new plan: 2007-01-24 22:40:21 -08:00
io.c [svn] Merge old trunk r2077,r2079: 2007-03-29 13:03:06 -07:00
io.h [svn] - the new plan: 2007-01-24 22:40:21 -08:00
Makefile.in [svn] - the new plan: 2007-01-24 22:40:21 -08:00
README [svn] - the new plan: 2007-01-24 22:40:21 -08:00
servlink.c [svn] - the new plan: 2007-01-24 22:40:21 -08:00
servlink.h [svn] - the new plan: 2007-01-24 22:40:21 -08:00
TODO [svn] - the new plan: 2007-01-24 22:40:21 -08:00

Servlink protocol documentation.
$Id: README 1285 2006-05-05 15:03:53Z nenolod $
--------------

After negotiating an incoming/outgoing server connection, the ircd will
fork, then execve servlink, with fd 0 as one end of a control pipe and
fd 1 as one end of a data pipe. fd 2 will be the socket connected to
the remote server.

The data pipe is used by the ircd to send/receive normal, decrypted,
uncompressed IRC commands to/from the remote server.  The socket is used to
send the (processed) data to the remote server, and receive the data from
the remote server.

The control pipe is used to activate encryption/compression and to set the
encryption key/algorithm to be used.

Format of control messages:

<u8 command><optional data>

data format:
<u16 len><data>

Commands:

001 - SET_ZIP_OUT_LEVEL
	data: yes
	description:
		set compression level (0 [use default, 6], or 1-9)

002 - START_ZIP_OUT
	data: no
	description:
		all data written to the data pipe will be compressed
		prior to being sent to the remote server.

003 - START_ZIP_IN
	data: no
	description:
		all data not yet read from the slink program will be
		decompressed before reading

004 - INJECT_RECVQ
	data: recvq

	Used before INIT to inject any data read from the server fd which
	should be pre-processed by servlink before being sent back
	to the LOCAL_FD through the data fd.

005 - INJECT_SENDQ
	data: sendq

	As above, but sent to remote server without processing.

006 - INIT

007 - ZIPSTATS
	request to send ziplinks statistics reply.

replies

001 - ERROR
	data: u32 len/char error[len]

	fatal error message.

002 - ZIPSTATS
        data: u32 in/u32 in_wire/u32 out/u32 out_wire                           

	ziplinks commpression statistics