Main Page | Class List | File List | Class Members | File Members | Related Pages

gi_transfer_api.h

00001 /* 00002 * $Id: gi_transfer_api.h,v 1.1.2.1 2004/04/10 05:36:04 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __GI_TRANSFER_API_H 00018 #define __GI_TRANSFER_API_H 00019 00020 /*****************************************************************************/ 00021 00031 /*****************************************************************************/ 00032 00033 typedef enum 00034 { 00035 TRANSFER_DOWNLOAD, 00036 TRANSFER_UPLOAD 00037 } TransferType; 00038 00039 struct transfer; 00040 00041 /* leave the type opaque for now... */ 00042 #ifdef GIFT_PLUGIN 00043 typedef struct transfer Transfer; 00044 #endif /* GIFT_PLUGIN */ 00045 00046 /*****************************************************************************/ 00047 00053 typedef struct 00054 { 00058 unsigned int queue_pos; 00060 unsigned int queue_ttl; 00061 } upload_auth_t; 00062 00063 /*****************************************************************************/ 00064 00070 typedef enum source_status 00071 { 00072 SOURCE_UNUSED = 0, 00074 SOURCE_PAUSED, 00076 SOURCE_QUEUED_REMOTE, 00078 SOURCE_QUEUED_LOCAL, 00080 SOURCE_COMPLETE, 00084 SOURCE_CANCELLED, 00086 SOURCE_TIMEOUT, 00087 SOURCE_WAITING, 00089 SOURCE_ACTIVE 00091 } SourceStatus; 00092 00097 typedef struct source 00098 { 00099 struct gi_protocol *p; 00102 struct chunk *chunk; 00103 SourceStatus status; 00104 char *status_data; 00106 char *user; 00108 char *hash; 00113 off_t size; 00115 char *url; 00119 void *udata; 00121 } Source; 00122 00123 /*****************************************************************************/ 00124 00130 typedef struct chunk 00131 { 00132 struct transfer *transfer; 00134 Source *source; 00137 off_t start; 00143 off_t stop; 00144 unsigned char stop_change : 1; 00148 unsigned char suspended : 1; 00154 #ifndef HIDE_DEPRECATED 00155 float adjust_dep; 00156 #endif /* !HIDE_DEPRECATED */ 00157 00158 off_t transmit; 00160 #ifndef HIDE_DEPRECATED 00161 off_t transmit_old_dep; 00162 unsigned long throughput_dep; 00163 #endif /* HIDE_DEPRECATED */ 00164 00165 unsigned long tmp_recv; 00167 int timeout_cnt; 00169 int timeout_max; 00172 void *udata; 00173 } Chunk; 00174 00175 /*****************************************************************************/ 00176 00177 EXTERN_C_BEGIN 00178 00179 /*****************************************************************************/ 00180 00189 GIFTD_EXPORT 00190 TransferType transfer_direction (struct transfer *t); 00191 00192 /*****************************************************************************/ 00193 00194 /* 00195 * These will move to GiProtocol:: someday. These are also exported by giFT, 00196 * not libgiftproto. 00197 */ 00198 GIFTD_EXPORT 00199 size_t download_throttle (Chunk *chunk, size_t len); 00200 GIFTD_EXPORT 00201 size_t upload_throttle (Chunk *chunk, size_t len); 00202 00203 /*****************************************************************************/ 00204 00205 EXTERN_C_END 00206 00207 /*****************************************************************************/ 00208 00209 #endif /* __GI_TRANSFER_API_H */

Generated on Sun Aug 22 08:11:13 2004 by doxygen 1.3.7