29 #if !defined(ONLY_LOCAL_PROXY) && defined (PAYMENT)
33 const char*
const CAXMLBI::ms_pXmlElemName=
"PaymentInstance";
43 CAXMLBI* CAXMLBI::getInstance(
const UINT8 * biID,
const UINT8 * hostName,
const int portNumber,
CACertificate * pCert)
45 if(biID==NULL||hostName==NULL)
49 CAXMLBI* pBI =
new CAXMLBI();
52 pBI->m_pCert = pCert->
clone();
54 pBI->m_pBiID =
new UINT8[strlen((
char*)biID)+1];
55 strcpy((
char*)pBI->m_pBiID, (
char*)biID);
56 memset(pBI->m_pBiID, 0, (strlen((
char*)biID)+1));
57 pBI->m_pHostName =
new UINT8[strlen((
char*)hostName)+1];
58 strcpy((
char*)pBI->m_pHostName, (
char*)hostName);
59 pBI->m_iPortNumber = portNumber;
60 pBI->m_pVeryfire = NULL;
64 CAXMLBI* CAXMLBI::getInstance(DOMElement* elemRoot)
70 CAXMLBI* pPI =
new CAXMLBI();
94 SINT32 CAXMLBI::setValues(DOMElement* elemRoot)
96 DOMElement* elem=NULL;
97 UINT8 strGeneral[256];
98 UINT32 strGeneralLen = 255;
100 if(!
equals(elemRoot->getTagName(),CAXMLBI::getXMLElementName()))
108 m_pBiID =
new UINT8[strGeneralLen+1];
109 memset(m_pBiID, 0, (strGeneralLen+1));
110 memcpy(m_pBiID,strGeneral,strGeneralLen);
118 DOMElement* elemCert=NULL;
128 CAMsg::printMsg(LOG_CRIT,
"No certificate for payment instance available!\n");
133 DOMElement* elemNet=NULL;
134 DOMElement* elemListeners=NULL;
135 DOMElement* elemListener=NULL;
136 DOMElement* elemHost=NULL;
137 DOMElement* elemPort=NULL;
154 m_pHostName =
new UINT8[strGeneralLen+1];
155 strcpy((
char*)m_pHostName, (
char*)strGeneral);
159 SINT32 CAXMLBI::toXmlElement(XERCES_CPP_NAMESPACE::DOMDocument *a_doc, DOMElement* & elemRoot)
166 elemRoot->appendChild(elemNet);
168 elemNet->appendChild(elemListeners);
170 elemListeners->appendChild(elemListener);
173 elemListener->appendChild(elemHost);
177 elemListener->appendChild(elemPort);
183 elemRoot->appendChild(elemCert);
185 DOMElement* tmpElem=NULL;
186 m_pCert->encode(tmpElem, a_doc);
187 elemCert->appendChild(tmpElem);
#define CERT_X509CERTIFICATE
SINT32 setDOMElementAttribute(DOMNode *pElem, const char *attrName, const char *value)
SINT32 getDOMElementValue(const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
Returns the content of the text node(s) under elem as null-terminated C String.
SINT32 setDOMElementValue(DOMElement *pElem, SINT32 value)
bool equals(const XMLCh *const e1, const char *const e2)
DOMElement * createDOMElement(XERCES_CPP_NAMESPACE::DOMDocument *pOwnerDoc, const char *const name)
Creates a new DOMElement with the given name which belongs to the DOMDocument owernDoc.
SINT32 getDOMChildByName(const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep)
SINT32 getDOMElementAttribute(const DOMNode *const elem, const char *attrName, UINT8 *value, UINT32 *len)
Abstract base class for classes which can be converted to an XML structure.
CACertificate * clone() const
static CACertificate * decode(const UINT8 *const buff, UINT32 bufflen, UINT32 type, const char *const passwd=NULL)
Extracts a certificate from an encoded (DER,XML) form.
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.