00001 /* 00002 Copyright (C) 2005-2009 Erik van Pienbroek 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00019 #ifndef _COLLECTIONS_H_ 00020 #define _COLLECTIONS_H_ 00021 00022 #define MAX_NNTP_SERVERS 25 00023 00024 typedef struct _par2real_file { 00025 char real_filename[256]; 00026 int num_blocks_found; 00027 int num_blocks_missing; 00028 gboolean blocks_found[65535]; // FIXME: What is the maximum number of possible PAR2 blocks? 00029 } PAR2RealFile; 00030 00031 typedef struct _par2file { 00032 char filename[256]; 00033 GList *real_files; // List containing PAR2RealFile pointers 00034 int num_blocks_found; 00035 int num_blocks_missing; 00036 } PAR2File; 00037 00038 typedef struct _par2set { 00039 unsigned char set_id[16]; 00040 guint64 blocksize; 00041 GList *par2_files; // List containing PAR2File pointers 00042 int total_num_blocks_found; 00043 int total_num_blocks_missing; 00044 int total_recovery_blocks_available; 00045 } PAR2Set; 00046 00047 typedef struct _nntp_part { 00048 const char message_id[256]; 00049 int size; 00050 int partnum; 00051 gboolean downloaded; 00052 gboolean now_downloading; 00053 gboolean servers_already_tried[MAX_NNTP_SERVERS]; 00054 } NNTPPart; 00055 00056 typedef struct _nntp_file { 00057 volatile int refcount; 00058 const char subject[256]; 00059 const char poster[256]; 00060 time_t stamp; 00061 guint64 file_size; 00062 guint64 file_size_remaining; 00063 int position; 00064 int numparts; 00065 int num_parts_downloaded; 00066 int num_parts_failed; 00067 GList *parts; 00068 GList *groups; 00069 gboolean file_is_downloading; 00070 gboolean file_is_downloaded; 00071 gboolean stop_flag; 00072 gboolean now_decoding; 00073 gboolean now_verifying; 00074 const char tmp_filename[256]; 00075 const char real_filename[256]; 00076 TaskState status; 00077 NNTPFileType file_type; 00078 int par2_start_num; 00079 int par2_end_num; 00080 int par2_num_blocks; 00081 guint64 file_id; // Necessary for the SQLite database 00082 gboolean file_is_new; // Necessary for the SQLite database 00083 gboolean file_is_changed; // Necessary for the SQLite database 00084 gboolean position_is_changed; // Necessary for the SQLite database 00085 } NNTPFile; 00086 00087 typedef struct _nntp_collection { 00088 volatile int refcount; 00089 GStaticMutex mutex; 00090 const char collection_name[256]; 00091 gboolean now_repairing; 00092 gboolean now_unpacking; 00093 char poster[256]; 00094 char groups[256]; 00095 guint64 total_size; 00096 guint64 total_size_remaining; 00097 GList *files; 00098 GList *files_to_download; 00099 gboolean stop_flag; 00100 int position; 00101 GList *par2sets; // This list contains PAR2Set pointers 00102 guint64 collection_id; // Necessary for the SQLite database 00103 gboolean collection_is_new; // Necessary for the SQLite database 00104 gboolean collection_is_changed; // Necessary for the SQLite database 00105 } NNTPCollection; 00106 00107 #endif /* _COLLECTIONS_H */