]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fde.h
2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
5 * Squid is the result of efforts by numerous individuals from
6 * the Internet community; see the CONTRIBUTORS file for full
7 * details. Many organizations have provided support for Squid's
8 * development; see the SPONSORS file for full details. Squid is
9 * Copyrighted (C) 2001 by the Regents of the University of
10 * California; see the COPYRIGHT file for full details. Squid
11 * incorporates software developed and/or copyrighted by other
12 * sources; see the CREDITS file for full details.
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
35 #include "ip/Address.h"
37 #if HAVE_OPENSSL_SSL_H
38 #include <openssl/ssl.h>
50 void *wrt_handle_data
;
52 dwrite_q
*write_q_tail
;
54 _fde_disk() { memset(this, 0, sizeof(_fde_disk
)); }
63 /// True if comm_close for this fd has been called
64 bool closing() { return flags
.close_request
; }
66 /* NOTE: memset is used on fdes today. 20030715 RBC */
67 static void DumpStats (StoreEntry
*);
69 char const *remoteAddr() const;
70 void dumpStats (StoreEntry
&, int);
71 bool readPending(int);
76 /// global table of FD and their state.
80 unsigned short remote_port
;
82 Ip::Address local_addr
;
83 tos_t tosToServer
; /**< The TOS value for packets going towards the server.
84 See also tosFromServer. */
85 nfmark_t nfmarkToServer
; /**< The netfilter mark for packets going towards the server.
86 See also nfmarkFromServer. */
88 char ipaddr
[MAX_IPSTRLEN
]; /* dotted decimal address of peer */
89 char desc
[FD_DESC_SZ
];
93 bool close_request
; ///< true if file_ or comm_close has been called
103 //bool write_pending; //XXX seems not to be used
108 int64_t bytes_written
;
111 int uses
; /* ie # req's over persistent conn */
115 ClientInfo
* clientInfo
;/* pointer to client info used in client write limiter or NULL if not present */
117 unsigned epoll_state
;
124 AsyncCall::Pointer timeoutHandler
;
128 AsyncCall::Pointer closeHandler
;
129 AsyncCall::Pointer halfClosedReader
; /// read handler for half-closed fds
130 CommWriteStateData
*wstate
; /* State data for comm_write */
131 READ_HANDLER
*read_method
;
132 WRITE_HANDLER
*write_method
;
135 SSL_CTX
*dynamicSslContext
; ///< cached and then freed when fd is closed
142 tos_t tosFromServer
; /**< Stores the TOS flags of the packets from the remote server.
143 See FwdState::dispatch(). Note that this differs to
144 tosToServer in that this is the value we *receive* from the,
145 connection, whereas tosToServer is the value to set on packets
147 unsigned int nfmarkFromServer
; /**< Stores the Netfilter mark value of the connection from the remote
148 server. See FwdState::dispatch(). Note that this differs to
149 nfmarkToServer in that this is the value we *receive* from the,
150 connection, whereas nfmarkToServer is the value to set on packets
154 /** Clear the fde class back to NULL equivalent. */
155 inline void clear() {
158 local_addr
.setEmpty();
162 memset(ipaddr
, '\0', MAX_IPSTRLEN
);
163 memset(desc
,'\0',FD_DESC_SZ
);
164 memset(&flags
,0,sizeof(_fde_flags
));
174 write_handler
= NULL
;
176 timeoutHandler
= NULL
;
179 lifetime_data
= NULL
;
181 halfClosedReader
= NULL
;
187 dynamicSslContext
= NULL
;
192 tosFromServer
= '\0';
193 nfmarkFromServer
= 0;
197 #define fd_table fde::Table
201 #define FD_READ_METHOD(fd, buf, len) (*fd_table[fd].read_method)(fd, buf, len)
202 #define FD_WRITE_METHOD(fd, buf, len) (*fd_table[fd].write_method)(fd, buf, len)
204 #endif /* SQUID_FDE_H */