3 * $Id: helper.h,v 1.10 2007/12/14 23:11:46 amosjeffries 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
41 #include "IPAddress.h"
45 typedef struct _helper helper
;
47 typedef struct _helper_stateful statefulhelper
;
49 typedef struct _helper_server helper_server
;
51 typedef struct _helper_stateful_server helper_stateful_server
;
53 typedef struct _helper_flags helper_flags
;
55 typedef struct _helper_stateful_flags helper_stateful_flags
;
57 typedef stateful_helper_callback_t
HLPSCB(void *, void *lastserver
, char *buf
);
70 unsigned int concurrency
;
71 time_t last_queue_warn
;
85 struct _helper_stateful
96 MemAllocator
*datapool
;
97 HLPSAVAIL
*IsAvailable
;
98 HLPSONEQ
*OnEmptyQueue
;
99 time_t last_queue_warn
;
113 struct _helper_server
126 struct timeval dispatch_time
;
128 struct timeval answer_time
;
132 helper_request
**requests
;
137 unsigned int writing
:
140 unsigned int closing
:
143 unsigned int shutdown
:
152 unsigned int pending
;
160 class helper_stateful_request
;
162 struct _helper_stateful_server
170 /* MemBuf writebuf; */
175 struct timeval dispatch_time
;
177 struct timeval answer_time
;
181 statefulhelper
*parent
;
182 helper_stateful_request
*request
;
184 struct _helper_stateful_flags
190 unsigned int closing
:
193 unsigned int shutdown
:
195 stateful_helper_reserve_t reserved
;
210 int deferred_requests
; /* current number of deferred requests */
211 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
, const char *label
= NULL
);
248 SQUIDCEXTERN
void helperStatefulStats(StoreEntry
* sentry
, statefulhelper
* hlp
, const char *label
= NULL
);
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 */