Mixe for Privacy and Anonymity in the Internet
CAAccountingBIInterface.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2000, The JAP-Team
00003 All rights reserved.
00004 Redistribution and use in source and binary forms, with or without modification,
00005 are permitted provided that the following conditions are met:
00006 
00007   - Redistributions of source code must retain the above copyright notice,
00008     this list of conditions and the following disclaimer.
00009 
00010   - Redistributions in binary form must reproduce the above copyright notice,
00011     this list of conditions and the following disclaimer in the documentation and/or
00012     other materials provided with the distribution.
00013 
00014   - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
00015     may be used to endorse or promote products derived from this software without specific
00016     prior written permission.
00017 
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027 */
00028 
00029 #ifndef __CAACCOUNTINGBIINTERFACE__
00030 #define __CAACCOUNTINGBIINTERFACE__
00031 #include "CATLSClientSocket.hpp"
00032 #include "CAHttpClient.hpp"
00033 #include "CASocketAddrINet.hpp"
00034 #include "CAXMLCostConfirmation.hpp"
00035 #include "CAXMLErrorMessage.hpp"
00036 #include "CAXMLBI.hpp"
00037 
00038 #define PI_CONNECT_TIMEOUT 5000
00039 
00040 #define XML_ELEMENT_CCS "CCs"
00041 #define XML_ELEMENT_SETTLE_RESULT "SettleResult"
00042 #define XML_ATTR_SETTLE_SUCCESSFUL "successful"
00043 
00044 #define POST_CMD_SETTLEALL "/settleAll"
00045 
00051 class CAAccountingBIInterface
00052 {
00053 
00054 public:
00055 
00056   //SINT32 setPIServerAddress(UINT8* pPiServerName, UINT16 piServerPort);
00057   //SINT32 setPIServerCertificate(CACertificate * pPiServerCertificate);
00058   CAAccountingBIInterface();
00059   ~CAAccountingBIInterface();
00060   SINT32 setPIServerConfiguration(CAXMLBI* pPiServerConfig);
00061 
00062   SINT32 initBIConnection();
00063   SINT32 terminateBIConnection();
00064 
00065   //static CAAccountingBIInterface *getInstance(CAXMLBI *pPiServerConfig);
00066   //static SINT32 cleanup();
00067 
00071   CAXMLErrorMessage *settle(CAXMLCostConfirmation &cc);
00072   CAXMLErrorMessage **settleAll(CAXMLCostConfirmation **CCs, UINT32 nrOfCCs, CAXMLErrorMessage **settleException);
00073 
00074 /*  **
00075    * Request a new Balance certificate from the JPI
00076    *
00077    * @param balanceCert an old balance certificate that the AI wishes to update
00078    * @param response a buffer to receive the new balanceCert
00079    * @param responseLen the maximum size of the buffer
00080    *
00081   SINT32 update(UINT8 *balanceCert, UINT8 * response, UINT32 *responseLen);*/
00082 
00083 private:
00084 
00085   //CAAccountingBIInterface();
00086   //~CAAccountingBIInterface();
00087 
00088 
00089   CATLSClientSocket *m_pSocket;
00090   CAHttpClient   *m_phttpClient;
00091   CASocketAddrINet *m_pPiServerAddress;
00092   CACertificate *m_pPiServerCertificate;
00093 
00094   //static CAAccountingBIInterface *m_pPiInterfaceSingleton;
00095   //CAMutex *m_pPiInterfaceMutex;
00096   //friend class CAAccountingInstance;
00097 };
00098 
00099 
00100 #endif