3
File descriptors states.
5
Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
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
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.
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
3
* File descriptors states.
5
* Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
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
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.
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
22
22
#ifndef _TYPES_FD_H
23
23
#define _TYPES_FD_H
59
58
#define FD_POLL_DATA (FD_POLL_IN | FD_POLL_OUT)
60
59
#define FD_POLL_STICKY (FD_POLL_ERR | FD_POLL_HUP)
61
/* bit values for fdtab[fd]->flags. Most of them are used to hold a value
62
* consecutive to a behaviour change.
64
#define FD_FL_TCP 0x0001 /* socket is TCP */
65
#define FD_FL_TCP_NODELAY 0x0002
66
#define FD_FL_TCP_NOLING 0x0004 /* lingering disabled */
62
68
/* info about one given fd */
66
72
struct buffer *b; /* read/write buffer */
68
74
void *owner; /* the session (or proxy) associated with this fd */
75
struct { /* used by pollers which support speculative polling */
76
unsigned char e; /* read and write events status. 4 bits, may be merged into flags' lower bits */
77
unsigned int s1; /* Position in spec list+1. 0=not in list. */
79
unsigned short flags; /* various flags precising the exact status of this fd */
69
80
unsigned char state; /* the state of this fd */
70
81
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
71
struct sockaddr *peeraddr; /* pointer to peer's network address, or NULL if unset */
72
socklen_t peerlen; /* peer's address length, or 0 if unset */
84
/* less often used information */
86
struct port_range *port_range; /* optional port range to bind to */
73
87
int local_port; /* optional local port */
74
struct port_range *port_range; /* optional port range to bind to */
88
struct sockaddr *peeraddr; /* pointer to peer's network address, or NULL if unset */
89
socklen_t peerlen; /* peer's address length, or 0 if unset */
116
131
extern struct poller pollers[MAX_POLLERS]; /* all registered pollers */
118
133
extern struct fdtab *fdtab; /* array of all the file descriptors */
134
extern struct fdinfo *fdinfo; /* less-often used infos for file descriptors */
119
135
extern int maxfd; /* # of the highest fd + 1 */
120
136
extern int totalconn; /* total # of terminated sessions */
121
137
extern int actconn; /* # of active sessions */