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_bh_download_h_
00037 #define _core_bh_download_h_
00038
00039 #include "common.h"
00040
00041 #include "search.h"
00042 #include "rx.h"
00043 #include "rx_link.h"
00044 #include "rx_inflate.h"
00045 #include "rx_chunk.h"
00046
00047 #include "if/core/wrap.h"
00048 #include "if/core/gnutella.h"
00049
00053 #define BH_DL_INFLATE (1 << 0)
00054 #define BH_DL_GUNZIP (1 << 1)
00055 #define BH_DL_CHUNKED (1 << 2)
00057 struct browse_ctx {
00058 gpointer owner;
00059 rxdrv_t *rx;
00060 gnet_host_t host;
00061 gnet_search_t sh;
00062 gchar *vendor;
00063 struct gnutella_header header;
00064 gchar *data;
00065 guint data_size;
00066 guint pos;
00067 guint32 size;
00068 gboolean has_header;
00069 gboolean closed;
00070 };
00071
00072
00073
00074
00075
00076 struct bio_source;
00077
00078 struct browse_ctx *browse_host_dl_create(
00079 gpointer owner, gnet_host_t *host, gnet_search_t sh);
00080 void browse_host_dl_free(struct browse_ctx *bc);
00081 gboolean browse_host_dl_for_search(struct browse_ctx *bc, gnet_search_t sh);
00082 void browse_host_dl_write(struct browse_ctx *bc, gchar *data, size_t len);
00083 gboolean browse_host_dl_receive(
00084 struct browse_ctx *bc, gnet_host_t *host, wrap_io_t *wio,
00085 const gchar *vendor, guint32 flags);
00086 struct bio_source *browse_host_io_source(struct browse_ctx *bc);
00087 void browse_host_dl_close(struct browse_ctx *bc);
00088 void browse_host_dl_search_closed(struct browse_ctx *bc, gnet_search_t sh);
00089
00090 #endif
00091
00092