eventlib_p.h revision 6a1c6faa6f0834799d7de3e77fac2ec32d923f9a
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1995-1999 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* eventlib_p.h - private interfaces for eventlib
* vix 09sep95 [initial]
*
* $Id: eventlib_p.h,v 1.31 2003/04/03 05:37:56 marka Exp $
*/
#ifndef _EVENTLIB_P_H
#define _EVENTLIB_P_H
#define EVENTLIB_DEBUG 1
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <isc/memcluster.h>
FILL(p); \
else \
(void)NULL;
return (-1); \
} else \
FILL(p)
#if EVENTLIB_DEBUG
#else
#define FILL(p)
#endif
#ifdef SUNW_POLL
#include <stropts.h>
#include <poll.h>
#endif
typedef struct evConn {
void * uap;
int fd;
int flags;
} evConn;
typedef struct evAccept {
int fd;
union {
struct sockaddr_in in;
#ifndef NO_SOCKADDR_UN
struct sockaddr_un un;
#endif
} la;
union {
struct sockaddr_in in;
#ifndef NO_SOCKADDR_UN
struct sockaddr_un un;
#endif
} ra;
int ioErrno;
} evAccept;
typedef struct evFile {
void * uap;
int fd;
int eventmask;
int preemptive;
} evFile;
typedef struct evStream {
void * uap;
int flags;
int fd;
int iovOrigCount;
int iovCurCount;
int ioTotal;
int ioDone;
int ioErrno;
} evStream;
typedef struct evTimer {
void * uap;
int index;
} evTimer;
typedef struct evWait {
void * uap;
const void * tag;
} evWait;
typedef struct evWaitList {
struct evWaitList * prev;
struct evWaitList * next;
} evWaitList;
typedef struct evEvent_p {
union {
struct { const void *placeholder; } null;
} u;
} evEvent_p;
#ifdef SUNW_POLL
typedef struct {
void *ctx; /* Pointer to the evContext_p */
} __evEmulMask;
/* Any value other than EV_* values from <isc/eventlib.h> will do */
#define EV_WASNONBLOCKING 4000000001U
#endif /* SUNW_POLL */
typedef struct {
/* Global. */
/* Debugging. */
int debug;
/* Connections. */
/* Files. */
#ifdef SUNW_POLL
int maxnfds; /* # elements in above */
int firstfd; /* First active fd */
int fdMax; /* Last active fd */
int fdCount; /* # fd:s with I/O */
int highestFD; /* Max fd allowed by OS */
#else
#endif
#ifdef EVENTLIB_TIME_CHECKS
struct timespec lastSelectTime;
int lastFdCount;
#endif
/* Streams. */
/* Timers. */
struct timespec lastEventTime;
/* Waits. */
} evContext_p;
/* eventlib.c */
#define evPrintf __evPrintf
#ifdef SUNW_POLL
#endif /* SUNW_POLL */
/* ev_timers.c */
#define evCreateTimers __evCreateTimers
#define evDestroyTimers __evDestroyTimers
void evDestroyTimers(const evContext_p *);
/* ev_waits.c */
#define evFreeWait __evFreeWait
#endif /*_EVENTLIB_P_H*/