TrustedQSL Library API: adif.h Source File

TrustedQSL Library API

adif.h
Go to the documentation of this file.
1/***************************************************************************
2 adif.h - description
3 -------------------
4 begin : Wed May 15 2002
5 copyright : (C) 2002 by ARRL
6 email : MSimcik@localhost.localdomain
7 revision : $Id$
8 ***************************************************************************/
9
10#ifndef __ADIF_H
11#define __ADIF_H
12
13
14#include <stdio.h>
15#include <stdlib.h>
16
18
25
26
27#define TQSL_ADIF_FIELD_NAME_LENGTH_MAX 64
28#define TQSL_ADIF_FIELD_SIZE_LENGTH_MAX 10
29#define TQSL_ADIF_FIELD_TYPE_LENGTH_MAX 1
30
34#ifndef TQSL_ADIF_BOOLEAN
35 typedef enum {
36 TQSL_FALSE,
37 TQSL_TRUE
38} TQSL_ADIF_BOOLEAN;
39#endif
40
41 typedef void * tQSL_ADIF;
42
44 typedef enum {
45 TQSL_ADIF_RANGE_TYPE_NONE,
46 TQSL_ADIF_RANGE_TYPE_MINMAX,
47 TQSL_ADIF_RANGE_TYPE_ENUMERATION
48} TQSL_ADIF_RANGE_TYPE;
49
51 typedef enum {
52 TQSL_ADIF_GET_FIELD_SUCCESS,
53 TQSL_ADIF_GET_FIELD_NO_NAME_MATCH,
54 TQSL_ADIF_GET_FIELD_NO_TYPE_MATCH,
55 TQSL_ADIF_GET_FIELD_NO_RANGE_MATCH,
56 TQSL_ADIF_GET_FIELD_NO_ENUMERATION_MATCH,
57 TQSL_ADIF_GET_FIELD_NO_RESULT_ALLOCATION,
58 TQSL_ADIF_GET_FIELD_NAME_LENGTH_OVERFLOW,
59 TQSL_ADIF_GET_FIELD_DATA_LENGTH_OVERFLOW,
60 TQSL_ADIF_GET_FIELD_SIZE_OVERFLOW,
61 TQSL_ADIF_GET_FIELD_TYPE_OVERFLOW,
62 TQSL_ADIF_GET_FIELD_ERRONEOUS_STATE,
63 TQSL_ADIF_GET_FIELD_EOF
64} TQSL_ADIF_GET_FIELD_ERROR;
65
67 typedef struct {
68 char name[TQSL_ADIF_FIELD_NAME_LENGTH_MAX + 1];
69 char type[TQSL_ADIF_FIELD_TYPE_LENGTH_MAX + 1];
70 TQSL_ADIF_RANGE_TYPE rangeType;
71 unsigned int max_length;
72 long signed min_value;
73 long signed max_value;
74 const char **enumStrings;
75 void *userPointer;
76} tqsl_adifFieldDefinitions;
77
79 typedef struct {
80 char name[TQSL_ADIF_FIELD_NAME_LENGTH_MAX + 1];
81 char size[TQSL_ADIF_FIELD_SIZE_LENGTH_MAX + 1];
82 char type[TQSL_ADIF_FIELD_TYPE_LENGTH_MAX + 1];
83 unsigned char *data;
84 unsigned int adifNameIndex;
85 void *userPointer;
86 int line_no;
87} tqsl_adifFieldResults;
88
89
90/* function prototypes */
91
92#define TQSLLIB_DEF
93#include "tqsllib.h"
94
95#ifdef __cplusplus
96extern "C" {
97#endif
98
100 DLLEXPORT const char* CALLCONVENTION tqsl_adifGetError(TQSL_ADIF_GET_FIELD_ERROR status);
101
103 DLLEXPORT int CALLCONVENTION tqsl_beginADIF(tQSL_ADIF *adifp, const char *filename);
104
121 DLLEXPORT int CALLCONVENTION tqsl_getADIFField(tQSL_ADIF adif, tqsl_adifFieldResults *field, TQSL_ADIF_GET_FIELD_ERROR *status,
122 const tqsl_adifFieldDefinitions *adifFields, const char * const *typesDefined,
123 unsigned char *(*allocator)(size_t) );
124
126 DLLEXPORT int CALLCONVENTION tqsl_getADIFLine(tQSL_ADIF adif, int *lineno);
127
129 DLLEXPORT int CALLCONVENTION tqsl_endADIF(tQSL_ADIF *adifp);
130
136 DLLEXPORT int CALLCONVENTION tqsl_adifMakeField(const char *fieldname, char type, const unsigned char *value, int len,
137 unsigned char *buf, int buflen);
138
139#ifdef __cplusplus
140}
141#endif
142
144
145#endif /* __ADIF_H */
tQSL_ADIF
void * tQSL_ADIF
Opaque ADIF type.
Definition adif.h:41
TQSL_ADIF_BOOLEAN
TQSL_ADIF_BOOLEAN
Definition adif.h:35
tqsl_getADIFLine
DLLEXPORT int CALLCONVENTION tqsl_getADIFLine(tQSL_ADIF adif, int *lineno)
tqsl_getADIFField
DLLEXPORT int CALLCONVENTION tqsl_getADIFField(tQSL_ADIF adif, tqsl_adifFieldResults *field, TQSL_ADIF_GET_FIELD_ERROR *status, const tqsl_adifFieldDefinitions *adifFields, const char *const *typesDefined, unsigned char *(*allocator)(size_t))
TQSL_ADIF_GET_FIELD_ERROR
TQSL_ADIF_GET_FIELD_ERROR
Response values returned from tqsl_getADIFField()
Definition adif.h:51
TQSL_ADIF_FIELD_TYPE_LENGTH_MAX
#define TQSL_ADIF_FIELD_TYPE_LENGTH_MAX
Max length of field type.
Definition adif.h:29
tqsl_beginADIF
DLLEXPORT int CALLCONVENTION tqsl_beginADIF(tQSL_ADIF *adifp, const char *filename)
tqsl_endADIF
DLLEXPORT int CALLCONVENTION tqsl_endADIF(tQSL_ADIF *adifp)
TQSL_ADIF_FIELD_SIZE_LENGTH_MAX
#define TQSL_ADIF_FIELD_SIZE_LENGTH_MAX
Max length of field name.
Definition adif.h:28
tqsl_adifGetError
DLLEXPORT const char *CALLCONVENTION tqsl_adifGetError(TQSL_ADIF_GET_FIELD_ERROR status)
TQSL_ADIF_RANGE_TYPE
TQSL_ADIF_RANGE_TYPE
Specifies the type of range limits to apply to a field.
Definition adif.h:44
TQSL_ADIF_FIELD_NAME_LENGTH_MAX
#define TQSL_ADIF_FIELD_NAME_LENGTH_MAX
Max length of ADIF field.
Definition adif.h:27
tqsl_adifMakeField
DLLEXPORT int CALLCONVENTION tqsl_adifMakeField(const char *fieldname, char type, const unsigned char *value, int len, unsigned char *buf, int buflen)
tqsl_adifFieldDefinitions
Definition adif.h:67
tqsl_adifFieldDefinitions::max_length
unsigned int max_length
Max length.
Definition adif.h:71
tqsl_adifFieldDefinitions::enumStrings
const char ** enumStrings
Enumerated values.
Definition adif.h:74
tqsl_adifFieldDefinitions::name
char name[TQSL_ADIF_FIELD_NAME_LENGTH_MAX+1]
Field name.
Definition adif.h:68
tqsl_adifFieldDefinitions::userPointer
void * userPointer
user pointer
Definition adif.h:75
tqsl_adifFieldDefinitions::rangeType
TQSL_ADIF_RANGE_TYPE rangeType
Range type.
Definition adif.h:70
tqsl_adifFieldDefinitions::type
char type[TQSL_ADIF_FIELD_TYPE_LENGTH_MAX+1]
Field type.
Definition adif.h:69
tqsl_adifFieldDefinitions::max_value
long signed max_value
Max value.
Definition adif.h:73
tqsl_adifFieldDefinitions::min_value
long signed min_value
Min value.
Definition adif.h:72
tqsl_adifFieldResults
Definition adif.h:79
tqsl_adifFieldResults::line_no
int line_no
Input line where the tag was found.
Definition adif.h:86
tqsl_adifFieldResults::userPointer
void * userPointer
User pointer.
Definition adif.h:85
tqsl_adifFieldResults::data
unsigned char * data
data
Definition adif.h:83
tqsl_adifFieldResults::type
char type[TQSL_ADIF_FIELD_TYPE_LENGTH_MAX+1]
Type.
Definition adif.h:82
tqsl_adifFieldResults::name
char name[TQSL_ADIF_FIELD_NAME_LENGTH_MAX+1]
Field name.
Definition adif.h:80
tqsl_adifFieldResults::adifNameIndex
unsigned int adifNameIndex
Name index.
Definition adif.h:84
tqsl_adifFieldResults::size
char size[TQSL_ADIF_FIELD_SIZE_LENGTH_MAX+1]
Size.
Definition adif.h:81
tqsllib.h
CALLCONVENTION
#define CALLCONVENTION
Symbol exports - Windows only.
Definition tqsllib.h:27
DLLEXPORT
#define DLLEXPORT
Symbol exports - Windows only.
Definition tqsllib.h:25