                           VACM Loose Module Library
                                 March 10, 2000
                          San Mehat (nettwerk@valinux.com)

  The Loose Module Library allows users to quickly prototype and write VACM
modules using C Language. There is also a Perl equivalent library for Perl
programmers called 'Loose.pm' which is available in the VACM distribution.

  Loose Modules run in their own process space from Nexxus, and communicate
via an AF_UNIX domain socket. They are intended for use in prototyping, 
quick hacks, and special modules where a tightly bound module is not desired.
The API for the library is defined below.

int lm_init(void);
-- Initialize the library. Must be your first call into the library

int lm_nexxus_connect(void);
-- Connect to the Nexxus AF_UNIX socket.

int lm_nexxus_disconnect(void);
-- Disconnect from the Nexxus AF_UNIX socket.

int lm_register(char *short_name,
                char *long_name,
                char *desc,
                char *author,
                char *ipc_tag,
                int  major_version,
                int  minor_version);
-- Register the current module with nexxus.

int lm_timer_add(int  timeout,
                 int (*cb) void *),
                 void *arg);
-- Add a timer that will call function 'cb' with argument 'arg' in 
   'timeout' seconds. A timertag is returned. If TRUE is returned from
   the function 'cb', the timer will be rescheduled. If FALSE is returned,
   the timer will be destroyed

lm_timer_remove(int tag);
-- Remove a timer.

lm_watch_fd(int  I_fd,
            void (*cb) (int, void *),
            void *arg);
-- Add the FD 'I_fd' to the libraries async i/o list and call function 'cb'
   with the FD and argument 'arg' when there is data waiting to be read.

int lm_unwatch_fd(int I_fd);
-- Remove the FD 'I_fd' from the libraries async i/o list.

int lm_send_to_nexxus(char *msg);
-- Send the message 'msg' to the connected Nexxus

void lm_main_loop(void (*config_cb) (__uint32_t, int, char *),
                  void (*deinit_cb) (__uint32_t, int, char *),
                  void (*discon_cb) (__uint32_t, int, char *),
                  void (*ipc_cb) (char *, __uint32_t, int, char *));
-- Execute the library main loop. The pointers to functions are used as
callback initializers when certain messages arrive from Nexxus. Configuration
init and change messages are sent to 'config_cb'. A request from Nexxus to
shut down is sent to 'deinit_cb'. Notification of a client disconnect is
sent to 'discon_cb'. All other messages are sent to 'ipc_cb'. The first
argument is the NODE ID the message relates to. The second argument is the 
JOB_ID of the message (which may be 0 if the message is
not generated by a user). The third argument is the Nexxus client FD. While
this FD is not usable by the library, it can serve as an identifier for a
given client connection. The last argument is the message that was sent itself.

