|
Data Structures |
struct | parq_banned |
struct | parq_ul_queue |
| Holds status of current queue. More...
|
struct | parq_ul_queued_by_addr |
struct | parq_ul_queued |
| Contains the queued upload. More...
|
struct | parq_dl_queued |
| Contains the queued download status. More...
|
struct | parq_tag |
struct | parq_entry_t |
Defines |
#define | PARQ_VERSION_MAJOR 1 |
#define | PARQ_VERSION_MINOR 0 |
#define | PARQ_RETRY_SAFETY 40 /**< 40 seconds before lifetime */ |
| 40 seconds before lifetime
|
#define | PARQ_TIMER_BY_POS 30 /**< 30 seconds for each queue position */ |
| 30 seconds for each queue position
|
#define | GUARDING_TIME 45 /**< Time we keep a slot after disconnect */ |
| Time we keep a slot after disconnect.
|
#define | MIN_LIFE_TIME 90 |
#define | QUEUE_PERIOD 600 /**< Try to resend a queue every 10 min. */ |
| Try to resend a queue every 10 min.
|
#define | MAX_QUEUE 144 /**< Max amount of QUEUE we can send */ |
| Max amount of QUEUE we can send.
|
#define | MAX_QUEUE_REFUSED 2 /**< Max QUEUE they can refuse in a row */ |
| Max QUEUE they can refuse in a row.
|
#define | MAX_UPLOADS 100 /**< Avoid more than that many uploads */ |
| Avoid more than that many uploads.
|
#define | MAX_UPLOAD_QSIZE 4000 /**< Size of the PARQ queue */ |
| Size of the PARQ queue.
|
#define | MEBI (1024 * 1024) |
#define | PARQ_UL_LARGE_SIZE (300 * MEBI) |
#define | PARQ_UL_MAGIC 0x6a3900a1 |
#define | PARQ_UL_QUEUE 0x00000001 /**< Scheduled for QUEUE sending */ |
| Scheduled for QUEUE sending.
|
#define | PARQ_UL_NOQUEUE 0x00000002 /**< No IP:port, don't send QUEUE */ |
| No IP:port, don't send QUEUE.
|
#define | PARQ_UL_QUEUE_SENT 0x00000004 /**< QUEUE message sent */ |
| QUEUE message sent.
|
#define | PARQ_UL_ID_SENT 0x00000008 /**< We already sent an ID */ |
| We already sent an ID.
|
#define | PARQ_TAG(x) { CAT2(PARQ_TAG_,x), STRINGIFY(x) } |
#define | GET_ITEM(i) (parq_tag_map[(i)].str) |
#define | FOUND(i) |
#define | bs_nop(x) (x) |
Enumerations |
enum | parq_tag_t {
PARQ_TAG_UNKNOWN = 0,
PARQ_TAG_ENTERED,
PARQ_TAG_EXPIRE,
PARQ_TAG_ID,
PARQ_TAG_IP,
PARQ_TAG_NAME,
PARQ_TAG_POS,
PARQ_TAG_QUEUE,
PARQ_TAG_SHA1,
PARQ_TAG_SIZE,
PARQ_TAG_XIP,
PARQ_TAG_XPORT,
PARQ_TAG_QUEUESSENT,
PARQ_TAG_SENDNEXTQUEUE,
NUM_PARQ_TAGS
} |
Functions |
| RCSID ("$Id:parq.c, v 1.55 2006/01/10 10:32:57 cbiere Exp $") |
void | parq_dl_del_id (struct download *d) |
| Remove the memory used by the ID string, and removes it from various lists.
|
void | parq_upload_free (struct parq_ul_queued *parq_ul) |
| removes an parq_ul from the parq list and frees all its memory.
|
parq_ul_queued * | parq_upload_create (gnutella_upload_t *u) |
| Creates a new upload structure and prefills some values.
|
parq_ul_queue * | parq_upload_which_queue (gnutella_upload_t *u) |
| Looks up in which queue the current upload should be placed and if the queue doesn't exist yet it will be created.
|
parq_ul_queue * | parq_upload_new_queue () |
| Creates a new parq_ul_queue structure and places it in the ul_parqs linked list.
|
void | parq_upload_free_queue (struct parq_ul_queue *queue) |
| Frees the queue from memory and the ul_parqs linked list.
|
void | parq_upload_update_eta (struct parq_ul_queue *which_ul_queue) |
| Updates the ETA of all queued items in the given queue.
|
parq_ul_queued * | parq_upload_find (const gnutella_upload_t *u) |
| Finds an upload if available in the upload queue.
|
gint | parq_ul_rel_pos_cmp (gconstpointer a, gconstpointer b) |
| Function used to keep the relative position list sorted by relative position.
|
gboolean | parq_upload_continue (struct parq_ul_queued *uq, gint free_slots) |
void | parq_upload_decrease_all_after (struct parq_ul_queued *cur_parq_ul) |
| Decreases the position of all queued items after the given queued item.
|
void | parq_upload_load_queue () |
| Loads the saved queue status back into memory.
|
void | parq_upload_update_relative_position (struct parq_ul_queued *parq_ul) |
| Updates the relative position of all queued after the given queued item.
|
void | parq_upload_update_addr_and_name (struct parq_ul_queued *parq_ul, gnutella_upload_t *u) |
| Updates the IP and name entry in the queued structure and makes sure the hash table remains in sync.
|
void | parq_upload_register_send_queue (struct parq_ul_queued *parq_ul) |
| Possibly register the upload in the list for deferred QUEUE sending.
|
void | parq_upload_send_queue (struct parq_ul_queued *parq_ul) |
| Sends a QUEUE to a parq enabled client.
|
gboolean | parq_still_sharing (struct parq_ul_queued *) |
| Determine if we are still sharing this file, so that PARQ can determine if it makes sense to keep this file in the queue.
|
void | parq_add_banned_source (const host_addr_t addr, time_t delay) |
| Adds an ip to the parq ban list.
|
void | parq_del_banned_source (const host_addr_t addr) |
| Removes a banned ip from the parq banned list.
|
gboolean | get_header_version (gchar const *const header, guint *major, guint *minor) |
| Get header version.
|
gchar * | get_header_value (gchar *const s, gchar const *const attribute, size_t *length) |
| Get header value.
|
const gchar * | get_parq_dl_id (const struct download *d) |
| Retrieves the PARQ ID associated with an download.
|
gint | get_parq_dl_position (const struct download *d) |
| Retrieves the remote queued position associated with an download.
|
gint | get_parq_dl_queue_length (const struct download *d) |
| Retrieves the remote queue size associated with an download.
|
gint | get_parq_dl_eta (const struct download *d) |
| Retrieves the estimated time of arival for a queued download.
|
gint | get_parq_dl_retry_delay (const struct download *d) |
| Retrieves the retry rate at which a queued download should retry.
|
void | parq_download_retry_active_queued (struct download *d) |
| Active queued means we didn't close the http connection on a HTTP 503 busy when the server supports queueing.
|
guint | get_integer (const gchar *buf) |
| Convenience wrapper on top of parse_uint32().
|
void | parq_dl_remove (struct download *d) |
| Tells the parq logic that a download has been removed.
|
void | parq_dl_free (struct download *d) |
| Removes the queue information for a download from memory.
|
gpointer | parq_dl_create (struct download *d) |
| Creates a queue structure for a download.
|
void | parq_dl_add_id (struct download *d, const gchar *new_id) |
| Assigns an parq ID to a download, and places them in various lists for lookup.
|
void | parq_dl_reparent_id (struct download *d, struct download *cd) |
| Called from download_clone to reparent the PARQ ID from the parent `d' to the cloned `cd'.
|
void | parq_dl_update_id (struct download *d, const gchar *temp) |
| Updates a parq id if needed.
|
gboolean | parq_download_parse_queue_status (struct download *d, header_t *header) |
| Retrieve and parse queueing information.
|
gboolean | parq_download_is_active_queued (struct download *d) |
| Whether the download is queued remotely or not.
|
gboolean | parq_download_is_passive_queued (struct download *d) |
| Whether the download is queued remotely without keeping the connection or not.
|
void | parq_download_add_header (gchar *buf, size_t len, size_t *rw, struct download *d) |
| Needs brief description here.
|
void | parq_download_queue_ack (struct gnutella_socket *s) |
| parq_download_queue_ack
|
parq_ul_queued * | handle_to_queued (gpointer handle) |
| Convert a handle to a `parq_ul_queued' structure.
|
guint32 | parq_ul_calc_retry (struct parq_ul_queued *parq_ul) |
| Calculates the retry delay for an upload.
|
parq_ul_queued * | parq_upload_find_id (header_t *header) |
void | parq_upload_timer (time_t now) |
| Removes any PARQ uploads which show no activity.
|
gboolean | parq_upload_queue_full (gnutella_upload_t *u) |
gboolean | parq_upload_queued (gnutella_upload_t *u) |
| Whether the current upload is already queued.
|
parq_ul_queued * | parq_upload_get_at (struct parq_ul_queue *queue, int position) |
| Get parq structure at specified position.
|
gboolean | parq_upload_addr_can_proceed (const gnutella_upload_t *u) |
| Check that the IP is not already downloading more than is alllowed.
|
gboolean | parq_upload_quick_continue (struct parq_ul_queued *uq, gint used_slots) |
void | parq_upload_upload_got_cloned (gnutella_upload_t *u, gnutella_upload_t *cu) |
void | parq_upload_upload_got_freed (gnutella_upload_t *u) |
| Makes sure parq doesn't keep any internal reference to the upload structure.
|
gpointer | parq_upload_get (gnutella_upload_t *u, header_t *header, gboolean replacing) |
| Get a queue slot, either existing or new.
|
gboolean | parq_upload_request_force (gnutella_upload_t *u, gpointer handle, guint used_slots) |
| If the download may continue, true is returned.
|
gboolean | parq_upload_request (gnutella_upload_t *u, guint used_slots) |
void | parq_upload_busy (gnutella_upload_t *u, gpointer handle) |
| Mark an upload as really being active instead of just being queued.
|
void | parq_upload_add (gnutella_upload_t *unused_u) |
void | parq_upload_force_remove (gnutella_upload_t *u) |
void | parq_upload_collect_stats (const gnutella_upload_t *u) |
| Collect running stats about the completed / removed upload.
|
gboolean | parq_upload_remove (gnutella_upload_t *u) |
| When an upload is removed this function should be called so parq knows the current upload status of an upload.
|
void | parq_upload_add_header (gchar *buf, gint *retval, gpointer arg, guint32 flags) |
| Adds X-Queued status in the HTTP reply header for a queued upload.
|
void | parq_upload_add_header_id (gchar *buf, gint *retval, gpointer arg, guint32 unused_flags) |
| Adds X-Queued status in the HTTP reply header showing the queue ID for an upload getting a slot.
|
gboolean | parq_ul_id_sent (const gnutella_upload_t *u) |
| Determines whether the PARQ ID was already sent for an upload.
|
guint | parq_upload_lookup_position (const gnutella_upload_t *u) |
const gchar * | parq_upload_lookup_id (const gnutella_upload_t *u) |
guint | parq_upload_lookup_eta (const gnutella_upload_t *u) |
guint | parq_upload_lookup_size (const gnutella_upload_t *u) |
time_t | parq_upload_lookup_lifetime (const gnutella_upload_t *u) |
time_t | parq_upload_lookup_retry (const gnutella_upload_t *u) |
guint | parq_upload_lookup_queue_no (const gnutella_upload_t *u) |
gboolean | parq_upload_lookup_quick (const gnutella_upload_t *u) |
void | parq_upload_send_queue_conf (gnutella_upload_t *u) |
| 'Call back' connection was succesfull.
|
void | parq_store (gpointer data, gpointer file_ptr) |
| Saves an individual queued upload to disc.
|
void | parq_upload_save_queue (void) |
| Saves all the current queues and their items so it can be restored when the client starts up again.
|
parq_tag_t | parq_string_to_tag (const gchar *s) |
time_t | parq_banned_source_expire (const host_addr_t addr) |
void | parq_init (void) |
| Initialises the upload queue for PARQ.
|
void | parq_close (void) |
| Saves any queueing information and frees all memory used by PARQ.
|
Variables |
GHashTable * | dl_all_parq_by_id = NULL |
guint | parq_max_upload_size = MAX_UPLOAD_QSIZE |
guint | parq_upload_active_size = 20 |
| parq_upload_active_size is the maximum number of active upload slots per queue.
|
guint | parq_upload_ban_window = 600 |
const gchar | file_parq_file [] = "parq" |
GList * | ul_parqs = NULL |
| List of all queued uploads.
|
GList * | ul_parq_queue = NULL |
| To whom we need to send a QUEUE.
|
GHashTable * | ul_all_parq_by_addr_and_name = NULL |
GHashTable * | ul_all_parq_by_addr = NULL |
GHashTable * | ul_all_parq_by_id = NULL |
gboolean | enable_real_passive = TRUE |
| If enable_real_passive is TRUE, a dead upload is only marked dead, if FALZE, a dead upload is really removed and cannot reclaim its position.
|
GHashTable * | ht_banned_source = NULL |
GList * | parq_banned_sources = NULL |
gboolean | parq_shutdown = FALSE |
const struct parq_tag | parq_tag_map [] |