The "dm" Package

These routines are meant to provide a generic and simple to use descriptor management facility (ie. event processing on pipes, connections and terminals). NOTE: THIS PACKAGE IS WORK IN PROGRESS. THE INTERFACE MAY CHANGE IN THE NEXT RELEASE, POSSIBLY WITHOUT NOTICE.

Library: karma
Link With: -lkarma

Functions

dm_manageManage a file descriptor for events.
dm_unmanageTerminate the management of a file descriptor for activity.
dm_pollPoll all managed descriptors for any activity.

Prototype Functions

DM_PROTO_input_funcInput event callback.
DM_PROTO_close_funcClose event callback.
DM_PROTO_output_funcOutput event callback.
DM_PROTO_exception_funcException event callback.


Functions


flag dm_manage ( int fd, void *info, flag (*input_func) (), void (*close_func) (), flag (*output_func) (), flag (*exception_func) () )

This routine will manage a file descriptor for activity by registering callback routines. Only one set of callbacks may be registered per file descriptor.

Parameters:

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe


void dm_unmanage (int fd)

Terminate the management of a file descriptor for activity.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe
Note:


void dm_poll (long timeout_ms)

Poll all managed descriptors for any activity.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


Prototype Functions


flag DM_PROTO_input_func (int fd, void **info)

This routine is called when new input occurs on a descriptor.

Parameters:

Returns: TRUE if the descriptor is to remain managed and open, else it returns FALSE (indicating that the descriptor is to be unmanaged and closed). This routine MUST NOT unmanage or close the descriptor.
Multithreading Level: Unsafe
Note:


void DM_PROTO_close_func (int fd, void *info)

This routine is called when a descriptor closes.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe
Note:


flag DM_PROTO_output_func (int fd, void **info)

This routine is called when a descriptor becomes ready for writing.

Parameters:

Returns: TRUE if the descriptor is to remain managed and open, else it returns FALSE (indicating that the descriptor is to be unmanaged and closed). This routine MUST NOT unmanage or close the descriptor.
Multithreading Level: Unsafe
Note:


flag DM_PROTO_exception_func (int fd, void **info)

This routine is called when an exception occurrs on a descriptor.

Parameters:

Returns: TRUE if the descriptor is to remain managed and open, else it returns FALSE (indicating that the descriptor is to be unmanaged and closed). This routine MUST NOT unmanage or close the descriptor.
Multithreading Level: Unsafe
Note:


Contact: Richard Gooch
Web Development: Ariel Internet Services