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
00036 #ifndef _core_pcache_h_
00037 #define _core_pcache_h_
00038
00039 #include "common.h"
00040 #include "hcache.h"
00041 #include "if/core/nodes.h"
00042 #include "gnutella.h"
00043
00044 struct gnutella_node;
00045
00049 typedef struct pong_meta {
00050 guchar vendor[4];
00051 guchar language[2];
00052 guchar country[2];
00053 guint8 guess;
00055 host_addr_t ipv6_addr;
00057 host_addr_t sender_addr;
00058 guint16 sender_port;
00060 guint32 daily_uptime;
00061 guint8 up_slots;
00062 guint8 leaf_slots;
00063 guint8 version_up;
00064 guint8 version_ua;
00065 guint8 flags;
00066 } pong_meta_t;
00067
00068 enum {
00069 PONG_META_HAS_VC = (1 << 0),
00070 PONG_META_HAS_GUE = (1 << 1),
00071 PONG_META_HAS_UP = (1 << 2),
00072 PONG_META_HAS_LOC = (1 << 3),
00073 PONG_META_HAS_DU = (1 << 4),
00074 PONG_META_HAS_IPV6 = (1 << 5),
00075 PONG_META_HAS_TLS = (1 << 6)
00076 };
00077
00082 gnutella_msg_init_t *build_ping_msg(
00083 const gchar *muid, guint8 ttl, gboolean uhc, guint32 *size);
00084
00085
00086
00087
00088
00089 void pcache_init(void);
00090 void pcache_close(void);
00091 void pcache_set_peermode(node_peer_t mode);
00092 void pcache_possibly_expired(time_t now);
00093 void pcache_outgoing_connection(struct gnutella_node *n);
00094 void pcache_ping_received(struct gnutella_node *n);
00095 void pcache_pong_received(struct gnutella_node *n);
00096 void pcache_pong_fake(struct gnutella_node *n,
00097 const host_addr_t addr, guint16 port);
00098 gboolean pcache_get_recent(host_type_t type, host_addr_t *addr, guint16 *port);
00099 void pcache_clear_recent(host_type_t type);
00100
00101 #endif
00102