LIBRARY PREREQUISITES: michael tokarev's tinycdb (http://www.corpit.ru/mjt/tinycdb.html) ari edelkind's lx_lib (http://episec.com/people/edelkind/lx_lib.html) ari edelkind's minilib (http://episec.com/people/edelkind/minilib.html) MODULE PREREQUISITES: x509 module: openssl (http://www.openssl.org/) The library prerequisites will be automatically found if they are compiled under './cdb/', './lx_lib/', and './minilib/', respectively, or their locations can be specified on the 'configure' script command line. Sample session: % curl -O http://episec.com/people/edelkind/arc/c/libnaw-current.tar.gz % tar xvzf libnaw-current.tar.gz % cd libnaw % curl -O http://episec.com/people/edelkind/arc/c/minilib-current.tar.gz % curl -O http://episec.com/people/edelkind/arc/c/lx_lib-current.tar.gz % curl -O http://www.corpit.ru/mjt/tinycdb/tinycdb_0.75.tar.gz % tar xvzf minilib-current.tar.gz % tar xvzf lx_lib-current.tar.gz % tar xvzf tinycdb_0.75.tar.gz % ln -s tinycdb-0.75 cdb % cd cdb && make && cd - % cd lx_lib && make && cd - # <-- lx_lib requires gnu make % cd minilib && make && cd - % ./configure --prefix=/usr --sysconfdir=/etc % make everything % sudo make install The prefix may, as one might expect, point anywhere, but you should install the library in a standard system library path if you don't want to specify the full path on the command line for LD_LIBRARY_PATH. If you like, you may install it to a nonstandard directory and add that directory to the runtime library search path using 'ld.so.conf' and 'ldconfig' (bsd-based systems) or 'crle' (solaris). The configuration tree will be automatically set up if and only if the nawconfdir directory (normally /naw; see './configure --help') does not already exist. If you'd like to install it anew, remove the old directory first. At this point, you'll want to set up your naw configuration file, because the default is in place as an example, and it probably won't work for you. % cd /etc/naw # or wherever you installed it % vi config.naw ... edit config.naw to your liking ... % make This operation requires that 'naw-data' be installed in the current path (this is normally handled by 'make install'). If you would like to simply allow everything to start, see the configuration examples in ./CONFIG . By default, the server configuration is exactly the same as the client configuration. The two files may be different, of course, but libnaw is designed to be usable in this manner if so desired. config_srv.cdb is used for accept(2) calls, whereas config_cli.cdb is used for connect(2) calls, and libnaw will interpret them accordingly. Note that the resultant cdb files are _not_ endian-portable. You're now ready to use libnaw. To modify the configuration while your software is running, edit config.naw, then remake the naw cdb, as described above. After the configuration file is updated, libnaw will automatically use it. No reloading, signaling, or wait period is involved. TO START USING LIBNAW: % env LD_PRELOAD=libnaw.so /path/to/service ... and you're running. If you want to check on debug output, set the environment variable NAW_INIT_DEBUG before starting libnaw (or on the 'env' command line). Useful values are 1-3, for progressively more verbose output. % env LD_PRELOAD=libnaw.so NAW_INIT_DEBUG=3 /path/to/service args... INSTALLING LANGUAGE BINDINGS: Python bindings are currently included in the distribution, but they are not built or installed by default. They are installed in the normal fashion for python modules (i.e., using distutils): % cd bindings/python % python setup.py build % sudo python setup.py install See the NOTES file in that directory for information on how to use the naw module, and be sure that you aren't in the python binding directory when you import it (or python will attempt to use './naw' instead). A NOTE ABOUT MODULES: For efficiency, libnaw does not use dlopen() on each module every time it is to be executed, but rather keeps handles and functions in a local cache. If you upgrade a module (remember to do it atomically by moving it into place, not copying it over the old one), you'll probably want to flush the cache so that libnaw will open and use the new version. In an effort to be as unobtrusive (and efficient) as possible, it monitors shared memory mapped from '/etc/naw/flush' (or /flush). To update that shared memory, libnaw comes with a helper program, 'naw-flush'. The usage of naw-flush is: % naw-flush [flushfile] [flushfile2] [...] ... or, in other words ... % naw-flush /etc/naw/flush The next time libnaw goes to use a module, it will see that this value has changed and will first flush its cache to start anew. USING THE API: The api library is built as -lnaw_api . This is currenly the only way to use libnaw on darwin, since its dynamic library interface is broken for preloading (i hope to create a workaround later on). API-related functions are declared and documented in naw_api.h, which must be included in your program. See example/skel-accept.c for an example of API usage. USING THE DIRECT LINKING LIBRARY: This library is built along with the others, but is not currently supported.