/* Contest Arbitrator v0.3.2 by Dmitry Gorokh, UR4MCK
This program is freeware!
*/
#ifndef MAIN_H
#define MAIN_H
#include <time.h>
#include "cabrillo.h"
/* Various flags in 'ham' structure record */
#define HAM_FLAG_SCORE_TAB 0x01
#define HAM_FLAG_VALID_SIGNATURE 0x80
/* QSO verification status definition */
#define QSO_STATUS_CONTEST_ERROR -2
#define QSO_STATUS_ERROR -1
#define QSO_STATUS_NOT_CHECKED 0
#define QSO_STATUS_GENERAL_XCHECK_OK 1
#define QSO_STATUS_CONTEST_XCHECK_FAIL 2
#define QSO_STATUS_CONTEST_XCHECK_ONE_SIDE_FAIL_RECV 3
#define QSO_STATUS_CONTEST_XCHECK_ONE_SIDE_FAIL_SENT 4
#define QSO_STATUS_CONTEST_XCHECK_ONE_SIDE_VALID 5
#define QSO_STATUS_CONTEST_XCHECK_OK 6
/* Errors & warnings types */
#define WARN_TYPE_ERROR -1
#define WARN_TYPE_NONE 0
#define WARN_TYPE_WARNING 1
/* QSO mark IDs definition */
#define MARK_ID_NONE 0
#define MARK_ID_QSO_VALID 1
#define MARK_ID_QSO_INVALID 2
#define MARK_ID_MULT_VALID 4
#define MARK_ID_MULT_INVALID 8
/* QSO mark chars definition */
#define MARK_QSO_VALID '+'
#define MARK_QSO_INVALID '-'
#define MARK_MULT_VALID '*'
#define MARK_MULT_INVALID '%'
/* Log file description structure */
typedef struct {
char *name; /* Name of log file */
/* TODO */
void *next; /* Pointer to the next element in the list */
} LOG_FILE_S;
/* Configuration structure */
typedef struct {
char *log_dir; /* Directory with log files */
char *out_file; /* Output file with results */
char report_dir[MAX_STR]; /* Log analyzis reports directory */
char ubn_dir[MAX_STR]; /* UBN files directory */
FILE *out_fd; /* Output file descriptor pointer */
LOG_FILE_S *file_list; /* Pointer to the List of log files to work with */
/* Contest specific configuration */
struct {
int valid; /* Contest configuration is valid (when not 0) */
char name[MAX_STR]; /* Contest name */
int id; /* Contest identifier */
time_t start; /* Starting date */
time_t end; /* End date */
unsigned int rounds; /* Number of rounds (0 if not applicable) */
unsigned int max_dt; /* Maximum allowable difference in time (in sec) */
char band_list[MAX_STR]; /* Bands list */
char mode_list[MAX_STR]; /* Modes list */
char signature[MAX_STR]; /* Judge's signature */
char email[MAX_STR]; /* Log submissions e-mail(s) */
char www[MAX_STR]; /* Contest results URL */
int skip_rst_snt; /* Sent RST checking (0 - check, 1 - do not check) */
int skip_rst_rcv; /* Received RST checking (0 - check, 1 - do not check) */
int skip_num_snt; /* Sent incremental number checking (0 - check, 1 - do not check) */
int skip_num_rcv; /* Received incremental number checking (0 - check, 1 - do not check) */
int skip_chk_snt; /* Sent check number checking (0 - check, 1 - do not check) */
int skip_chk_rcv; /* Received check number checking (0 - check, 1 - do not check) */
int cfm_unresolved; /* Minimum count of unresolved QSOs to confirm them as valid QSO and multiplyer */
int uniq_mult; /* Flag to count multiplier only once */
int strict_eval; /* Flag to perform strict evaluation */
int allow_dupes; /* Flag to allow duplicate QSOs */
int search_tags; /* Flag to search similar tags upon log format error */
int ignore_tags; /* Flags to ignore any unknown tag in the log */
} contest;
/* TODO */
} CONFIG_S;
typedef struct {
int num;
time_t start;
time_t end;
} ROUND_S;
typedef struct {
int id;
time_t start;
time_t end;
unsigned int mode_cnt;
int mode[MAX_MODES];
unsigned int band_cnt;
int band[MAX_BANDS];
unsigned int round_cnt;
ROUND_S **round;
} CONTEST_CONFIG_S;
/* Warning message list structure definition */
typedef struct {
int type; /* Type of a warning or error */
unsigned int line; /* Line number in log file */
char *text; /* Description text */
void *next; /* Pointer to the next warning or error */
} WARNING_S;
/* General QSO structure */
typedef struct {
int ham_id; /* Remote station ID (if resolved) */
int checked; /* Contest cross-check status */
int marked; /* Judge's mark is present */
int dupe; /* Flag for duplicate QSO */
char callsign[CALLSIGN_SIZE]; /* Remote station callsign */
unsigned int freq; /* Frequency, kHz */
int mode_op; /* Operation mode ID */
time_t timestamp; /* Contains date & time (UTC) */
char check_sent[CHK_CNT][CHK_SIZE]; /* Sent check numbers */
char check_recv[CHK_CNT][CHK_SIZE]; /* Received check numbers */
int tx_num; /* Transmitter number */
int round_num; /* A round number this QSO belongs to */
int score; /* Score for this QSO */
unsigned int mult; /* Multiplier for this QSO (if applicable) */
int mark; /* Judge's mark value (if QSO have been marked) */
unsigned int error_cnt; /* QSO errors & warnings counter */
WARNING_S *warnings; /* QSO errors & warnings list */
void *his_qso; /* Pointer to remote operator's QSO with us */
void *next; /* Next QSO record pointer */
} QSO_S;
/* General description of ham radio operator */
typedef struct {
char callsign[CALLSIGN_SIZE]; /* Operator's callsign */
int optype_id; /* Type of operation ID */
int band_id; /* Band ID */
int mode_id; /* Mode ID */
int power_id; /* Power type ID */
int assisted_id; /* Assistment type ID */
int tx_id; /* Transmitter type ID */
int station_id; /* Station type ID */
int time_id; /* Time type ID */
int overlay_id; /* Overlay type ID */
char name[MAX_STR]; /* Ham's name */
char location[MAX_STR]; /* Ham's location */
char club_name[MAX_STR]; /* Ham's club name */
time_t off_time_start; /* Off time range: start (date & time in UTC) */
time_t off_time_end; /* Off time range: end (date & time in UTC) */
unsigned int claimed_score; /* Claimed score */
unsigned int sum_score; /* Summary score (calculated by this program) */
unsigned int actual_score; /* Actual score (calculated by this program) */
unsigned int total_mult; /* Total multiplier */
unsigned int rating_place; /* Place in the rating table */
int no_loc; /* Marks an absence of QTH locator in 'location' field */
int systematic_dt; /* Systematic difference in time */
unsigned int flags; /* Auxulary bit flags */
char ubn_file[MAX_STR]; /* Path to UBN file */
QSO_S *qso; /* Pointer to QSO records */
WARNING_S *warnings; /* General errors & warnings list */
} HAM_S;
typedef struct {
unsigned int ham_num; /* Total number of participant's logs */
HAM_S **ham; /* Array of pointers to the ham's structure */
} BASE_S;
int out(FILE *report_fd, const char *fmt, ...);
#endif