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 
00072 CFCT void (*OfxCallbackFunc) ();
00073 
00074 
00081 CFCT int ofx_proc_file(int argc, char *argv[]);
00082 
00083 
00096 struct OfxStatusData{  
00101   char ofx_element_name[OFX_ELEMENT_NAME_LENGTH];
00103   int ofx_element_name_valid;
00104   
00109   int code;            
00110   char* name;          
00111   char* description;   
00112   int code_valid;      
00115     enum Severity{INFO, 
00116                 WARN, 
00117                 ERROR 
00118   } severity;
00119   int severity_valid;
00120   
00126   char* server_message; 
00128   int server_message_valid;
00130 };
00131 
00132 
00140 CFCT int ofx_proc_status_cb(const struct OfxStatusData data);
00141 
00148 struct OfxAccountData{
00149   
00160   char account_id[OFX_ACCOUNT_ID_LENGTH];
00166   char account_name[OFX_ACCOUNT_NAME_LENGTH];
00167   int account_id_valid;/* Use for both account_id and account_name */
00168 
00170     enum AccountType{
00171     OFX_CHECKING,  
00172     OFX_SAVINGS,   
00173     OFX_MONEYMRKT, 
00174     OFX_CREDITLINE,
00175     OFX_CMA,       
00176     OFX_CREDITCARD,
00177     OFX_INVESTMENT 
00178   } account_type;
00179   int account_type_valid;
00180   char currency[OFX_CURRENCY_LENGTH]; 
00181   int currency_valid;
00182 
00183 };
00184 
00196 CFCT int ofx_proc_account_cb(const struct OfxAccountData data);
00197 
00204 struct OfxSecurityData{
00210   char unique_id[OFX_UNIQUE_ID_LENGTH];   
00211   int unique_id_valid;
00212   char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
00214   int unique_id_type_valid;
00215   char secname[OFX_SECNAME_LENGTH];
00216   int secname_valid;
00217 
00223   char ticker[OFX_TICKER_LENGTH];
00224   int ticker_valid;
00225 
00226   double unitprice;
00228   int unitprice_valid;
00229 
00230   time_t date_unitprice;
00231   int date_unitprice_valid;
00232 
00233   char currency[OFX_CURRENCY_LENGTH]; 
00236   int currency_valid;
00237   char memo[OFX_MEMO2_LENGTH];
00238   int memo_valid;
00239 };/* end struct OfxSecurityData */
00240 
00251 CFCT int ofx_proc_security_cb(const struct OfxSecurityData data);
00252 
00253 
00260 struct OfxTransactionData{
00261   
00267   char account_id[OFX_ACCOUNT_ID_LENGTH];
00270   struct OfxAccountData * account_ptr; 
00272   int account_id_valid;
00273   enum TransactionType{
00274     OFX_CREDIT,     
00275     OFX_DEBIT,      
00276     OFX_INT,        
00277     OFX_DIV,        
00278     OFX_FEE,        
00279     OFX_SRVCHG,     
00280     OFX_DEP,        
00281     OFX_ATM,        
00282     OFX_POS,        
00283     OFX_XFER,       
00284     OFX_CHECK,      
00285     OFX_PAYMENT,    
00286     OFX_CASH,       
00287     OFX_DIRECTDEP,  
00288     OFX_DIRECTDEBIT,
00289     OFX_REPEATPMT,  
00290     OFX_OTHER       
00291   } transactiontype;
00292   int transactiontype_valid;
00293  
00297   enum InvTransactionType{
00298     OFX_BUYDEBT,        
00299     OFX_BUYMF,          
00300     OFX_BUYOPT,         
00301     OFX_BUYOTHER,       
00302     OFX_BUYSTOCK,       
00303     OFX_CLOSUREOPT,     
00304     OFX_INCOME,         
00305     OFX_INVEXPENSE,     
00306     OFX_JRNLFUND,       
00307     OFX_JRNLSEC,        
00308     OFX_MARGININTEREST, 
00309     OFX_REINVEST,       
00310     OFX_RETOFCAP,       
00311     OFX_SELLDEBT,       
00312     OFX_SELLMF,         
00313     OFX_SELLOPT,        
00314     OFX_SELLOTHER,      
00315     OFX_SELLSTOCK,      
00316     OFX_SPLIT,          
00317     OFX_TRANSFER        
00318   }  invtransactiontype;
00319 
00320  int  invtransactiontype_valid;
00321 
00322   double units;     
00328   int units_valid;
00329   double unitprice; 
00331   int unitprice_valid;
00332   double amount;    
00336   int amount_valid;
00337   char fi_id[256];  
00340   int fi_id_valid;
00341   
00349   char unique_id[OFX_UNIQUE_ID_LENGTH];  
00350   int unique_id_valid;
00351   char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
00353   int unique_id_type_valid;
00354   struct OfxSecurityData *security_data_ptr;  
00355   int security_data_valid;
00356   
00357   time_t date_posted;
00362   int date_posted_valid;
00363   
00364   time_t date_initiated;
00370   int date_initiated_valid;
00371   time_t date_funds_available;
00374   int date_funds_available_valid;
00378   char fi_id_corrected[256];
00379   int fi_id_corrected_valid;
00382   enum FiIdCorrectionAction{
00383     DELETE, 
00385     REPLACE 
00387   } fi_id_correction_action;
00388   int fi_id_correction_action_valid;
00389   
00392   char server_transaction_id[OFX_SVRTID2_LENGTH];
00393   int server_transaction_id_valid;
00397 char check_number[OFX_CHECK_NUMBER_LENGTH];
00398   int check_number_valid;
00401   char reference_number[OFX_REFERENCE_NUMBER_LENGTH];
00402   int reference_number_valid;
00403   long int standard_industrial_code;
00405   int standard_industrial_code_valid;
00406   char payee_id[OFX_SVRTID2_LENGTH];
00407   int payee_id_valid;
00408   char name[OFX_TRANSACTION_NAME_LENGTH];
00410   int name_valid;
00411   char memo[OFX_MEMO2_LENGTH];
00412   int memo_valid;
00413 
00414   /*********** NOT YET COMPLETE!!! *********************/
00415 };
00416 
00424 CFCT int ofx_proc_transaction_cb(const struct OfxTransactionData data);
00425 
00434 struct OfxStatementData{
00435 
00443   char currency[OFX_CURRENCY_LENGTH]; 
00444   int currency_valid;
00445   char account_id[OFX_ACCOUNT_ID_LENGTH];
00447   struct OfxAccountData * account_ptr; 
00449   int account_id_valid;
00452   double ledger_balance;
00453   int ledger_balance_valid;
00454   time_t ledger_balance_date;
00455   int ledger_balance_date_valid;
00456   
00462   double available_balance; 
00465   int available_balance_valid;
00466   time_t available_balance_date;
00467   int available_balance_date_valid;
00472   time_t date_start;
00473   int date_start_valid;
00478   time_t date_end;
00479   int date_end_valid;
00482   char marketing_info[OFX_MARKETING_INFO_LENGTH];
00483   int marketing_info_valid;
00484 };
00485 
00492 CFCT int ofx_proc_statement_cb(const struct OfxStatementData data);
00493 
00497 struct OfxCurrency{
00498   char currency[OFX_CURRENCY_LENGTH]; 
00499   double exchange_rate;  
00500   int must_convert;   
00501 };
00502 
00503 #endif
00504 

Generated on Fri Sep 12 00:35:46 2003 for LibOFX by doxygen 1.3.3