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

dmesh.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dmesh.h 13969 2007-06-24 11:03:15Z cbiere $
00003  *
00004  * Copyright (c) 2002-2003, Raphael Manfredi
00005  *
00006  *----------------------------------------------------------------------
00007  * This file is part of gtk-gnutella.
00008  *
00009  *  gtk-gnutella is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  gtk-gnutella is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with gtk-gnutella; if not, write to the Free Software
00021  *  Foundation, Inc.:
00022  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *----------------------------------------------------------------------
00024  */
00025 
00036 #ifndef _core_dmesh_h_
00037 #define _core_dmesh_h_
00038 
00039 #include "common.h"
00040 #include "downloads.h"
00041 
00053 typedef struct {
00054     const gchar *name;          
00055     host_addr_t addr;           
00056     guint idx;                  
00057     guint16 port;               
00058 } dmesh_urlinfo_t;
00059 
00064 typedef enum {
00065     DMESH_URL_OK = 0,           
00066     DMESH_URL_HTTP_PARSER,      
00067     DMESH_URL_BAD_FILE_PREFIX,  
00068     DMESH_URL_RESERVED_INDEX,   
00069     DMESH_URL_NO_FILENAME,      
00070     DMESH_URL_BAD_ENCODING,     
00071     DMESH_URL_BAD_URI_RES       
00072 } dmesh_url_error_t;
00073 
00074 extern dmesh_url_error_t dmesh_url_errno;
00075 
00076 /*
00077  * Public interface
00078  */
00079 
00080 void dmesh_init(void);
00081 void dmesh_close(void);
00082 
00083 const gchar *dmesh_url_strerror(dmesh_url_error_t errnum);
00084 gboolean dmesh_url_parse(const gchar *url, dmesh_urlinfo_t *info);
00085 
00086 gboolean dmesh_add(
00087     const struct sha1 *sha1, const host_addr_t addr, guint16 port, guint idx,
00088     const gchar *name, time_t stamp);
00089 
00090 gboolean dmesh_remove(
00091     const struct sha1 *sha1, const host_addr_t addr, guint16 port, guint idx,
00092     const gchar *name);
00093 
00094 void dmesh_add_alternate(const struct sha1 *sha1,
00095         host_addr_t addr, guint16 port);
00096 void dmesh_add_good_alternate(const struct sha1 *sha1,
00097         host_addr_t addr, guint16 port);
00098 void dmesh_remove_alternate(const struct sha1 *sha1,
00099         host_addr_t addr, guint16 port);
00100 void dmesh_add_alternates(const struct sha1 *sha1, const gnet_host_vec_t *vec);
00101 
00102 void dmesh_negative_alt(const struct sha1 *sha1,
00103     host_addr_t reporter, host_addr_t addr, guint16 port);
00104 void dmesh_good_mark(const struct sha1 *sha1,
00105     host_addr_t addr, guint16 port, gboolean good);
00106 
00107 gint dmesh_count(const struct sha1 *sha1);
00108 
00109 gboolean dmesh_collect_sha1(const gchar *value, struct sha1 *sha1);
00110 void dmesh_collect_locations(const struct sha1 *sha1, const gchar *value);
00111 void dmesh_collect_compact_locations(const struct sha1 *sha1,
00112         const gchar *value);
00113 void dmesh_collect_negative_locations(const struct sha1 *sha1,
00114     const gchar *value, host_addr_t reporter);
00115 gint dmesh_fill_alternate(const struct sha1 *sha1,
00116         gnet_host_t *hvec, gint hcnt);
00117 
00118 gint dmesh_alternate_location(
00119     const struct sha1 *sha1, gchar * buf, size_t size, const host_addr_t addr,
00120     time_t last_sent, const gchar *vendor, fileinfo_t *fi,
00121     gboolean request);
00122 
00123 void dmesh_multiple_downloads(
00124     const struct sha1 *sha1, filesize_t size, fileinfo_t *fi);
00125 
00126 void dmesh_check_results_set(gnet_results_set_t *rs);
00127 
00128 void dmesh_store(void);
00129 void dmesh_ban_store(void);
00130 
00131 #endif  /* _core_dmesh_h_ */
00132 
00133 /* vi: set ts=4 sw=4 cindent: */

Generated on Sat Jun 30 17:53:22 2007 for gtk-gnutella by  doxygen 1.3.9.1