ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/fdlist.h
Revision: 8379
Committed: Sun Mar 11 14:57:20 2018 UTC (7 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 2739 byte(s)
Log Message:
- Move fd_dump() to m_stats.c; rename it to stats_fdlist()

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2018 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file fdlist.h
23 * \brief The file descriptor list header.
24 * \version $Id$
25 */
26
27 #ifndef INCLUDED_fdlist_h
28 #define INCLUDED_fdlist_h
29
30 #include "ircd_defs.h"
31 #include "tls.h"
32
33
34 enum { FD_DESC_SIZE = 128 }; /* HOSTLEN + comment */
35
36 enum
37 {
38 COMM_OK,
39 COMM_ERR_BIND,
40 COMM_ERR_DNS,
41 COMM_ERR_TIMEOUT,
42 COMM_ERR_CONNECT,
43 COMM_ERROR,
44 COMM_ERR_MAX
45 };
46
47 struct Client;
48
49 typedef struct _fde
50 {
51 /* New-school stuff, again pretty much ripped from squid */
52 /*
53 * Yes, this gives us only one pending read and one pending write per
54 * filedescriptor. Think though: when do you think we'll need more?
55 */
56 int fd; /* So we can use the fde_t as a callback ptr */
57 int comm_index; /* where in the poll list we live */
58 int evcache; /* current fd events as set up by the underlying I/O */
59 char desc[FD_DESC_SIZE];
60
61 void (*read_handler)(struct _fde *, void *);
62 void *read_data;
63
64 void (*write_handler)(struct _fde *, void *);
65 void *write_data;
66
67 void (*timeout_handler)(struct _fde *, void *);
68 void *timeout_data;
69 uintmax_t timeout;
70
71 void (*flush_handler)(struct _fde *, void *);
72 void *flush_data;
73 uintmax_t flush_timeout;
74
75 struct
76 {
77 unsigned int open:1;
78 unsigned int is_socket:1;
79 } flags;
80
81 struct
82 {
83 /* We don't need the host here ? */
84 struct irc_ssaddr S;
85 struct irc_ssaddr hostaddr;
86
87 void (*callback)(struct _fde *, int, void *);
88 void *data;
89 /* We'd also add the retry count here when we get to that -- adrian */
90 } connect;
91
92 tls_data_t ssl;
93 } fde_t;
94
95 extern int number_fd;
96 extern int hard_fdlimit;
97 extern int highest_fd;
98 extern fde_t *fd_table;
99
100 extern void fdlist_init(void);
101 extern fde_t *fd_open(int, int, const char *);
102 extern void fd_close(fde_t *);
103 extern void fd_note(fde_t *, const char *, ...);
104 extern void close_standard_fds(void);
105 extern void close_fds(void);
106 #endif

Properties

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