blob: 1b24be3f59fdad0b90bdd033f5384c4f946ca68f [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 include/fd.h
3 File descriptors states.
4
5 Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation, version 2.1
10 exclusively.
11
12 This library 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 GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/
21
22#ifndef _TYPES_FD_H
23#define _TYPES_FD_H
24
25#include <sys/time.h>
26#include <sys/types.h>
27#include <unistd.h>
28
Willy Tarreau2dd0d472006-06-29 17:53:05 +020029#include <common/config.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020030#include <types/task.h>
31
32/* different possible states for the fd */
33#define FD_STCLOSE 0
34#define FD_STLISTEN 1
35#define FD_STCONN 2
36#define FD_STREADY 3
37#define FD_STERROR 4
38
39
40/* info about one given fd */
41struct fdtab {
42 int (*read)(int fd); /* read function */
43 int (*write)(int fd); /* write function */
44 struct task *owner; /* the session (or proxy) associated with this fd */
45 int state; /* the state of this fd */
46};
47
48extern struct fdtab *fdtab; /* array of all the file descriptors */
49extern int maxfd; /* # of the highest fd + 1 */
50extern int totalconn; /* total # of terminated sessions */
51extern int actconn; /* # of active sessions */
52
53#endif /* _TYPES_FD_H */
54
55/*
56 * Local variables:
57 * c-indent-level: 8
58 * c-basic-offset: 8
59 * End:
60 */