-/*
- * Copyright (c) 1995-1999, Index Data
- * See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
- *
- * $Log: eventl.h,v $
- * Revision 1.3 2007-04-08 23:04:20 adam
- * Moved HTTP channel address from struct iochan to struct http_channel.
- * This fixes compilation on FreeBSD and reverts eventl.{c,h} to original
- * paraz state. This change, simple as it is, is untested.
- *
- * Revision 1.1 2006/12/20 20:47:16 quinn
- * Reorganized source tree
- *
- * Revision 1.3 2006/12/12 02:36:24 quinn
- * Implemented session timeout; ping command
- *
- * Revision 1.2 2006/11/18 05:00:38 quinn
- * Added record retrieval, etc.
- *
- * Revision 1.1.1.1 2006/11/14 20:44:38 quinn
- * PazPar2
- *
- * Revision 1.1.1.1 2000/02/23 14:40:18 heikki
- * Original import to cvs
- *
- * Revision 1.11 1999/04/20 09:56:48 adam
- * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
- * Modified all encoders/decoders to reflect this change.
- *
- * Revision 1.10 1998/01/29 13:30:23 adam
- * Better event handle system for NT/Unix.
- *
- * Revision 1.9 1997/09/01 09:31:48 adam
- * Removed definition statserv_remove from statserv.h to eventl.h.
- *
- * Revision 1.8 1995/06/19 12:39:09 quinn
- * Fixed bug in timeout code. Added BER dumper.
- *
- * Revision 1.7 1995/06/16 10:31:34 quinn
- * Added session timeout.
- *
- * Revision 1.6 1995/05/16 08:51:02 quinn
- * License, documentation, and memory fixes
- *
- * Revision 1.5 1995/05/15 11:56:37 quinn
- * Asynchronous facilities. Restructuring of seshigh code.
- *
- * Revision 1.4 1995/03/27 08:34:23 quinn
- * Added dynamic server functionality.
- * Released bindings to session.c (is now redundant)
- *
- * Revision 1.3 1995/03/15 08:37:42 quinn
- * Now we're pretty much set for nonblocking I/O.
- *
- * Revision 1.2 1995/03/14 10:28:00 quinn
- * More work on demo server.
- *
- * Revision 1.1 1995/03/10 18:22:45 quinn
- * The rudiments of an asynchronous server.
- *
- */
+/* This file is part of Pazpar2.
+ Copyright (C) 2006-2009 Index Data
+
+Pazpar2 is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
#ifndef EVENTL_H
#define EVENTL_H
struct iochan;
typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
+typedef int (*IOC_SOCKETFUN)(struct iochan *i);
+typedef int (*IOC_MASKFUN)(struct iochan *i);
typedef struct iochan
{
#define EVENT_OUTPUT 0x02
#define EVENT_EXCEPT 0x04
#define EVENT_TIMEOUT 0x08
-#define EVENT_WORK 0x10
int force_event;
IOC_CALLBACK fun;
+ IOC_SOCKETFUN socketfun;
+ IOC_MASKFUN maskfun;
void *data;
int destroyed;
time_t last_event;
#define iochan_getnext(i) ((i)->next)
#define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
#define iochan_activity(i) ((i)->last_event = time(0))
+#define iochan_setsocketfun(i, f) ((i)->socketfun = (f))
+#define iochan_getsocketfun(i) ((i)->socketfun)
+#define iochan_setmaskfun(i, f) ((i)->maskfun = (f))
+#define iochan_getmaskfun(i) ((i)->maskfun)
IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags);
int event_loop(IOCHAN *iochans);