view src/gt_node_list.h @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
line source
1 /*
2 * $Id: gt_node_list.h,v 1.6 2004/01/04 06:01:20 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 */
17 #ifndef GIFT_GT_NODE_LIST_H_
18 #define GIFT_GT_NODE_LIST_H_
20 /*****************************************************************************/
22 typedef GtNode* (*GtConnForeachFunc) (TCPC *c, GtNode *node, void *udata);
23 #define GT_CONN_FOREACH(func) ((GtConnForeachFunc)func)
25 /*****************************************************************************/
27 void gt_conn_add (GtNode *node);
28 void gt_conn_remove (GtNode *node);
29 GtNode *gt_conn_foreach (GtConnForeachFunc func, void *udata,
30 gt_node_class_t klass, gt_node_state_t state,
31 int iter);
33 /*****************************************************************************/
35 int gt_conn_length (gt_node_class_t klass,
36 gt_node_state_t state);
37 GtNode *gt_conn_random (gt_node_class_t klass,
38 gt_node_state_t state);
39 void gt_conn_trim (void);
41 void gt_conn_sort (CompareFunc func);
42 int gt_conn_sort_vit (GtNode *a, GtNode *b);
43 int gt_conn_sort_vit_neg (GtNode *a, GtNode *b);
45 /*****************************************************************************/
47 void gt_conn_set_state (GtNode *node, gt_node_state_t old_state,
48 gt_node_state_t new_state);
49 void gt_conn_set_class (GtNode *node, gt_node_class_t old_class,
50 gt_node_class_t new_class);
52 /*****************************************************************************/
54 /* update or load the list of nodes in ~/.giFT/Gnutella/nodes */
55 void gt_node_list_save (void);
56 void gt_node_list_load (void);
58 /*****************************************************************************/
60 #endif /* GIFT_GT_NODE_LIST_H_ */