Mixe for Privacy and Anonymity in the Internet
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CAXMLBI Class Reference

This class contains the parameters needed for talking to a BI (payment instance - bezahlinstanz). More...

#include <CAXMLBI.hpp>

Inheritance diagram for CAXMLBI:
[legend]
Collaboration diagram for CAXMLBI:
[legend]

List of all members.

Public Member Functions

 ~CAXMLBI ()
UINT8getID ()
 returns the BI's unique name (identifier)
UINT8getHostName ()
 returns a CASignature object for veriying this BI's signatures Don't delete it because it is 0wned by this!
UINT32 getPortNumber ()
 gets the port number
SINT32 toXmlElement (XERCES_CPP_NAMESPACE::DOMDocument *a_doc, DOMElement *&elemRoot)
 Creates the XML structure inside an existing DOM_Document, but does not append it to any node.
CACertificategetCertificate ()

Static Public Member Functions

static CAXMLBIgetInstance (const UINT8 *biID, const UINT8 *hostName, const int portNumber, CACertificate *pCert)
static CAXMLBIgetInstance (DOMElement *elemRoot)
static const char *const getXMLElementName ()

Private Member Functions

SINT32 setValues (DOMElement *elemRoot)
 CAXMLBI ()

Private Attributes

UINT8m_pBiID
UINT8m_pHostName
CACertificatem_pCert
CASignaturem_pVeryfire
UINT32 m_iPortNumber

Static Private Attributes

static const char *const ms_pXmlElemName = "PaymentInstance"

Detailed Description

This class contains the parameters needed for talking to a BI (payment instance - bezahlinstanz).

It corresponds to anon.pay.BI in the Java implementation

Author:
Bastian Voigt (bavoigt@inf.fu-berlin.de)

Definition at line 44 of file CAXMLBI.hpp.


Constructor & Destructor Documentation

Definition at line 79 of file CAXMLBI.cpp.

References m_pBiID, m_pCert, m_pHostName, and m_pVeryfire.

  {
    delete m_pCert;
    m_pCert = NULL;
    
    delete m_pVeryfire;
    m_pVeryfire = NULL;

    delete[] m_pBiID;
    m_pBiID = NULL;
    
    delete m_pHostName;
    m_pHostName = NULL;
  }
CAXMLBI::CAXMLBI ( ) [private]

Definition at line 35 of file CAXMLBI.cpp.

References m_pBiID, m_pCert, m_pHostName, and m_pVeryfire.

Referenced by getInstance().

                 : CAAbstractXMLEncodable()
  {
    m_pVeryfire = NULL;
    m_pBiID = NULL;
    m_pHostName = NULL;
    m_pCert = NULL;
  }

Member Function Documentation

Definition at line 84 of file CAXMLBI.hpp.

References m_pCert.

Referenced by CAAccountingBIInterface::setPIServerConfiguration(), and CACmdLnOptions::setPriceCertificate().

    {
      return m_pCert;
    }
UINT8* CAXMLBI::getHostName ( ) [inline]

returns a CASignature object for veriying this BI's signatures Don't delete it because it is 0wned by this!

returns the hostname of the host on which this BI is running

Definition at line 71 of file CAXMLBI.hpp.

References m_pHostName.

Referenced by CAAccountingBIInterface::setPIServerConfiguration().

      {
        return m_pHostName;
      }
UINT8* CAXMLBI::getID ( ) [inline]

returns the BI's unique name (identifier)

Definition at line 52 of file CAXMLBI.hpp.

References m_pBiID.

      {
        return m_pBiID;
      }
CAXMLBI * CAXMLBI::getInstance ( const UINT8 biID,
const UINT8 hostName,
const int  portNumber,
CACertificate pCert 
) [static]

Definition at line 43 of file CAXMLBI.cpp.

References CAXMLBI(), CACertificate::clone(), m_iPortNumber, m_pBiID, m_pCert, m_pHostName, and m_pVeryfire.

Referenced by CAInfoService::getPaymentInstance(), and CACmdLnOptions::setPaymentInstance().

  {
    if(biID==NULL||hostName==NULL)
      {
        return NULL;
      }
    CAXMLBI* pBI = new CAXMLBI();   
    if(pCert!=NULL)
      {
        pBI->m_pCert = pCert->clone();
      }
    pBI->m_pBiID = new UINT8[strlen((char*)biID)+1];
    strcpy((char*)pBI->m_pBiID, (char*)biID);
    memset(pBI->m_pBiID, 0, (strlen((char*)biID)+1));
    pBI->m_pHostName = new UINT8[strlen((char*)hostName)+1];
    strcpy((char*)pBI->m_pHostName, (char*)hostName);
    pBI->m_iPortNumber = portNumber;
    pBI->m_pVeryfire = NULL;
    return pBI;
  }

Here is the call graph for this function:

CAXMLBI * CAXMLBI::getInstance ( DOMElement *  elemRoot) [static]

Definition at line 64 of file CAXMLBI.cpp.

References CAXMLBI(), E_SUCCESS, and setValues().

  {
    if (elemRoot == NULL)
      {
        return NULL;
      }
    CAXMLBI* pPI = new CAXMLBI();
    if(pPI->setValues(elemRoot)!=E_SUCCESS)
      {
        delete pPI;
        return NULL;
      }
    return pPI;
  }

Here is the call graph for this function:

gets the port number

Definition at line 77 of file CAXMLBI.hpp.

References m_iPortNumber.

Referenced by CAAccountingBIInterface::setPIServerConfiguration().

      {
        return m_iPortNumber;
      }
static const char* const CAXMLBI::getXMLElementName ( ) [inline, static]

Definition at line 89 of file CAXMLBI.hpp.

References ms_pXmlElemName.

Referenced by setValues(), and toXmlElement().

SINT32 CAXMLBI::setValues ( DOMElement *  elemRoot) [private]

Definition at line 94 of file CAXMLBI.cpp.

References CERT_X509CERTIFICATE, CACertificate::decode(), E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), getXMLElementName(), m_iPortNumber, m_pBiID, m_pCert, m_pHostName, and CAMsg::printMsg().

Referenced by getInstance().

  {
    DOMElement* elem=NULL;
    UINT8 strGeneral[256];
    UINT32 strGeneralLen = 255;
    
    if(!equals(elemRoot->getTagName(),CAXMLBI::getXMLElementName()))
    {
      return E_UNKNOWN;
    }
    
    //Parse ID
    if(getDOMElementAttribute(elemRoot, "id", strGeneral, &strGeneralLen)==E_SUCCESS)
      {
        m_pBiID = new UINT8[strGeneralLen+1];
        memset(m_pBiID, 0, (strGeneralLen+1));
        memcpy(m_pBiID,strGeneral,strGeneralLen);
      }
    else 
      {
        return E_UNKNOWN;
      }
    
    //Parse PI Certificate
    DOMElement* elemCert=NULL;
    getDOMChildByName(elemRoot, "Certificate", elem, false);
    getDOMChildByName(elem, "X509Certificate", elemCert, false);
    CACertificate *pPICert = CACertificate::decode(elemCert, CERT_X509CERTIFICATE, NULL);
    if (pPICert != NULL)
    {
      m_pCert = pPICert;
    }
    else
    {
      CAMsg::printMsg(LOG_CRIT,"No certificate for payment instance available!\n");
      return E_UNKNOWN;
    }
      
    //Parse PI Host
    DOMElement* elemNet=NULL;
    DOMElement* elemListeners=NULL;
    DOMElement* elemListener=NULL;
    DOMElement* elemHost=NULL;
    DOMElement* elemPort=NULL;
    getDOMChildByName(elemRoot, "Network", elemNet, false);
    getDOMChildByName(elemNet, "ListenerInterfaces", elemListeners, false);
    getDOMChildByName(elemListeners, "ListenerInterface", elemListener, false);
    getDOMChildByName(elemListener, "Host", elemHost, false);
    getDOMChildByName(elemListener, "Port", elemPort, false);
    strGeneralLen=255;
    //Parse PI Host and Port
    if( getDOMElementValue(elemHost, strGeneral, &strGeneralLen)!=E_SUCCESS||
        getDOMElementValue(elemPort, &m_iPortNumber)!=E_SUCCESS)
      {
        delete [] m_pBiID;
        m_pBiID=NULL;
        delete m_pCert;
        m_pCert=NULL;
        return E_UNKNOWN;
      }
    m_pHostName = new UINT8[strGeneralLen+1];
    strcpy((char*)m_pHostName, (char*)strGeneral);
    return E_SUCCESS;
  }

Here is the call graph for this function:

SINT32 CAXMLBI::toXmlElement ( XERCES_CPP_NAMESPACE::DOMDocument *  a_pDoc,
DOMElement *&  pElemRoot 
) [virtual]

Creates the XML structure inside an existing DOM_Document, but does not append it to any node.

Parameters:
a_docan existing DOM_Document
elemRooton return contains the root element of the created XML structure. Note that the element is not appended to any node in the document

Implements CAAbstractXMLEncodable.

Definition at line 159 of file CAXMLBI.cpp.

References createDOMElement(), E_SUCCESS, CACertificate::encode(), getXMLElementName(), m_iPortNumber, m_pBiID, m_pCert, m_pHostName, setDOMElementAttribute(), and setDOMElementValue().

  {
    elemRoot = createDOMElement(a_doc,getXMLElementName());
    setDOMElementAttribute(elemRoot, "id", m_pBiID);
    
    //Set network settings
    DOMElement* elemNet = createDOMElement(a_doc,"Network");
    elemRoot->appendChild(elemNet);
    DOMElement* elemListeners = createDOMElement(a_doc,"ListenerInterfaces");
    elemNet->appendChild(elemListeners);  
    DOMElement* elemListener = createDOMElement(a_doc,"ListenerInterface");
    elemListeners->appendChild(elemListener);
    //Set Hostname
    DOMElement* elemHost = createDOMElement(a_doc,"Host");
    elemListener->appendChild(elemHost);
    setDOMElementValue(elemHost, m_pHostName);
    //Set Port
    DOMElement* elemPort = createDOMElement(a_doc,"Port");
    elemListener->appendChild(elemPort);
    setDOMElementValue(elemPort, m_iPortNumber);
    //Set Cert
    if(m_pCert!=NULL)
    {
      DOMElement* elemCert = createDOMElement(a_doc,"Certificate");
      elemRoot->appendChild(elemCert);
      
      DOMElement* tmpElem=NULL;
      m_pCert->encode(tmpElem, a_doc);
      elemCert->appendChild(tmpElem);
    }
    
    return E_SUCCESS;
  }

Here is the call graph for this function:


Member Data Documentation

Definition at line 101 of file CAXMLBI.hpp.

Referenced by getInstance(), getPortNumber(), setValues(), and toXmlElement().

UINT8* CAXMLBI::m_pBiID [private]

Definition at line 97 of file CAXMLBI.hpp.

Referenced by CAXMLBI(), getID(), getInstance(), setValues(), toXmlElement(), and ~CAXMLBI().

Definition at line 99 of file CAXMLBI.hpp.

Referenced by CAXMLBI(), getCertificate(), getInstance(), setValues(), toXmlElement(), and ~CAXMLBI().

Definition at line 98 of file CAXMLBI.hpp.

Referenced by CAXMLBI(), getHostName(), getInstance(), setValues(), toXmlElement(), and ~CAXMLBI().

Definition at line 100 of file CAXMLBI.hpp.

Referenced by CAXMLBI(), getInstance(), and ~CAXMLBI().

const char *const CAXMLBI::ms_pXmlElemName = "PaymentInstance" [static, private]

Definition at line 103 of file CAXMLBI.hpp.

Referenced by getXMLElementName().


The documentation for this class was generated from the following files: