comparison src/gt_share_state.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:c10876482d1d
1 /*
2 * $Id: gt_share_state.h,v 1.2 2004/03/31 08:58:24 hipnod Exp $
3 *
4 * Copyright (C) 2004 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 GIFT_GT_SHARE_STATE_H_
18 #define GIFT_GT_SHARE_STATE_H_
19
20 /******************************************************************************/
21
22 /*
23 * Keep track of the "hidden" share status on the remote node. To
24 * disable sharing, the node is sent a HopsFlow message with a payload of 0,
25 * telling it not to send us any queries. If the HopsFlow message isn't
26 * supported, the query handling code can simply drop the queries
27 * (alternatively, the QRT could be manipulated, but that's more complicated).
28 *
29 * There are two variables to deal with: giftd may have disabled sharing, and
30 * the plugin may have flow-controlled the remote node. When either of these
31 * conditions becomes true, the node is sent the HopsFlow message to disable
32 * receipt of queries. Only when both these conditions become false does the
33 * node receive another HopsFlow with a payload of 8, allowing the node to send
34 * us queries again.
35 *
36 * giftd's hidden state is tracked by gt_share_state.c. Here, each node's
37 * hidden state is tracked:
38 */
39 struct gt_share_state
40 {
41 BOOL hidden; /* sharing is disabled for this node */
42 BOOL plugin_hidden; /* plugin disabled it (flow control) */
43 };
44
45 /*****************************************************************************/
46
47 struct gt_share_state *gt_share_state_new (void);
48 void gt_share_state_free (struct gt_share_state *state);
49
50 /*****************************************************************************/
51
52 /* update the node about our sharing status, possibly by sending it a HopsFlow
53 * message */
54 void gt_share_state_update (struct gt_node *node);
55
56 /* control share disabling on each individual node (as opposed to locally) */
57 void gt_share_state_hide (struct gt_node *node);
58 void gt_share_state_show (struct gt_node *node);
59
60 /*****************************************************************************/
61
62 void gt_share_state_local_init (void);
63 void gt_share_state_local_cleanup (void);
64
65 /*****************************************************************************/
66
67 void gnutella_share_hide (Protocol *p);
68 void gnutella_share_show (Protocol *p);
69
70 /******************************************************************************/
71
72 #endif /* GIFT_GT_SHARE_STATE_H_ */