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

bh_download.c File Reference


Detailed Description

Handles the client-side of the Browse Host function.

Author:
Raphael Manfredi
Date:
2005

#include "common.h"
#include "bh_download.h"
#include "downloads.h"
#include "pmsg.h"
#include "bsched.h"
#include "gnet_stats.h"
#include "lib/atoms.h"
#include "lib/endian.h"
#include "lib/walloc.h"
#include "lib/override.h"

Defines

#define BH_DL_DEFAULT_SIZE   4096 /* Default data buffer size */
#define BH_DL_MAX_SIZE   65536 /* Maximum payload size we allow */

Functions

 RCSID ("$Id:bh_download.c, v 1.6 2005/11/21 21:11:23 rmanfredi Exp $")
browse_ctxbrowse_host_dl_create (gpointer owner, gnet_host_t *host, gnet_search_t sh)
 Initialize the browse host context.

gboolean browse_host_dl_for_search (struct browse_ctx *bc, gnet_search_t sh)
 Check sure the browse-host context is for the proper search ID.

gboolean browse_data_read (struct browse_ctx *bc, pmsg_t *mb)
 Read data from the message buffer we just received.

gboolean browse_data_process (struct browse_ctx *bc)
 Process the whole message we read.

void browse_data_ind (rxdrv_t *rx, pmsg_t *mb)
 RX data indication callback used to give us some new Gnet traffic in a low-level message structure (which can contain several Gnet messages).

void browse_rx_given (gpointer o, ssize_t r)
 G_GNUC_PRINTF (2, 3)
void browse_rx_got_eof (gpointer o)
void browse_rx_done (gpointer o)
gboolean browse_host_dl_receive (struct browse_ctx *bc, gnet_host_t *host, wrap_io_t *wio, const gchar *vendor, guint32 flags)
 Prepare reception of query hit data by building an appropriate RX stack.

bio_sourcebrowse_host_io_source (struct browse_ctx *bc)
 Fetch the I/O source of the RX stack.

void browse_host_dl_write (struct browse_ctx *bc, gchar *data, size_t len)
 Received data from outside the RX stack.

void browse_host_dl_close (struct browse_ctx *bc)
 Disable the RX stack.

void browse_host_dl_free (struct browse_ctx *bc)
 Terminate host browsing.

void browse_host_dl_search_closed (struct browse_ctx *bc, gnet_search_t sh)
 Signal that the corresponding search was closed.


Variables

const struct rx_link_cb browse_rx_link_cb
const struct rx_chunk_cb browse_rx_chunk_cb
const struct rx_inflate_cb browse_rx_inflate_cb


Define Documentation

#define BH_DL_DEFAULT_SIZE   4096 /* Default data buffer size */
 

#define BH_DL_MAX_SIZE   65536 /* Maximum payload size we allow */
 


Function Documentation

void browse_data_ind rxdrv_t rx,
pmsg_t mb
[static]
 

RX data indication callback used to give us some new Gnet traffic in a low-level message structure (which can contain several Gnet messages).

gboolean browse_data_process struct browse_ctx bc  )  [static]
 

Process the whole message we read.

Returns:
FALSE if an error was reported (processing aborted).

gboolean browse_data_read struct browse_ctx bc,
pmsg_t mb
[static]
 

Read data from the message buffer we just received.

Returns:
TRUE whilst we think there is more data to read in the buffer.

void browse_host_dl_close struct browse_ctx bc  ) 
 

Disable the RX stack.

struct browse_ctx* browse_host_dl_create gpointer  owner,
gnet_host_t host,
gnet_search_t  sh
 

Initialize the browse host context.

gboolean browse_host_dl_for_search struct browse_ctx bc,
gnet_search_t  sh
 

Check sure the browse-host context is for the proper search ID.

void browse_host_dl_free struct browse_ctx bc  ) 
 

Terminate host browsing.

gboolean browse_host_dl_receive struct browse_ctx bc,
gnet_host_t host,
wrap_io_t wio,
const gchar *  vendor,
guint32  flags
 

Prepare reception of query hit data by building an appropriate RX stack.

Returns:
TRUE if we may continue with the download, FALSE if the search was already closed in the GUI.

void browse_host_dl_search_closed struct browse_ctx bc,
gnet_search_t  sh
 

Signal that the corresponding search was closed.

void browse_host_dl_write struct browse_ctx bc,
gchar *  data,
size_t  len
 

Received data from outside the RX stack.

struct bio_source* browse_host_io_source struct browse_ctx bc  ) 
 

Fetch the I/O source of the RX stack.

void browse_rx_done gpointer  o  )  [static]
 

void browse_rx_given gpointer  o,
ssize_t  r
[static]
 

void browse_rx_got_eof gpointer  o  )  [static]
 

G_GNUC_PRINTF ,
[static]
 

RCSID "$Id:bh_download.  c,
v 1.6 2005/11/21 21:11:23 rmanfredi Exp $" 
 


Variable Documentation

const struct rx_chunk_cb browse_rx_chunk_cb [static]
 

Initial value:

 {
    browse_rx_error,        
    browse_rx_done,         
}

const struct rx_inflate_cb browse_rx_inflate_cb [static]
 

Initial value:

 {
    NULL,                   
    browse_rx_error,        
}

const struct rx_link_cb browse_rx_link_cb [static]
 

Initial value:

 {
    browse_rx_given,        
    browse_rx_error,        
    browse_rx_got_eof,      
}


Generated on Sun Feb 12 10:49:59 2006 for Gtk-Gnutella by doxygen 1.3.6