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