paulo@0: /* paulo@0: * $Id: gt_node_list.h,v 1.6 2004/01/04 06:01:20 hipnod Exp $ paulo@0: * paulo@0: * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) paulo@0: * paulo@0: * This program is free software; you can redistribute it and/or modify it paulo@0: * under the terms of the GNU General Public License as published by the paulo@0: * Free Software Foundation; either version 2, or (at your option) any paulo@0: * later version. paulo@0: * paulo@0: * This program is distributed in the hope that it will be useful, but paulo@0: * WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU paulo@0: * General Public License for more details. paulo@0: */ paulo@0: paulo@0: #ifndef GIFT_GT_NODE_LIST_H_ paulo@0: #define GIFT_GT_NODE_LIST_H_ paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: typedef GtNode* (*GtConnForeachFunc) (TCPC *c, GtNode *node, void *udata); paulo@0: #define GT_CONN_FOREACH(func) ((GtConnForeachFunc)func) paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: void gt_conn_add (GtNode *node); paulo@0: void gt_conn_remove (GtNode *node); paulo@0: GtNode *gt_conn_foreach (GtConnForeachFunc func, void *udata, paulo@0: gt_node_class_t klass, gt_node_state_t state, paulo@0: int iter); paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: int gt_conn_length (gt_node_class_t klass, paulo@0: gt_node_state_t state); paulo@0: GtNode *gt_conn_random (gt_node_class_t klass, paulo@0: gt_node_state_t state); paulo@0: void gt_conn_trim (void); paulo@0: paulo@0: void gt_conn_sort (CompareFunc func); paulo@0: int gt_conn_sort_vit (GtNode *a, GtNode *b); paulo@0: int gt_conn_sort_vit_neg (GtNode *a, GtNode *b); paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: void gt_conn_set_state (GtNode *node, gt_node_state_t old_state, paulo@0: gt_node_state_t new_state); paulo@0: void gt_conn_set_class (GtNode *node, gt_node_class_t old_class, paulo@0: gt_node_class_t new_class); paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: /* update or load the list of nodes in ~/.giFT/Gnutella/nodes */ paulo@0: void gt_node_list_save (void); paulo@0: void gt_node_list_load (void); paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: #endif /* GIFT_GT_NODE_LIST_H_ */