Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

api.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: api.h,v $
00003                              -------------------
00004     cvs         : $Id: api.h,v 1.32 2003/06/14 11:06:23 aquamaniac Exp $
00005     begin       : Sat Jun 08 2002
00006     copyright   : (C) 2001 by Martin Preuss
00007     email       : openhbci@aquamaniac.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00033 #ifndef HBCIAPI_H
00034 #define HBCIAPI_H
00035 
00036 #ifdef __cplusplus
00037 #include <string>
00038 #include <list>
00039 
00040 namespace HBCI {
00041   class API;
00042 };
00043 
00044 #endif /* __cplusplus */
00045 #include <openhbci/dllimport.h>
00046 #include <openhbci/hbci.h>
00047 #include <openhbci/pointer.h>
00048 #include <openhbci/error.h>
00049 #include <openhbci/bank.h>
00050 #include <openhbci/account.h>
00051 #include <openhbci/medium.h>
00052 #include <openhbci/mediumpluginlist.h>
00053 #ifdef __cplusplus
00054 #include <openhbci/adminjobs.h>
00055 
00056 
00080 typedef struct HBCI::API HBCI_API;
00081 #else /* __cplusplus */
00082 typedef struct HBCI_API HBCI_API;
00083 #endif /* __cplusplus */
00084 
00085 #ifdef __cplusplus
00086 #include <openhbci/loader.h>
00087 #include <openhbci/outbox.h>
00088 #include <openhbci/mediumplugin.h>
00089 #include <openhbci/mediumpluginfile.h>
00090 #endif /* __cplusplus */
00091 #include <openhbci/progressmonitor.h>
00092 #include <openhbci/outboxjob.h>
00093 #ifdef __cplusplus
00094 
00095 #define HBCIAPP_CONFIG_MODE (\
00096     PARSER_FLAGS_SKIP_BLANKS            |\
00097     PARSER_FLAGS_CUT_BLANKS             |\
00098     PARSER_FLAGS_REMOVE_QUOTATION_MARKS |\
00099     CONFIG_MODE_QUOTED_VALUES           |\
00100     CONFIG_MODE_UNIQUE_VARS             |\
00101     CONFIG_MODE_RETURN_ON_ERROR         |\
00102     CONFIG_MODE_WRITE_GROUP_NAME        |\
00103     CONFIG_MODE_IGNORE_GROUP_CASE       |\
00104     CONFIG_MODE_IGNORE_VAR_CASE         |\
00105     CONFIG_MODE_ALLOW_EMPTY_VALUES      |\
00106     CONFIG_MODE_ONE_VALUE_PER_LINE      |\
00107     CONFIG_MODE_BACKSLASH_CONTINUATION)
00108 
00109 
00113 namespace HBCI {
00114 
00115 class Connection;
00116     
00177 class DLLIMPORT API : public Hbci {
00178   friend class OutboxJobKeys; /* for postProcessInitJob */
00179   friend class OutboxJobSynchronize; /* for postProcessInitJob */
00180   friend class OutboxJobDisableKeys; /* for postProcessInitJob */
00181   friend class OutboxJobChangeKeys; /* for postProcessInitJob */
00182 private:
00183   list<Pointer<Bank> > _banks;
00184   list<Pointer<MediumPlugin> > _mediumPlugins;
00185   list<Pointer<MediumPluginFile> > _pluginFiles;
00186   Pointer<Loader> _loader;
00187   Pointer<ProgressMonitor> _monitor;
00188   Pointer<Outbox> _queue;
00189   static unsigned _nextTransactionId;
00190 
00191   void _logMessage(int loglevel, const string &msg);
00192   Error _handleMessageQueue(Pointer<Connection> conn,
00193                             Pointer<MessageQueue> mbox);
00194   Error _handleJobQueue(const list<Pointer<OutboxJob> > &jq,
00195                         Pointer<Connection> conn,
00196                         Pointer<MessageQueue> mbox,
00197                         bool dlg,
00198                         bool chg);
00199   Error _handleUserQueue(Pointer<customerQueue> q,
00200                          Pointer<Connection> conn,
00201                          bool chg=true);
00202   Error _handleBankQueue(Pointer<bankQueue> q, bool chg=true);
00203   Error _handleQueue(Pointer<Outbox> q, bool chg=true);
00204 
00205   string _getLibraryPrefix(const string &path);
00206   Pointer<MediumPlugin> _findMediumPlugin(const string &name);
00207   Error _tryToLoadPlugin(const string &path, const list<string> &mtye);
00208   Error _tryToLoadPlugin(const list<string> &dnames, const string &mtyes);
00209   Pointer<MediumPlugin> _ensureMediumPlugin(const string &name);
00210   void _addPluginsFromDirs(Pointer<MediumPluginList> pl,
00211                            const list<string> &dname);
00212 
00217   Error postProcessInitJob(JOBDialogInit &job);
00218 
00224   Error processInstituteMessages(Pointer<MessageQueue> mbox);
00225 
00226 public:
00241   API(bool readonly = false,
00242       bool retrievalOnly = false);
00243 
00245   ~API();
00246 
00264   Error loadEnvironment(const string &filename,
00265                         unsigned int fl=HBCILOADER_DEFAULT);
00266 
00280   Error saveEnvironment(const string &filename,
00281                         unsigned int fl=HBCILOADER_DEFAULT) const;
00288 #ifndef OPENHBCI_NO_COMPAT
00289 
00299   const list<Pointer<Bank> > &bankList() const
00300     { return banks(); };
00301 #endif
00302 
00311   const list<Pointer<Bank> > &banks() const
00312     { return _banks; };
00313 
00323   Pointer<Bank> findBank(int country, const string &instcode) const;
00324 
00332   Pointer<Medium> findMedium(const string &name) const;
00333 
00344   list<Pointer<Account> >
00345     getAccounts(int country=0,
00346                 const string &bankId="*",
00347                 const string &accountId="*") const;
00348 
00360   list<Pointer<User> >
00361     getUsers(int country=0,
00362              const string &instid="*",
00363              const string &userid="*") const;
00364 
00376   list<Pointer<Customer> >
00377     getCustomers(int country=0,
00378                  const string &instid="*",
00379                  const string &custid="*") const;
00398   Pointer<Account> findAccount(int country,
00399                                const string &instcode,
00400                                const string &accnr,
00401                                const string &suffix="") const;
00402 
00411   Pointer<User> findUser(int country,
00412                          const string &instcode,
00413                          const string &user) const;
00414 
00423   Pointer<Customer> findCustomer(int country,
00424                                  const string &instcode,
00425                                  const string &cust) const;
00426 
00432   int totalAccounts() const;
00433 
00439   int totalUsers() const;
00454   void addBank(Pointer<Bank> b);
00455 
00467   void removeBank(Pointer<Bank> b);
00492   Error addJob(Pointer<OutboxJob> job);
00493 
00518   Error executeQueue(bool chg=true);
00519 
00526   list<Pointer<OutboxJob> > queuedJobs() const;
00527 
00536   void clearQueueByResult(OutboxJob_Result result=HBCI_JOB_RESULT_NONE);
00537 
00547   void clearQueueByStatus(OutboxJob_Status status=HBCI_JOB_STATUS_NONE);
00548 
00553   void removeQueuedJob(Pointer<OutboxJob> job);
00567   Pointer<ProgressMonitor> monitor() const;
00568 
00576   void setMonitor(Pointer<ProgressMonitor> monitor);
00600   Pointer<Bank>
00601     bankFactory(int country=280,
00602                 const string &bankCode="",
00603                 const string &server="",
00604                 int hbciVersion=HBCI_VERSION_201) const;
00605 
00620   Pointer<Medium> mediumFactory(const string &name,
00621                                 const string &mediumType);
00622 
00623 
00675   Pointer<Medium> createNewMedium(const string &mtype,
00676                                   bool readonly,
00677                                   int country,
00678                                   const string &bankId,
00679                                   const string &userId,
00680                                   const string &name);
00681 
00692   Pointer<Medium> mediumFromConfig(SimpleConfig &cfg,
00693                                    cfgPtr group);
00694 
00702   Error mediumToConfig(Pointer<Medium> m,
00703                        SimpleConfig &cfg,
00704                        cfgPtr group);
00705 
00714   MediumType mediumType(const string &mtype);
00715 
00720   string pluginPath() const;
00721 
00722   Pointer<MediumPluginList> enumerateMediumPlugins();
00723 
00731 
00739   Error registerMediumPlugin(Pointer<MediumPlugin> mp);
00740 
00745   Error loadMediumPlugin(const string &path);
00746 
00774   static Pointer<User> userFactory(Pointer<Bank> b,
00775                                    Pointer<Medium> m,
00776                                    const string &userid,
00777                                    int version=0,
00778                                    const string &userName="",
00779                                    bool knowsSupportedJobs=false);
00780 
00792   static Pointer<Customer> customerFactory(Pointer<User> u,
00793                                            const string &id,
00794                                            const string &role);
00795 
00805   static Pointer<Account>
00806     accountFactory(Pointer<Bank> b,
00807                    const string &accountId="",
00808                    const string &accountSubId="");
00813   static unsigned nextTransactionId();
00814   static unsigned lastTransactionId();
00815   static void setLastTransactionId(unsigned int i);
00817 };
00818 
00819 } /* namespace HBCI */
00820 
00821 extern "C" {
00822 #endif /* __cplusplus */
00823 
00853   extern HBCI_API *HBCI_API_new(int readonly,
00854                                 int retrievalOnly);
00858   extern void HBCI_API_delete(HBCI_API *h);
00862   extern HBCI_Hbci *HBCI_API_Hbci(HBCI_API *h);
00865   /* methods */
00866 
00877   extern HBCI_Error *HBCI_API_loadEnvironment(HBCI_API *h,
00878                                               const char *filename);
00885   extern HBCI_Error *HBCI_API_saveEnvironment(const HBCI_API *h,
00886                                               const char *filename);
00901   extern const list_HBCI_Bank *HBCI_API_bankList(const HBCI_API *h);
00911   extern HBCI_Bank *HBCI_API_findBank(const HBCI_API *h,
00912                                       int country,
00913                                       const char *bankCode);
00921   extern HBCI_Medium *HBCI_API_findMedium(const HBCI_API *h,
00922                                           const char *name);
00940   /*extern HBCI_Account *HBCI_API_findAccount(const HBCI_API *h,
00941                                               int country,
00942                                               const char *bankCode,
00943                                               const char *accnr);*/
00955   /*extern HBCI_Account *HBCI_API_findAccountWSuf(const HBCI_API *h,
00956                                                   int country,
00957                                                   const char *bankCode,
00958                                                   const char *accnr,
00959                                                   const char *suffix);*/
00960 
00969   /*extern HBCI_User *HBCI_API_findUser(const HBCI_API *h,
00970                                         int country,
00971                                         const char *bankCode,
00972                                         const char *userId);*/
00973 
00979   extern int HBCI_API_totalAccounts(const HBCI_API *h);
00980 
00986   extern int HBCI_API_totalUsers(const HBCI_API *h);
01010   extern HBCI_Error *
01011     HBCI_API_addBank(HBCI_API *h, HBCI_Bank *b, int autoDelete);
01037   extern HBCI_Error *HBCI_API_addJob(HBCI_API *h, HBCI_OutboxJob *j);
01062   extern HBCI_Error *HBCI_API_executeQueue(HBCI_API *h,
01063                                            int changesAllowed);
01072   extern void HBCI_API_clearQueueByResult(HBCI_API *h,
01073                                           OutboxJob_Result result);
01082   extern void HBCI_API_clearQueueByStatus(HBCI_API *h,
01083                                           OutboxJob_Status status);
01103   extern void HBCI_API_setMonitor(HBCI_API *h,
01104                                   HBCI_ProgressMonitor *m,
01105                                   int autoDelete);
01127   extern HBCI_Bank *HBCI_API_bankFactory(const HBCI_API *h,
01128                                          int country,
01129                                          const char *bankCode,
01130                                          const char *server);
01145   /*extern HBCI_Medium* HBCI_API_mediumFactory(HBCI_API *h,
01146                                              const char *name,
01147                                              MediumType mediumType);*/
01148 
01202   extern HBCI_Medium *HBCI_API_createNewMedium(HBCI_API *h,
01203                                                const char *mtype,
01204                                                int readonly,
01205                                                int country,
01206                                                const char *bankId,
01207                                                const char *userid,
01208                                                const char *name,
01209                                                HBCI_Error **err);
01210 
01218   extern MediumType HBCI_API_mediumType(HBCI_API *h,
01219                                         const char *mtype);
01220 
01228   extern HBCI_MediumPluginList *HBCI_API_enumerateMediumPlugins(HBCI_API *h);
01252   extern HBCI_User *HBCI_API_userFactory(HBCI_Bank *b,
01253                                          HBCI_Medium *m,
01254                                          int mediumAutoDelete,
01255                                          const char *userid);
01266   extern HBCI_Customer *HBCI_API_customerFactory(HBCI_User *u,
01267                                                  const char *id,
01268                                                  const char *custName);
01282   extern HBCI_Account *HBCI_API_accountFactory(HBCI_Bank *b,
01283                                                const char *accountId,
01284                                                const char *accountSubId);
01287 
01288 #ifdef __cplusplus
01289 }
01290 #endif /* __cplusplus */
01291 
01292 
01293 #endif

Generated on Mon Jun 23 13:41:07 2003 for openhbci by doxygen1.2.17