diff src/transfer/source.h @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/transfer/source.h	Sat Feb 20 21:18:28 2010 -0800
     1.3 @@ -0,0 +1,90 @@
     1.4 +/*
     1.5 + * $Id: source.h,v 1.4 2003/12/22 02:46:34 hipnod Exp $
     1.6 + *
     1.7 + * Copyright (C) 2002-2003 giFT project (gift.sourceforge.net)
     1.8 + *
     1.9 + * This program is free software; you can redistribute it and/or modify it
    1.10 + * under the terms of the GNU General Public License as published by the
    1.11 + * Free Software Foundation; either version 2, or (at your option) any
    1.12 + * later version.
    1.13 + *
    1.14 + * This program is distributed in the hope that it will be useful, but
    1.15 + * WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.17 + * General Public License for more details.
    1.18 + */
    1.19 +
    1.20 +#ifndef GIFT_GT_TRANSFER_SOURCE_H_
    1.21 +#define GIFT_GT_TRANSFER_SOURCE_H_
    1.22 +
    1.23 +/*****************************************************************************/
    1.24 +
    1.25 +struct transfer;
    1.26 +struct source;
    1.27 +
    1.28 +typedef struct gt_source
    1.29 +{
    1.30 +	uint32_t        user_ip;
    1.31 +	uint16_t        user_port;
    1.32 +	uint32_t        server_ip;
    1.33 +	uint16_t        server_port;
    1.34 +	BOOL            firewalled;
    1.35 +	gt_guid_t      *guid;
    1.36 +	uint32_t        index;
    1.37 +	char           *filename;
    1.38 +
    1.39 +	/*
    1.40 +	 * Parameters we don't understand, but were in the source URL.
    1.41 +	 * Parsed for forwards compatibility reasons, so newer versions
    1.42 +	 * can play with the same state files as older versions).
    1.43 +	 */
    1.44 +	Dataset        *extra;
    1.45 +
    1.46 +	/*
    1.47 +	 * Fields that get set depending on what happens to this source.
    1.48 +	 * This should be in a shared per-server structure, actually.
    1.49 +	 */
    1.50 +	time_t          retry_time;       /* used for Retry-After; pollMin */
    1.51 +	char           *status_txt;       /* previous status text message */
    1.52 +	BOOL            uri_res_failed;   /* uri-res request failed */
    1.53 +	BOOL            connect_failed;   /* last connection attempt failed */
    1.54 +} GtSource;
    1.55 +
    1.56 +/*****************************************************************************/
    1.57 +
    1.58 +GtSource     *gt_source_new             (void);
    1.59 +void          gt_source_free            (GtSource *gt);
    1.60 +
    1.61 +char         *gt_source_serialize       (GtSource *src);
    1.62 +GtSource     *gt_source_unserialize     (const char *url);
    1.63 +
    1.64 +void          gt_source_set_ip          (GtSource *src, in_addr_t port);
    1.65 +void          gt_source_set_port        (GtSource *src, in_port_t port);
    1.66 +void          gt_source_set_index       (GtSource *src, uint32_t index);
    1.67 +void          gt_source_set_server_ip   (GtSource *src, in_addr_t server_ip);
    1.68 +void          gt_source_set_server_port (GtSource *src, in_port_t server_port);
    1.69 +void          gt_source_set_firewalled  (GtSource *src, BOOL fw);
    1.70 +
    1.71 +BOOL          gt_source_set_filename    (GtSource *src, const char *filename);
    1.72 +BOOL          gt_source_set_guid        (GtSource *src, const gt_guid_t *guid);
    1.73 +
    1.74 +/*****************************************************************************/
    1.75 +
    1.76 +/* deprecated */
    1.77 +char         *gt_source_url_new    (const char *filename, uint32_t index,
    1.78 +                                    in_addr_t user_ip, uint16_t user_port,
    1.79 +                                    in_addr_t server_ip, uint16_t server_port,
    1.80 +                                    BOOL firewalled,
    1.81 +                                    const gt_guid_t *client_id);
    1.82 +
    1.83 +/*****************************************************************************/
    1.84 +
    1.85 +int  gnutella_source_cmp    (Protocol *p, struct source *a, struct source *b);
    1.86 +BOOL gnutella_source_add    (Protocol *p, struct transfer *transfer,
    1.87 +                             struct source *source);
    1.88 +void gnutella_source_remove (Protocol *p, struct transfer *transfer,
    1.89 +                             struct source *source);
    1.90 +
    1.91 +/*****************************************************************************/
    1.92 +
    1.93 +#endif /* GIFT_GT_TRANSFER_SOURCE_H_ */