Mercurial > notdcc
comparison include/dcc_clnt.h @ 0:c7f6b056b673
First import of vendor version
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 13:49:58 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c7f6b056b673 |
---|---|
1 /* Distributed Checksum Clearinghouse | |
2 * | |
3 * internal client definitions | |
4 * | |
5 * Copyright (c) 2008 by Rhyolite Software, LLC | |
6 * | |
7 * This agreement is not applicable to any entity which sells anti-spam | |
8 * solutions to others or provides an anti-spam solution as part of a | |
9 * security solution sold to other entities, or to a private network | |
10 * which employs the DCC or uses data provided by operation of the DCC | |
11 * but does not provide corresponding data to other users. | |
12 * | |
13 * Permission to use, copy, modify, and distribute this software without | |
14 * changes for any purpose with or without fee is hereby granted, provided | |
15 * that the above copyright notice and this permission notice appear in all | |
16 * copies and any distributed versions or copies are either unchanged | |
17 * or not called anything similar to "DCC" or "Distributed Checksum | |
18 * Clearinghouse". | |
19 * | |
20 * Parties not eligible to receive a license under this agreement can | |
21 * obtain a commercial license to use DCC by contacting Rhyolite Software | |
22 * at sales@rhyolite.com. | |
23 * | |
24 * A commercial license would be for Distributed Checksum and Reputation | |
25 * Clearinghouse software. That software includes additional features. This | |
26 * free license for Distributed ChecksumClearinghouse Software does not in any | |
27 * way grant permision to use Distributed Checksum and Reputation Clearinghouse | |
28 * software | |
29 * | |
30 * THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL | |
31 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | |
32 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC | |
33 * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES | |
34 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
35 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
36 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
37 * SOFTWARE. | |
38 * | |
39 * Rhyolite Software DCC 1.3.103-1.120 $Revision$ | |
40 */ | |
41 | |
42 #ifndef DCC_CLNT_H | |
43 #define DCC_CLNT_H | |
44 | |
45 #include "dcc_defs.h" | |
46 | |
47 | |
48 #define DCC_DCCD_DELAY (100*1000) /* typical server delay */ | |
49 | |
50 /* The minimum assumed RTT should be long enough for the DCC server to do | |
51 * some disk operations even if the server and network have usually | |
52 * been faster. */ | |
53 #define DCC_MIN_RTT (DCC_DCCD_DELAY + 150*1000) | |
54 | |
55 #define DCC_MAX_XMITS 4 | |
56 | |
57 /* worst client-->server-->client RTT | |
58 * The total delay for N exponentially increasing delays starting with X | |
59 * is about X*(2**N). With the delay limited to Y, it is Y*N. | |
60 * The RTT measuring done with NOPs uses retransmission delays based on | |
61 * DCC_MIN_RTT, and so will not find a server with a worse delay than | |
62 * DCC_MAX_RTT */ | |
63 #define DCC_MAX_RTT (DCC_MIN_RTT<<DCC_MAX_XMITS) | |
64 #define DCC_MAX_RTT_SECS (DCC_MAX_RTT/DCC_US) | |
65 | |
66 #define DCC_RTT_ADJ_MAX (DCC_MAX_RTT/2) /* limit manual RTT bias */ | |
67 #define DCC_RTT_VERS_ADJ DCC_RTT_ADJ_MAX /* penalize strange versions */ | |
68 #define DCC_RTT_BAD (DCC_MAX_RTT*2+1) | |
69 | |
70 /* If DCC_MAX_XMITS and the retransmission delay limited to DCC_MAX_RTT_SECS, | |
71 * the the worst case delay is DCC_MAX_XMITS*DCC_MAX_RTT_SECS=16 seconds */ | |
72 #define DCC_MAX_DELAY (DCC_MAX_XMITS*DCC_MAX_RTT) | |
73 #define DCC_MAX_DELAY_SECS (DCC_MAX_DELAY/DCC_US) | |
74 | |
75 | |
76 /* No client's retransmission can be delayed by more than this starting | |
77 * from the initial intransmission and including network delays for the | |
78 * last retransmission | |
79 * This controls how long a DCC server must remember old requests | |
80 * to recognize retransmissions. */ | |
81 #define DCC_MAX_RETRANS_DELAY_SECS (DCC_MAX_DELAY_SECS*2) | |
82 | |
83 | |
84 #ifndef DCC_MAP_RESOLVE | |
85 #define DCC_MAP_RESOLVE (2*60*60) /* DNS resolve server host names */ | |
86 #endif | |
87 #ifndef DCC_WHITECLNT_RESOLVE | |
88 #define DCC_WHITECLNT_RESOLVE (2*60*60) /* DNS resolve whitelist hosts */ | |
89 #endif | |
90 | |
91 #define DCC_MAX_SRVR_NMS 8 /* server hostnames */ | |
92 #define DCC_MAX_SRVR_ADDRS 12 /* server IP addresses */ | |
93 | |
94 extern u_char dcc_clnt_debug; | |
95 extern int dcc_debug_ttl; | |
96 | |
97 extern char dcc_clnt_hostname[MAXHOSTNAMELEN]; | |
98 | |
99 /* information kept by a client about a server */ | |
100 typedef struct { | |
101 int rtt_adj; | |
102 DCC_CLNT_ID clnt_id; /* our client-ID sent to the server */ | |
103 u_int16_t port; /* network byte order port # */ | |
104 u_char defined; /* name resolves into an IP address */ | |
105 char hostname[DCC_MAXDOMAINLEN]; /* null terminated */ | |
106 u_char pad; | |
107 DCC_PASSWD passwd; /* null filled but not terminated */ | |
108 } DCC_SRVR_NM; | |
109 | |
110 /* the port number must be installed in this before use */ | |
111 #define DCC_SRVR_NM_DEF_HOST "127.0.0.1" | |
112 #define DCC_SRVR_NM_DEF {0, DCC_ID_ANON, 0, 0, {DCC_SRVR_NM_DEF_HOST}, 0, {""}} | |
113 | |
114 typedef u_int16_t NAM_INX; | |
115 typedef struct { /* a single server address */ | |
116 DCC_IP ip; | |
117 time_t rtt_updated; /* when RTT last updated */ | |
118 int rtt; /* round trip time in microseconds */ | |
119 int srvr_wait; /* microseconds server penalizes us */ | |
120 u_int32_t resp_mem; /* 1 bit per recent xmit */ | |
121 # define DCC_TOTAL_XMITS_MAX (sizeof(u_int32_t)*8) | |
122 NAM_INX nam_inx; /* DCC_NO_NM or DCC_SRVR_NM.nms index */ | |
123 # define NO_NAM ((NAM_INX)(-1)) | |
124 # define GOOD_NAM(n) ((n) < DCC_MAX_SRVR_NMS) | |
125 DCC_SRVR_ID srvr_id; /* the server's claimed ID */ | |
126 u_char total_xmits; | |
127 u_char total_resps; | |
128 u_char srvr_pkt_vers; | |
129 u_char flags; | |
130 # define DCC_SRVR_ADDR_MHOME 0x01 /* do not use connect */ | |
131 DCC_BRAND brand; /* the server's announced brand name */ | |
132 } DCC_SRVR_ADDR; | |
133 | |
134 typedef u_char SRVR_INX; | |
135 typedef struct { | |
136 time_t resolve; /* when names need to be resolved */ | |
137 time_t measure; /* when RTT measurements need */ | |
138 int gen; | |
139 int base_rtt; /* RTT to the chosen server */ | |
140 int thold_rtt; /* threshold for switching */ | |
141 int avg_thold_rtt; /* long term threshold */ | |
142 int num_srvrs; /* addresses in .addrs */ | |
143 time_t fail_time; /* DCC broken until then */ | |
144 u_char fail_exp; /* backoff */ | |
145 # define DCC_INIT_FAIL_SECS (DCC_MAX_DELAY_SECS*2) | |
146 # define DCC_MAX_FAIL_EXP 6 | |
147 # define DCC_MAX_FAIL_SECS (DCC_INIT_FAIL_SECS<<DCC_MAX_FAIL_EXP) | |
148 SRVR_INX srvr_inx; /* NO_SRVR or index in .addrs */ | |
149 # define NO_SRVR ((SRVR_INX)(-1)) | |
150 # define GOOD_SRVR(c,s) ((s) < (c)->num_srvrs) | |
151 # define HAVE_SRVR(c) GOOD_SRVR(c,c->srvr_inx) | |
152 DCC_SRVR_NM nms[DCC_MAX_SRVR_NMS]; | |
153 DCC_SRVR_ADDR addrs[DCC_MAX_SRVR_ADDRS]; | |
154 } DCC_SRVR_CLASS; | |
155 | |
156 /* Information about DCC servers shared among clients on a host | |
157 * This is the shape of the mmap()'ed file. */ | |
158 typedef struct { | |
159 # define DCC_MAP_INFO_VERSION "DCC client mapped data version #11" | |
160 char version[36]; | |
161 u_int residue; /* random # for picking addresses */ | |
162 u_char flags; | |
163 # define DCC_INFO_FG_IPV6 0x01 | |
164 #ifdef NO_IPV6 | |
165 # define DCC_INFO_IPV6() 0 | |
166 #else | |
167 # define DCC_INFO_IPV6() (dcc_clnt_info \ | |
168 && (dcc_clnt_info->flags \ | |
169 & DCC_INFO_FG_IPV6) != 0) | |
170 #endif | |
171 # define DCC_INFO_FG_SOCKS 0x02 | |
172 # define DCC_INFO_FG_TMP 0x04 | |
173 DCC_HDR proto_hdr; /* prototype DCC request header */ | |
174 DCC_SRVR_CLASS dcc; /* normal DCC services */ | |
175 DCC_SRVR_CLASS grey; /* grey listing */ | |
176 DCC_IP src; /* send from this interface */ | |
177 time_t dccproc_last; | |
178 time_t dccproc_dccifd_try; | |
179 int dccproc_c; | |
180 # define DCCPROC_TRY_DCCIFD (60*60) /* start dccifd once/hour */ | |
181 # define DCCPROC_MAX_CREDITS 500 /* at least 500 */ | |
182 # define DCCPROC_COST 10 /* and at least 0.1/second */ | |
183 } DCC_CLNT_INFO; | |
184 | |
185 | |
186 #define DCC_MAP_INFO_VERSION_10 "DCC client mapped data version #10" | |
187 #ifdef DCC_MAP_INFO_VERSION_10 | |
188 typedef struct { | |
189 int rtt_adj; | |
190 DCC_CLNT_ID clnt_id; | |
191 u_int16_t port; | |
192 u_char defined; | |
193 char hostname[MAXHOSTNAMELEN]; | |
194 u_char pad; | |
195 DCC_PASSWD passwd; | |
196 } DCC_V10_SRVR_NM; | |
197 typedef struct { | |
198 time_t resolve; | |
199 time_t measure; | |
200 int gen; | |
201 int base_rtt; | |
202 int thold_rtt; | |
203 int avg_thold_rtt; | |
204 int num_addrs; | |
205 time_t fail_time; | |
206 u_char fail_exp; | |
207 u_char act_inx; | |
208 DCC_V10_SRVR_NM nms[DCC_MAX_SRVR_NMS]; | |
209 DCC_SRVR_ADDR addrs[DCC_MAX_SRVR_ADDRS]; | |
210 } DCC_V10_SRVR_CLASS; | |
211 typedef struct { | |
212 char version[36]; | |
213 u_int residue; | |
214 u_char flags; | |
215 DCC_HDR proto_hdr; | |
216 DCC_V10_SRVR_CLASS dcc; | |
217 DCC_V10_SRVR_CLASS grey; | |
218 DCC_IP src; | |
219 time_t dccproc_last; | |
220 time_t dccproc_dccifd_try; | |
221 int dccproc_c; | |
222 } DCC_V10_CLNT_INFO; | |
223 #endif /* DCC_MAP_INFO_VERSION_10 */ | |
224 | |
225 #define DCC_MAP_INFO_VERSION_9 "DCC client mapped data version #9" | |
226 #ifdef DCC_MAP_INFO_VERSION_9 | |
227 typedef struct { | |
228 char version[36]; | |
229 u_int residue; | |
230 u_char flags; | |
231 DCC_HDR proto_hdr; | |
232 DCC_V10_SRVR_CLASS dcc; | |
233 DCC_V10_SRVR_CLASS grey; | |
234 DCC_IP src; | |
235 } DCC_V9_CLNT_INFO; | |
236 #endif /* DCC_MAP_INFO_VERSION_9 */ | |
237 | |
238 #define DCC_MAP_INFO_VERSION_8 "DCC client mapped data version #8" | |
239 #ifdef DCC_MAP_INFO_VERSION_8 | |
240 typedef struct { | |
241 char version[36]; | |
242 u_int residue; | |
243 u_char flags; | |
244 DCC_HDR proto_hdr; | |
245 DCC_V10_SRVR_CLASS dcc; | |
246 DCC_V10_SRVR_CLASS grey; | |
247 } DCC_V8_CLNT_INFO; | |
248 #endif /* DCC_MAP_INFO_VERSION_8 */ | |
249 | |
250 #ifndef DCC_WIN32 | |
251 #define DCC_MAP_INFO_VERSION_7 "DCC client mapped data version #7" | |
252 #endif | |
253 #ifdef DCC_MAP_INFO_VERSION_7 | |
254 typedef struct { | |
255 DCC_SOCKU su; | |
256 time_t rtt_updated; | |
257 int rtt; | |
258 int srvr_wait; | |
259 u_int32_t resp_mem; | |
260 u_int16_t nm_inx; | |
261 DCC_SRVR_ID srvr_id; | |
262 u_char total_xmits; | |
263 u_char total_resps; | |
264 u_char srvr_pkt_vers; | |
265 u_char unused[1]; | |
266 DCC_BRAND brand; | |
267 } DCC_V7_IPV6_SRVR_ADDR; | |
268 typedef struct { | |
269 union { | |
270 struct sockaddr sa; | |
271 struct sockaddr_in ipv4; | |
272 struct dcc_sockaddr_in6 ipv6; | |
273 } su; | |
274 time_t rtt_updated; | |
275 int rtt; | |
276 int srvr_wait; | |
277 u_int32_t resp_mem; | |
278 u_int16_t nm_inx; | |
279 DCC_SRVR_ID srvr_id; | |
280 u_char total_xmits; | |
281 u_char total_resps; | |
282 u_char srvr_pkt_vers; | |
283 u_char unused[1]; | |
284 DCC_BRAND brand; | |
285 } DCC_V7_NOIPV6_SRVR_ADDR; | |
286 | |
287 typedef struct { | |
288 time_t resolve; | |
289 time_t measure; | |
290 int gen; | |
291 int base_rtt; | |
292 int thold_rtt; | |
293 int avg_thold_rtt; | |
294 int num_addrs; | |
295 time_t fail_time; | |
296 u_char fail_exp; | |
297 u_char act_inx; | |
298 DCC_V10_SRVR_NM nms[8]; | |
299 DCC_V7_IPV6_SRVR_ADDR addrs[12]; | |
300 } DCC_V7_IPV6_SRVR_CLASS; | |
301 typedef struct { | |
302 time_t resolve; | |
303 time_t measure; | |
304 int gen; | |
305 int base_rtt; | |
306 int thold_rtt; | |
307 int avg_thold_rtt; | |
308 int num_addrs; | |
309 time_t fail_time; | |
310 u_char fail_exp; | |
311 u_char act_inx; | |
312 DCC_V10_SRVR_NM nms[8]; | |
313 DCC_V7_NOIPV6_SRVR_ADDR addrs[12]; | |
314 } DCC_V7_NOIPV6_SRVR_CLASS; | |
315 | |
316 typedef struct { | |
317 char version[36]; | |
318 u_int residue; | |
319 u_char flags; | |
320 DCC_HDR proto_hdr; | |
321 DCC_V7_IPV6_SRVR_CLASS dcc; | |
322 DCC_V7_IPV6_SRVR_CLASS grey; | |
323 } DCC_V7_IPV6_CLNT_INFO; | |
324 typedef struct { | |
325 char version[36]; | |
326 u_int residue; | |
327 u_char flags; | |
328 DCC_HDR proto_hdr; | |
329 DCC_V7_NOIPV6_SRVR_CLASS dcc; | |
330 DCC_V7_NOIPV6_SRVR_CLASS grey; | |
331 } DCC_V7_NOIPV6_CLNT_INFO; | |
332 #endif /* DCC_MAP_INFO_VERSION_7 */ | |
333 | |
334 #ifndef DCC_WIN32 | |
335 #define DCC_MAP_INFO_VERSION_6 "DCC client mapped data version #6" | |
336 #endif | |
337 #ifdef DCC_MAP_INFO_VERSION_6 | |
338 typedef struct { | |
339 char version[36]; | |
340 time_t resolve; | |
341 time_t measure; | |
342 time_t srvr_fail_time; | |
343 int base_rtt; | |
344 int thold_rtt; | |
345 int avg_thold_rtt; | |
346 u_char unused[8]; | |
347 u_char srvr_fail_exp; | |
348 u_char act_inx; | |
349 u_char total_addrs; | |
350 u_char flags; | |
351 DCC_HDR proto_hdr; | |
352 DCC_V10_SRVR_NM nms[8]; | |
353 } DCC_V6_CLNT_INFO; | |
354 | |
355 typedef struct { | |
356 DCC_CLNT_ID clnt_id; | |
357 u_int16_t port; | |
358 char hostname[MAXHOSTNAMELEN+1]; | |
359 DCC_PASSWD passwd; | |
360 signed char rtt_adj; | |
361 } DCC_V5_SRVR_NM; | |
362 | |
363 typedef struct { | |
364 # define DCC_MAP_INFO_VERSION_5 "DCC client mapped data version #5" | |
365 char version[36]; | |
366 time_t resolve; | |
367 int min_delay; | |
368 u_int16_t act_inx; | |
369 u_char unused[13]; | |
370 u_char total_addrs; | |
371 u_char working_addrs; | |
372 u_char flags; | |
373 DCC_HDR proto_hdr; | |
374 DCC_V5_SRVR_NM nms[8]; | |
375 } DCC_V5_CLNT_INFO; | |
376 #endif /* DCC_MAP_INFO_VERSION_6 */ | |
377 | |
378 #define DCC_IS_GREY(class) ((class) == &dcc_clnt_info->grey) | |
379 #define DCC_IS_GREY_STR(c) (DCC_IS_GREY(c) ? "greylist" : "DCC") | |
380 #define DCC_GREY2PORT(mode) htons((mode)? DCC_GREY_PORT : DCC_SRVR_PORT) | |
381 #define DCC_CLASS2PORT(c) DCC_GREY2PORT(DCC_IS_GREY(c)) | |
382 #define DCC_GREY2CLASS(g) ((g) ? &dcc_clnt_info->grey : &dcc_clnt_info->dcc) | |
383 | |
384 extern DCC_CLNT_INFO *dcc_clnt_info; /* memory mapped shared data */ | |
385 extern u_char dcc_all_srvrs; /* try to contact all servers */ | |
386 extern DCC_PATH dcc_info_nm; | |
387 | |
388 | |
389 typedef struct { /* record of 1 transmission */ | |
390 DCC_OP_NUMS op_nums; | |
391 time_t sent_us; /* microseconds since operation start */ | |
392 DCC_OPS op; | |
393 DCC_CLNT_ID id; | |
394 int addrs_gen; | |
395 DCC_SOCKU su; | |
396 int addr_inx; | |
397 DCC_PASSWD passwd; | |
398 } DCC_XLOG_ENTRY; | |
399 | |
400 typedef struct { | |
401 u_char outstanding; /* unheard responses */ | |
402 u_char working_addrs; | |
403 struct { | |
404 u_char xmits; | |
405 u_char resps; | |
406 } cur[DCC_MAX_SRVR_ADDRS]; | |
407 DCC_XLOG_ENTRY *base; /* start of array */ | |
408 DCC_XLOG_ENTRY *next; /* next entry to use */ | |
409 DCC_XLOG_ENTRY *last; /* last entry in array */ | |
410 } DCC_XLOG; | |
411 | |
412 /* invalid timer */ | |
413 #define DCC_OP_NUMS_NULL ((u_int32_t)-1) | |
414 | |
415 | |
416 typedef struct dcc_clnt_ctxt { | |
417 struct dcc_clnt_ctxt *fwd; | |
418 struct timeval now; /* current time */ | |
419 struct timeval start; /* when operation started */ | |
420 int now_us; /* usecs since start of operation */ | |
421 time_t bind_time; /* when to retry binding socket */ | |
422 # define DCC_CTXT_REBIND_SECS 3600 /* check local interface hourly */ | |
423 SOCKET soc; | |
424 DCC_SOCKU bind_su; /* socket bound to this address */ | |
425 DCC_SOCKU conn_su; /* socket connected to this address */ | |
426 DCC_XLOG xlog; | |
427 DCC_XLOG_ENTRY xlog_entries[DCC_MAX_SRVR_ADDRS*DCC_MAX_XMITS]; | |
428 u_char flags; | |
429 # define DCC_CTXT_USING_IPV4 0x01 /* socket is opened for IPv4 */ | |
430 # define DCC_CTXT_SRCBAD 0x02 /* bind() failed */ | |
431 } DCC_CLNT_CTXT; | |
432 | |
433 #define DCC_INFO_USE_IPV4 "IPv6 off" | |
434 #define DCC_INFO_USE_IPV6 "IPv6 on" | |
435 #define DCC_INFO_USE_SOCKS "use SOCKS" | |
436 #define DCC_INFO_USE_SRC "src=" | |
437 #define DCC_INFO_USE_SRCBAD "but unused" | |
438 | |
439 | |
440 /* many POSIX thread implementations have unexpected side effects on | |
441 * ordinary system calls, so allow the calling application | |
442 * to not use threads by having both threaded and unthreaded | |
443 * DCC client interfaces */ | |
444 | |
445 extern void dcc_ctxts_lock(void); | |
446 extern void dcc_ctxts_unlock(void); | |
447 extern void dcc_syslog_lock(void); | |
448 extern void dcc_syslog_unlock(void); | |
449 extern u_char dcc_clnt_wake_resolve(void); | |
450 extern void dcc_clnt_stop_resolve(void); | |
451 extern void dcc_clnt_unthread_init(void); | |
452 extern void dcc_clnt_thread_init(void); | |
453 extern void lock_work(void); | |
454 extern void unlock_work(void); | |
455 extern void lock_wf(void); | |
456 extern void unlock_wf(void); | |
457 #ifdef DCC_DEBUG_CLNT_LOCK | |
458 extern void assert_ctxts_locked(void); | |
459 extern void assert_ctxts_unlocked(void); | |
460 extern void assert_info_locked(void); | |
461 extern void assert_info_unlocked(void); | |
462 extern void assert_cwf_locked(void); | |
463 #else | |
464 #define assert_ctxts_locked() | |
465 #define assert_ctxts_unlocked() | |
466 #define assert_info_locked() | |
467 #define assert_info_unlocked() | |
468 #define assert_cwf_locked() | |
469 #endif /* DCC_DEBUG_CLNT_LOCK */ | |
470 extern u_char helper_lock_init(void); | |
471 extern void helper_lock(void); | |
472 extern void helper_unlock(void); | |
473 | |
474 | |
475 extern const char *dcc_ap2str(const DCC_SRVR_ADDR *); | |
476 extern int dcc_ap2str_opt(char *, int, | |
477 const DCC_SRVR_CLASS *, u_char inx, char); | |
478 | |
479 extern FILE *dcc_open_srvr_nm(DCC_EMSG, const char *); | |
480 extern const char *dcc_parse_nm_port(DCC_EMSG, const char *, u_int, | |
481 char *, u_int, u_int16_t *, char *, u_int, | |
482 const char *, int); | |
483 extern int dcc_parse_srvr_nm(DCC_EMSG, DCC_SRVR_NM *, u_char *, | |
484 const char *, const char *, int); | |
485 extern const char *dcc_srvr_nm(u_char); | |
486 extern DCC_CLNT_CTXT *dcc_alloc_ctxt(void); | |
487 extern void dcc_rel_ctxt(DCC_CLNT_CTXT *); | |
488 extern u_char dcc_info_unlock(DCC_EMSG); | |
489 extern u_char dcc_info_lock(DCC_EMSG); | |
490 extern void dcc_force_measure_rtt(DCC_SRVR_CLASS *); | |
491 extern u_char dcc_create_map(DCC_EMSG, const DCC_PATH, int *, | |
492 const DCC_SRVR_NM *, int, | |
493 const DCC_SRVR_NM *, int, | |
494 const DCC_IP *, u_char); | |
495 extern u_char dcc_unmap_close_info(DCC_EMSG); | |
496 extern u_char dcc_map_info(DCC_EMSG, const char *, int); | |
497 extern u_char dcc_map_lock_info(DCC_EMSG, const char *, int); | |
498 extern u_char dcc_map_tmp_info(DCC_EMSG, const DCC_SRVR_NM *, | |
499 const DCC_IP *, u_char); | |
500 typedef u_char DCC_CLNT_FGS; | |
501 #define DCC_CLNT_FG_NONE 0x00 | |
502 #define DCC_CLNT_FG_GREY 0x01 | |
503 #define DCC_CLNT_FG_BAD_SRVR_OK 0x02 | |
504 #define DCC_CLNT_FG_NO_PICK_SRVR 0x04 | |
505 #define DCC_CLNT_FG_NO_FAIL 0x08 | |
506 #define DCC_CLNT_FG_RETRY 0x10 /* retrying with different server */ | |
507 #define DCC_CLNT_FG_SLOW 0x20 /* slow timeouts */ | |
508 #define DCC_CLNT_FG_RETRANS 0x40 /* use old op_nums.r */ | |
509 extern u_char dcc_clnt_rdy(DCC_EMSG, DCC_CLNT_CTXT *, DCC_CLNT_FGS); | |
510 extern DCC_CLNT_CTXT *dcc_tmp_clnt_init(DCC_EMSG, DCC_CLNT_CTXT *, | |
511 const DCC_SRVR_NM *, | |
512 const DCC_IP *, DCC_CLNT_FGS, u_char); | |
513 extern DCC_CLNT_CTXT *dcc_clnt_start(DCC_EMSG, DCC_CLNT_CTXT *, | |
514 const char *, DCC_CLNT_FGS); | |
515 extern DCC_CLNT_CTXT *dcc_clnt_start_fin(DCC_EMSG, DCC_CLNT_CTXT *); | |
516 extern DCC_CLNT_CTXT *dcc_clnt_init(DCC_EMSG, DCC_CLNT_CTXT *, | |
517 const char *, DCC_CLNT_FGS); | |
518 extern u_char dcc_clnt_connect(DCC_EMSG, DCC_CLNT_CTXT *, const DCC_SOCKU *); | |
519 extern void dcc_clnt_soc_close(DCC_CLNT_CTXT *); | |
520 extern u_char dcc_clnt_soc_reopen(DCC_EMSG, DCC_CLNT_CTXT *); | |
521 extern int dcc_select_poll(DCC_EMSG, SOCKET, u_char, int); | |
522 extern u_char dcc_clnt_op(DCC_EMSG, DCC_CLNT_CTXT *, DCC_CLNT_FGS, | |
523 const SRVR_INX *, DCC_SRVR_ID *, DCC_SOCKU *, | |
524 DCC_HDR *, int, DCC_OPS, DCC_OP_RESP *, int); | |
525 | |
526 extern DCC_OPS dcc_aop(DCC_EMSG, DCC_CLNT_CTXT *, | |
527 DCC_CLNT_FGS, SRVR_INX, time_t, | |
528 DCC_AOPS, u_int32_t, u_char, u_char, u_char, | |
529 u_char *, u_int, DCC_OP_RESP *, DCC_SOCKU *); | |
530 extern u_char dcc_aop_persist(DCC_EMSG, DCC_CLNT_CTXT *, DCC_CLNT_FGS, u_char, | |
531 DCC_AOPS, u_int32_t, int, DCC_OP_RESP *); | |
532 | |
533 extern void dcc_print_info(const char *, const DCC_CLNT_INFO *, | |
534 u_char, u_char, u_char, u_char, u_char); | |
535 | |
536 extern int get_xhdr_fname(char *, int, const DCC_CLNT_INFO *); | |
537 extern void xhdr_init(DCC_HEADER_BUF *, DCC_SRVR_ID); | |
538 extern void xhdr_add_str(DCC_HEADER_BUF *, const char *, ...) PATTRIB(2,3); | |
539 extern void xhdr_add_ck(DCC_HEADER_BUF *, DCC_CK_TYPES, DCC_TGTS); | |
540 extern void xhdr_write(LOG_WRITE_FNC, void *, const char *, int, u_char); | |
541 extern void xhdr_whitelist(DCC_HEADER_BUF *); | |
542 extern u_char is_xhdr(const char *, int); | |
543 | |
544 | |
545 #endif /* DCC_CLNT_H */ |