ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/fdlist.h
Revision: 7330
Committed: Fri Feb 19 17:50:13 2016 UTC (10 years, 5 months ago) by michael
Content type: text/x-chdr
File size: 2925 byte(s)
Log Message:
- Now that we got time_t to work nicely on openbsd with snprintf's conversion specifiers,
  we ran into a similiar issue on Raspbian/ARMv7's time_t which is of signed 32 bit and
  doesn't cope at all with %j. Instead of doing tricks, get rid of time_t everywhere and
  forever and use uintmax_t instead which has at least a 'standardized' conversion specifier
  associated with it.

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2016 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 enum { FD_HASH_SIZE = 1024 };
36
37 enum
38 {
39 COMM_OK,
40 COMM_ERR_BIND,
41 COMM_ERR_DNS,
42 COMM_ERR_TIMEOUT,
43 COMM_ERR_CONNECT,
44 COMM_ERROR,
45 COMM_ERR_MAX
46 };
47
48 struct _fde;
49 struct Client;
50
51 typedef struct _fde
52 {
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_SIZE];
62 void (*read_handler)(struct _fde *, void *);
63 void *read_data;
64 void (*write_handler)(struct _fde *, void *);
65 void *write_data;
66 void (*timeout_handler)(struct _fde *, void *);
67 void *timeout_data;
68 uintmax_t timeout;
69 void (*flush_handler)(struct _fde *, void *);
70 void *flush_data;
71 uintmax_t flush_timeout;
72
73 struct
74 {
75 unsigned int open:1;
76 unsigned int is_socket:1;
77 } flags;
78
79 struct
80 {
81 /* We don't need the host here ? */
82 struct irc_ssaddr S;
83 struct irc_ssaddr hostaddr;
84 void (*callback)(struct _fde *, int, void *);
85 void *data;
86 /* We'd also add the retry count here when we get to that -- adrian */
87 } connect;
88
89 tls_data_t ssl;
90 struct _fde *hnext;
91 } fde_t;
92
93 extern int number_fd;
94 extern int hard_fdlimit;
95 extern fde_t *fd_hash[];
96 extern fde_t *fd_next_in_loop;
97
98 extern void fdlist_init(void);
99 extern fde_t *lookup_fd(int);
100 extern void fd_open(fde_t *, int, int, const char *);
101 extern void fd_close(fde_t *);
102 extern void fd_dump(struct Client *, int, char *[]);
103 extern void fd_note(fde_t *, const char *, ...);
104 extern void close_standard_fds(void);
105 extern void close_fds(fde_t *);
106 #endif /* INCLUDED_fdlist_h */

Properties

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