lpmoo-1.2/etc/
lpmoo-1.2/mudlib/
lpmoo-1.2/mudlib/etc/
lpmoo-1.2/mudlib/include/
lpmoo-1.2/mudlib/include/moo/
lpmoo-1.2/mudlib/lpc/
lpmoo-1.2/mudlib/std/auto/
lpmoo-1.2/mudlib/std/bfuns/
/*
 * NAME:	listener.c
 * DESCRIPTION:	a generic port listener
 */

# define DEBUG  1

# include <objects.h>

private	string	prototype;
private	object	listener;

/*
 * NAME:	open()
 * DESCRIPTION:	called by DGD when the network port is opened
 */
static
void open(void)
{ /* do nothing */ }

/*
 * NAME:	destruct()
 * DESCRIPTION:	called to destroy this object
 */
static
void destruct(void)
{ destruct_object(this_object()); }

/*
 * NAME:	close()
 * DESCRIPTION:	called by DGD when the network port is closed
 */
static
void close(void)
{ call_out("destruct", 1); }

/*
 * NAME:	configure()
 * DESCRIPTION:	set how to yield a connection object
 */
varargs
void configure(string nprototype, object nlistener)
{
  prototype = nprototype;
  listener  = nlistener;
}

/*
 * NAME:	connection()
 * DESCRIPTION:	called by DGD when a connection is established
 */
static
object connection(string host, int port)
{ return DRIVER->init_connection(clone_object(prototype), listener, port); }