Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

libofx.h

Go to the documentation of this file.
00001 /***************************************************************************
00002               libofx.h  -  Main header file for the libofx API
00003                              -------------------
00004     copyright            : (C) 2002 by Benoit Grégoire
00005     email                : bock@step.polymtl.ca
00006 ***************************************************************************/
00026 /***************************************************************************
00027  *                                                                         *
00028  *   This program is free software; you can redistribute it and/or modify  *
00029  *   it under the terms of the GNU General Public License as published by  *
00030  *   the Free Software Foundation; either version 2 of the License, or     *
00031  *   (at your option) any later version.                                   *
00032  *                                                                         *
00033  ***************************************************************************/
00034 
00035 #ifndef LIBOFX_H
00036 #define LIBOFX_H
00037 #include <time.h>
00038 
00039 #ifdef __cplusplus
00040 #define CFCT extern "C"
00041 #else
00042 #define CFCT
00043 #define true 1
00044 #define false 0
00045 #endif
00046 
00047 #define OFX_ELEMENT_NAME_LENGTH         100
00048 #define OFX_SVRTID2_LENGTH             36 + 1
00049 #define OFX_CHECK_NUMBER_LENGTH        12 + 1
00050 #define OFX_REFERENCE_NUMBER_LENGTH    32 + 1
00051 #define OFX_FITID_LENGTH               255 + 1
00052 #define OFX_TOKEN2_LENGTH              36 + 1
00053 #define OFX_MEMO2_LENGTH               390 + 1
00054 #define OFX_BALANCE_NAME_LENGTH        32 + 1
00055 #define OFX_BALANCE_DESCRIPTION_LENGTH 80 + 1
00056 #define OFX_CURRENCY_LENGTH            3 + 1 /* In ISO-4217 format */
00057 #define OFX_BANKID_LENGTH              9
00058 #define OFX_BRANCHID_LENGTH            22 + 1
00059 #define OFX_ACCTID_LENGTH              22 + 1 
00060 #define OFX_ACCTKEY_LENGTH             22 + 1
00061 #define OFX_BROKERID_LENGTH            22 + 1
00062 /* Must be MAX of <BANKID>+<BRANCHID>+<ACCTID>, <ACCTID>+<ACCTKEY> and <ACCTID>+<BROKERID> */
00063 #define OFX_ACCOUNT_ID_LENGTH OFX_BANKID_LENGTH + OFX_BRANCHID_LENGTH + OFX_ACCTID_LENGTH + 1
00064 #define OFX_ACCOUNT_NAME_LENGTH        255
00065 #define OFX_MARKETING_INFO_LENGTH      360 + 1
00066 #define OFX_TRANSACTION_NAME_LENGTH    32 + 1
00067 #define OFX_UNIQUE_ID_LENGTH           32 + 1
00068 #define OFX_UNIQUE_ID_TYPE_LENGTH      10 + 1
00069 #define OFX_SECNAME_LENGTH             32 + 1
00070 #define OFX_TICKER_LENGTH              32 + 1
00071 
00078 CFCT int ofx_proc_file(int argc, char *argv[]);
00079 
00080 
00093 struct OfxStatusData{  
00098   char ofx_element_name[OFX_ELEMENT_NAME_LENGTH];
00100   int ofx_element_name_valid;
00101   
00106   int code;            
00107   char* name;          
00108   char* description;   
00109   int code_valid;      
00112     enum Severity{INFO, 
00113                 WARN, 
00114                 ERROR 
00115   } severity;
00116   int severity_valid;
00117   
00123   char* server_message; 
00125   int server_message_valid;
00127 };
00128 
00129 
00137 CFCT int ofx_proc_status_cb(const struct OfxStatusData data);
00138 
00145 struct OfxAccountData{
00146   
00157   char account_id[OFX_ACCOUNT_ID_LENGTH];
00163   char account_name[OFX_ACCOUNT_NAME_LENGTH];
00164   int account_id_valid;/* Use for both account_id and account_name */
00165 
00167     enum AccountType{
00168     OFX_CHECKING,  
00169     OFX_SAVINGS,   
00170     OFX_MONEYMRKT, 
00171     OFX_CREDITLINE,
00172     OFX_CMA,       
00173     OFX_CREDITCARD,
00174     OFX_INVESTMENT 
00175   } account_type;
00176   int account_type_valid;
00177   char currency[OFX_CURRENCY_LENGTH]; 
00178   int currency_valid;
00179 
00180 };
00181 
00193 CFCT int ofx_proc_account_cb(const struct OfxAccountData data);
00194 
00201 struct OfxSecurityData{
00207   char unique_id[OFX_UNIQUE_ID_LENGTH];   
00208   int unique_id_valid;
00209   char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
00211   int unique_id_type_valid;
00212   char secname[OFX_SECNAME_LENGTH];
00213   int secname_valid;
00214 
00220   char ticker[OFX_TICKER_LENGTH];
00221   int ticker_valid;
00222 
00223   double unitprice;
00225   int unitprice_valid;
00226 
00227   time_t date_unitprice;
00228   int date_unitprice_valid;
00229 
00230   char currency[OFX_CURRENCY_LENGTH]; 
00233   int currency_valid;
00234   char memo[OFX_MEMO2_LENGTH];
00235   int memo_valid;
00236 };/* end struct OfxSecurityData */
00237 
00248 CFCT int ofx_proc_security_cb(const struct OfxSecurityData data);
00249 
00250 
00257 struct OfxTransactionData{
00258   
00264   char account_id[OFX_ACCOUNT_ID_LENGTH];
00267   struct OfxAccountData * account_ptr; 
00269   int account_id_valid;
00270   enum TransactionType{
00271     OFX_CREDIT,     
00272     OFX_DEBIT,      
00273     OFX_INT,        
00274     OFX_DIV,        
00275     OFX_FEE,        
00276     OFX_SRVCHG,     
00277     OFX_DEP,        
00278     OFX_ATM,        
00279     OFX_POS,        
00280     OFX_XFER,       
00281     OFX_CHECK,      
00282     OFX_PAYMENT,    
00283     OFX_CASH,       
00284     OFX_DIRECTDEP,  
00285     OFX_DIRECTDEBIT,
00286     OFX_REPEATPMT,  
00287     OFX_OTHER       
00288   } transactiontype;
00289   int transactiontype_valid;
00290  
00294   enum InvTransactionType{
00295     OFX_BUYDEBT,        
00296     OFX_BUYMF,          
00297     OFX_BUYOPT,         
00298     OFX_BUYOTHER,       
00299     OFX_BUYSTOCK,       
00300     OFX_CLOSUREOPT,     
00301     OFX_INCOME,         
00302     OFX_INVEXPENSE,     
00303     OFX_JRNLFUND,       
00304     OFX_JRNLSEC,        
00305     OFX_MARGININTEREST, 
00306     OFX_REINVEST,       
00307     OFX_RETOFCAP,       
00308     OFX_SELLDEBT,       
00309     OFX_SELLMF,         
00310     OFX_SELLOPT,        
00311     OFX_SELLOTHER,      
00312     OFX_SELLSTOCK,      
00313     OFX_SPLIT,          
00314     OFX_TRANSFER        
00315   }  invtransactiontype;
00316 
00317  int  invtransactiontype_valid;
00318 
00319   double units;     
00325   int units_valid;
00326   double unitprice; 
00328   int unitprice_valid;
00329   double amount;    
00333   int amount_valid;
00334   char fi_id[256];  
00337   int fi_id_valid;
00338   
00346   char unique_id[OFX_UNIQUE_ID_LENGTH];  
00347   int unique_id_valid;
00348   char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
00350   int unique_id_type_valid;
00351   struct OfxSecurityData *security_data_ptr;  
00352   int security_data_valid;
00353   
00354   time_t date_posted;
00359   int date_posted_valid;
00360   
00361   time_t date_initiated;
00367   int date_initiated_valid;
00368   time_t date_funds_available;
00371   int date_funds_available_valid;
00375   char fi_id_corrected[256];
00376   int fi_id_corrected_valid;
00379   enum FiIdCorrectionAction{
00380     DELETE, 
00382     REPLACE 
00384   } fi_id_correction_action;
00385   int fi_id_correction_action_valid;
00386   
00389   char server_transaction_id[OFX_SVRTID2_LENGTH];
00390   int server_transaction_id_valid;
00394 char check_number[OFX_CHECK_NUMBER_LENGTH];
00395   int check_number_valid;
00398   char reference_number[OFX_REFERENCE_NUMBER_LENGTH];
00399   int reference_number_valid;
00400   long int standard_industrial_code;
00402   int standard_industrial_code_valid;
00403   char payee_id[OFX_SVRTID2_LENGTH];
00404   int payee_id_valid;
00405   char name[OFX_TRANSACTION_NAME_LENGTH];
00407   int name_valid;
00408   char memo[OFX_MEMO2_LENGTH];
00409   int memo_valid;
00410 
00411   /*********** NOT YET COMPLETE!!! *********************/
00412 };
00413 
00421 CFCT int ofx_proc_transaction_cb(const struct OfxTransactionData data);
00422 
00431 struct OfxStatementData{
00432 
00440   char currency[OFX_CURRENCY_LENGTH]; 
00441   int currency_valid;
00442   char account_id[OFX_ACCOUNT_ID_LENGTH];
00444   struct OfxAccountData * account_ptr; 
00446   int account_id_valid;
00449   double ledger_balance;
00450   int ledger_balance_valid;
00451   time_t ledger_balance_date;
00452   int ledger_balance_date_valid;
00453   
00459   double available_balance; 
00462   int available_balance_valid;
00463   time_t available_balance_date;
00464   int available_balance_date_valid;
00469   time_t date_start;
00470   int date_start_valid;
00475   time_t date_end;
00476   int date_end_valid;
00479   char marketing_info[OFX_MARKETING_INFO_LENGTH];
00480   int marketing_info_valid;
00481 };
00482 
00489 CFCT int ofx_proc_statement_cb(const struct OfxStatementData data);
00490 
00494 struct OfxCurrency{
00495   char currency[OFX_CURRENCY_LENGTH]; 
00496   double exchange_rate;  
00497   int must_convert;   
00498 };
00499 
00500 #endif
00501 

Generated on Sun Nov 24 20:26:31 2002 for LibOFX by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002