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

downloads.h File Reference

#include "lib/tm.h"
#include "lib/event.h"
#include "if/core/search.h"

Go to the source code of this file.

Data Structures

struct  vernum
struct  dl_key
struct  dl_server
struct  dl_buffers
 Structure used to control read buffering for active downloads. More...

struct  download

Defines

#define URN_INDEX   0xffffffff /**< Marking index, indicates URN instead */
 Marking index, indicates URN instead.

#define dl_server_valid(x)   ((x) != NULL && (x)->magic == DL_SERVER_MAGIC)
#define DL_F_URIRES   0x00000001 /**< We sent a "/uri-res/N2R?" request */
 We sent a "/uri-res/N2R?" request.

#define DL_F_PUSH_IGN   0x00000002 /**< Trying to ignore push flag */
 Trying to ignore push flag.

#define DL_F_OVERLAPPED   0x00000004 /**< We went through overlap checking */
 We went through overlap checking.

#define DL_F_REPLIED   0x00000008 /**< Servent replied to last request */
 Servent replied to last request.

#define DL_F_CHUNK_CHOSEN   0x00000010 /**< Retrying with specific chunk */
 Retrying with specific chunk.

#define DL_F_SHRUNK_REPLY   0x00000020 /**< Server sending less than we asked */
 Server sending less than we asked.

#define DL_F_SUNK_DATA   0x00000040 /**< Whether we previously sunk data */
 Whether we previously sunk data.

#define DL_F_ACTIVE_QUEUED   0x00000080 /**< Download is actively queued */
 Download is actively queued.

#define DL_F_PASSIVE_QUEUED   0x00000100 /**< Download is passively queued */
 Download is passively queued.

#define DL_F_DNS_LOOKUP   0x00000200 /**< Attempted DNS lookup */
 Attempted DNS lookup.

#define DL_F_BROWSE   0x00000400 /**< Browse host type (requests "/") */
 Browse host type (requests "/").

#define DL_F_TRANSIENT   0x20000000 /**< Transient, don't persist */
 Transient, don't persist.

#define DL_F_SUSPENDED   0x40000000 /**< Suspended, do not schedule */
 Suspended, do not schedule.

#define DL_F_MARK   0x80000000 /**< Marked in traversal */
 Marked in traversal.

#define DLS_A_UNUSED_1   0x00000001 /**< UNUSED */
 UNUSED.

#define DLS_A_PUSH_IGN   0x00000002 /**< Ignore pushes, connect directly */
 Ignore pushes, connect directly.

#define DLS_A_UNUSED_2   0x00000004 /**< UNUSED */
 UNUSED.

#define DLS_A_NO_HTTP_1_1   0x00000008 /**< Server does NOT support HTTP/1.1 */
 Server does NOT support HTTP/1.1.

#define DLS_A_MINIMAL_HTTP   0x00000010 /**< Use minimalist HTTP with server */
 Use minimalist HTTP with server.

#define DLS_A_BANNING   0x00000020 /**< Server might be banning us */
 Server might be banning us.

#define DLS_A_FAKE_G2   0x00000040 /**< Fake a G2 server */
 Fake a G2 server.

#define DLS_A_DNS_LOOKUP   0x00000080 /**< Perform DNS lookup if possible */
 Perform DNS lookup if possible.

#define DLS_A_REMOVED   0x80000000 /**< Server marked for removal */
 Server marked for removal.

#define download_guid(d)   ((d)->server->key->guid)
#define download_addr(d)   ((d)->server->key->addr)
#define download_port(d)   ((d)->server->key->port)
#define download_vendor(d)   ((d)->server->vendor)
#define download_country(d)   ((d)->server->country)
#define download_hostname(d)   ((d)->server->hostname)
#define download_vendor_str(d)   ((d)->server->vendor ? (d)->server->vendor : "")
#define download_path(d)   ((d)->file_info->path)
#define download_outname(d)   ((d)->file_info->file_name)
#define download_filesize(d)   ((d)->file_info->size)
#define download_filedone(d)   ((d)->file_info->done)
#define DOWNLOAD_IS_QUEUED(d)   ((d)->status == GTA_DL_QUEUED)
#define DOWNLOAD_IS_VERIFYING(d)
#define DOWNLOAD_IS_MOVING(d)
#define DOWNLOAD_IS_STOPPED(d)
#define DOWNLOAD_IS_ACTIVE(d)   ( (d)->status == GTA_DL_RECEIVING )
#define DOWNLOAD_IS_WAITING(d)   ( (d)->status == GTA_DL_TIMEOUT_WAIT)
#define DOWNLOAD_IS_ESTABLISHING(d)
#define DOWNLOAD_IS_EXPECTING_GIV(d)
#define DOWNLOAD_IS_RUNNING(d)
#define DOWNLOAD_IS_IN_PUSH_MODE(d)   (d->push)
#define DOWNLOAD_IS_VISIBLE(d)   (d->visible)

Typedefs

typedef guint32 gnet_src_t
typedef void(* src_listener_t )(gnet_src_t)
typedef download download_t

Enumerations

enum  gnet_src_ev_t {
  EV_SRC_ADDED = 0, EV_SRC_REMOVED, EV_SRC_INFO_CHANGED, EV_SRC_STATUS_CHANGED,
  EV_SRC_RANGES_CHANGED, EV_SRC_EVENTS
}
enum  dl_list {
  DL_LIST_INVALID = -1, DL_LIST_RUNNING = 0, DL_LIST_WAITING = 1, DL_LIST_STOPPED = 2,
  DL_LIST_SZ = 3
}
enum  dl_server_magic { DL_SERVER_MAGIC = 0x5e45e4ffU }
enum  download_status_t {
  GTA_DL_QUEUED = 1, GTA_DL_CONNECTING = 2, GTA_DL_PUSH_SENT = 3, GTA_DL_FALLBACK = 4,
  GTA_DL_REQ_SENT = 5, GTA_DL_HEADERS = 6, GTA_DL_RECEIVING = 7, GTA_DL_COMPLETED = 8,
  GTA_DL_ERROR = 9, GTA_DL_ABORTED = 10, GTA_DL_TIMEOUT_WAIT = 11, GTA_DL_REMOVED = 12,
  GTA_DL_VERIFY_WAIT = 13, GTA_DL_VERIFYING = 14, GTA_DL_VERIFIED = 15, GTA_DL_MOVE_WAIT = 16,
  GTA_DL_MOVING = 17, GTA_DL_DONE = 18, GTA_DL_SINKING = 19, GTA_DL_ACTIVE_QUEUED = 20,
  GTA_DL_PASSIVE_QUEUED = 21, GTA_DL_REQ_SENDING = 22
}
 Download states. More...

enum  dl_bufmode { DL_BUF_READING = 0, DL_BUF_WRITING }


Define Documentation

#define DL_F_ACTIVE_QUEUED   0x00000080 /**< Download is actively queued */
 

Download is actively queued.

#define DL_F_BROWSE   0x00000400 /**< Browse host type (requests "/") */
 

Browse host type (requests "/").

#define DL_F_CHUNK_CHOSEN   0x00000010 /**< Retrying with specific chunk */
 

Retrying with specific chunk.

#define DL_F_DNS_LOOKUP   0x00000200 /**< Attempted DNS lookup */
 

Attempted DNS lookup.

#define DL_F_MARK   0x80000000 /**< Marked in traversal */
 

Marked in traversal.

#define DL_F_OVERLAPPED   0x00000004 /**< We went through overlap checking */
 

We went through overlap checking.

#define DL_F_PASSIVE_QUEUED   0x00000100 /**< Download is passively queued */
 

Download is passively queued.

#define DL_F_PUSH_IGN   0x00000002 /**< Trying to ignore push flag */
 

Trying to ignore push flag.

#define DL_F_REPLIED   0x00000008 /**< Servent replied to last request */
 

Servent replied to last request.

#define DL_F_SHRUNK_REPLY   0x00000020 /**< Server sending less than we asked */
 

Server sending less than we asked.

#define DL_F_SUNK_DATA   0x00000040 /**< Whether we previously sunk data */
 

Whether we previously sunk data.

#define DL_F_SUSPENDED   0x40000000 /**< Suspended, do not schedule */
 

Suspended, do not schedule.

#define DL_F_TRANSIENT   0x20000000 /**< Transient, don't persist */
 

Transient, don't persist.

#define DL_F_URIRES   0x00000001 /**< We sent a "/uri-res/N2R?" request */
 

We sent a "/uri-res/N2R?" request.

#define dl_server_valid  )     ((x) != NULL && (x)->magic == DL_SERVER_MAGIC)
 

#define DLS_A_BANNING   0x00000020 /**< Server might be banning us */
 

Server might be banning us.

#define DLS_A_DNS_LOOKUP   0x00000080 /**< Perform DNS lookup if possible */
 

Perform DNS lookup if possible.

#define DLS_A_FAKE_G2   0x00000040 /**< Fake a G2 server */
 

Fake a G2 server.

#define DLS_A_MINIMAL_HTTP   0x00000010 /**< Use minimalist HTTP with server */
 

Use minimalist HTTP with server.

#define DLS_A_NO_HTTP_1_1   0x00000008 /**< Server does NOT support HTTP/1.1 */
 

Server does NOT support HTTP/1.1.

#define DLS_A_PUSH_IGN   0x00000002 /**< Ignore pushes, connect directly */
 

Ignore pushes, connect directly.

#define DLS_A_REMOVED   0x80000000 /**< Server marked for removal */
 

Server marked for removal.

#define DLS_A_UNUSED_1   0x00000001 /**< UNUSED */
 

UNUSED.

#define DLS_A_UNUSED_2   0x00000004 /**< UNUSED */
 

UNUSED.

#define download_addr  )     ((d)->server->key->addr)
 

#define download_country  )     ((d)->server->country)
 

#define download_filedone  )     ((d)->file_info->done)
 

#define download_filesize  )     ((d)->file_info->size)
 

#define download_guid  )     ((d)->server->key->guid)
 

#define download_hostname  )     ((d)->server->hostname)
 

#define DOWNLOAD_IS_ACTIVE  )     ( (d)->status == GTA_DL_RECEIVING )
 

#define DOWNLOAD_IS_ESTABLISHING  ) 
 

Value:

(  (d)->status == GTA_DL_CONNECTING \
    || (d)->status == GTA_DL_PUSH_SENT  \
    || (d)->status == GTA_DL_FALLBACK   \
    || (d)->status == GTA_DL_REQ_SENT   \
    || (d)->status == GTA_DL_REQ_SENDING    \
    || (d)->status == GTA_DL_ACTIVE_QUEUED  \
    || (d)->status == GTA_DL_SINKING    \
    || (d)->status == GTA_DL_HEADERS    )

#define DOWNLOAD_IS_EXPECTING_GIV  ) 
 

Value:

(  (d)->status == GTA_DL_PUSH_SENT  \
    || (d)->status == GTA_DL_FALLBACK   )

#define DOWNLOAD_IS_IN_PUSH_MODE  )     (d->push)
 

#define DOWNLOAD_IS_MOVING  ) 
 

Value:

(  (d)->status == GTA_DL_MOVE_WAIT  \
    || (d)->status == GTA_DL_MOVING     )

#define DOWNLOAD_IS_QUEUED  )     ((d)->status == GTA_DL_QUEUED)
 

#define DOWNLOAD_IS_RUNNING  ) 
 

Value:

#define DOWNLOAD_IS_STOPPED  ) 
 

Value:

(  (d)->status == GTA_DL_ABORTED    \
    || (d)->status == GTA_DL_ERROR      \
    || (d)->status == GTA_DL_COMPLETED  \
    || DOWNLOAD_IS_VERIFYING(d)         \
    || DOWNLOAD_IS_MOVING(d)            \
    || (d)->status == GTA_DL_DONE       )

#define DOWNLOAD_IS_VERIFYING  ) 
 

Value:

(  (d)->status == GTA_DL_VERIFY_WAIT \
    || (d)->status == GTA_DL_VERIFYING   \
    || (d)->status == GTA_DL_VERIFIED    )

#define DOWNLOAD_IS_VISIBLE  )     (d->visible)
 

#define DOWNLOAD_IS_WAITING  )     ( (d)->status == GTA_DL_TIMEOUT_WAIT)
 

#define download_outname  )     ((d)->file_info->file_name)
 

#define download_path  )     ((d)->file_info->path)
 

#define download_port  )     ((d)->server->key->port)
 

#define download_vendor  )     ((d)->server->vendor)
 

#define download_vendor_str  )     ((d)->server->vendor ? (d)->server->vendor : "")
 

#define URN_INDEX   0xffffffff /**< Marking index, indicates URN instead */
 

Marking index, indicates URN instead.


Typedef Documentation

typedef struct download download_t
 

typedef guint32 gnet_src_t
 

typedef void(* src_listener_t)(gnet_src_t)
 


Enumeration Type Documentation

enum dl_bufmode
 

Enumeration values:
DL_BUF_READING 
DL_BUF_WRITING 

enum dl_list
 

Enumeration values:
DL_LIST_INVALID 
DL_LIST_RUNNING 
DL_LIST_WAITING 
DL_LIST_STOPPED 
DL_LIST_SZ 

enum dl_server_magic
 

Enumeration values:
DL_SERVER_MAGIC 

enum download_status_t
 

Download states.

Enumeration values:
GTA_DL_QUEUED  Download queued, will start later.
GTA_DL_CONNECTING  We are connecting to the server.
GTA_DL_PUSH_SENT  Sent a push, waiting connection.
GTA_DL_FALLBACK  Direct request failed, using push.
GTA_DL_REQ_SENT  Request sent, waiting for HTTP headers.
GTA_DL_HEADERS  We are receiving the HTTP headers.
GTA_DL_RECEIVING  We are receiving the data of the file.
GTA_DL_COMPLETED  Download is completed.
GTA_DL_ERROR  Download is stopped due to error.
GTA_DL_ABORTED  User used the 'Abort Download' button.
GTA_DL_TIMEOUT_WAIT  Waiting to try connecting again.
GTA_DL_REMOVED  Download was removed, pending free.
GTA_DL_VERIFY_WAIT  Waiting to verify SHA1.
GTA_DL_VERIFYING  Computing SHA1.
GTA_DL_VERIFIED  Verify of SHA1 done.
GTA_DL_MOVE_WAIT  Waiting to be moved to "done/bad" dir.
GTA_DL_MOVING  Being moved to "done/bad" dir.
GTA_DL_DONE  All done!
GTA_DL_SINKING  Sinking HTML reply.
GTA_DL_ACTIVE_QUEUED  Actively queued.
GTA_DL_PASSIVE_QUEUED  Passively queued.
GTA_DL_REQ_SENDING  Sending HTTP request.

enum gnet_src_ev_t
 

Enumeration values:
EV_SRC_ADDED 
EV_SRC_REMOVED 
EV_SRC_INFO_CHANGED 
EV_SRC_STATUS_CHANGED 
EV_SRC_RANGES_CHANGED 
EV_SRC_EVENTS 


Generated on Sun Feb 12 10:50:00 2006 for Gtk-Gnutella by doxygen 1.3.6