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

dmesh.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dmesh.h,v 1.11 2005/09/04 21:34:35 cbiere Exp $
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 "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  * Public interface
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  /* _core_dmesh_h_ */
00116 
00117 /* vi: set ts=4 sw=4 cindent: */

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