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

uploads.h

Go to the documentation of this file.
00001 /*
00002  * $Id: uploads.h,v 1.16 2005/12/01 20:23:23 rmanfredi Exp $
00003  *
00004  * Copyright (c) 2001-2003, Raphael Manfredi
00005  * Copyright (c) 2000 Daniel Walker (dwalker@cats.ucsc.edu)
00006  *
00007  *----------------------------------------------------------------------
00008  * This file is part of gtk-gnutella.
00009  *
00010  *  gtk-gnutella is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  gtk-gnutella is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with gtk-gnutella; if not, write to the Free Software
00022  *  Foundation, Inc.:
00023  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *----------------------------------------------------------------------
00025  */
00026 
00039 #ifndef _core_uploads_h_
00040 #define _core_uploads_h_
00041 
00042 #include "common.h"
00043 #include "bsched.h"
00044 #include "bh_upload.h"
00045 
00046 #include "if/core/uploads.h"
00047 
00048 struct gnutella_node;
00049 struct dl_file_info;
00050 
00051 typedef struct upload {
00052     gnet_upload_t upload_handle;
00053     guint32 flags;                  
00054     upload_stage_t status;
00055     struct gnutella_socket *socket;
00056     gint error_sent;                
00057     gpointer io_opaque;             
00058     gpointer parq_opaque;           
00060     gint file_desc;
00061     bio_source_t *bio;              
00062     sendfile_ctx_t sendfile_ctx;
00063     struct special_ctx *special;    
00065     gchar *buffer;
00066     gint bpos;
00067     gint bsize;
00068     gint buf_size;
00069 
00070     guint index;
00071     gchar *name;
00072     filesize_t file_size;
00073 
00074     time_t start_date;
00075     time_t last_update;
00076 
00077     struct dl_file_info *file_info; 
00079     host_addr_t addr;           
00080     gchar *user_agent;          
00081     gint country;               
00082     filesize_t skip;            
00083     filesize_t end;             
00084     filesize_t pos;             
00085     filesize_t sent;            
00087     host_addr_t gnet_addr;      
00088     guint16 gnet_port;          
00090     guint32 last_dmesh;         
00091     gchar *sha1;                
00092     filesize_t total_requested; 
00093     gint http_major;            
00094     gint http_minor;            
00096     gboolean keep_alive;        
00097     gboolean push;
00098     gboolean queue;             
00099     gboolean accounted;         
00100     gboolean unavailable_range; 
00101     gboolean n2r;               
00102     gboolean browse_host;       
00103     gboolean from_browser;      
00105     gboolean parq_status;
00106 } gnutella_upload_t;
00107 
00108 #define upload_vendor_str(u)    ((u)->user_agent ? (u)->user_agent : "")
00109 
00110 /*
00111  * Operating flags
00112  */
00113 
00114 #define UPLOAD_F_STALLED        0x00000001  
00115 #define UPLOAD_F_EARLY_STALL    0x00000002  
00120 struct upload_http_cb {
00121     gnutella_upload_t *u;           
00122     time_t now;                     
00123     time_t mtime;                   
00124     struct shared_file *sf;         
00125 };
00126 
00127 /*
00128  * Global Data
00129  */
00130 
00131 /*
00132  * Global Functions
00133  */
00134 
00135 gboolean upload_is_enabled(void);
00136 void upload_timer(time_t now);
00137 void upload_remove(struct upload *, const gchar *, ...) G_GNUC_PRINTF(2, 3);
00138 void handle_push_request(struct gnutella_node *);
00139 void upload_add(struct gnutella_socket *s);
00140 void upload_connect_conf(struct upload *u);
00141 void upload_init(void);
00142 void upload_close(void);
00143 void upload_stop_all(struct dl_file_info *fi, const gchar *reason);
00144 void upload_send_giv(const host_addr_t addr, guint16 port, guint8 hops,
00145     guint8 ttl, guint32 file_index, const gchar *file_name,
00146     gboolean banning, guint32 flags);
00147 gnutella_upload_t *upload_create(struct gnutella_socket *s, gboolean push);
00148 void upload_fire_upload_info_changed(gnutella_upload_t *n);
00149 void expect_http_header(gnutella_upload_t *u, upload_stage_t new_status);
00150 
00151 #endif /* _core_uploads_h_ */
00152 
00153 /* vi: set ts=4 sw=4 cindent: */

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