Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

bsched.h

Go to the documentation of this file.
00001 /*
00002  * $Id: bsched.h,v 1.3 2005/06/29 16:58:38 rmanfredi Exp $
00003  *
00004  * Copyright (c) 2001-2003, Raphael Manfredi
00005  *
00006  *----------------------------------------------------------------------
00007  * This file is part of gtk-gnutella.
00008  *
00009  *  gtk-gnutella is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  gtk-gnutella is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with gtk-gnutella; if not, write to the Free Software
00021  *  Foundation, Inc.:
00022  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *----------------------------------------------------------------------
00024  */
00025 
00026 #ifndef _if_core_bsched_h_
00027 #define _if_core_bsched_h_
00028 
00029 #include "if/core/wrap.h"   /* For wrap_io_t */
00030 #include "lib/inputevt.h"   /* For inputevt_handler_t */
00031 
00032 #define BS_BW_MAX   (2*1024*1024)
00033 
00034 typedef struct bsched bsched_t;
00035 
00040 typedef struct bio_source {
00041     bsched_t *bs;                   
00042     wrap_io_t *wio;                 
00043     gint io_tag;                    
00044     guint io_flags;                 
00045     inputevt_handler_t io_callback;     
00046     gpointer io_arg;                
00047     guint32 flags;                  
00048     guint bw_actual;                
00049     guint bw_last_bps;              
00050     guint bw_fast_ema;              
00051     guint bw_slow_ema;              
00052 } bio_source_t;
00053 
00054 /*
00055  * Source flags.
00056  */
00057 
00058 #define BIO_F_READ          0x00000001  
00059 #define BIO_F_WRITE         0x00000002  
00060 #define BIO_F_ACTIVE        0x00000004  
00061 #define BIO_F_USED          0x00000008  
00063 #define BIO_F_RW            (BIO_F_READ|BIO_F_WRITE)
00064 
00065 #define BIO_EMA_SHIFT   7
00066 
00067 #define bio_bps(b)      ((b)->bw_last_bps)
00068 #define bio_avg_bps(b)  ((b)->bw_slow_ema >> BIO_EMA_SHIFT)
00069 
00070 #endif /* _if_core_bsched_h_ */
00071 
00072 /* vi: set ts=4: */

Generated on Sun Feb 12 10:49:55 2006 for Gtk-Gnutella by doxygen 1.3.6