Mercurial > hg > index.fcgi > gift-gnutella > gift-gnutella-0.0.11-1pba
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9b0130b9f0e0 |
---|---|
1 /* | |
2 * $Id: source.h,v 1.4 2003/12/22 02:46:34 hipnod Exp $ | |
3 * | |
4 * Copyright (C) 2002-2003 giFT project (gift.sourceforge.net) | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify it | |
7 * under the terms of the GNU General Public License as published by the | |
8 * Free Software Foundation; either version 2, or (at your option) any | |
9 * later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * General Public License for more details. | |
15 */ | |
16 | |
17 #ifndef GIFT_GT_TRANSFER_SOURCE_H_ | |
18 #define GIFT_GT_TRANSFER_SOURCE_H_ | |
19 | |
20 /*****************************************************************************/ | |
21 | |
22 struct transfer; | |
23 struct source; | |
24 | |
25 typedef struct gt_source | |
26 { | |
27 uint32_t user_ip; | |
28 uint16_t user_port; | |
29 uint32_t server_ip; | |
30 uint16_t server_port; | |
31 BOOL firewalled; | |
32 gt_guid_t *guid; | |
33 uint32_t index; | |
34 char *filename; | |
35 | |
36 /* | |
37 * Parameters we don't understand, but were in the source URL. | |
38 * Parsed for forwards compatibility reasons, so newer versions | |
39 * can play with the same state files as older versions). | |
40 */ | |
41 Dataset *extra; | |
42 | |
43 /* | |
44 * Fields that get set depending on what happens to this source. | |
45 * This should be in a shared per-server structure, actually. | |
46 */ | |
47 time_t retry_time; /* used for Retry-After; pollMin */ | |
48 char *status_txt; /* previous status text message */ | |
49 BOOL uri_res_failed; /* uri-res request failed */ | |
50 BOOL connect_failed; /* last connection attempt failed */ | |
51 } GtSource; | |
52 | |
53 /*****************************************************************************/ | |
54 | |
55 GtSource *gt_source_new (void); | |
56 void gt_source_free (GtSource *gt); | |
57 | |
58 char *gt_source_serialize (GtSource *src); | |
59 GtSource *gt_source_unserialize (const char *url); | |
60 | |
61 void gt_source_set_ip (GtSource *src, in_addr_t port); | |
62 void gt_source_set_port (GtSource *src, in_port_t port); | |
63 void gt_source_set_index (GtSource *src, uint32_t index); | |
64 void gt_source_set_server_ip (GtSource *src, in_addr_t server_ip); | |
65 void gt_source_set_server_port (GtSource *src, in_port_t server_port); | |
66 void gt_source_set_firewalled (GtSource *src, BOOL fw); | |
67 | |
68 BOOL gt_source_set_filename (GtSource *src, const char *filename); | |
69 BOOL gt_source_set_guid (GtSource *src, const gt_guid_t *guid); | |
70 | |
71 /*****************************************************************************/ | |
72 | |
73 /* deprecated */ | |
74 char *gt_source_url_new (const char *filename, uint32_t index, | |
75 in_addr_t user_ip, uint16_t user_port, | |
76 in_addr_t server_ip, uint16_t server_port, | |
77 BOOL firewalled, | |
78 const gt_guid_t *client_id); | |
79 | |
80 /*****************************************************************************/ | |
81 | |
82 int gnutella_source_cmp (Protocol *p, struct source *a, struct source *b); | |
83 BOOL gnutella_source_add (Protocol *p, struct transfer *transfer, | |
84 struct source *source); | |
85 void gnutella_source_remove (Protocol *p, struct transfer *transfer, | |
86 struct source *source); | |
87 | |
88 /*****************************************************************************/ | |
89 | |
90 #endif /* GIFT_GT_TRANSFER_SOURCE_H_ */ |