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_dmesh_h_
00037 #define _core_dmesh_h_
00038
00039 #include "downloads.h"
00040
00041 #include <glib.h>
00042 #include <errno.h>
00043
00055 typedef struct {
00056 gchar *name;
00057 guint idx;
00058 host_addr_t addr;
00059 guint16 port;
00060 } dmesh_urlinfo_t;
00061
00066 typedef enum {
00067 DMESH_URL_OK = 0,
00068 DMESH_URL_HTTP_PARSER,
00069 DMESH_URL_BAD_FILE_PREFIX,
00070 DMESH_URL_RESERVED_INDEX,
00071 DMESH_URL_NO_FILENAME,
00072 DMESH_URL_BAD_ENCODING
00073 } dmesh_url_error_t;
00074
00075 extern dmesh_url_error_t dmesh_url_errno;
00076
00077
00078
00079
00080
00081 void dmesh_init(void);
00082 void dmesh_close(void);
00083
00084 const gchar *dmesh_url_strerror(dmesh_url_error_t errnum);
00085 gboolean dmesh_url_parse(const gchar *url, dmesh_urlinfo_t *info);
00086
00087 gboolean dmesh_add(
00088 gchar *sha1, const host_addr_t addr, guint16 port, guint idx, gchar *name,
00089 time_t stamp);
00090
00091 gboolean dmesh_remove(
00092 const gchar *sha1, const host_addr_t addr, guint16 port, guint idx,
00093 gchar *name);
00094
00095 gint dmesh_count(const gchar *sha1);
00096
00097 gboolean dmesh_collect_sha1(const gchar *value, gchar *digest);
00098 void dmesh_collect_locations(gchar *sha1, gchar *value, gboolean defer);
00099 void dmesh_collect_compact_locations(gchar *sha1, gchar *value);
00100 gint dmesh_fill_alternate(const gchar *sha1, gnet_host_t *hvec, gint hcnt);
00101
00102 gint dmesh_alternate_location(
00103 const gchar *sha1, gchar * buf, size_t size, const host_addr_t addr,
00104 time_t last_sent, const gchar *vendor, fileinfo_t *fi,
00105 gboolean request);
00106
00107 void dmesh_multiple_downloads(
00108 gchar *sha1, filesize_t size, fileinfo_t *fi);
00109
00110 void dmesh_check_results_set(gnet_results_set_t *rs);
00111
00112 void dmesh_store(void);
00113 void dmesh_ban_store(void);
00114
00115 #endif
00116
00117