include "styxconv.m"; styxconv := load Styxconv Styxconv->PATHNEW2OLD; styxconv := load Styxconv Styxconv->PATHOLD2NEW; init: fn(); styxconv: fn(client: ref Sys->FD, server: ref Sys->FD);
Init must be called before any other function in the module.
The function styxconv takes two file descriptors: client should be a connection to a client requiring one version of the protocol; server should be a connection to a server serving the other version of the protocol. There are two conversion modules: PATHNEW2OLD converts from a new client to an old server; PATHOLD2NEW converts from an old client to a new server.
Styxconv should be spawned by the caller, and copies messages between client and server, converting as required. See the example below.
cvstyx(fd: ref Sys->FD): ref Sys->FD
{
styxconv := load Styxconv Styxconv->NEW2OLDPATH;
if(styxconv == nil)
return nil;
p := array[2] of ref Sys->FD;
if(sys->pipe(p) < 0)
return nil;
styxconv->init();
spawn styxconv->styxconv(p[1], fd);
return p[0];
}
| STYXCONV(2 ) | Rev: Tue Mar 31 02:42:39 GMT 2015 |