ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/include/fdlist.h
Revision: 1015
Committed: Sun Oct 25 00:08:06 2009 UTC (14 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 3107 byte(s)
Log Message:
- fixed broken cryptlinks as reported by henri
- removed deprecated inet_misc.c
- removed __attribute__ format, which sometimes really is usefull, even if
  unportable unless gcc, but for now they only give false warnings

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * fdlist.h: The file descriptor list header.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (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
20 * USA
21 *
22 * $Id$
23 */
24
25 #ifndef INCLUDED_fdlist_h
26 #define INCLUDED_fdlist_h
27 #define FILEIO_V2
28
29 #include "ircd_defs.h"
30 #define FD_DESC_SZ 128 /* hostlen + comment */
31
32 enum {
33 COMM_OK,
34 COMM_ERR_BIND,
35 COMM_ERR_DNS,
36 COMM_ERR_TIMEOUT,
37 COMM_ERR_CONNECT,
38 COMM_ERROR,
39 COMM_ERR_MAX
40 };
41
42 struct _fde;
43 struct Client;
44
45 /* Callback for completed IO events */
46 typedef void PF(struct _fde *, void *);
47
48 /* Callback for completed connections */
49 /* int fd, int status, void * */
50 typedef void CNCB(struct _fde *, int, void *);
51
52 typedef struct _fde {
53 /* New-school stuff, again pretty much ripped from squid */
54 /*
55 * Yes, this gives us only one pending read and one pending write per
56 * filedescriptor. Think though: when do you think we'll need more?
57 */
58 int fd; /* So we can use the fde_t as a callback ptr */
59 int comm_index; /* where in the poll list we live */
60 int evcache; /* current fd events as set up by the underlying I/O */
61 char desc[FD_DESC_SZ];
62 PF *read_handler;
63 void *read_data;
64 PF *write_handler;
65 void *write_data;
66 PF *timeout_handler;
67 void *timeout_data;
68 time_t timeout;
69 PF *flush_handler;
70 void *flush_data;
71 time_t flush_timeout;
72
73 struct {
74 unsigned int open:1;
75 unsigned int is_socket:1;
76 #ifdef HAVE_LIBCRYPTO
77 unsigned int pending_read:1;
78 #endif
79 } flags;
80
81 struct {
82 /* We don't need the host here ? */
83 struct irc_ssaddr S;
84 struct irc_ssaddr hostaddr;
85 CNCB *callback;
86 void *data;
87 /* We'd also add the retry count here when we get to that -- adrian */
88 } connect;
89 #ifdef HAVE_LIBCRYPTO
90 SSL *ssl;
91 #endif
92 struct _fde *hnext;
93 } fde_t;
94
95 #define FD_HASH_SIZE CLIENT_HEAP_SIZE
96
97 extern int number_fd;
98 extern int hard_fdlimit;
99 extern fde_t *fd_hash[];
100 extern fde_t *fd_next_in_loop;
101 extern struct Callback *fdlimit_cb;
102
103 extern void fdlist_init(void);
104 extern fde_t *lookup_fd(int);
105 extern void fd_open(fde_t *, int, int, const char *);
106 extern void fd_close(fde_t *);
107 extern void fd_dump(struct Client *);
108 extern void fd_note(fde_t *, const char *, ...);
109 extern void close_standard_fds(void);
110 extern void close_fds(fde_t *);
111 extern void recalc_fdlimit(void *);
112
113 #endif /* INCLUDED_fdlist_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision