|
Data Structures |
struct | message |
| An entry in the routing table. More...
|
struct | route_data |
| We don't store a list of nodes in the message structure, but a list of route_data: the reason is that nodes can go away, but we don't want to traverse the whole routing table to reclaim all the places where they were referenced. More...
|
struct | route_log |
| Routing logging. More...
|
Defines |
#define | QUERY_HIT_ROUTE_SAVE 0 /**< Function used to store QHit GUIDs */ |
| Function used to store QHit GUIDs.
|
#define | CHUNK_BITS 14 /**< log2 of # messages stored in a chunk */ |
| log2 of # messages stored in a chunk
|
#define | MAX_CHUNKS 32 /**< Max # of chunks */ |
| Max # of chunks.
|
#define | TABLE_MIN_CYCLE 1800 /**< 30 minutes at least */ |
| 30 minutes at least
|
#define | CHUNK_MESSAGES (1 << CHUNK_BITS) |
#define | CHUNK_INDEX(x) (((x) & ~(CHUNK_MESSAGES - 1)) >> CHUNK_BITS) |
#define | ENTRY_INDEX(x) ((x) & (CHUNK_MESSAGES - 1)) |
#define | BANNED_PUSH_COUNT G_N_ELEMENTS(banned_push) |
Functions |
| RCSID ("$Id:routing.c, v 1.37 2005/10/20 06:39:19 cbiere Exp $") |
gboolean | find_message (const gchar *muid, guint8 function, struct message **m) |
| Look for a particular message in the routing tables.
|
void | free_route_list (struct message *m) |
| Dispose of route list in message.
|
void | routing_log_init (struct route_log *log, struct gnutella_node *n, const gchar *muid, guint8 function, guint8 hops, guint8 ttl) |
| Record message parameters.
|
void | routing_log_set_route (struct route_log *log, struct route_dest *dest, gboolean handle) |
| Record message's route.
|
void | routing_log_set_new (struct route_log *log) |
| Mark message as being new.
|
void | routing_log_extra (struct route_log *log, const gchar *fmt,...) |
| Record extra logging information, appending to existing information.
|
gchar * | route_string (struct route_dest *dest, const host_addr_t origin_addr) |
void | routing_log_flush (struct route_log *log) |
| Emit log message.
|
const gchar * | route_mangled_oob_muid (const gchar *muid) |
| Mangle OOB query MUID by zeroing the parts of the MUID where the IP:port are recorded.
|
route_data * | get_routing_data (struct gnutella_node *n) |
| Used to ensure type safety when accessing the routing_data field.
|
void | init_routing_data (struct gnutella_node *node) |
| If a node doesn't currently have routing data attached, this creates and attaches some.
|
void | clean_entry (struct message *entry) |
| Clean already allocated entry.
|
message * | prepare_entry (struct message **entryp) |
| Prepare entry, cleaning any old value we can find at the referenced slot.
|
message ** | get_next_slot (void) |
| Fetch next routing table slot, a pointer to a routing entry.
|
message * | get_next_entry (void) |
| Fetch next routing table entry to be able to store routing information.
|
void | revitalize_entry (struct message *entry, gboolean force) |
| When a precious route (for query hit or push) is used, revitalize the entry by moving it to the end of the "message_array[]", thereby making it unlikely that it expires soon.
|
gboolean | node_sent_message (struct gnutella_node *n, struct message *m) |
| Did node send the message?
|
gboolean | node_ttl_higher (struct gnutella_node *n, struct message *m, guint8 ttl) |
| For a broadcasted message which is known to have already been sent, check whether the TTL of the message previously seen is less than the one we just got.
|
gint | message_compare_func (gconstpointer a, gconstpointer b) |
| compares two message structures
|
guint | message_hash_func (gconstpointer key) |
| Hashes message structures for storage in a hash table.
|
void | routing_init (void) |
| Init function.
|
void | message_set_muid (struct gnutella_header *header, guint8 function) |
| Generate a new muid and put it in a message header.
|
void | remove_one_message_reference (struct route_data *rd) |
| The route references one less message.
|
void | routing_node_remove (struct gnutella_node *node) |
| Erase a node from the routing tables.
|
void | message_add (const gchar *muid, guint8 function, struct gnutella_node *node) |
| Adds a new message in the routing tables.
|
void | purge_dangling_references (struct message *m) |
| Remove references to routing data that is no longer associated with a node, within the route list of the message.
|
gboolean | check_hops_ttl (struct route_log *log, struct gnutella_node *sender) |
| Ensure sane hops and TTL counts.
|
gboolean | forward_message (struct route_log *log, struct gnutella_node **node, struct gnutella_node *target, struct route_dest *dest, GSList *routes, gboolean duplicate) |
| Forwards message to one node if `target' is non-NULL, or to all nodes but the sender otherwise.
|
gboolean | check_duplicate (struct route_log *log, struct gnutella_node **node, const gchar *mangled, struct message **mp) |
| Lookup message in the routing table and check whether we have a duplicate.
|
gboolean | route_push (struct route_log *log, struct gnutella_node **node, struct route_dest *dest, gboolean duplicate) |
| Route a push message.
|
gboolean | route_query (struct route_log *log, struct gnutella_node **node, struct route_dest *dest, gboolean duplicate) |
| Route a query message.
|
gboolean | route_query_hit (struct route_log *log, struct gnutella_node **node, struct route_dest *dest) |
| Route a query hit message.
|
gboolean | route_message (struct gnutella_node **node, struct route_dest *dest) |
| Main route computation function.
|
gboolean | route_exists_for_reply (const gchar *muid, guint8 function) |
| Check whether we have a route for the reply that would be generated for this request.
|
GSList * | route_towards_guid (const gchar *guid) |
| Check whether we have a route to the given GUID, in order to send pushes.
|
void | route_proxy_remove (gchar *guid) |
| Remove push-proxy entry indexed by GUID.
|
gboolean | route_proxy_add (gchar *guid, struct gnutella_node *n) |
| Add push-proxy route to GUID `guid', which is node `n'.
|
gnutella_node * | route_proxy_find (gchar *guid) |
| Find node to which we are connected with supplied GUID and who requested that we act as its push-proxy.
|
void | free_banned_push (gpointer key, gpointer unused_value, gpointer unused_udata) |
| Frees the banned GUID atom keys.
|
void | routing_close (void) |
| Destroy routing data structures.
|
Variables |
gnutella_node * | fake_node |
| Our fake node.
|
route_data | fake_route |
| Our fake route_data.
|
const gchar * | debug_msg [256] |
struct { |
message ** chunks [MAX_CHUNKS] |
gint next_idx |
gint capacity |
gint count |
GHashTable * messages_hashed |
time_t last_rotation |
} | routing |
const gchar *const | banned_push [] |
| "banned" GUIDs for push routing.
|
GHashTable * | ht_banned_push = NULL |
GHashTable * | ht_proxyfied = NULL |
| Push-proxy table.
|