comparison src/gt_query_route.h @ 0:d39e1d0d75b6

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