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_parq_h_
00037 #define _core_parq_h_
00038
00039 #include "lib/header.h"
00040 #include "downloads.h"
00041 #include "uploads.h"
00042
00043 #include "if/core/parq.h"
00044
00045 #define PARQ_MAX_UL_RETRY_DELAY 1200
00046 #define PARQ_GRACE_TIME 90
00048
00049
00050
00051
00052 void parq_init(void);
00053 void parq_close(void);
00054
00055 const gchar *get_parq_dl_id(const struct download *d);
00056 void parq_dl_reparent_id(struct download *d, struct download *cd);
00057
00058 gpointer parq_dl_create(struct download *d);
00059 void parq_dl_add_id(struct download *d, const gchar *new_id);
00060 void parq_dl_remove(struct download *d);
00061 void parq_dl_free(struct download *d);
00062
00063 void parq_download_retry_active_queued(struct download *d);
00064 gboolean parq_download_supports_parq(header_t *header);
00065 gboolean parq_download_parse_queue_status(struct download *d, header_t *header);
00066 gboolean parq_download_is_active_queued(struct download *d);
00067 void parq_download_add_header(
00068 gchar *buf, size_t len, size_t *rw, struct download *d);
00069 gboolean parq_download_is_passive_queued(struct download *d);
00070 void parq_download_queue_ack(struct gnutella_socket *s);
00071
00072 void parq_upload_timer(time_t now);
00073 void parq_upload_add_header(
00074 gchar *buf, gint *retval, gpointer arg, guint32 flags);
00075 void parq_upload_add_header_id(
00076 gchar *buf, gint *retval, gpointer arg, guint32 flags);
00077 gpointer parq_upload_get(
00078 gnutella_upload_t *u, header_t *header, gboolean replacing);
00079 gboolean parq_upload_request(gnutella_upload_t *u, guint used_slots);
00080 gboolean parq_upload_request_force(gnutella_upload_t *u, gpointer handle,
00081 guint used_slots);
00082 guint parq_upload_lookup_position(const gnutella_upload_t *u);
00083 const gchar * parq_upload_lookup_id(const gnutella_upload_t *u);
00084 gboolean parq_upload_queue_full(gnutella_upload_t *u);
00085 guint parq_upload_lookup_size(const gnutella_upload_t *u);
00086 gboolean parq_upload_addr_can_proceed(const gnutella_upload_t *u);
00087
00088 time_t parq_upload_lookup_lifetime(const gnutella_upload_t *u);
00089 time_t parq_upload_lookup_retry(const gnutella_upload_t *u);
00090 guint parq_upload_lookup_eta(const gnutella_upload_t *u);
00091 guint parq_upload_lookup_queue_no(const gnutella_upload_t *u);
00092 gboolean parq_upload_lookup_quick(const gnutella_upload_t *u);
00093
00094 gboolean parq_upload_queued(gnutella_upload_t *u);
00095 gboolean parq_upload_remove(gnutella_upload_t *u);
00096 void parq_upload_collect_stats(const gnutella_upload_t *u);
00097 void parq_upload_upload_got_freed(gnutella_upload_t *u);
00098 void parq_upload_upload_got_cloned(gnutella_upload_t *u, gnutella_upload_t *cu);
00099 void parq_upload_force_remove(gnutella_upload_t *u);
00100 void parq_upload_add(gnutella_upload_t *u);
00101 void parq_upload_busy(gnutella_upload_t *u, gpointer handle);
00102 void parq_upload_save_queue(void);
00103 void parq_upload_send_queue_conf(gnutella_upload_t *u);
00104
00105 gboolean parq_ul_id_sent(const gnutella_upload_t *u);
00106
00107 time_t parq_banned_source_expire(const host_addr_t addr);
00108
00109 #endif