1/***********************************************************************
2*
3* eventpriv.h
4*
5* Abstraction of select call into "event-handling" to make programming
6* easier.  This header includes "private" definitions which users
7* of the event-handling code should not care about.
8*
9* Copyright (C) 2001 Roaring Penguin Software Inc.
10*
11* This program may be distributed according to the terms of the GNU
12* General Public License, version 2 or (at your option) any later version.
13*
14* $Id$
15*
16* LIC: GPL
17*
18***********************************************************************/
19
20#ifndef INCLUDE_EVENTPRIV_H
21#define INCLUDE_EVENTPRIV_H 1
22#include <sys/time.h>
23#include <sys/types.h>
24#include <unistd.h>
25
26/* Handler structure */
27typedef struct EventHandler_t {
28    struct EventHandler_t *next; /* Link in list                           */
29    int fd;			/* File descriptor for select              */
30    unsigned int flags;		/* Select on read or write; enable timeout */
31    struct timeval tmout;	/* Absolute time for timeout               */
32    EventCallbackFunc fn;	/* Callback function                       */
33    void *data;			/* Extra data to pass to callback          */
34} EventHandler;
35
36/* Selector structure */
37typedef struct EventSelector_t {
38    EventHandler *handlers;	/* Linked list of EventHandlers            */
39    int nestLevel;		/* Event-handling nesting level            */
40    int opsPending;		/* True if operations are pending          */
41    int destroyPending;		/* If true, a destroy is pending           */
42} EventSelector;
43
44/* Private flags */
45#define EVENT_FLAG_DELETED 256
46#endif
47