3 * $Id: helper.h,v 1.12 2008/02/26 21:49:34 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
;
83 struct _helper_stateful
94 MemAllocator
*datapool
;
95 HLPSAVAIL
*IsAvailable
;
96 HLPSONEQ
*OnEmptyQueue
;
97 time_t last_queue_warn
;
109 struct _helper_server
122 struct timeval dispatch_time
;
124 struct timeval answer_time
;
128 helper_request
**requests
;
132 unsigned int writing
:1;
133 unsigned int closing
:1;
134 unsigned int shutdown
:1;
140 unsigned int pending
;
146 class helper_stateful_request
;
148 struct _helper_stateful_server
156 /* MemBuf writebuf; */
161 struct timeval dispatch_time
;
163 struct timeval answer_time
;
167 statefulhelper
*parent
;
168 helper_stateful_request
*request
;
170 struct _helper_stateful_flags
173 unsigned int closing
:1;
174 unsigned int shutdown
:1;
175 stateful_helper_reserve_t reserved
;
186 int deferred_requests
; /* current number of deferred requests */
187 void *data
; /* State data used by the calling routines */
195 MEMPROXY_CLASS(helper_request
);
200 struct timeval dispatch_time
;
203 MEMPROXY_CLASS_INLINE(helper_request
) /**DOCS_NOSEMI*/
205 class helper_stateful_request
209 MEMPROXY_CLASS(helper_stateful_request
);
212 int placeholder
; /* if 1, this is a dummy request waiting for a stateful helper to become available for deferred requests.*/
216 MEMPROXY_CLASS_INLINE(helper_stateful_request
) /**DOCS_NOSEMI*/
219 SQUIDCEXTERN
void helperOpenServers(helper
* hlp
);
220 SQUIDCEXTERN
void helperStatefulOpenServers(statefulhelper
* hlp
);
221 SQUIDCEXTERN
void helperSubmit(helper
* hlp
, const char *buf
, HLPCB
* callback
, void *data
);
222 SQUIDCEXTERN
void helperStatefulSubmit(statefulhelper
* hlp
, const char *buf
, HLPSCB
* callback
, void *data
, helper_stateful_server
* lastserver
);
223 SQUIDCEXTERN
void helperStats(StoreEntry
* sentry
, helper
* hlp
, const char *label
= NULL
);
224 SQUIDCEXTERN
void helperStatefulStats(StoreEntry
* sentry
, statefulhelper
* hlp
, const char *label
= NULL
);
225 SQUIDCEXTERN
void helperShutdown(helper
* hlp
);
226 SQUIDCEXTERN
void helperStatefulShutdown(statefulhelper
* hlp
);
227 SQUIDCEXTERN helper
*helperCreate(const char *);
228 SQUIDCEXTERN statefulhelper
*helperStatefulCreate(const char *);
229 SQUIDCEXTERN
void helperFree(helper
*);
230 SQUIDCEXTERN
void helperStatefulFree(statefulhelper
*);
231 SQUIDCEXTERN
void helperStatefulReset(helper_stateful_server
* srv
);
232 SQUIDCEXTERN
void helperStatefulReleaseServer(helper_stateful_server
* srv
);
233 SQUIDCEXTERN
void *helperStatefulServerGetData(helper_stateful_server
* srv
);
234 SQUIDCEXTERN helper_stateful_server
*helperStatefulDefer(statefulhelper
*);
238 #endif /* SQUID_HELPER_H */