The Posadis file server/client

The Posadis file server and client programs are a research project of the Posadis project. They were basically designed to test the Poslib libraries, though they might also actually be useful in real life. In short, these programs provide a means of distributing small files over the Domain Name System (DNS).

The system consists of two programs: fileserver and fileclient.

Fileserver

This is the server for the system. It has the following command-line syntax:
fileserver [] [directory]
The fileserver will by default listen to port 53, the standard DNS port, for all interfaces on the system. In order for this to work, you will need to be the root user on Unix systems. Alternatively, specify an alternate port to listen to, for example, "", to get it to run if you're not root. The file server will listen to both TCP and UDP ports.

You can also specify a directory to export. The directory and all of its subdirectories will be shared. Clients will be able to read all files and subdirectories the user running the server has access to. There *should* be no way to access other directories than the directory you specify and its subdirectories (symlinks are followed though). If you don't specify a directory, the current working directory will be exported.

Fileclient

The client program. It has a very similar syntax:
fileclient [] path
The client will contact the server (localhost port 53 by default), and retrieve the file or directory specified by "path". If path is a directory, the directory listings will be printed, for example:
[ poslib]$ tools/fileclient  CVS/
Directory listing of CVS/:
  "./"
  "../"
  "Root"
  "Repository"
  "Entries"
The same result can also be retrieved by using any DNS client program, for example "posask CVS txt", or "dig @127.0.0.1 -p 3000 CVS txt". See the "Domain-name mapping and other details" section.

To retrieve files, just enter a filename. For example:
[ poslib]$ tools/fileclient  CVS/Root
:ext::/cvsroot/posadis
Note that the file server is not able to serve files larger than 65.000 bytes. Changing this would require a change in the protocol we're not planning to make. Note also that retrieving files can not be done by standard DNS client programs because it uses the NULL RR type, which is not supported by any query programs we are aware of.

Domain-name mapping and other details

You might wonder how file names are mapped to domain names. This happens according to the following algorithm:
For example, "poslib/server/serverthread.cpp" would become "serverthread/cpp.server.poslib".

The client sends queries for this domain name with QTYPE=any and QCLASS=in to the server. If the domain name corresponds to a directory, the server answers with a directory listing, containing resource records with NAME=<queried name>, TYPE=txt, CLASS=in, TTL=3600, RDATA=<name of file in directory>. Directory names have a trailing "/".

If the domain name corresponds to a file, the file is sent back in the form of a resource record with NAME=<queried name>, TYPE=null, CLASS=in, TTL=3600, RDATA=<the file>. If the file is larger than 65.000 bytes, the TC bit is set and the file is not sent.

If no file name or directory exists corresponding to the domain name, RCODE=nxdomain is sent back.

The client sends queries through UDP first, and if the TC bit is set, it retries using TCP on the same port.

How to get it

The programs are both in the "poslib" CVS repository, in the "tools" subdirectory. They will be built if you compile Poslib from source. Linux binaries are here and here . Both programs require pthreads and the Poslib library. The programs were written by . Mail him if you have problems or additions.

Currently, there is no fileserver module for pos6 yet; however, I do think that would be fun so I might update this webpage with a Pos6 module in the future.