2 * DEBUG: section 84 Helper process maintenance
3 * AUTHOR: Harvest Derived?
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 #ifndef SQUID_HELPER_H
34 #define SQUID_HELPER_H
38 #include "ip/IpAddress.h"
42 typedef struct _helper helper
;
44 typedef struct _helper_stateful statefulhelper
;
46 typedef struct _helper_server helper_server
;
48 typedef struct _helper_stateful_server helper_stateful_server
;
50 typedef struct _helper_flags helper_flags
;
52 typedef struct _helper_stateful_flags helper_stateful_flags
;
54 typedef stateful_helper_callback_t
HLPSCB(void *, void *lastserver
, char *buf
);
66 unsigned int concurrency
;
67 time_t last_queue_warn
;
78 struct _helper_stateful
{
88 MemAllocator
*datapool
;
89 HLPSAVAIL
*IsAvailable
;
90 HLPSONEQ
*OnEmptyQueue
;
91 time_t last_queue_warn
;
102 struct _helper_server
{
114 struct timeval dispatch_time
;
116 struct timeval answer_time
;
120 helper_request
**requests
;
122 struct _helper_flags
{
123 unsigned int writing
:1;
124 unsigned int closing
:1;
125 unsigned int shutdown
:1;
130 unsigned int pending
;
136 class helper_stateful_request
;
138 struct _helper_stateful_server
{
145 /* MemBuf writebuf; */
150 struct timeval dispatch_time
;
152 struct timeval answer_time
;
156 statefulhelper
*parent
;
157 helper_stateful_request
*request
;
159 struct _helper_stateful_flags
{
161 unsigned int closing
:1;
162 unsigned int shutdown
:1;
163 stateful_helper_reserve_t reserved
;
173 int deferred_requests
; /* current number of deferred requests */
174 void *data
; /* State data used by the calling routines */
182 MEMPROXY_CLASS(helper_request
);
187 struct timeval dispatch_time
;
190 MEMPROXY_CLASS_INLINE(helper_request
) /**DOCS_NOSEMI*/
192 class helper_stateful_request
196 MEMPROXY_CLASS(helper_stateful_request
);
199 int placeholder
; /* if 1, this is a dummy request waiting for a stateful helper to become available for deferred requests.*/
203 MEMPROXY_CLASS_INLINE(helper_stateful_request
) /**DOCS_NOSEMI*/
206 SQUIDCEXTERN
void helperOpenServers(helper
* hlp
);
207 SQUIDCEXTERN
void helperStatefulOpenServers(statefulhelper
* hlp
);
208 SQUIDCEXTERN
void helperSubmit(helper
* hlp
, const char *buf
, HLPCB
* callback
, void *data
);
209 SQUIDCEXTERN
void helperStatefulSubmit(statefulhelper
* hlp
, const char *buf
, HLPSCB
* callback
, void *data
, helper_stateful_server
* lastserver
);
210 SQUIDCEXTERN
void helperStats(StoreEntry
* sentry
, helper
* hlp
, const char *label
= NULL
);
211 SQUIDCEXTERN
void helperStatefulStats(StoreEntry
* sentry
, statefulhelper
* hlp
, const char *label
= NULL
);
212 SQUIDCEXTERN
void helperShutdown(helper
* hlp
);
213 SQUIDCEXTERN
void helperStatefulShutdown(statefulhelper
* hlp
);
214 SQUIDCEXTERN helper
*helperCreate(const char *);
215 SQUIDCEXTERN statefulhelper
*helperStatefulCreate(const char *);
216 SQUIDCEXTERN
void helperFree(helper
*);
217 SQUIDCEXTERN
void helperStatefulFree(statefulhelper
*);
218 SQUIDCEXTERN
void helperStatefulReset(helper_stateful_server
* srv
);
219 SQUIDCEXTERN
void helperStatefulReleaseServer(helper_stateful_server
* srv
);
220 SQUIDCEXTERN
void *helperStatefulServerGetData(helper_stateful_server
* srv
);
221 SQUIDCEXTERN helper_stateful_server
*helperStatefulDefer(statefulhelper
*);
225 #endif /* SQUID_HELPER_H */