Jeroen Asselman wrote:

>> Op di 09-09-2003, om 14:01 schreef Richard Eckart:
>>
>
>>>>Hi
>>>>
>>>>
>>
>>>>>>Just what exactly is the purpose of the file info pane?  It seems
>>>>>>somewhat incomplete
>>>>>>and I am unsure of what the vision for it was?  If you can
describe what
>>>>>>it is aiming at
>>>>>>doing, I can avoid duplicating the fileinfo tab and either remove
it or
>>>>>>fix / finish it.
>
>>
>> <snip>
>>
>
>>>>So the reasons were:
>>>>- control of the top-level file information structure managing all
>>>>  downloads and sources
>>>>- gui/core separation
>
>>
>>
>> If gui/core separation was a issue, it might be a good idea waiting for
>> the gnutella-lib split to be ready?
>>

I agree and have put off the project until gnutella-lib is ready.

I have attached a header file for a propsed interface to the downloads
code through
gnut_lib.  It is not complete but gives an idea of a direction we could
go with this.
If it looks good, I would be happy to develop this more.

Cheers,
Russ
/*
 * This is a primitive vision of what a section of 
 * gnut_lib may look like.  It is intended to spark ideas and
 * conversation and spur progress toward gnut_lib and eventual
 * gui/core separation.
 *
 * There is an important distinction between this and the current
 * downloads.h file in that it refers to a download as a 1-1
 * connection with a server.  This file assumes that a download
 * occurs for a particular file, so gnut_download_new could 
 * start several independent connections or downloads each
 * fetching a piece of the file refered to by gnut_query_atom_t.
 * gnut_download_source_t refers to a particular source which is
 * serving the file or a part of it.
 *
 * gnut_download_t refers to a particular download for 
 * some_file.x, sha1, and may use several gnut_download_source's
 *
 */
#ifndef _gnut_downloads_h_
#define _gnut_downloads_h_

/* 
 * Unique integer identifier used to refer to a specific 
 * download externally.
 *
 */
typedef guint32 gnut_download_atom_t;

void gnut_download_init(void);
void gnut_download_shutdown(void);

/*
 * Start a new download 
 * gnut_query_atom_t refers to something like struct record
 *
 */
gnut_download_atom_t gnut_download_new(gnut_query_atom_t);
/* and gnut_lib stores the information to find the server(s)
   which has the query and starts downloading ... */

/*
 * Stop a download
 */
void gnut_download_stop(gnut_download_atom_t);

/*
 * Abort a download
 */
void gnut_download_abort(gnut_download_atom_t);

/*
 * Resume a download
 */
void gnut_download_resume(gnut_download_atom_t); 

/*
 * Return the status of the download
 */
typedef enum {
...
} gnut_download_status_t;
gnut_download_status_t gnut_download_status(gnut_download_atom_t);

/*
 * Get percentage of download completed.
 */
gdouble gnut_download_progress(gnut_download_atom_t);

/*
 * Destroy a download reclaim resources and invalidate
 * gnut_download_atom_t.
 */
void gnut_download_destroy(gnut_download_atom_t *);


/*
 * Determine yes/no information about a download.
 */
typedef enum { 
        IS_VALID,
        IS_STOPPED,
        IS_RUNNING,
} download_query_type_t;
gboolean gnut_download_query(gnut_download_atom_t, download_query_type_t);

/**************************************************************
  Functions to interact with individual sources of a download
**************************************************************/
/*
 * return a NULL terminated array of sources
 */
typedef guint32 gnut_server_atom_t;
gnut_server_atom_t * gnut_download_get_sources(gnut_download_atom_t);
void gnut_download_server_ban(gnut_download_source_t);
typedef enum { 
        IS_VALID,
        IS_QUEUED,
        IS_VERIFYING,
        IS_MOVING,
        IS_STOPPED,
        IS_ACTIVE,
        IS_WAITING,
        IS_ESTABLISHING,
        IS_RUNNING,
        IS_IN_PUSH_MODE
} download_source_query_type_t;
gboolean gnut_download_source_query(gnut_server_atom_t, query_type_t);

.
.
.

#endif

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to