/[LeafOK_CVS]/pvpgn-1.7.4/src/common/fdwatch.h
ViewVC logotype

Contents of /pvpgn-1.7.4/src/common/fdwatch.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 /*
2 * Abstraction API/layer for the various ways PvPGN can inspect sockets state
3 * 2003 (C) dizzy@roedu.net
4 *
5 * Code is based on the ideas found in thttpd project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 #ifndef __FDWATCH_INCLUDED__
23 #define __FDWATCH_INCLUDED__
24
25 #include "common/elist.h"
26
27 typedef enum {
28 fdwatch_type_none = 0,
29 fdwatch_type_read = 1,
30 fdwatch_type_write = 2
31 } t_fdwatch_type;
32
33 typedef int (*fdwatch_handler)(void *data, t_fdwatch_type);
34
35 typedef struct {
36 int fd;
37 int rw;
38 fdwatch_handler hnd;
39 void *data;
40
41 t_elist uselist;
42 t_elist freelist;
43 } t_fdwatch_fd;
44
45 #ifdef FDWATCH_BACKEND
46 typedef int (*t_fdw_cb)(t_fdwatch_fd *cfd, void *data);
47 #endif
48
49 typedef struct {
50 int (*init)(int nfds);
51 int (*close)(void);
52 int (*add_fd)(int idx, t_fdwatch_type rw);
53 int (*del_fd)(int idx);
54 int (*watch)(long timeout_msecs);
55 void (*handle)(void);
56 } t_fdw_backend;
57
58 extern int fdw_maxcons;
59 extern t_fdwatch_fd *fdw_fds;
60
61 #define fdw_idx(ptr) ((ptr) - fdw_fds)
62 #define fdw_fd(ptr) ((ptr)->fd)
63 #define fdw_rw(ptr) ((ptr)->rw)
64 #define fdw_data(ptr) ((ptr)->data)
65 #define fdw_hnd(ptr) ((ptr)->hnd)
66 extern int fdwatch_init(int maxcons);
67 extern int fdwatch_close(void);
68 extern int fdwatch_add_fd(int fd, t_fdwatch_type rw, fdwatch_handler h, void *data);
69 extern int fdwatch_update_fd(int idx, t_fdwatch_type rw);
70 extern int fdwatch_del_fd(int idx);
71 extern int fdwatch(long timeout_msecs);
72 extern void fdwatch_handle(void);
73 #ifdef FDWATCH_BACKEND
74 extern void fdwatch_traverse(t_fdw_cb cb, void *data);
75 #endif
76
77 #endif /* __FDWATCH_INCLUDED__ */

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1