Common data types

Common data types

Synopsis

                    ConfigGroupInfo;
                    NNTPGrabPart;
                    NNTPGrabFolder;
                    NNTPGrabPluginInfo;
enum                ConfigChangedFlag;
enum                NGSchedularState;
enum                NNTPDisconnectType;
enum                NNTPFileType;
enum                NGTaskState;
enum                PAR2FileState;
enum                NGLogLevel;
void                (*ForeachCollectionFunc)            (const char *collection_name,
                                                         const char *poster,
                                                         nguint64 total_size,
                                                         nguint64 total_size_remaining,
                                                         int position,
                                                         void *user_data);
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,
                                                         NGTaskState status,
                                                         const char *filename,
                                                         void *user_data);
void                (*ForeachGroupFunc)                 (const char *collection_name,
                                                         const char *subject,
                                                         const char *group,
                                                         void *user_data);

Description

Details

ConfigGroupInfo

typedef struct {
    char newsgroup[256];
    ngboolean is_subscribed;
    ngboolean is_moderated;
    int num_articles;
    int start_article;
    int end_article;
    time_t last_checked;
} ConfigGroupInfo;

This structure is currently unused in NNTPGrab 0.6


NNTPGrabPart

typedef struct {
    char message_id[256];
    int size;
    int part_num;
} NNTPGrabPart;

This structure is used for the functions nntpgrab_core_schedular_add_task_to_queue() and nntpgrab_schedular_add_task_to_queue()

char message_id[256];

The message ID of the part (with the < and >)

int size;

The size of the part in bytes

int part_num;

The number of the part

NNTPGrabFolder

typedef struct {
    char folder[2048];
    ngboolean has_subfolders;
} NNTPGrabFolder;

This structure is used for the functions nntpgrab_utils_get_folder_listing() and nntpgrab_config_get_avail_servers()

char folder[2048];

The last element of the folder name

ngboolean has_subfolders;

Whether this folder has subfolders

NNTPGrabPluginInfo

typedef struct {
    char name[128];
    char version[64];
    char author[128];
    char url[256];
    char description[4096];

    ngboolean is_loaded;
    ngboolean is_persistent;
} NNTPGrabPluginInfo;

This structure is used by the functions nntpgrab_core_plugins_get_plugin_info() and nntpgrab_plugins_get_plugin_info()

char name[128];

The name of the plugin

char version[64];

The version of the plugin

char author[128];

Who created the plugin

char url[256];

A link to the website of the plugin

char description[4096];

A description indicated the purpose of the plugin

ngboolean is_loaded;

Whether the plugin is loaded at the moment

ngboolean is_persistent;

Unused in NNTPGrab 0.6

enum ConfigChangedFlag

typedef enum {
    CONFIG_CHANGED_NOTHING,
    CONFIG_CHANGED_SERVER_ADDED,
    CONFIG_CHANGED_SERVER_DELETED,
    CONFIG_CHANGED_OPTS_CHANGED
} ConfigChangedFlag;

enum NGSchedularState

typedef enum {
    SCHEDULAR_STATE_RUNNING,
    SCHEDULAR_STATE_STOPPING,
    SCHEDULAR_STATE_STOPPED
} NGSchedularState;

enum NNTPDisconnectType

typedef enum {
    DISCONNECT_NORMAL,
    DISCONNECT_NO_SUCH_HOST,
    DISCONNECT_CONNECTION_REFUSED,
    DISCONNECT_TOO_MANY_CONNECTIONS,
    DISCONNECT_CONNECT_TIMEOUT,
    DISCONNECT_READ_ERROR,
    DISCONNECT_READ_TIMEOUT,
    DISCONNECT_WRITE_ERROR,
    DISCONNECT_IDLE_TIMEOUT,
    DISCONNECT_INVALID_MSG,
    DISCONNECT_LOGIN_FAILURE,
    DISCONNECT_ERROR_SSL_INITIALISE,
    DISCONNECT_UNEXPECTED
} NNTPDisconnectType;

enum NNTPFileType

typedef enum {
    NNTP_FILE_TYPE_UNKNOWN,
    NNTP_FILE_TYPE_RAR,
    NNTP_FILE_TYPE_PAR,
    NNTP_FILE_TYPE_PAR2,
    NNTP_FILE_TYPE_SFV,
    NNTP_FILE_TYPE_NFO,
    NNTP_FILE_TYPE_NZB,
    NNTP_FILE_TYPE_OTHER
} NNTPFileType;

enum NGTaskState

typedef enum {
    TASK_STATE_WAITING_FOR_DOWNLOAD,
    TASK_STATE_DOWNLOADING,
    TASK_STATE_WAITING_FOR_DECODE,
    TASK_STATE_DECODING,
    TASK_STATE_FINISHED_COMPLETE,
    TASK_STATE_FINISHED_INCOMPLETE,
    TASK_STATE_FINISHED_NO_PARTS_AVAIL,
    TASK_STATE_SKIPPED
} NGTaskState;

enum PAR2FileState

typedef enum {
    PAR2_FILE_STATE_MISSING,
    PAR2_FILE_STATE_FOUND,
    PAR2_FILE_STATE_DAMAGED,
    PAR2_FILE_STATE_NO_NEW_BLOCKS_FOUND
} PAR2FileState;

This is currently unused in NNTPGrab 0.6


enum NGLogLevel

typedef enum {
    NG_LOG_LEVEL_ALL = 0,
    NG_LOG_LEVEL_INFO,
    NG_LOG_LEVEL_WARNING,
    NG_LOG_LEVEL_ERROR,
    NG_LOG_LEVEL_FATAL,
    NG_LOG_LEVEL_DEBUG,
} NGLogLevel;

ForeachCollectionFunc ()

void                (*ForeachCollectionFunc)            (const char *collection_name,
                                                         const char *poster,
                                                         nguint64 total_size,
                                                         nguint64 total_size_remaining,
                                                         int position,
                                                         void *user_data);

collection_name :

The name of the collection

poster :

The poster of the collection. Can be NULL if multiple posters are involved. [allow-none]

total_size :

The total size of the collection in bytes

total_size_remaining :

The number of bytes of files in this collection which still need to be downloaded

position :

The position of this collection in the entire download queue

user_data :

User provided callback data

ForeachFileFunc ()

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,
                                                         NGTaskState status,
                                                         const char *filename,
                                                         void *user_data);

collection_name :

The name of the collection

subject :

The subject of the current file

poster :

The poster of the file

stamp :

The timestamp indicating when the file was posted

file_size :

The size of the file in bytes

file_size_remaining :

The number of bytes of this file which still need to be downloaded

position :

The position of this file in the current collection

num_parts_total :

The total number of parts of which this file consists

num_parts_downloaded :

The number of parts of this file which are already downloaded

num_parts_failed :

The number of parts of this file which failed to download

status :

The current status of this file

user_data :

User provided callback data

ForeachGroupFunc ()

void                (*ForeachGroupFunc)                 (const char *collection_name,
                                                         const char *subject,
                                                         const char *group,
                                                         void *user_data);

collection_name :

The name of the collection

subject :

The subject of the current file

group :

The group in which this file is posted

user_data :

User provided callback data