$Id: README.usage,v 1.6 2001/01/02 09:59:31 michaels Exp $ The socks package can be used in two ways. Dynamically The simplest way to add socks support to an already (dynamically) complied application is to use the LD_PRELOAD facility to replace the standard library functions with socksified ones. The libdsocks library is provided for this purpose. See the README.socksify file for more information. This will probably only work with non-setuid applications since LD_PRELOAD is usually ignored otherwise. If setting LD_PRELOAD is not possible, compilation is another possibility. If the application can be compiled dynamically socks support can be added explicitly by linking with libdsocks (usually done by adding '-ldsocks'). This will automagically give the application socks support without making any code changes. Static Compilation If the source code for an application is available it can be changed to use socks, even if it is not linked dynamically. Several systemcalls must be changed to use the socksified versions instead of the standard ones. The application is then linked with the libsocks library in the distribution (-lsocks, not -ldsocks). These system calls can be found in the socks library: Rconnect Rbind Rgetsockname Rgetpeername Raccept Rrresvport Rbindresvport Rgethostbyname Rgethostbyname2 Rsendto Rrecvfrom Rrecvfrom Rwrite Rwritev Rsend Rsendmsg Rread Rreadv Rrecv Rrecvmsg These calls currently does nothing and are only provided for compatibility with programs which use them. Rlisten Rselect SOCKSinit The source can either be modified directly, or by using defines to change the source during compilation. Either add this line to the command compilation line (e.g. CFLAGS): -Dconnect=Rconnect -Dbind=Rbind -Dgetsockname=Rgetsockname -Dgetpeername=Rgetpeername -Daccept=Raccept -Drresvport=Rrresvport -Dbindresvport=Rbindresvport -Dgethostbyname=Rgethostbyname -Dgethostbyname2=Rgethostbyname2 -Dsendto=Rsendto -Drecvfrom=Rrecvfrom -Drecvfrom=Rrecvfrom -Dwrite=Rwrite -Dwritev=Rwritev -Dsend=Rsend -Dsendmsg=Rsendmsg -Dread=Rread -Dreadv=Rreadv -Drecv=Rrecv -Drecvmsg=Rrecvmsg or add "include <socks.h>" to every C file in the program you are compiling. Libraries In total there are three libraries distributed with this package: libsocks.so - standard shared library, contains Rfoo type functions. libsocks.a - static version of the above. libdsocks.so - shared library which does "on the fly" socksification.