Main Page | Modules | Class List | File List | File Members

tqsllib.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           tqsllib.h  -  description
00003                              -------------------
00004     begin                : Mon May 20 2002
00005     copyright            : (C) 2002 by ARRL
00006     author               : Jon Bloom
00007     email                : jbloom@arrl.org
00008     revision             : $Id: tqsllib_8h-source.html,v 1.8 2005/02/22 13:16:11 ke3z Exp $
00009  ***************************************************************************/
00010 
00011 #ifndef TQSLLIB_H
00012 #define TQSLLIB_H
00013 
00014 #ifdef __WIN32__
00015         #ifdef TQSLLIB_DEF
00016                 #define DLLEXPORT __stdcall __declspec(dllexport)
00017                 #define DLLEXPORTDATA __declspec(dllexport)
00018         #else
00019                 #define DLLEXPORT __stdcall __declspec(dllimport)
00020                 #define DLLEXPORTDATA __declspec(dllimport)
00021         #endif
00022 #else
00023         #define DLLEXPORT
00024         #define DLLEXPORTDATA
00025 #endif
00026 
00027 #include "adif.h"
00028 #include "cabrillo.h"
00029 
00034 /* Sizes */
00035 #define TQSL_MAX_PATH_LEN            256
00036 #define TQSL_PASSWORD_MAX            80
00037 #define TQSL_NAME_ELEMENT_MAX        256
00038 #define TQSL_CALLSIGN_MAX            13
00039 #define TQSL_CRQ_NAME_MAX            60
00040 #define TQSL_CRQ_ADDR_MAX            80
00041 #define TQSL_CRQ_CITY_MAX            80
00042 #define TQSL_CRQ_STATE_MAX           80
00043 #define TQSL_CRQ_POSTAL_MAX          20
00044 #define TQSL_CRQ_COUNTRY_MAX         80
00045 #define TQSL_CRQ_EMAIL_MAX           180
00046 #define TQSL_BAND_MAX                6
00047 #define TQSL_MODE_MAX                16
00048 #define TQSL_FREQ_MAX                20
00049 #define TQSL_SATNAME_MAX             6
00050 #define TQSL_PROPMODE_MAX            6
00051 
00052 #define TQSL_CERT_CB_USER            0
00053 #define TQSL_CERT_CB_CA              1
00054 #define TQSL_CERT_CB_ROOT            2
00055 #define TQSL_CERT_CB_PKEY            3
00056 #define TQSL_CERT_CB_CONFIG          4
00057 #define TQSL_CERT_CB_CERT_TYPE(x)    ((x) & 0xf)
00058 #define TQSL_CERT_CB_MILESTONE       0
00059 #define TQSL_CERT_CB_RESULT          0x10
00060 #define TQSL_CERT_CB_CALL_TYPE(x)    ((x) & TQSL_CERT_CB_RESULT)
00061 #define TQSL_CERT_CB_PROMPT          0
00062 #define TQSL_CERT_CB_DUPLICATE       0x100
00063 #define TQSL_CERT_CB_ERROR           0x200
00064 #define TQSL_CERT_CB_LOADED          0x300
00065 #define TQSL_CERT_CB_RESULT_TYPE(x)  ((x) & 0x0f00)
00066 
00067 typedef void * tQSL_Cert;
00068 typedef void * tQSL_Location;
00069 
00071 typedef struct {
00072         int year;
00073         int month;
00074         int day;
00075 } tQSL_Date;
00076 
00078 typedef struct {
00079         int hour;
00080         int minute;
00081         int second;
00082 } tQSL_Time;
00083 
00085 typedef struct tqsl_provider_st {
00086         char organizationName[TQSL_NAME_ELEMENT_MAX+1];
00087         char organizationalUnitName[TQSL_NAME_ELEMENT_MAX+1];
00088         char emailAddress[TQSL_NAME_ELEMENT_MAX+1];
00089         char url[TQSL_NAME_ELEMENT_MAX+1];
00090 } TQSL_PROVIDER;
00091 
00093 typedef struct tqsl_cert_req_st {
00094         char providerName[TQSL_NAME_ELEMENT_MAX+1];
00095         char providerUnit[TQSL_NAME_ELEMENT_MAX+1];
00096         char callSign[TQSL_CALLSIGN_MAX+1];
00097         char name[TQSL_CRQ_NAME_MAX+1];
00098         char address1[TQSL_CRQ_ADDR_MAX+1];
00099         char address2[TQSL_CRQ_ADDR_MAX+1];
00100         char city[TQSL_CRQ_CITY_MAX+1];
00101         char state[TQSL_CRQ_STATE_MAX+1];
00102         char postalCode[TQSL_CRQ_POSTAL_MAX+1];
00103         char country[TQSL_CRQ_COUNTRY_MAX+1];
00104         char emailAddress[TQSL_CRQ_EMAIL_MAX+1];
00105         int dxccEntity;
00106         tQSL_Date qsoNotBefore;
00107         tQSL_Date qsoNotAfter;
00108         char password[TQSL_PASSWORD_MAX+1];
00109         tQSL_Cert signer;
00110         char renew;
00111 } TQSL_CERT_REQ;
00112 
00114 typedef struct {
00115         char callsign[TQSL_CALLSIGN_MAX+1];
00116         char band[TQSL_BAND_MAX+1];
00117         char mode[TQSL_MODE_MAX+1];
00118         tQSL_Date date;
00119         tQSL_Time time;
00120         char freq[TQSL_FREQ_MAX+1];
00121         char rxfreq[TQSL_FREQ_MAX+1];
00122         char rxband[TQSL_BAND_MAX+1];
00123         char propmode[TQSL_PROPMODE_MAX+1];
00124         char satname[TQSL_SATNAME_MAX+1];
00125 } TQSL_QSO_RECORD;
00126 
00128 extern const char *tQSL_BaseDir;
00129 
00130 #ifdef __cplusplus
00131 extern "C" {
00132 #endif
00133 
00138 
00139 
00141 DLLEXPORTDATA extern int tQSL_Error;
00143 DLLEXPORTDATA extern TQSL_ADIF_GET_FIELD_ERROR tQSL_ADIF_Error;
00145 DLLEXPORTDATA extern TQSL_CABRILLO_ERROR_TYPE tQSL_Cabrillo_Error;
00147 DLLEXPORTDATA extern char tQSL_ErrorFile[256];
00149 DLLEXPORTDATA extern char tQSL_CustomError[256];
00150 
00155 DLLEXPORT int tqsl_init();
00156 
00166 DLLEXPORT int tqsl_setDirectory(const char *dir);
00167 
00171 DLLEXPORT const char *tqsl_getErrorString();
00172 
00177 DLLEXPORT const char *tqsl_getErrorString_v(int err);
00178 
00186 DLLEXPORT int tqsl_encodeBase64(const unsigned char *data, int datalen, char *output, int outputlen);
00187 
00196 DLLEXPORT int tqsl_decodeBase64(const char *input, unsigned char *data, int *datalen);
00197 
00204 DLLEXPORT int tqsl_initDate(tQSL_Date *date, const char *str);
00205 
00212 DLLEXPORT int tqsl_initTime(tQSL_Time *time, const char *str);
00213 
00223 DLLEXPORT int tqsl_compareDates(const tQSL_Date *a, const tQSL_Date *b);
00224 
00229 DLLEXPORT char *tqsl_convertDateToText(const tQSL_Date *date, char *buf, int bufsiz);
00230 
00235 DLLEXPORT int tqsl_isDateValid(const tQSL_Date *d);
00236 
00241 DLLEXPORT int tqsl_isDateNull(const tQSL_Date *d);
00242 
00247 DLLEXPORT int tqsl_isTimeValid(const tQSL_Time *t);
00248 
00253 DLLEXPORT char *tqsl_convertTimeToText(const tQSL_Time *time, char *buf, int bufsiz);
00254 
00257 DLLEXPORT int tqsl_getVersion(int *major, int *minor);
00258 
00261 DLLEXPORT int tqsl_getConfigVersion(int *major, int *minor);
00262 
00291 #define TQSL_SELECT_CERT_WITHKEYS 1
00292 #define TQSL_SELECT_CERT_EXPIRED 2
00293 #define TQSL_SELECT_CERT_SUPERCEDED 4
00294 
00320 DLLEXPORT int tqsl_selectCertificates(tQSL_Cert **certlist, int *ncerts,
00321         const char *callsign, int dxcc, const tQSL_Date *date, const TQSL_PROVIDER *issuer, int flag);
00322 
00331 DLLEXPORT int tqsl_getSelectedCertificate(tQSL_Cert *cert, const tQSL_Cert **certlist,
00332         int idx);
00333 
00336 DLLEXPORT int tqsl_getCertificateKeyOnly(tQSL_Cert cert, int *keyonly);
00337 
00340 DLLEXPORT int tqsl_getCertificateEncoded(tQSL_Cert cert, char *buf, int bufsiz);
00341 
00344 DLLEXPORT int tqsl_getCertificateSerial(tQSL_Cert cert, long *serial);
00345 
00355 DLLEXPORT int tqsl_getCertificateIssuer(tQSL_Cert cert, char *buf, int bufsiz);
00356 
00366 DLLEXPORT int tqsl_getCertificateIssuerOrganization(tQSL_Cert cert, char *buf, int bufsiz);
00376 DLLEXPORT int tqsl_getCertificateIssuerOrganizationalUnit(tQSL_Cert cert, char *buf, int bufsiz);
00386 DLLEXPORT int tqsl_getCertificateCallSign(tQSL_Cert cert, char *buf, int bufsiz);
00396 DLLEXPORT int tqsl_getCertificateAROName(tQSL_Cert cert, char *buf, int bufsiz);
00397 
00407 DLLEXPORT int tqsl_getCertificateEmailAddress(tQSL_Cert cert, char *buf, int bufsiz);
00408 
00417 DLLEXPORT int tqsl_getCertificateQSONotBeforeDate(tQSL_Cert cert, tQSL_Date *date);
00418 
00427 DLLEXPORT int tqsl_getCertificateQSONotAfterDate(tQSL_Cert cert, tQSL_Date *date);
00428 
00437 DLLEXPORT int tqsl_getCertificateNotBeforeDate(tQSL_Cert cert, tQSL_Date *date);
00438 
00447 DLLEXPORT int tqsl_getCertificateNotAfterDate(tQSL_Cert cert, tQSL_Date *date);
00448 
00457 DLLEXPORT int tqsl_getCertificateDXCCEntity(tQSL_Cert cert, int *dxcc);
00458 
00469 DLLEXPORT int tqsl_getCertificateRequestAddress1(tQSL_Cert cert, char *str, int bufsiz);
00470 
00481 DLLEXPORT int tqsl_getCertificateRequestAddress2(tQSL_Cert cert, char *str, int bufsiz);
00482 
00493 DLLEXPORT int tqsl_getCertificateRequestCity(tQSL_Cert cert, char *str, int bufsiz);
00494 
00505 DLLEXPORT int tqsl_getCertificateRequestState(tQSL_Cert cert, char *str, int bufsiz);
00506 
00517 DLLEXPORT int tqsl_getCertificateRequestPostalCode(tQSL_Cert cert, char *str, int bufsiz);
00518 
00529 DLLEXPORT int tqsl_getCertificateRequestCountry(tQSL_Cert cert, char *str, int bufsiz);
00530 
00531 #define TQSL_PK_TYPE_ERR        0
00532 #define TQSL_PK_TYPE_NONE       1
00533 #define TQSL_PK_TYPE_UNENC      2
00534 #define TQSL_PK_TYPE_ENC        3
00535 
00550 DLLEXPORT int tqsl_getCertificatePrivateKeyType(tQSL_Cert cert);
00551 
00552 
00556 DLLEXPORT void tqsl_freeCertificate(tQSL_Cert cert);
00557 
00558 /* int tqsl_checkCertificate(tQSL_Cert); */
00559 
00577 DLLEXPORT int tqsl_importTQSLFile(const char *file, int(*cb)(int type, const char *message, void *userdata), void *user);
00578 
00581 DLLEXPORT int tqsl_getNumProviders(int *n);
00582 
00587 DLLEXPORT int tqsl_getProvider(int idx, TQSL_PROVIDER *provider);
00588 
00601 DLLEXPORT int tqsl_createCertRequest(const char *filename, TQSL_CERT_REQ *req,
00602         int(*pwcb)(char *pwbuf, int pwsize, void *userdata), void *user);
00603 
00611 DLLEXPORT int tqsl_exportPKCS12File(tQSL_Cert cert, const char *filename, const char *p12password);
00612 
00615 DLLEXPORT int tqsl_importPKCS12File(const char *filename, const char *p12password, const char *password,
00616         int (*pwcb)(char *buf, int bufsiz, void *userdata), int(*cb)(int type , const char *message, void *userdata), void *user);
00617 
00620 DLLEXPORT int tqsl_deleteCertificate(tQSL_Cert cert);
00621 
00644 DLLEXPORT int tqsl_beginSigning(tQSL_Cert cert, char *password,  int(*pwcb)(char *pwbuf, int pwsize, void *userdata), void *user);
00645 
00650 DLLEXPORT int tqsl_checkSigningStatus(tQSL_Cert cert);
00651 
00656 DLLEXPORT int tqsl_getMaxSignatureSize(tQSL_Cert cert, int *sigsize);
00657 
00663 DLLEXPORT int tqsl_signDataBlock(tQSL_Cert cert, const unsigned char *data, int datalen, unsigned char *sig, int *siglen);
00664 
00669 DLLEXPORT int tqsl_verifyDataBlock(tQSL_Cert cert, const unsigned char *data, int datalen, unsigned char *sig, int siglen);
00670 
00678 DLLEXPORT int tqsl_signQSORecord(tQSL_Cert cert, tQSL_Location loc, TQSL_QSO_RECORD *rec, unsigned char *sig, int *siglen);
00679 
00684 DLLEXPORT int tqsl_endSigning(tQSL_Cert cert);
00685 
00787 /* Location field input types */
00788 
00789 #define TQSL_LOCATION_FIELD_TEXT        1
00790 #define TQSL_LOCATION_FIELD_DDLIST      2
00791 #define TQSL_LOCATION_FIELD_LIST        3
00792 
00793 /* Location field data types */
00794 #define TQSL_LOCATION_FIELD_CHAR 1
00795 #define TQSL_LOCATION_FIELD_INT 2
00796 
00798 DLLEXPORT int tqsl_initStationLocationCapture(tQSL_Location *locp);
00799 
00804 DLLEXPORT int tqsl_endStationLocationCapture(tQSL_Location *locp);
00805 
00807 DLLEXPORT int tqsl_updateStationLocationCapture(tQSL_Location loc);
00808 
00809 //int tqsl_getNumStationLocationCapturePages(tQSL_Location loc, int *npages);
00810 
00812 DLLEXPORT int tqsl_getStationLocationCapturePage(tQSL_Location loc, int *page);
00813 
00818 DLLEXPORT int tqsl_setStationLocationCapturePage(tQSL_Location loc, int page);
00819 
00821 DLLEXPORT int tqsl_nextStationLocationCapture(tQSL_Location loc);
00822 
00824 DLLEXPORT int tqsl_prevStationLocationCapture(tQSL_Location loc);
00825 
00827 DLLEXPORT int tqsl_hasNextStationLocationCapture(tQSL_Location loc, int *rval);
00828 
00830 DLLEXPORT int tqsl_hasPrevStationLocationCapture(tQSL_Location loc, int *rval);
00831 
00838 DLLEXPORT int tqsl_saveStationLocationCapture(tQSL_Location loc, int overwrite);
00839 
00841 DLLEXPORT int tqsl_getStationLocationCaptureName(tQSL_Location loc, char *namebuf, int bufsiz);
00842 
00844 DLLEXPORT int tqsl_setStationLocationCaptureName(tQSL_Location loc, const char *name);
00845 
00847 DLLEXPORT int tqsl_getNumStationLocations(tQSL_Location loc, int *nloc);
00848 
00850 DLLEXPORT int tqsl_getStationLocationName(tQSL_Location loc, int idx, char *buf, int bufsiz);
00851 
00853 DLLEXPORT int tqsl_getStationLocationCallSign(tQSL_Location loc, int idx, char *buf, int bufsiz);
00854 
00859 DLLEXPORT int tqsl_getStationLocation(tQSL_Location *loc, const char *name);
00860 
00862 DLLEXPORT int tqsl_deleteStationLocation(const char *name);
00863 
00865 DLLEXPORT int tqsl_getNumLocationField(tQSL_Location loc, int *numf);
00866 
00868 DLLEXPORT int tqsl_getLocationFieldDataLabelSize(tQSL_Location loc, int field_num, int *rval);
00869 
00871 DLLEXPORT int tqsl_getLocationFieldDataLabel(tQSL_Location loc, int field_num, char *buf, int bufsiz);
00872 
00874 DLLEXPORT int tqsl_getLocationFieldDataGABBISize(tQSL_Location loc, int field_num, int *rval);
00875 
00877 DLLEXPORT int tqsl_getLocationFieldDataGABBI(tQSL_Location loc, int field_num, char *buf, int bufsiz);
00878 
00884 DLLEXPORT int tqsl_getLocationFieldInputType(tQSL_Location loc, int field_num, int *type);
00885 
00890 DLLEXPORT int tqsl_getLocationFieldDataType(tQSL_Location loc, int field_num, int *type);
00891 
00893 DLLEXPORT int tqsl_getLocationFieldDataLength(tQSL_Location loc, int field_num, int *rval);
00894 
00901 DLLEXPORT int tqsl_getLocationFieldCharData(tQSL_Location loc, int field_num, char *buf, int bufsiz);
00902 
00908 DLLEXPORT int tqsl_getLocationFieldIntData(tQSL_Location loc, int field_num, int *dat);
00909 
00914 DLLEXPORT int tqsl_getLocationFieldIndex(tQSL_Location loc, int field_num, int *dat);
00915 
00917 DLLEXPORT int tqsl_getNumLocationFieldListItems(tQSL_Location loc, int field_num, int *rval);
00918 
00920 DLLEXPORT int tqsl_getLocationFieldListItem(tQSL_Location loc, int field_num, int item_idx, char *buf, int bufsiz);
00921 
00923 DLLEXPORT int tqsl_setLocationFieldCharData(tQSL_Location loc, int field_num, const char *buf);
00924 
00927 DLLEXPORT int tqsl_setLocationFieldIntData(tQSL_Location loc, int field_num, int dat);
00928 
00933 DLLEXPORT int tqsl_setLocationFieldIndex(tQSL_Location loc, int field_num, int dat);
00934 
00939 DLLEXPORT int tqsl_getLocationFieldChanged(tQSL_Location loc, int field_num, int *changed);
00940 
00942 DLLEXPORT int tqsl_getLocationCallSign(tQSL_Location loc, char *buf, int bufsiz);
00943 
00945 DLLEXPORT int tqsl_getLocationDXCCEntity(tQSL_Location loc, int *dxcc);
00946 
00949 DLLEXPORT int tqsl_getNumDXCCEntity(int *number);
00950 
00953 DLLEXPORT int tqsl_getDXCCEntity(int index, int *number, const char **name);
00954 
00957 DLLEXPORT int tqsl_getDXCCEntityName(int number, const char **name);
00958 
00960 DLLEXPORT int tqsl_getNumBand(int *number);
00961 
00971 DLLEXPORT int tqsl_getBand(int index, const char **name, const char **spectrum, int *low, int *high);
00972 
00974 DLLEXPORT int tqsl_getNumMode(int *number);
00975 
00983 DLLEXPORT int tqsl_getMode(int index, const char **mode, const char **group);
00984 
00986 DLLEXPORT int tqsl_getNumPropagationMode(int *number);
00987 
00995 DLLEXPORT int tqsl_getPropagationMode(int index, const char **name, const char **descrip);
00996 
00998 DLLEXPORT int tqsl_getNumSatellite(int *number);
00999 
01009 DLLEXPORT int tqsl_getSatellite(int index, const char **name, const char **descrip,
01010         tQSL_Date *start, tQSL_Date *end);
01011 
01014 DLLEXPORT int tqsl_clearCabrilloMap();
01015 
01026 DLLEXPORT int tqsl_setCabrilloMapEntry(const char *contest, int field, int contest_type);
01027 
01039 DLLEXPORT int tqsl_getCabrilloMapEntry(const char *contest, int *fieldnum, int *contest_type);
01040 
01043 DLLEXPORT int tqsl_clearADIFModes();
01044 
01047 DLLEXPORT int tqsl_setADIFMode(const char *adif_item, const char *mode);
01048 
01051 DLLEXPORT int tqsl_getADIFMode(const char *adif_item, char *mode, int nmode);
01052 
01062 DLLEXPORT const char *tqsl_getGABBItCERT(tQSL_Cert cert, int uid);
01063 
01074 DLLEXPORT const char *tqsl_getGABBItSTATION(tQSL_Location loc, int uid, int certuid);
01075 
01088 DLLEXPORT const char *tqsl_getGABBItCONTACT(tQSL_Cert cert, tQSL_Location loc, TQSL_QSO_RECORD *qso,
01089         int stationuid);
01090 
01093 #ifdef __cplusplus
01094 }
01095 #endif
01096 
01097 /* Useful defines */
01098 #define TQSL_MAX_PW_LENGTH         32     /* Password buffer length */
01099 
01100 #endif /* TQSLLIB_H */

Generated on Tue Feb 22 08:15:36 2005 for TrustedQSL Library API by doxygen 1.3.4