// STRUCTS.H - Global structures for FiveNine
// Written by Stefan Pfeiffer, DL1ELY, 940816
// Last modification: 960616
// (C) 1994 by Stefan Pfeiffer, DL1ELY@DB0PKE, 940816


#ifndef STRUCTS_H


#define STRUCTS_H


#define HEADER_SIZE sizeof(struct header)
#define QSO_SIZE sizeof(struct qso)


typedef struct header
{
  unsigned char magic[5];
  unsigned char owncall[14];
  unsigned char ownloc[7];
  unsigned char desc[60];
  unsigned qso_cnt;
  unsigned invalid;
  unsigned ODX;
  unsigned char ODX_call[14];
  unsigned average;
  unsigned char countries;
  unsigned char unknown_pref;
  unsigned char squares;
  unsigned long points;
};

typedef struct qso
{
  struct qso *next, *prev;

  unsigned hour, min;
  unsigned nr;
  unsigned char barecall[13];
  unsigned char call[14];
  unsigned char locator[7];
  unsigned char rst_RX[8];
  unsigned char rst_TX[4];
  unsigned points;
  unsigned direction;
};


typedef struct call_index
{
  unsigned char call[12];
  long pos;
};


typedef struct multi_index
{
   unsigned char multi[11];
   long pos;
};


typedef struct loc_index
{
   unsigned char locator[7];
   long pos;
};


typedef struct squareinfo
{
  struct squareinfo *next;
  struct squareinfo *prev;
  
  unsigned char name[5];
  unsigned worked;
  unsigned long points;
};

typedef struct countryinfo
{
   struct countryinfo *next;
   struct countryinfo *prev;
  
   unsigned worked;
   unsigned long points;
   unsigned char *name;
   unsigned char *name_eng;
   unsigned char *prefixes;
   unsigned char *valid_squares;
};

typedef struct callinfo
{
   unsigned char call[13];
   unsigned qrv_on;
   unsigned char loc1[7];
   unsigned loc1_date;
   unsigned char loc2[7];
   unsigned loc2_date;
   unsigned char loc3[7];
   unsigned loc3_date;
};

typedef struct cw_char
{
   unsigned char ch;
   unsigned char signs[6];
};

typedef struct ems_ib
{
   unsigned char inst;
   unsigned char used;
   unsigned free;
   unsigned char ver_hi;
   unsigned char ver_lo;
   unsigned startseg;
};

typedef struct xms_ib
{
   unsigned char inst;
   unsigned char used;
   unsigned free;
   unsigned char ver_hi;
   unsigned char ver_lo;
   unsigned char rev_hi;
   unsigned char rev_lo;
};

#define NULLchar       (char *)0
#define NULLcountry    (struct countryinfo *)0
#define NULLcallinfo   (struct callinfo *)0
#define NULLfile       (FILE *)0
#define NULLqso        (struct qso *)0
#define NULLsquare     (struct squareinfo *)0
        
#endif

