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

iprange.h File Reference


Detailed Description

Needs brief description here.

Author:
Raphael Manfredi
Date:
2004

Go to the source code of this file.

Data Structures

struct  iprange_stats_t
 Statistics. More...


Typedefs

typedef void(* iprange_free_t )(gpointer value, gpointer udata)
typedef gpointer(* iprange_clone_t )(gpointer value)

Enumerations

enum  iprange_err_t {
  IPR_ERR_OK = 0, IPR_ERR_BAD_PREFIX, IPR_ERR_RANGE_CLASH, IPR_ERR_RANGE_DUP,
  IPR_ERR_RANGE_SUBNET, IPR_ERR_RANGE_OVERLAP, IPR_ERROR_COUNT
}
 Error codes. More...


Functions

const gchar * iprange_strerror (iprange_err_t errnum)
gpointer iprange_make (iprange_free_t freecb, iprange_clone_t clonecb)
 Create a new IP range database.

void iprange_free_each (gpointer db, gpointer udata)
 Free values stored in the IP range database, then destroy database.

iprange_err_t iprange_add_cidr (gpointer db, guint32 net, guint bits, gpointer udata)
 Add CIDR network to the database.

iprange_err_t iprange_add_cidr_force (gpointer db, guint32 net, guint bits, gpointer udata, gpointer cdata)
 Add CIDR network to the database, forcing entry if new range supersedes an older range.

gpointer iprange_get (gpointer db, guint32 ip)
 Retrieve value associated with an IP address, i.e.

void iprange_get_stats (gpointer db, iprange_stats_t *stats)
 Get statistics about the database.


Typedef Documentation

typedef gpointer(* iprange_clone_t)(gpointer value)
 

typedef void(* iprange_free_t)(gpointer value, gpointer udata)
 


Enumeration Type Documentation

enum iprange_err_t
 

Error codes.

Enumeration values:
IPR_ERR_OK  OK.
IPR_ERR_BAD_PREFIX  Incorrect network prefix.
IPR_ERR_RANGE_CLASH  CIDR range clash.
IPR_ERR_RANGE_DUP  Duplicate range.
IPR_ERR_RANGE_SUBNET  Range is subnet of existing range.
IPR_ERR_RANGE_OVERLAP  Range is overlapping existing range.
IPR_ERROR_COUNT  Amount of error codes defined.


Function Documentation

iprange_err_t iprange_add_cidr gpointer  db,
guint32  net,
guint  bits,
gpointer  udata
 

Add CIDR network to the database.

Parameters:
db the IP range database
net the network prefix
bits the amount of bits in the network prefix
udata value associated to this IP network
Returns:
IPR_ERR_OK if successful, an error code otherwise.

iprange_err_t iprange_add_cidr_force gpointer  db,
guint32  net,
guint  bits,
gpointer  udata,
gpointer  cdata
 

Add CIDR network to the database, forcing entry if new range supersedes an older range.

Parameters:
db the IP range database
net the network prefix
bits the amount of bits in the network prefix
udata value associated to this IP network
cdata extra parameter to pass to free callback, if invoked
Returns:
IPR_ERR_OK if successful, an error code otherwise.

void iprange_free_each gpointer  db,
gpointer  udata
 

Free values stored in the IP range database, then destroy database.

Parameters:
db the database
udata trailing user-supplied data, passed to freeing callback

gpointer iprange_get gpointer  db,
guint32  ip
 

Retrieve value associated with an IP address, i.e.

that of the range containing it.

void iprange_get_stats gpointer  db,
iprange_stats_t stats
 

Get statistics about the database.

Parameters:
db the database
stats the supplied structure to fill

gpointer iprange_make iprange_free_t  freecb,
iprange_clone_t  clonecb
 

Create a new IP range database.

const gchar* iprange_strerror iprange_err_t  errnum  ) 
 

Returns:
human-readable error string for given error code.


Generated on Sun Feb 12 10:50:03 2006 for Gtk-Gnutella by doxygen 1.3.6