3 * $Id: helper.h,v 1.6 2006/09/03 04:11:59 hno Exp $
5 * DEBUG: section 84 Helper process maintenance
6 * AUTHOR: Harvest Derived?
8 * SQUID Web Proxy Cache http://www.squid-cache.org/
9 * ----------------------------------------------------------
11 * Squid is the result of efforts by numerous individuals from
12 * the Internet community; see the CONTRIBUTORS file for full
13 * details. Many organizations have provided support for Squid's
14 * development; see the SPONSORS file for full details. Squid is
15 * Copyrighted (C) 2001 by the Regents of the University of
16 * California; see the COPYRIGHT file for full details. Squid
17 * incorporates software developed and/or copyrighted by other
18 * sources; see the CREDITS file for full details.
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
36 #ifndef SQUID_HELPER_H
37 #define SQUID_HELPER_H
44 typedef struct _helper helper
;
46 typedef struct _helper_stateful statefulhelper
;
48 typedef struct _helper_server helper_server
;
50 typedef struct _helper_stateful_server helper_stateful_server
;
52 typedef struct _helper_flags helper_flags
;
54 typedef struct _helper_stateful_flags helper_stateful_flags
;
56 typedef stateful_helper_callback_t
HLPSCB(void *, void *lastserver
, char *buf
);
68 unsigned int concurrency
;
69 time_t last_queue_warn
;
83 struct _helper_stateful
93 MemAllocator
*datapool
;
94 HLPSAVAIL
*IsAvailable
;
95 HLPSONEQ
*OnEmptyQueue
;
96 time_t last_queue_warn
;
110 struct _helper_server
122 struct timeval dispatch_time
;
124 struct timeval answer_time
;
128 helper_request
**requests
;
133 unsigned int writing
:
136 unsigned int closing
:
139 unsigned int shutdown
:
148 unsigned int pending
;
158 class helper_stateful_request
;
160 struct _helper_stateful_server
167 /* MemBuf writebuf; */
172 struct timeval dispatch_time
;
174 struct timeval answer_time
;
178 statefulhelper
*parent
;
179 helper_stateful_request
*request
;
181 struct _helper_stateful_flags
187 unsigned int closing
:
190 unsigned int shutdown
:
192 stateful_helper_reserve_t reserved
;
207 int deferred_requests
; /* current number of deferred requests */
208 void *data
; /* State data used by the calling routines */
219 MEMPROXY_CLASS(helper_request
);
224 struct timeval dispatch_time
;
227 MEMPROXY_CLASS_INLINE(helper_request
)
229 class helper_stateful_request
233 MEMPROXY_CLASS(helper_stateful_request
);
236 int placeholder
; /* if 1, this is a dummy request waiting for a stateful helper to become available for deferred requests.*/
240 MEMPROXY_CLASS_INLINE(helper_stateful_request
)
243 SQUIDCEXTERN
void helperOpenServers(helper
* hlp
);
244 SQUIDCEXTERN
void helperStatefulOpenServers(statefulhelper
* hlp
);
245 SQUIDCEXTERN
void helperSubmit(helper
* hlp
, const char *buf
, HLPCB
* callback
, void *data
);
246 SQUIDCEXTERN
void helperStatefulSubmit(statefulhelper
* hlp
, const char *buf
, HLPSCB
* callback
, void *data
, helper_stateful_server
* lastserver
);
247 SQUIDCEXTERN
void helperStats(StoreEntry
* sentry
, helper
* hlp
);
248 SQUIDCEXTERN
void helperStatefulStats(StoreEntry
* sentry
, statefulhelper
* hlp
);
249 SQUIDCEXTERN
void helperShutdown(helper
* hlp
);
250 SQUIDCEXTERN
void helperStatefulShutdown(statefulhelper
* hlp
);
251 SQUIDCEXTERN helper
*helperCreate(const char *);
252 SQUIDCEXTERN statefulhelper
*helperStatefulCreate(const char *);
253 SQUIDCEXTERN
void helperFree(helper
*);
254 SQUIDCEXTERN
void helperStatefulFree(statefulhelper
*);
255 SQUIDCEXTERN
void helperStatefulReset(helper_stateful_server
* srv
);
256 SQUIDCEXTERN
void helperStatefulReleaseServer(helper_stateful_server
* srv
);
257 SQUIDCEXTERN
void *helperStatefulServerGetData(helper_stateful_server
* srv
);
258 SQUIDCEXTERN helper_stateful_server
*helperStatefulDefer(statefulhelper
*);
262 #endif /* SQUID_HELPER_H */