]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fde.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
14 #include "ip/Address.h"
16 #if HAVE_OPENSSL_SSL_H
17 #include <openssl/ssl.h>
29 void *wrt_handle_data
;
31 dwrite_q
*write_q_tail
;
33 _fde_disk() { memset(this, 0, sizeof(_fde_disk
)); }
42 /// True if comm_close for this fd has been called
43 bool closing() { return flags
.close_request
; }
45 /* NOTE: memset is used on fdes today. 20030715 RBC */
46 static void DumpStats (StoreEntry
*);
48 char const *remoteAddr() const;
49 void dumpStats (StoreEntry
&, int);
50 bool readPending(int);
55 /// global table of FD and their state.
59 unsigned short remote_port
;
61 Ip::Address local_addr
;
62 tos_t tosToServer
; /**< The TOS value for packets going towards the server.
63 See also tosFromServer. */
64 nfmark_t nfmarkToServer
; /**< The netfilter mark for packets going towards the server.
65 See also nfmarkFromServer. */
67 char ipaddr
[MAX_IPSTRLEN
]; /* dotted decimal address of peer */
68 char desc
[FD_DESC_SZ
];
72 bool close_request
; ///< true if file_ or comm_close has been called
82 //bool write_pending; //XXX seems not to be used
87 int64_t bytes_written
;
90 int uses
; /* ie # req's over persistent conn */
94 ClientInfo
* clientInfo
;/* pointer to client info used in client write limiter or NULL if not present */
103 AsyncCall::Pointer timeoutHandler
;
107 AsyncCall::Pointer closeHandler
;
108 AsyncCall::Pointer halfClosedReader
; /// read handler for half-closed fds
109 CommWriteStateData
*wstate
; /* State data for comm_write */
110 READ_HANDLER
*read_method
;
111 WRITE_HANDLER
*write_method
;
114 SSL_CTX
*dynamicSslContext
; ///< cached and then freed when fd is closed
121 tos_t tosFromServer
; /**< Stores the TOS flags of the packets from the remote server.
122 See FwdState::dispatch(). Note that this differs to
123 tosToServer in that this is the value we *receive* from the,
124 connection, whereas tosToServer is the value to set on packets
126 unsigned int nfmarkFromServer
; /**< Stores the Netfilter mark value of the connection from the remote
127 server. See FwdState::dispatch(). Note that this differs to
128 nfmarkToServer in that this is the value we *receive* from the,
129 connection, whereas nfmarkToServer is the value to set on packets
133 /** Clear the fde class back to NULL equivalent. */
134 inline void clear() {
137 local_addr
.setEmpty();
141 memset(ipaddr
, '\0', MAX_IPSTRLEN
);
142 memset(desc
,'\0',FD_DESC_SZ
);
143 memset(&flags
,0,sizeof(_fde_flags
));
153 write_handler
= NULL
;
155 timeoutHandler
= NULL
;
158 lifetime_data
= NULL
;
160 halfClosedReader
= NULL
;
166 dynamicSslContext
= NULL
;
171 tosFromServer
= '\0';
172 nfmarkFromServer
= 0;
176 #define fd_table fde::Table
180 #define FD_READ_METHOD(fd, buf, len) (*fd_table[fd].read_method)(fd, buf, len)
181 #define FD_WRITE_METHOD(fd, buf, len) (*fd_table[fd].write_method)(fd, buf, len)
183 #endif /* SQUID_FDE_H */