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

if/core/downloads.h File Reference

#include "lib/tm.h"
#include "lib/event.h"
#include "lib/list.h"
#include "lib/slist.h"
#include "core/rx.h"
#include "core/rx_link.h"
#include "core/rx_chunk.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.
#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_filesize(d)   ((d)->file_info->size)
#define download_filedone(d)   ((d)->file_info->done + (d)->file_info->buffered)
#define download_buffered(d)   ((d)->buffers == NULL ? 0 : (d)->buffers->held)
#define download_ranges(d)   ((d)->ranges)
#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)
#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_INVALID, GTA_DL_QUEUED, GTA_DL_CONNECTING, GTA_DL_PUSH_SENT,
  GTA_DL_FALLBACK, GTA_DL_REQ_SENT, GTA_DL_HEADERS, GTA_DL_RECEIVING,
  GTA_DL_COMPLETED, GTA_DL_ERROR, GTA_DL_ABORTED, GTA_DL_TIMEOUT_WAIT,
  GTA_DL_REMOVED, GTA_DL_VERIFY_WAIT, GTA_DL_VERIFYING, GTA_DL_VERIFIED,
  GTA_DL_MOVE_WAIT, GTA_DL_MOVING, GTA_DL_DONE, GTA_DL_SINKING,
  GTA_DL_ACTIVE_QUEUED, GTA_DL_PASSIVE_QUEUED, GTA_DL_REQ_SENDING, GTA_DL_IGNORING
}
 Download states. More...
enum  dl_bufmode { DL_BUF_READING = 0, DL_BUF_WRITING }
enum  download_magic { DOWNLOAD_MAGIC = 0x2dd6efe9 }
enum  {
  DL_F_URIRES = 1 << 0, DL_F_PUSH_IGN = 1 << 1, DL_F_OVERLAPPED = 1 << 2, DL_F_REPLIED = 1 << 3,
  DL_F_CHUNK_CHOSEN = 1 << 4, DL_F_SHRUNK_REPLY = 1 << 5, DL_F_SUNK_DATA = 1 << 6, DL_F_ACTIVE_QUEUED = 1 << 7,
  DL_F_PASSIVE_QUEUED = 1 << 8, DL_F_DNS_LOOKUP = 1 << 9, DL_F_BROWSE = 1 << 10, DL_F_TRANSIENT = 1 << 11,
  DL_F_SUSPENDED = 1 << 12, DL_F_MARK = 1 << 13, DL_F_PREFIX_HEAD = 1 << 14, DL_F_INITIAL = 1 << 15,
  DL_F_PAUSED = 1 << 16, DL_F_THEX = 1 << 17, DL_F_UDP_PUSH = 1 << 18, DL_F_FETCH_TTH = 1 << 19,
  DL_F_GOT_TTH = 1 << 20
}
enum  {
  DLS_A_UNUSED_1 = 1 << 0, DLS_A_PUSH_IGN = 1 << 1, DLS_A_UNUSED_2 = 1 << 2, DLS_A_NO_HTTP_1_1 = 1 << 3,
  DLS_A_MINIMAL_HTTP = 1 << 4, DLS_A_BANNING = 1 << 5, DLS_A_DNS_LOOKUP = 1 << 6, DLS_A_REMOVED = 1 << 7,
  DLS_A_FOOBAR = 1 << 8
}

Functions

gboolean dl_server_valid (const struct dl_server *s)
gboolean download_has_blank_guid (const struct download *d)
void download_check (const struct download *const d)
const gchar * download_pathname (const struct download *d)
const gchar * download_basename (const struct download *d)


Define Documentation

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

#define download_buffered  )     ((d)->buffers == NULL ? 0 : (d)->buffers->held)
 

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

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

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

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

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

#define DOWNLOAD_IS_ACTIVE  ) 
 

Value:

(  (d)->status == GTA_DL_RECEIVING  \
    || (d)->status == GTA_DL_IGNORING   )

#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_IGNORING   \
    || (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_port  )     ((d)->server->key->port)
 

#define download_ranges  )     ((d)->ranges)
 

#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.


Typedef Documentation

typedef struct download download_t
 

typedef guint32 gnet_src_t
 

typedef void(* src_listener_t)(gnet_src_t)
 


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
DL_F_URIRES  We sent a "/uri-res/N2R?" request.
DL_F_PUSH_IGN  Trying to ignore push flag.
DL_F_OVERLAPPED  We went through overlap checking.
DL_F_REPLIED  Servent replied to last request.
DL_F_CHUNK_CHOSEN  Retrying with specific chunk.
DL_F_SHRUNK_REPLY  Server sending less than we asked.
DL_F_SUNK_DATA  Whether we previously sunk data.
DL_F_ACTIVE_QUEUED  Download is actively queued.
DL_F_PASSIVE_QUEUED  Download is passively queued.
DL_F_DNS_LOOKUP  Attempted DNS lookup.
DL_F_BROWSE  Browse host type (requests "/").
DL_F_TRANSIENT  Transient, don't persist.
DL_F_SUSPENDED  Suspended, do not schedule.
DL_F_MARK  Marked in traversal.
DL_F_PREFIX_HEAD  Sent HEAD request before GET.
DL_F_INITIAL  First request on this connection.
DL_F_PAUSED  Paused by user.
DL_F_THEX  THEX download.
DL_F_UDP_PUSH  UDP push already attempted.
DL_F_FETCH_TTH  Tigertree data is being fetched.
DL_F_GOT_TTH  Tigertree fetching finished.

anonymous enum
 

Enumeration values:
DLS_A_UNUSED_1  UNUSED.
DLS_A_PUSH_IGN  Ignore pushes, connect directly.
DLS_A_UNUSED_2  UNUSED.
DLS_A_NO_HTTP_1_1  Server does NOT support HTTP/1.1.
DLS_A_MINIMAL_HTTP  Use minimalist HTTP with server.
DLS_A_BANNING  Server might be banning us.
DLS_A_DNS_LOOKUP  Perform DNS lookup if possible.
DLS_A_REMOVED  Server marked for removal.
DLS_A_FOOBAR  Server is foobar.

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_magic
 

Enumeration values:
DOWNLOAD_MAGIC 

enum download_status_t
 

Download states.

Enumeration values:
GTA_DL_INVALID  Never used.
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.
GTA_DL_IGNORING  Ignoring received data on resuming mismatch.

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 


Function Documentation

gboolean dl_server_valid const struct dl_server s  )  [inline, static]
 

const gchar* download_basename const struct download d  ) 
 

void download_check const struct download *const   d  )  [inline, static]
 

gboolean download_has_blank_guid const struct download d  ) 
 

const gchar* download_pathname const struct download d  ) 
 


Generated on Sat Jun 30 17:53:26 2007 for gtk-gnutella by  doxygen 1.3.9.1