Liboop Reference.

Event Source Interface.

#include <oop.h>

/* Applications can set these; liboop libraries will use them. */
extern void *(*oop_malloc)(size_t); /* returns NULL on failure */
extern void *(*oop_realloc)(void *,size_t); /* returns NULL on failure */
extern void (*oop_free)(void *);

typedef struct oop_source oop_source;
struct oop_source {
    /* File descriptor activity events. */
    void (*on_fd)(oop_source *,int fd,oop_event,oop_call_fd *,void *);
    void (*cancel_fd)(oop_source *,int fd,oop_event);

    /* Timer events. */
    void (*on_time)(oop_source *,struct timeval,oop_call_time *,void *);
    void (*cancel_time)(oop_source *,struct timeval,oop_call_time *,void *);

    /* UNIX signal events. */
    void (*on_signal)(oop_source *,int sig,oop_call_signal *,void *);
    void (*cancel_signal)(oop_source *,int sig,oop_call_signal *,void *);
};

System Event Source.

typedef struct oop_source_sys oop_source_sys;

/* Create and destroy a system event source. */
oop_source_sys *oop_sys_new(void); /* returns NULL on failure */
void oop_sys_delete(oop_source_sys *);

/* Run the system event loop. */
void *oop_sys_run(oop_source_sys *);
void *oop_sys_run_once(oop_source_sys *);

/* Get the standard source interface for a system event source. */
oop_source *oop_sys_source(oop_source_sys *);

ADNS Event Sink Adapter.

Please note that while the core of liboop is distributed under the Lesser GPL, ADNS is covered by the full GPL.

#include <adns.h>
#include <oop-adns.h>

typedef struct oop_adapter_adns oop_adapter_adns;
typedef struct oop_adns_query oop_adns_query;

/* Create and destroy a liboop adns adapter, including an instance of adns. */
oop_adapter_adns *oop_adns_new(oop_source *,adns_initflags,FILE *diag); /* returns NULL on failure */
void oop_adns_delete(oop_adapter_adns *);

/* Submit an asynchronous DNS query. */
oop_adns_query *oop_adns_submit( /* returns NULL on failure */
        oop_adapter_adns *,
        const char *owner,adns_rrtype type,adns_queryflags flags,
        oop_adns_call *,void *);

/* Cancel a running query. */
void oop_adns_cancel(oop_adns_query *);

GLib Event Source Adapter.

GLib is copyrighted by Peter Mattis, Spencer Kimball and Josh MacDonald, and licensed under the terms of the GNU Library GPL.

#include <glib.h>
#include <oop-glib.h>

/* Create and destroy a liboop GLib adapter. */
oop_source *oop_glib_new();
void oop_glib_delete();

/* Get the value used to terminate the event loop (e.g. OOP_HALT). */
void *oop_glib_return();

Tcl/Tk Event Source Adapter.

Tcl is copyrighted by the Regents of the University of California, Sun Microsystems, Inc., and other parties.

#include <oop-tcl.h>

/* Create and destroy a liboop Tcl adapter. */
oop_source *oop_tcl_new();
void oop_tcl_delete();

Libwww Event Sink Adapter.

Libwww is covered by this copyright notice and distributed under the terms of the W3C Software License.

#include <HTEvent.h>
#include <oop-www.h>

/* Register a liboop event source as a libwww "event manager". */
void oop_www_register(oop_source *);

/* Unregister the event source, leaving libwww with no event manager.
   This function cannot be executed with outstanding event requests. */
void oop_www_cancel();

/* Use libwww for liboop's oop_malloc, oop_realloc, and oop_free.
   If you use this, you must call it before any other liboop function! */
void oop_www_memory();

GNU Readline Library Event Sink Adapter.

Please note that while the core of liboop is distributed under the Lesser GPL, Readline is covered by the full GPL.

#include <oop-rl.h>

/* Use a liboop event source to call rl_callback_read_char().
   It is up to you to call rl_callback_handler_install().
   Note well that Readline uses malloc(), not oop_malloc(). */
void oop_readline_register(oop_source *);

/* Stop notifying readline of input characters. */
void oop_readline_cancel(oop_source *);

liboop home