ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/fdlist.h
Revision: 2865
Committed: Sun Jan 19 14:35:22 2014 UTC (11 years, 7 months ago) by michael
Content type: text/x-chdr
File size: 3036 byte(s)
Log Message:
- Clean up all files in include/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
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 #define FILEIO_V2
30
31 #include "ircd_defs.h"
32 #define FD_DESC_SZ 128 /* hostlen + comment */
33
34 enum
35 {
36 COMM_OK,
37 COMM_ERR_BIND,
38 COMM_ERR_DNS,
39 COMM_ERR_TIMEOUT,
40 COMM_ERR_CONNECT,
41 COMM_ERROR,
42 COMM_ERR_MAX
43 };
44
45 struct _fde;
46 struct Client;
47
48 /* Callback for completed IO events */
49 typedef void PF(struct _fde *, void *);
50
51 /* Callback for completed connections */
52 /* int fd, int status, void * */
53 typedef void CNCB(struct _fde *, int, void *);
54
55 typedef struct _fde
56 {
57 /* New-school stuff, again pretty much ripped from squid */
58 /*
59 * Yes, this gives us only one pending read and one pending write per
60 * filedescriptor. Think though: when do you think we'll need more?
61 */
62 int fd; /* So we can use the fde_t as a callback ptr */
63 int comm_index; /* where in the poll list we live */
64 int evcache; /* current fd events as set up by the underlying I/O */
65 char desc[FD_DESC_SZ];
66 PF *read_handler;
67 void *read_data;
68 PF *write_handler;
69 void *write_data;
70 PF *timeout_handler;
71 void *timeout_data;
72 time_t timeout;
73 PF *flush_handler;
74 void *flush_data;
75 time_t flush_timeout;
76
77 struct
78 {
79 unsigned int open:1;
80 unsigned int is_socket:1;
81 #ifdef HAVE_LIBCRYPTO
82 unsigned int pending_read:1;
83 #endif
84 } flags;
85
86 struct
87 {
88 /* We don't need the host here ? */
89 struct irc_ssaddr S;
90 struct irc_ssaddr hostaddr;
91 CNCB *callback;
92 void *data;
93 /* We'd also add the retry count here when we get to that -- adrian */
94 } connect;
95 #ifdef HAVE_LIBCRYPTO
96 SSL *ssl;
97 #endif
98 struct _fde *hnext;
99 } fde_t;
100
101 #define FD_HASH_SIZE 1024
102
103 extern int number_fd;
104 extern int hard_fdlimit;
105 extern fde_t *fd_hash[];
106 extern fde_t *fd_next_in_loop;
107
108 extern void fdlist_init(void);
109 extern fde_t *lookup_fd(int);
110 extern void fd_open(fde_t *, int, int, const char *);
111 extern void fd_close(fde_t *);
112 extern void fd_dump(struct Client *);
113 extern void fd_note(fde_t *, const char *, ...);
114 extern void close_standard_fds(void);
115 extern void close_fds(fde_t *);
116 #endif /* INCLUDED_fdlist_h */

Properties

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