]>
Commit | Line | Data |
---|---|---|
528b2c61 | 1 | |
2 | /* | |
5c2c2194 | 3 | * $Id: fde.h,v 1.15 2008/02/12 23:22:13 rousskov Exp $ |
528b2c61 | 4 | * |
5 | * | |
6 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
7 | * ---------------------------------------------------------- | |
8 | * | |
9 | * Squid is the result of efforts by numerous individuals from | |
10 | * the Internet community; see the CONTRIBUTORS file for full | |
11 | * details. Many organizations have provided support for Squid's | |
12 | * development; see the SPONSORS file for full details. Squid is | |
13 | * Copyrighted (C) 2001 by the Regents of the University of | |
14 | * California; see the COPYRIGHT file for full details. Squid | |
15 | * incorporates software developed and/or copyrighted by other | |
16 | * sources; see the CREDITS file for full details. | |
17 | * | |
18 | * This program is free software; you can redistribute it and/or modify | |
19 | * it under the terms of the GNU General Public License as published by | |
20 | * the Free Software Foundation; either version 2 of the License, or | |
21 | * (at your option) any later version. | |
22 | * | |
23 | * This program is distributed in the hope that it will be useful, | |
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 | * GNU General Public License for more details. | |
27 | * | |
28 | * You should have received a copy of the GNU General Public License | |
29 | * along with this program; if not, write to the Free Software | |
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
31 | * | |
32 | */ | |
33 | ||
34 | #ifndef SQUID_FDE_H | |
35 | #define SQUID_FDE_H | |
cc192b50 | 36 | |
a46d2c0e | 37 | #include "comm.h" |
cc192b50 | 38 | #include "IPAddress.h" |
528b2c61 | 39 | |
781ce8ff | 40 | class PconnPool; |
41 | ||
62e76326 | 42 | class fde |
43 | { | |
44 | ||
528b2c61 | 45 | public: |
cc192b50 | 46 | fde() { clear(); }; |
10b06767 | 47 | |
82ec8dfc AR |
48 | /// True if comm_close for this fd has been called |
49 | bool closing() { return flags.close_request; } | |
cc192b50 | 50 | |
75faaa7a | 51 | /* NOTE: memset is used on fdes today. 20030715 RBC */ |
528b2c61 | 52 | static void DumpStats (StoreEntry *); |
62e76326 | 53 | |
528b2c61 | 54 | char const *remoteAddr() const; |
55 | void dumpStats (StoreEntry &, int); | |
56 | bool readPending(int); | |
781ce8ff | 57 | void noteUse(PconnPool *); |
528b2c61 | 58 | |
59 | unsigned int type; | |
528b2c61 | 60 | u_short remote_port; |
62e76326 | 61 | |
cc192b50 | 62 | IPAddress local_addr; |
528b2c61 | 63 | unsigned char tos; |
cc192b50 | 64 | int sock_family; |
65 | char ipaddr[MAX_IPSTRLEN]; /* dotted decimal address of peer */ | |
528b2c61 | 66 | char desc[FD_DESC_SZ]; |
62e76326 | 67 | |
68 | struct | |
69 | { | |
aeb090a2 | 70 | unsigned int open:1; |
82ec8dfc | 71 | unsigned int close_request:1; // file_ or comm_close has been called |
aeb090a2 | 72 | unsigned int write_daemon:1; |
aeb090a2 | 73 | unsigned int socket_eof:1; |
74 | unsigned int nolinger:1; | |
75 | unsigned int nonblocking:1; | |
76 | unsigned int ipc:1; | |
77 | unsigned int called_connect:1; | |
78 | unsigned int nodelay:1; | |
79 | unsigned int close_on_exec:1; | |
80 | unsigned int read_pending:1; | |
81 | unsigned int write_pending:1; | |
3949d8b7 | 82 | unsigned int transparent:1; |
aeb090a2 | 83 | } flags; |
62e76326 | 84 | |
47f6e231 | 85 | int64_t bytes_read; |
86 | int64_t bytes_written; | |
781ce8ff | 87 | |
aeb090a2 | 88 | struct { |
781ce8ff | 89 | int uses; /* ie # req's over persistent conn */ |
90 | PconnPool *pool; | |
aeb090a2 | 91 | } pconn; |
781ce8ff | 92 | |
751406fe | 93 | unsigned epoll_state; |
62e76326 | 94 | |
528b2c61 | 95 | struct _fde_disk disk; |
96 | PF *read_handler; | |
97 | void *read_data; | |
98 | PF *write_handler; | |
99 | void *write_data; | |
5c2c2194 | 100 | AsyncCall::Pointer timeoutHandler; |
528b2c61 | 101 | time_t timeout; |
528b2c61 | 102 | void *lifetime_data; |
5c2c2194 | 103 | AsyncCall::Pointer closeHandler; |
74257126 | 104 | AsyncCall::Pointer halfClosedReader; /// read handler for half-closed fds |
51026b54 | 105 | CommWriteStateData *wstate; /* State data for comm_write */ |
528b2c61 | 106 | READ_HANDLER *read_method; |
107 | WRITE_HANDLER *write_method; | |
108 | #if USE_SSL | |
109 | SSL *ssl; | |
528b2c61 | 110 | #endif |
629b5f75 | 111 | #ifdef _SQUID_MSWIN_ |
aeb090a2 | 112 | struct { |
629b5f75 | 113 | long handle; |
aeb090a2 | 114 | } win32; |
629b5f75 | 115 | #endif |
7172612f AJ |
116 | #if USE_ZPH_QOS |
117 | unsigned char upstreamTOS; /* see FwdState::dispatch() */ | |
118 | #endif | |
629b5f75 | 119 | |
bf81adb4 AR |
120 | private: |
121 | /** Clear the fde class back to NULL equivalent. */ | |
122 | inline void clear() { | |
123 | timeoutHandler = NULL; | |
124 | closeHandler = NULL; | |
74257126 | 125 | halfClosedReader = NULL; |
bf81adb4 AR |
126 | // XXX: the following memset may corrupt or leak new or changed members |
127 | memset(this, 0, sizeof(fde)); | |
128 | local_addr.SetEmpty(); // IPAddress likes to be setup nicely. | |
129 | } | |
130 | ||
528b2c61 | 131 | }; |
132 | ||
133 | #endif /* SQUID_FDE_H */ |