nntpgrab_types.h

Go to the documentation of this file.
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 _NNTPGRAB_TYPES_H_
00020 #define _NNTPGRAB_TYPES_H_
00021 
00022 #include 
00023 #include 
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /* These declarations are actually from GLib, but to easy the development
00030  * of external frontends, they have been duplicated here to avoid linkage bloat */
00031 #ifndef FALSE
00032 #define FALSE (0)
00033 #endif
00034 
00035 #ifndef TRUE
00036 #define TRUE (!FALSE)
00037 #endif
00038 
00039 typedef int                 ngboolean;
00040 #ifdef WIN32
00041 typedef long long           ngint64;
00042 typedef unsigned long long  nguint64;
00043 #else
00044 typedef int64_t             ngint64;
00045 typedef __uint64_t          nguint64;
00046 #endif
00047 
00048 typedef struct _NGList NGList;
00049 typedef void NGRegex;
00050 
00051 struct _NGList
00052 {
00053   void *data;
00054   NGList *next;
00055   NGList *prev;
00056 };
00057 
00058 #define NG_CALLBACK(f) ((NGCallback) (f))
00059 typedef void  (*NGCallback)              (void);
00060 
00061 /* End of GLib declarations */
00062 
00063 typedef enum {
00064     SERVER_PRIORITY_HIGH,
00065     SERVER_PRIORITY_NORMAL,
00066     SERVER_PRIORITY_LOW
00067 } ServerPriority;
00068 
00069 typedef struct _config_server {
00070     char servername[128];
00071     char hostname[128];
00072     int port;
00073     char username[64];
00074     char password[64];
00075     int max_threads;
00076     ServerPriority priority;
00077     ngboolean use_ssl;
00078     ngboolean enabled;
00079 } ConfigServer;
00080 
00081 typedef struct _config_opts {
00082     char download_directory[256];
00083     char temp_directory[256];
00084     ngboolean enable_intelligent_par2_downloading;
00085     ngboolean enable_par2_repair;
00086     char auto_import_directory[256];
00087     ngboolean enable_auto_import;
00088     ngboolean move_file_after_auto_import;
00089     ngboolean enable_auto_unpack;
00090 } ConfigOpts;
00091 
00092 typedef struct _config_group_info {
00093     char newsgroup[256];
00094     ngboolean is_subscribed;
00095     ngboolean is_moderated;
00096     int num_articles;
00097     int start_article;
00098     int end_article;
00099     time_t last_checked;
00100 } ConfigGroupInfo;
00101 
00102 typedef struct _nntpgrab_part {
00103     char message_id[256];
00104     int size;
00105     int partnum;
00106 } NNTPGrabPart;
00107 
00108 typedef enum {
00109     CONFIG_CHANGED_NOTHING,
00110     CONFIG_CHANGED_SERVER_ADDED,
00111     CONFIG_CHANGED_SERVER_DELETED,
00112     CONFIG_CHANGED_OPTS_CHANGED
00113 } ConfigChangedFlag;
00114 
00115 typedef enum {
00116     SCHEDULAR_STATE_RUNNING,
00117     SCHEDULAR_STATE_STOPPING,
00118     SCHEDULAR_STATE_STOPPED
00119 } SchedularState;
00120 
00121 typedef enum _nntp_disconnect_type {
00122     DISCONNECT_NORMAL,
00123     DISCONNECT_NO_SUCH_HOST,
00124     DISCONNECT_CONNECTION_REFUSED,
00125     DISCONNECT_TOO_MANY_CONNECTIONS,
00126     DISCONNECT_CONNECT_TIMEOUT,
00127     DISCONNECT_READ_ERROR,
00128     DISCONNECT_READ_TIMEOUT,
00129     DISCONNECT_WRITE_ERROR,
00130     DISCONNECT_IDLE_TIMEOUT,
00131     DISCONNECT_INVALID_MSG,
00132     DISCONNECT_LOGIN_FAILURE,
00133     DISCONNECT_ERROR_SSL_INITIALISE,
00134     DISCONNECT_UNEXPECTED
00135 } NNTPDisconnectType;
00136 
00137 typedef enum _nntp_file_type {
00138     NNTP_FILE_TYPE_UNKNOWN,
00139     NNTP_FILE_TYPE_RAR,
00140     NNTP_FILE_TYPE_PAR,
00141     NNTP_FILE_TYPE_PAR2,
00142     NNTP_FILE_TYPE_SFV,
00143     NNTP_FILE_TYPE_NFO,
00144     NNTP_FILE_TYPE_NZB,
00145     NNTP_FILE_TYPE_OTHER
00146 } NNTPFileType;
00147 
00148 typedef enum {
00149     TASK_STATE_WAITING_FOR_DOWNLOAD,
00150     TASK_STATE_DOWNLOADING,
00151     TASK_STATE_WAITING_FOR_DECODE,
00152     TASK_STATE_DECODING,
00153     TASK_STATE_FINISHED_COMPLETE,
00154     TASK_STATE_FINISHED_INCOMPLETE,
00155     TASK_STATE_FINISHED_NO_PARTS_AVAIL,
00156     TASK_STATE_SKIPPED
00157 } TaskState;
00158 
00159 typedef enum _par2_file_state {
00160     PAR2_FILE_STATE_MISSING,
00161     PAR2_FILE_STATE_FOUND,
00162     PAR2_FILE_STATE_DAMAGED,
00163     PAR2_FILE_STATE_NO_NEW_BLOCKS_FOUND
00164 } PAR2FileState;
00165 
00166 typedef void (*ForeachCollectionFunc) (const char *collection_name, const char *poster, nguint64 total_size, nguint64 total_size_remaining, int position, void *data);
00167 typedef void (*ForeachFileFunc) (const char *collection_name, const char *subject, const char *poster, ngint64 stamp, nguint64 file_size, nguint64 file_size_remaining, int position, int num_parts_total, int num_parts_downloaded, int num_parts_failed, TaskState status, const char *filename, void *data);
00168 typedef void (*ForeachGroupFunc) (const char *collection_name, const char *subject, const char *group, void *data);
00169 
00170 #ifdef __cplusplus
00171 }
00172 #endif
00173 
00174 #endif /* _NNTPGRAB_TYPES_H_ */

Generated on Thu May 21 21:25:05 2009 for NNTPGrab by  1.5.4