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

iprange.h

Go to the documentation of this file.
00001 /*
00002  * $Id: iprange.h,v 1.5 2005/06/29 14:24:26 daichik Exp $
00003  *
00004  * Copyright (c) 2004, 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 
00036 #ifndef _iprange_h_
00037 #define _iprange_h_
00038 
00039 typedef void (*iprange_free_t)(gpointer value, gpointer udata);
00040 typedef gpointer (*iprange_clone_t)(gpointer value);
00041 
00045 typedef struct {
00046     gint count;                 
00047     gint level2;                
00048     gint heads;                 
00049     gint enlisted;              
00050 } iprange_stats_t;
00051 
00056 typedef enum {
00057     IPR_ERR_OK = 0,             
00058     IPR_ERR_BAD_PREFIX,         
00059     IPR_ERR_RANGE_CLASH,        
00060     IPR_ERR_RANGE_DUP,          
00061     IPR_ERR_RANGE_SUBNET,       
00062     IPR_ERR_RANGE_OVERLAP,      
00064     IPR_ERROR_COUNT             
00065 } iprange_err_t;
00066 
00067 /*
00068  * Public interface.
00069  */
00070 
00071 const gchar *iprange_strerror(iprange_err_t errnum);
00072 
00073 gpointer iprange_make(iprange_free_t freecb, iprange_clone_t clonecb);
00074 void iprange_free_each(gpointer db, gpointer udata);
00075 iprange_err_t iprange_add_cidr(
00076     gpointer db, guint32 net, guint bits, gpointer udata);
00077 iprange_err_t iprange_add_cidr_force(
00078     gpointer db, guint32 net, guint bits, gpointer udata, gpointer cdata);
00079 gpointer iprange_get(gpointer db, guint32 ip);
00080 void iprange_get_stats(gpointer db, iprange_stats_t *stats);
00081 
00082 #endif  /* _iprange_h_ */
00083 
00084 /* vi: set ts=4 sw=4 cindent: */

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