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