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 (8 years, 4 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

# User Rev Content
1 adx 30 /*
2 michael 2865 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 8279 * Copyright (c) 1997-2018 ircd-hybrid development team
5 adx 30 *
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2865 /*! \file fdlist.h
23     * \brief The file descriptor list header.
24     * \version $Id$
25     */
26    
27 adx 30 #ifndef INCLUDED_fdlist_h
28     #define INCLUDED_fdlist_h
29    
30     #include "ircd_defs.h"
31 michael 7105 #include "tls.h"
32 adx 30
33 michael 6347
34 michael 8339 enum { FD_DESC_SIZE = 128 }; /* HOSTLEN + comment */
35 michael 6347
36 michael 2865 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 adx 30 };
46    
47     struct Client;
48    
49 michael 2865 typedef struct _fde
50     {
51 adx 30 /* 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 michael 2865 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 adx 30 int evcache; /* current fd events as set up by the underlying I/O */
59 michael 6347 char desc[FD_DESC_SIZE];
60 michael 8349
61 michael 4461 void (*read_handler)(struct _fde *, void *);
62 adx 30 void *read_data;
63 michael 8349
64 michael 4461 void (*write_handler)(struct _fde *, void *);
65 adx 30 void *write_data;
66 michael 8349
67 michael 4461 void (*timeout_handler)(struct _fde *, void *);
68 adx 30 void *timeout_data;
69 michael 7330 uintmax_t timeout;
70 michael 8349
71 michael 4461 void (*flush_handler)(struct _fde *, void *);
72 adx 30 void *flush_data;
73 michael 7330 uintmax_t flush_timeout;
74 michael 992
75 michael 2865 struct
76     {
77 adx 30 unsigned int open:1;
78     unsigned int is_socket:1;
79     } flags;
80    
81 michael 2865 struct
82     {
83 adx 30 /* We don't need the host here ? */
84     struct irc_ssaddr S;
85     struct irc_ssaddr hostaddr;
86 michael 8349
87 michael 4464 void (*callback)(struct _fde *, int, void *);
88 adx 30 void *data;
89     /* We'd also add the retry count here when we get to that -- adrian */
90     } connect;
91 michael 7105
92     tls_data_t ssl;
93 adx 30 } fde_t;
94    
95     extern int number_fd;
96     extern int hard_fdlimit;
97 michael 8339 extern int highest_fd;
98     extern fde_t *fd_table;
99 adx 30
100     extern void fdlist_init(void);
101 michael 8339 extern fde_t *fd_open(int, int, const char *);
102 adx 30 extern void fd_close(fde_t *);
103 michael 1015 extern void fd_note(fde_t *, const char *, ...);
104 adx 30 extern void close_standard_fds(void);
105 michael 8339 extern void close_fds(void);
106 michael 8379 #endif

Properties

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