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

qhit.h File Reference


Detailed Description

Query hit management.

Author:
Raphael Manfredi
Date:
2001-2004

#include <glib.h>

Go to the source code of this file.

Typedefs

typedef void(* qhit_process_t )(gpointer data, size_t len, gpointer udata)

Functions

void qhit_init (void)
 Initialization of the query hit generation.

void qhit_close (void)
 Shutdown cleanup.

void qhit_send_results (struct gnutella_node *n, GSList *files, gint count, const gchar *muid, gboolean use_ggep_h)
 Send as many small query hit packets as necessary to hold the `count' results held in the `files' list.

void qhit_build_results (GSList *files, gint count, size_t max_msgsize, qhit_process_t cb, gpointer udata, const gchar *muid, gboolean use_ggep_h)
 Build query hit results for later delivery.


Typedef Documentation

typedef void(* qhit_process_t)(gpointer data, size_t len, gpointer udata)
 


Function Documentation

void qhit_build_results GSList *  files,
gint  count,
size_t  max_msgsize,
qhit_process_t  cb,
gpointer  udata,
const gchar *  muid,
gboolean  use_ggep_h
 

Build query hit results for later delivery.

Results are held in the `files' list. They are packed in hits until the message reaches the `max_msgsize' limit at which time the packet is flushed and given the the `cb' callback for processing (sending, queueing, whatever).

The callback is invoked as

cb(data, len, udata)

where the query hit message is held in the `len' bytes starting at `data'. The `udata' parameter is simply user-supplied data, opaque for us.

Parameters:
files the list of shared_file_t entries that make up results
count the amount of results to deliver (first `count' files)
max_msgsize the targeted maximum hit size before flushing
cb the processor callback to invoke on each built hit
udata argument to pass to callback
muid the MUID to use on each generated hit
use_ggep_h whether GGEP "H" can be used to send the SHA1 of files

void qhit_close void   ) 
 

Shutdown cleanup.

void qhit_init void   ) 
 

Initialization of the query hit generation.

void qhit_send_results struct gnutella_node n,
GSList *  files,
gint  count,
const gchar *  muid,
gboolean  use_ggep_h
 

Send as many small query hit packets as necessary to hold the `count' results held in the `files' list.

Parameters:
n the node where we should send results to
files the list of shared_file_t entries that make up results
count the amount of results
muid the query's MUID
use_ggep_h whether GGEP "H" can be used to send the SHA1 of files


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