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

oob.c File Reference


Detailed Description

Out of band query hits.

Author:
Raphael Manfredi
Date:
2004

#include "common.h"
#include "oob.h"
#include "hosts.h"
#include "nodes.h"
#include "share.h"
#include "guid.h"
#include "pmsg.h"
#include "mq.h"
#include "mq_udp.h"
#include "vmsg.h"
#include "qhit.h"
#include "gmsg.h"
#include "gnet_stats.h"
#include "if/gnet_property_priv.h"
#include "lib/atoms.h"
#include "lib/cq.h"
#include "lib/fifo.h"
#include "lib/walloc.h"
#include "lib/override.h"

Data Structures

struct  oob_results
 A set of hits awaiting delivery. More...

struct  gservent
 A servent entry, used as values in the `servent_by_host' table. More...


Defines

#define OOB_EXPIRE_MS   (2*60*1000) /**< 2 minutes at most */
 2 minutes at most

#define OOB_TIMEOUT_MS   (45*1000) /**< 45 secs for them to reply */
 45 secs for them to reply

#define OOB_DELIVER_MS   (5*1000) /**< 1 message queued every 5 secs */
 1 message queued every 5 secs

#define OOB_MAX_QUEUED   50 /**< Max # of messages per host */
 Max # of messages per host.

#define OOB_MAX_RETRY   3 /**< Retry # if LIME/12v2 dropped */
 Retry # if LIME/12v2 dropped.

#define OOB_MAX_QHIT_SIZE   645 /**< Flush hits larger than this */
 Flush hits larger than this.


Functions

 RCSID ("$Id:oob.c, v 1.22 2005/10/01 11:45:48 nonamer Exp $")
void results_destroy (cqueue_t *cq, gpointer obj)
 Callout queue callback to free the results.

void servent_free (struct gservent *s)
 Free servent structure.

void oob_send_reply_ind (struct oob_results *r)
 Send them a LIME/12v2, monitoring progress in queue via a callback.

oob_resultsresults_make (gchar *muid, GSList *files, gint count, gnet_host_t *to, gboolean ggep_h)
 Create new "struct oob_results" to handle the initial negotiation of results delivery via the sent LIME/12v2 and the expected LIME/11v2 reply.

void results_free_remove (struct oob_results *r)
 Dispose of results.

void results_timeout (cqueue_t *unused_cq, gpointer obj)
 Callout queue callback to free the results.

void servent_free_remove (struct gservent *s)
 Dispose of servent, removing entry from the `servent_by_host' table.

void servent_service (cqueue_t *cq, gpointer obj)
 Service servent's FIFO: send next packet, and re-arm servicing callback if there are more data to send.

gserventservent_make (gnet_host_t *host)
 Create a new servent structure.

void free_pmsg (gpointer item, gpointer unused_udata)
 Cleanup items from FIFO.

void oob_record_hit (gpointer data, size_t len, gpointer udata)
 Invoked via qhit_build_results() for each fully built query hit message.

void oob_deliver_hits (struct gnutella_node *n, gchar *muid, guint8 wanted)
 The remote host acknowledges that we have some hits for it and wishes to get the specified amount.

void oob_pmsg_free (pmsg_t *mb, gpointer arg)
 Callback invoked when the LIME/12v2 message we queued is freed.

void oob_got_results (struct gnutella_node *n, GSList *files, gint count, gboolean use_ggep_h)
 Notification that we got matches for a query from some node that needs to be replied to using out-of-band delivery.

void oob_init (void)
 Initialize out-of-band query hit delivery.

void free_oob_kv (gpointer key, gpointer value, gpointer unused_udata)
 Cleanup oob_results -- hash table iterator callback.

void free_servent_kv (gpointer key, gpointer value, gpointer unused_udata)
 Cleanup servent -- hash table iterator callback.

void oob_shutdown (void)
 Cleanup at shutdown time.

void oob_close (void)
 Final cleanup.


Variables

GHashTable * results_by_muid = NULL
 Indexes all OOB queries by MUID.

GHashTable * servent_by_host = NULL
 Each servent, as identified by its IP:port, is given a FIFO for queuing messages and sending them at a rate of 1 message every OOB_DELIVER_MS, to avoid UDP flooding on the remote side.

gint num_oob_records
 Leak and duplicate free detector.


Define Documentation

#define OOB_DELIVER_MS   (5*1000) /**< 1 message queued every 5 secs */
 

1 message queued every 5 secs

#define OOB_EXPIRE_MS   (2*60*1000) /**< 2 minutes at most */
 

2 minutes at most

#define OOB_MAX_QHIT_SIZE   645 /**< Flush hits larger than this */
 

Flush hits larger than this.

#define OOB_MAX_QUEUED   50 /**< Max # of messages per host */
 

Max # of messages per host.

#define OOB_MAX_RETRY   3 /**< Retry # if LIME/12v2 dropped */
 

Retry # if LIME/12v2 dropped.

#define OOB_TIMEOUT_MS   (45*1000) /**< 45 secs for them to reply */
 

45 secs for them to reply


Function Documentation

void free_oob_kv gpointer  key,
gpointer  value,
gpointer  unused_udata
[static]
 

Cleanup oob_results -- hash table iterator callback.

void free_pmsg gpointer  item,
gpointer  unused_udata
[static]
 

Cleanup items from FIFO.

-- fifo_free_all() callback.

void free_servent_kv gpointer  key,
gpointer  value,
gpointer  unused_udata
[static]
 

Cleanup servent -- hash table iterator callback.

void oob_close void   ) 
 

Final cleanup.

void oob_deliver_hits struct gnutella_node n,
gchar *  muid,
guint8  wanted
 

The remote host acknowledges that we have some hits for it and wishes to get the specified amount.

Parameters:
n where we got the message from
muid the query identifier
wanted the amount of results they want delivered

void oob_got_results struct gnutella_node n,
GSList *  files,
gint  count,
gboolean  use_ggep_h
 

Notification that we got matches for a query from some node that needs to be replied to using out-of-band delivery.

Parameters:
n the node from which we got the query
files the list of shared_file_t entries that make up results
count the amount of results
use_ggep_h whether GGEP "H" can be used to send the SHA1 of files

void oob_init void   ) 
 

Initialize out-of-band query hit delivery.

void oob_pmsg_free pmsg_t mb,
gpointer  arg
[static]
 

Callback invoked when the LIME/12v2 message we queued is freed.

void oob_record_hit gpointer  data,
size_t  len,
gpointer  udata
[static]
 

Invoked via qhit_build_results() for each fully built query hit message.

Hit is enqueued in the FIFO, for slow delivery.

void oob_send_reply_ind struct oob_results r  )  [static]
 

Send them a LIME/12v2, monitoring progress in queue via a callback.

void oob_shutdown void   ) 
 

Cleanup at shutdown time.

RCSID "$Id:oob.  c,
v 1.22 2005/10/01 11:45:48 nonamer Exp $" 
 

void results_destroy cqueue_t unused_cq,
gpointer  obj
[static]
 

Callout queue callback to free the results.

void results_free_remove struct oob_results r  )  [static]
 

Dispose of results.

struct oob_results* results_make gchar *  muid,
GSList *  files,
gint  count,
gnet_host_t to,
gboolean  ggep_h
[static]
 

Create new "struct oob_results" to handle the initial negotiation of results delivery via the sent LIME/12v2 and the expected LIME/11v2 reply.

void results_timeout cqueue_t unused_cq,
gpointer  obj
[static]
 

Callout queue callback to free the results.

void servent_free struct gservent s  )  [static]
 

Free servent structure.

void servent_free_remove struct gservent s  )  [static]
 

Dispose of servent, removing entry from the `servent_by_host' table.

struct gservent* servent_make gnet_host_t host  )  [static]
 

Create a new servent structure.

Parameters:
host the servent's IP:port. Caller may free it upon return.

void servent_service cqueue_t cq,
gpointer  obj
[static]
 

Service servent's FIFO: send next packet, and re-arm servicing callback if there are more data to send.


Variable Documentation

gint num_oob_records [static]
 

Leak and duplicate free detector.

GHashTable* results_by_muid = NULL [static]
 

Indexes all OOB queries by MUID.

This hash table records MUID => "struct oob_results"

GHashTable* servent_by_host = NULL [static]
 

Each servent, as identified by its IP:port, is given a FIFO for queuing messages and sending them at a rate of 1 message every OOB_DELIVER_MS, to avoid UDP flooding on the remote side.

This hash table records gnet_host_t => "struct gservent"


Generated on Sun Feb 12 10:50:05 2006 for Gtk-Gnutella by doxygen 1.3.6