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

hosts.c File Reference


Detailed Description

Host management.

Author:
Raphael Manfredi
Date:
2001-2004

#include "common.h"
#include "sockets.h"
#include "hosts.h"
#include "nodes.h"
#include "share.h"
#include "routing.h"
#include "gmsg.h"
#include "pcache.h"
#include "whitelist.h"
#include "settings.h"
#include "bogons.h"
#include "uhc.h"
#include "if/gnet_property_priv.h"
#include "lib/endian.h"
#include "lib/glib-missing.h"
#include "lib/misc.h"
#include "lib/walloc.h"
#include "lib/override.h"

Data Structures

struct  network_pair

Functions

guint host_hash (gconstpointer key)
 Hash function for use in g_hash_table_new.
gint host_eq (gconstpointer v1, gconstpointer v2)
 Compare function which returns TRUE if the hosts are equal.
gint host_cmp (gconstpointer v1, gconstpointer v2)
 Compare function which returns 0 if the hosts are equal, otherwise 1.
void gnet_host_vec_free (gnet_host_vec_t **vec_ptr)
gnet_host_vec_tgnet_host_vec_alloc (void)
gnet_host_vec_tgnet_host_vec_copy (const gnet_host_vec_t *vec)
void gnet_host_vec_add (gnet_host_vec_t *vec, host_addr_t addr, guint16 port)
gnet_host_vec_tgnet_host_vec_create (gnet_host_t *hvec, gint hcnt)
void host_timer (void)
 Periodic host heartbeat timer.
void host_init (void)
const gchar * gnet_host_to_string (const struct gnutella_host *h)
gboolean host_is_valid (const host_addr_t addr, guint16 port)
 Check whether host is connectible.
void host_add (const host_addr_t addr, guint16 port, gboolean do_connect)
 Add a new host to our pong reserve.
void host_add_semi_pong (const host_addr_t addr, guint16 port)
 Add a new host to our pong reserve, although the information here does not come from a pong but from a Query Hit packet, hence the port may be unsuitable for Gnet connections.
void free_networks (void)
 frees the local networks array
void parse_netmasks (const gchar *str)
 Break the netmaks string and convert them into network_pair elements in the local_networks array.
gboolean host_is_nearby (const host_addr_t addr)
void host_shutdown (void)
 Signals that we're shutdowning and entering a grace period, during which we don't need to make any new connection.
void host_close (void)

Variables

gboolean host_low_on_pongs = FALSE
 True when less than 12% full.
gboolean in_shutdown = FALSE
network_pairlocal_networks = NULL
guint32 number_local_networks


Function Documentation

void free_networks void   )  [static]
 

frees the local networks array

const gchar* gnet_host_to_string const struct gnutella_host h  ) 
 

Returns:
the address:port of a host

void gnet_host_vec_add gnet_host_vec_t vec,
host_addr_t  addr,
guint16  port
 

gnet_host_vec_t* gnet_host_vec_alloc void   ) 
 

gnet_host_vec_t* gnet_host_vec_copy const gnet_host_vec_t vec  ) 
 

gnet_host_vec_t* gnet_host_vec_create gnet_host_t hvec,
gint  hcnt
 

void gnet_host_vec_free gnet_host_vec_t **  vec_ptr  ) 
 

void host_add const host_addr_t  addr,
guint16  port,
gboolean  do_connect
 

Add a new host to our pong reserve.

When `connect' is true, attempt to connect if we are low in Gnet links.

void host_add_semi_pong const host_addr_t  addr,
guint16  port
 

Add a new host to our pong reserve, although the information here does not come from a pong but from a Query Hit packet, hence the port may be unsuitable for Gnet connections.

void host_close void   ) 
 

gint host_cmp gconstpointer  v1,
gconstpointer  v2
 

Compare function which returns 0 if the hosts are equal, otherwise 1.

Note:
For use in g_list_find_custom.

gint host_eq gconstpointer  v1,
gconstpointer  v2
 

Compare function which returns TRUE if the hosts are equal.

Note:
For use in g_hash_table_new.

guint host_hash gconstpointer  key  ) 
 

Hash function for use in g_hash_table_new.

void host_init void   ) 
 

gboolean host_is_nearby const host_addr_t  addr  ) 
 

Returns:
true if the address is inside one of the local networks

gboolean host_is_valid const host_addr_t  addr,
guint16  port
 

Check whether host is connectible.

i.e. that it has a valid port and that its IP address is not private not bogus.

void host_shutdown void   ) 
 

Signals that we're shutdowning and entering a grace period, during which we don't need to make any new connection.

void host_timer void   ) 
 

Periodic host heartbeat timer.

void parse_netmasks const gchar *  str  ) 
 

Break the netmaks string and convert them into network_pair elements in the local_networks array.

IP's are in network order.


Variable Documentation

gboolean host_low_on_pongs = FALSE
 

True when less than 12% full.

gboolean in_shutdown = FALSE [static]
 

struct network_pair* local_networks = NULL
 

guint32 number_local_networks
 


Generated on Sat Jun 30 17:53:27 2007 for gtk-gnutella by  doxygen 1.3.9.1