Statistics
| Revision:

root / trunk / base / collections.h @ 1843

History | View | Annotate | Download (3 KB)

1
/* 
2
    Copyright (C) 2005-2010  Erik van Pienbroek
3

                
4
    This program is free software; you can redistribute it and/or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation; either version 2 of the License, or
7
    (at your option) any later version.
8

                
9
    This program is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU General Public License for more details.
13

                
14
    You should have received a copy of the GNU General Public License
15
    along with this program; if not, write to the Free Software
16
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
*/
18

                
19
#ifndef _COLLECTIONS_H_
20
#define _COLLECTIONS_H_
21

                
22
#define MAX_NNTP_SERVERS    32
23

                
24
typedef struct _par2real_file {
25
    char real_filename[256];
26
    int num_blocks_found;
27
    int num_blocks_missing;
28
    gboolean blocks_found[65535];           // FIXME: What is the maximum number of possible PAR2 blocks?
29
} PAR2RealFile;
30

                
31
typedef struct _par2file {
32
    char filename[256];
33
    GList *real_files;                      // List containing PAR2RealFile pointers
34
    int num_blocks_found;
35
    int num_blocks_missing;
36
} PAR2File;
37

                
38
typedef struct _par2set {
39
    unsigned char set_id[16];
40
    guint64 blocksize;
41
    GList *par2_files;                      // List containing PAR2File pointers
42
    int total_num_blocks_found;
43
    int total_num_blocks_missing;
44
    int total_recovery_blocks_available;
45
} PAR2Set;
46

                
47
typedef struct _nntp_part {
48
    const char message_id[256];
49
    int size;
50
    int part_num;
51
    gboolean downloaded;
52
    gboolean now_downloading;
53
    unsigned int servers_already_tried;  /* This is actually a bit-masked variable where every server has one bit */
54
} NNTPPart;
55

                
56
typedef struct _nntp_file {
57
    volatile int refcount;
58
    const char subject[256];
59
    const char poster[256];
60
    time_t stamp;
61
    guint64 file_size;
62
    guint64 file_size_remaining;
63
    int position;
64
    int num_parts;
65
    int num_parts_downloaded;
66
    int num_parts_failed;
67
    GList *parts;
68
    GList *groups;
69
    gboolean file_is_downloading;
70
    gboolean file_is_downloaded;
71
    gboolean stop_flag;
72
    gboolean now_decoding;
73
    gboolean now_verifying;
74
    const char tmp_filename[256];
75
    const char real_filename[256];
76
    NGTaskState status;
77
    NNTPFileType file_type;
78
    char md5sum[33];
79
    int par2_start_num;
80
    int par2_end_num;
81
    int par2_num_blocks;
82
} NNTPFile;
83

                
84
typedef struct _nntp_collection {
85
    volatile int refcount;
86
    GStaticMutex mutex;
87
    const char collection_name[256];
88
    gboolean now_repairing;
89
    gboolean now_unpacking;
90
    char poster[256];
91
    char groups[256];
92
    guint64 total_size;
93
    guint64 total_size_remaining;
94
    GList *files;
95
    GList *files_to_download;
96
    gboolean stop_flag;
97
    int position;
98
    GList *par2sets;                // This list contains PAR2Set pointers
99
} NNTPCollection;
100

                
101
#endif /* _COLLECTIONS_H */