2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 16:15:27 +00:00

move eventclass stuff to eventclass.h; add event stuff

This commit is contained in:
Bob Halley
1999-05-10 22:51:49 +00:00
parent 75d597c630
commit 44963bb00d

View File

@@ -18,37 +18,44 @@
#ifndef ISC_EVENT_H #ifndef ISC_EVENT_H
#define ISC_EVENT_H 1 #define ISC_EVENT_H 1
#include <stddef.h>
#include <isc/lang.h> #include <isc/lang.h>
#include <isc/types.h>
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS
/*** /*****
*** Registry of Predefined Event Type Classes ***** Events.
***/ *****/
typedef void (*isc_eventdestructor_t)(isc_event_t *);
/* /*
* An event class is a 16 bit number, the most sigificant bit of which must be * This structure is public because "subclassing" it may be useful when
* zero. Each class may contain up to 65536 events. An event type is * defining new event types.
* formed by adding the event number within the class to the class number.
* E.g., the first event in the timer class is ISC_EVENTCLASS_TIMER + 1.
* Event number zero is always reserved in each class.
*/ */
struct isc_event {
isc_mem_t * mctx;
size_t size;
void * sender;
isc_eventtype_t type;
isc_taskaction_t action;
void * arg;
isc_eventdestructor_t destroy;
ISC_LINK(struct isc_event) link;
};
#define ISC_EVENTCLASS(eclass) ((eclass) << 16) #define ISC_EVENTTYPE_FIRSTEVENT 0x00000000
#define ISC_EVENTTYPE_LASTEVENT 0xffffffff
/* isc_event_t * isc_event_allocate(isc_mem_t *,
* Classes < 1024 are reserved for ISC use. void *,
*/ isc_eventtype_t,
isc_taskaction_t,
#define ISC_EVENTCLASS_TASK ISC_EVENTCLASS(0) void *arg,
#define ISC_EVENTCLASS_TIMER ISC_EVENTCLASS(1) size_t);
#define ISC_EVENTCLASS_SOCKET ISC_EVENTCLASS(2) void isc_event_free(isc_event_t **);
#define ISC_EVENTCLASS_FILE ISC_EVENTCLASS(3)
#define ISC_EVENTCLASS_DNS ISC_EVENTCLASS(4)
/*
* Event classes >= 1024 and <= 32767 are reserved for application use.
*/
ISC_LANG_ENDDECLS ISC_LANG_ENDDECLS