00001 /* -*- mode: cc-mode; tab-width:4; -*- 00002 * 00003 * $Id: sq.h,v 1.5 2005/06/25 01:37:41 daichik Exp $ 00004 * 00005 * Copyright (c) 2002-2003, Alex Bennee <alex@bennee.com> & Raphael Manfredi 00006 * 00007 *---------------------------------------------------------------------- 00008 * This file is part of gtk-gnutella. 00009 * 00010 * gtk-gnutella is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * gtk-gnutella is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with gtk-gnutella; if not, write to the Free Software 00022 * Foundation, Inc.: 00023 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 *---------------------------------------------------------------------- 00025 */ 00026 00038 #ifndef _core_sq_h_ 00039 #define _core_sq_h_ 00040 00041 #include "common.h" 00042 #include "pmsg.h" 00043 #include "qrp.h" 00044 00045 #include "if/core/search.h" 00046 00054 typedef struct search_queue { 00055 GList *searches; 00056 GHashTable *handles; 00057 struct gnutella_node *node; 00058 time_t last_sent; 00059 guint count; 00060 /* stats */ 00061 gint n_sent; 00062 gint n_dropped; 00063 } squeue_t; 00064 00065 #define sq_count(q) ((q)->count) 00066 #define sq_sent(q) ((q)->n_sent) 00067 00068 /* 00069 * Public interfaces 00070 */ 00071 00072 void sq_init(void); 00073 void sq_close(void); 00074 00075 squeue_t *sq_global_queue(void); 00076 00077 squeue_t *sq_make(struct gnutella_node *node); 00078 void sq_clear(squeue_t *sq); 00079 void sq_free(squeue_t *sq); 00080 void sq_putq(squeue_t *sq, gnet_search_t sh, pmsg_t *mb); 00081 void sq_process(squeue_t *sq, time_t now); 00082 void sq_search_closed(squeue_t *sq, gnet_search_t sh); 00083 void sq_global_putq(gnet_search_t sh, pmsg_t *mb, query_hashvec_t *qhv); 00084 void sq_set_peermode(node_peer_t mode); 00085 00086 #endif /* _core_sq_h_ */ 00087 00088 /* vi: set ts=4: */