rev |
line source |
paulo@0
|
1 /*
|
paulo@0
|
2 * $Id: gt_query_route.h,v 1.12 2003/09/22 21:11:10 hipnod Exp $
|
paulo@0
|
3 *
|
paulo@0
|
4 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net)
|
paulo@0
|
5 *
|
paulo@0
|
6 * This program is free software; you can redistribute it and/or modify it
|
paulo@0
|
7 * under the terms of the GNU General Public License as published by the
|
paulo@0
|
8 * Free Software Foundation; either version 2, or (at your option) any
|
paulo@0
|
9 * later version.
|
paulo@0
|
10 *
|
paulo@0
|
11 * This program is distributed in the hope that it will be useful, but
|
paulo@0
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
paulo@0
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
paulo@0
|
14 * General Public License for more details.
|
paulo@0
|
15 */
|
paulo@0
|
16
|
paulo@0
|
17 #ifndef __GT_QUERY_ROUTE_H__
|
paulo@0
|
18 #define __GT_QUERY_ROUTE_H__
|
paulo@0
|
19
|
paulo@0
|
20 /*****************************************************************************/
|
paulo@0
|
21
|
paulo@0
|
22 /*
|
paulo@0
|
23 * Delimiters for words in the query-router protocol hash function.
|
paulo@0
|
24 * This is what LimeWire uses.
|
paulo@0
|
25 */
|
paulo@0
|
26 #define QRP_DELIMITERS " -._+/*()\\/"
|
paulo@0
|
27
|
paulo@0
|
28 /*****************************************************************************/
|
paulo@0
|
29
|
paulo@0
|
30 struct gt_packet;
|
paulo@0
|
31 struct gt_zlib_stream;
|
paulo@0
|
32
|
paulo@0
|
33 typedef struct gt_query_router GtQueryRouter;
|
paulo@0
|
34 typedef struct gt_query_patch GtQueryPatch;
|
paulo@0
|
35
|
paulo@0
|
36 struct gt_query_patch
|
paulo@0
|
37 {
|
paulo@0
|
38 int seq_size;
|
paulo@0
|
39 int seq_num;
|
paulo@0
|
40 int compressed;
|
paulo@0
|
41
|
paulo@0
|
42 /* where the last patch left off in the table */
|
paulo@0
|
43 int table_pos;
|
paulo@0
|
44
|
paulo@0
|
45 struct gt_zlib_stream *stream;
|
paulo@0
|
46 };
|
paulo@0
|
47
|
paulo@0
|
48 struct gt_query_router
|
paulo@0
|
49 {
|
paulo@0
|
50 char *table;
|
paulo@0
|
51 size_t size;
|
paulo@0
|
52
|
paulo@0
|
53 GtQueryPatch *patch;
|
paulo@0
|
54 };
|
paulo@0
|
55
|
paulo@0
|
56 /*****************************************************************************/
|
paulo@0
|
57
|
paulo@0
|
58 uint32_t gt_query_router_hash_str (char *words, size_t bits);
|
paulo@0
|
59
|
paulo@0
|
60 /*****************************************************************************/
|
paulo@0
|
61
|
paulo@0
|
62 void gt_query_router_self_init (void);
|
paulo@0
|
63 void gt_query_router_self_destroy (void);
|
paulo@0
|
64 uint8_t *gt_query_router_self (size_t *size, int *version);
|
paulo@0
|
65 void gt_query_router_self_add (Share *share);
|
paulo@0
|
66 void gt_query_router_self_remove (Share *share);
|
paulo@0
|
67 void gt_query_router_self_sync (BOOL begin);
|
paulo@0
|
68
|
paulo@0
|
69 /*****************************************************************************/
|
paulo@0
|
70
|
paulo@0
|
71 GtQueryRouter *gt_query_router_new (size_t size, int infinity);
|
paulo@0
|
72 void gt_query_router_free (GtQueryRouter *router);
|
paulo@0
|
73
|
paulo@0
|
74 void gt_query_router_update (GtQueryRouter *router,
|
paulo@0
|
75 size_t seq_num, size_t seq_size,
|
paulo@0
|
76 int compressed, int bits,
|
paulo@0
|
77 unsigned char *zdata, size_t size);
|
paulo@0
|
78
|
paulo@0
|
79
|
paulo@0
|
80 /*****************************************************************************/
|
paulo@0
|
81
|
paulo@0
|
82 void query_route_table_submit (TCPC *c);
|
paulo@0
|
83 void query_route_table_reset (TCPC *c);
|
paulo@0
|
84
|
paulo@0
|
85 /*****************************************************************************/
|
paulo@0
|
86
|
paulo@0
|
87 #endif /* __GT_QUERY_ROUTE_H__ */
|