HOW-TO create new tunnel

Then tunnel interface is very simple. It's based on dynamic loading of functions from shared object.

Each new tunnel have to provide following functions:

int eInit(int fd)
eInit associats a new tunnel with fd

int eDestroy(int fd)
eDestroy removes a mapping between tunnel and fd. In addition it can deallocate all resurses, wich was allocated by eInit.

ssize_t eRead(int fd, void *buf, size_t size)
eRead reads size bytes into buffer buf through tunnel associated with fd..

ssize_t eWrite(int fd,const void *buf, size_t size)
eWrite writes size bytes into buffer buf through tunnel associated with fd.

Dummy example:


/* dummy-tunnel.c */
#include <unistd.h>

ssize_t eRead(int fd, void *buff, size_t len)
{
	return read(fd, buff, len);
}

ssize_t eWrite(int fd,const void *buff, size_t len)
{	
	return write(fd, buff, len);
}

int eInit(int fd)
{
	return 0;
}

int eDestroy(int fd)
{
	return 0;
}

$ cc dummy-tunnel.c -c -o dummy-tunnel.o
$ ld -shared -o libdummyTunnel.so dummy-tunnel.o
$ dccp -T libdummyTunnel.so /path/to/file /path/in/pnfs
$ dccp /path/to/file dummydcap://door/pnfs/domain/path/in/pnfs



$Id: tunnel-hacking.html,v 1.2 2004/04/08 13:00:26 tigran Exp $