00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00037 #ifndef _core_hcache_h_
00038 #define _core_hcache_h_
00039
00040 #include "common.h"
00041
00042 #include "if/core/hcache.h"
00043 #include "if/core/hosts.h"
00044
00045
00046
00047
00048
00049 void hcache_init(void);
00050 void hcache_shutdown(void);
00051 void hcache_close(void);
00052 void hcache_retrieve_all(void);
00053
00054 void hcache_timer(time_t now);
00055
00056 const gchar *host_type_to_string(host_type_t type);
00057 const gchar *hcache_type_to_string(hcache_type_t type);
00058
00059 gboolean hcache_add(
00060 hcache_type_t type, const host_addr_t addr, guint16 port,
00061 const gchar *what);
00062
00063 gboolean hcache_add_caught(
00064 host_type_t type, const host_addr_t addr, guint16 port,
00065 const gchar *what);
00066
00067 gboolean hcache_add_valid(
00068 host_type_t type, const host_addr_t addr, guint16 port,
00069 const gchar *what);
00070
00071 gboolean hcache_node_is_bad(const host_addr_t addr);
00072
00073 void hcache_prune(hcache_type_t type);
00074
00075 gboolean hcache_read_finished(void);
00076 gint hcache_size(host_type_t type);
00077 gboolean hcache_is_low(host_type_t type);
00078
00079 gint hcache_fill_caught_array(
00080 host_type_t type, gnet_host_t *hosts, gint hcount);
00081
00082 void hcache_get_caught(host_type_t type, host_addr_t *addr, guint16 *port);
00083 gboolean hcache_find_nearby(host_type_t type,
00084 host_addr_t *addr, guint16 *port);
00085
00086 void hcache_store_if_dirty(host_type_t type);
00087
00088 #endif
00089