Mixes for Privacy and Anonymity in the Internet
Defines | Functions | Variables
CAUtil.cpp File Reference

Defines

#define XML_ENCODE_KEY_TEMPLATE   "<EncryptedKey><EncryptionMethod Algorithm=\"RSA\"/><CipherData><CipherValue>%s</CipherValue></CipherData></EncryptedKey>"

Functions

UINT32 strtrim (UINT8 *s)
 Removes leading and ending whitespaces (chars<=32) from a zero terminated string.
UINT32 toLower (UINT8 *a_string)
UINT8bytes2hex (const void *bytes, UINT32 len)
 Converts the byte array to a hex string.
SINT32 memtrim (UINT8 *dest, const UINT8 *src, UINT32 size)
 Removes leading and ending whitespaces (chars<=32) from a byte array.
char * strins (const char *src, UINT32 pos, const char *ins)
 Inserts a String ins in a String src starting after pos chars.
char * strins (const char *src, const char *pos, const char *ins)
 Inserts a String ins in a String src starting at the char pos points to.
void logMemoryUsage ()
 Log information about the current memory (heap) usage.
SINT32 getcurrentTime (timespec &t)
 Gets the current Systemtime in milli seconds.
SINT32 getcurrentTimeMillis (UINT64 &u64Time)
 Gets the current Systemtime in milli seconds.
SINT32 getcurrentTimeMicros (UINT64 &u64Time)
 Gets the current Systemtime in micros seconds.
SINT32 initRandom ()
SINT32 compDate (struct tm *date1, struct tm *date2)
SINT32 getRandom (UINT32 *val)
 Gets 32 random bits.
SINT32 getRandom (UINT64 *val)
SINT32 getRandom (UINT8 *buff, UINT32 len)
 Gets some random bytes.
SINT32 msSleep (UINT32 ms)
 Sleeps ms milliseconds.
SINT32 sSleep (UINT32 sec)
 Sleeps sec Seconds.
UINT32 getMemoryUsage ()
SINT32 getDOMChildByName (const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep)
SINT32 getDOMChildByName (const DOMNode *pNode, const XMLCh *const name, DOMNode *&a_child, bool deep)
SINT32 getDOMChildByName (const DOMNode *pNode, const char *const name, DOMNode *&a_child, bool deep)
SINT32 getSignatureElements (DOMNode *parent, DOMNode **signatureNodes, UINT32 *length)
SINT32 integrateDOMNode (const DOMNode *srcNode, DOMNode *dstNode, bool recursive, bool replace)
 integrates the source node in the destination Node.
bool equals (const XMLCh *const e1, const char *const e2)
void initDOMParser ()
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument (const UINT8 *const buff, UINT32 len)
 Parses a buffer containing an XML document and returns this document.
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument (const UINT8 *const pathOrURL)
 parses a file via path or URL
void releaseDOMParser ()
SINT32 getNodeName (const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
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 getDOMElementAttribute (const DOMNode *const elem, const char *attrName, UINT8 *value, UINT32 *len)
SINT32 getDOMElementAttribute (const DOMNode *const elem, const char *attrName, SINT32 *value)
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.
DOMText * createDOMText (XERCES_CPP_NAMESPACE::DOMDocument *pOwnerDoc, const char *const text)
 Creates a new DOMText with the given value which belongs to the DOMDocument owernDoc.
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, const UINT8 *value)
SINT32 setCurrentTimeMilliesAsDOMAttribute (DOMNode *pElem)
UINT8getTermsAndConditionsTemplateRefId (DOMNode *tcTemplateRoot)
DOMNodeList * getElementsByTagName (DOMElement *pElem, const char *const name)
SINT32 getLastDOMChildByName (const DOMNode *pNode, const char *const name, DOMElement *&a_child)
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument ()
 Creates an empty DOM DOcument.
SINT32 setDOMElementValue (DOMElement *pElem, UINT32 value)
SINT32 setDOMElementValue (DOMElement *pElem, SINT32 value)
SINT32 setDOMElementValue (DOMElement *pElem, double floatValue)
SINT32 setDOMElementValue (DOMElement *pElem, const UINT64 text)
 Sets the decimal text representation of a 64bit integer as node value TODO: implement this for non-64bit platforms.
SINT32 setDOMElementValue (DOMElement *pElem, const UINT8 *value)
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, UINT64 value)
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, SINT64 value)
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, SINT32 value)
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, UINT32 value)
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, bool value)
SINT32 setDOMElementValue (DOMElement *pElem, bool value)
SINT32 getDOMElementAttribute (const DOMNode *const elem, const char *attrName, SINT64 &value)
SINT32 getDOMElementAttribute (const DOMNode *const elem, const char *attrName, UINT64 &value)
SINT32 getDOMElementAttribute (const DOMNode *const elem, const char *attrName, UINT32 &value)
SINT32 getDOMElementAttribute (const DOMNode *const elem, const char *attrName, bool &value)
SINT32 getLastDOMChildByName (const DOMNode *pNode, const char *const name, DOMNode *&a_child)
SINT32 getLastDOMChildByName (const DOMNode *pNode, const XMLCh *const name, DOMNode *&a_child)
SINT32 getDOMElementValue (const DOMElement *const pElem, UINT32 *value)
SINT32 getDOMElementValue (const DOMElement *const pElem, SINT32 *value)
SINT32 getDOMElementValue (const DOMElement *const pElem, double *value)
SINT32 getDOMElementValue (const DOMElement *pElem, UINT32 &value, UINT32 defaultValue)
 Gets the value from an DOM-Element as UINT32.
SINT32 getDOMElementValue (const DOMNode *const pElem, UINT64 &value)
SINT32 getDOMElementValue (const DOMElement *const pElem, SINT64 &value)
SINT32 getDOMElementValue (const DOMElement *const pElem, UINT16 *value)
void __encryptKey (UINT8 *key, UINT32 keylen, UINT8 *outBuff, UINT32 *outLen, CAASymCipher *pRSA)
SINT32 encodeXMLEncryptedKey (UINT8 *key, UINT32 keylen, UINT8 *xml, UINT32 *xmllen, CAASymCipher *pRSA)
SINT32 encodeXMLEncryptedKey (UINT8 *key, UINT32 keylen, DOMElement *&elemRootEncodedKey, XERCES_CPP_NAMESPACE::DOMDocument *docOwner, CAASymCipher *pRSA)
SINT32 decodeXMLEncryptedKey (UINT8 *key, UINT32 *keylen, const UINT8 *const xml, UINT32 xmllen, CAASymCipher *pRSA)
SINT32 decodeXMLEncryptedKey (UINT8 *key, UINT32 *keylen, const DOMNode *root, CAASymCipher *pRSA)
SINT32 encryptXMLElement (DOMNode *node, CAASymCipher *pRSA)
 The resulting encrypted xml struct is as follows:
UINT8encryptXMLElement (UINT8 *inbuff, UINT32 inlen, UINT32 &outlen, CAASymCipher *pRSA)
 Encrypts an XML-Element by wrapping it with:
SINT32 decryptXMLElement (DOMNode *node, CAASymCipher *pRSA)
 Replaces a DOM element with a deencrypted version of this element.
UINT8readFile (const UINT8 *const name, UINT32 *size)
SINT32 saveFile (const UINT8 *const name, const UINT8 *const buff, UINT32 buffSize)
SINT32 parseU64 (const UINT8 *str, UINT64 &value)
 Parses a 64bit unsigned integer.
SINT32 parseS64 (const UINT8 *str, SINT64 &value)
 Parses a 64bit signed integer.
SINT32 readPasswd (UINT8 *buff, UINT32 len)
 Read a passwd (i.e.

Variables

XercesDOMParser * theDOMParser = NULL
CAMutextheParseDOMDocumentLock = NULL

Define Documentation

#define XML_ENCODE_KEY_TEMPLATE   "<EncryptedKey><EncryptionMethod Algorithm=\"RSA\"/><CipherData><CipherValue>%s</CipherValue></CipherData></EncryptedKey>"

Referenced by encodeXMLEncryptedKey().


Function Documentation

void __encryptKey ( UINT8 key,
UINT32  keylen,
UINT8 outBuff,
UINT32 outLen,
CAASymCipher pRSA 
)
UINT8* bytes2hex ( const void *  bytes,
UINT32  len 
)

Converts the byte array to a hex string.

the caller is responsible for deleting the string

References len.

Referenced by CAChain::getPrintableChainId(), and CAThread::start().

SINT32 compDate ( struct tm *  date1,
struct tm *  date2 
)
XERCES_CPP_NAMESPACE::DOMDocument* createDOMDocument ( )
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.

Referenced by CAASymCipher::addKeyPart(), CAMix::appendCompatibilityInfo(), CAMix::appendTermsAndConditionsExtension(), CACmdLnOptions::buildDefaultConfig(), CAFirstMix::doUserLogin_internal(), CACertStore::encode(), CACertificate::encode(), encodeXMLEncryptedKey(), encryptXMLElement(), CAInfoService::getCascadeHeloXMLAsString(), CACmdLnOptions::getMixXml(), CAASymCipher::getPublicKeyAsDOMElement(), CASignature::getSignKey(), CAAccountingInstance::handleAccountCertificate_internal(), CAFirstMix::handleTermsAndConditionsLogin(), CAMix::initMixCascadeInfo(), CAReplayCtrlChannelMsgProc::initTimestampsMessageTemplate(), CAAccountingInstance::makeCCRequest(), CAAccountingInstance::makeInitialCCRequest(), CAAccountingInstance::prepareCCRequest(), CAReplayCtrlChannelMsgProc::proccessGetTimestamp(), CAReplayCtrlChannelMsgProc::proccessGotTimestamp(), CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), CAFirstMix::processKeyExchange(), CACmdLnOptions::processXmlConfiguration(), CAAccountingInstance::sendAILoginConfirmation(), CAReplayCtrlChannelMsgProc::sendGetTimestamp(), CACmdLnOptions::setMixName(), CACmdLnOptions::setNextMix(), CACmdLnOptions::setPrepaidInterval(), CACmdLnOptions::setPrevMix(), CACmdLnOptions::setTargetInterfaces(), CAAccountingBIInterface::settleAll(), CAMultiSignature::signXML(), CAMix::termsAndConditionsInfoNode(), CAListenerInterface::toDOMElement(), CAXMLPriceCert::toXmlElement(), CAXMLBI::toXmlElement(), and CAXMLErrorMessage::toXmlElement().

DOMText * createDOMText ( XERCES_CPP_NAMESPACE::DOMDocument *  pOwnerDoc,
const char *const  text 
)

Creates a new DOMText with the given value which belongs to the DOMDocument owernDoc.

Referenced by CAASymCipher::addKeyPart().

SINT32 decodeXMLEncryptedKey ( UINT8 key,
UINT32 keylen,
const UINT8 *const  xml,
UINT32  xmllen,
CAASymCipher pRSA 
)
SINT32 decodeXMLEncryptedKey ( UINT8 key,
UINT32 keylen,
const DOMNode *  root,
CAASymCipher pRSA 
)
SINT32 decryptXMLElement ( DOMNode *  node,
CAASymCipher pRSA 
)
SINT32 encodeXMLEncryptedKey ( UINT8 key,
UINT32  keylen,
UINT8 xml,
UINT32 xmllen,
CAASymCipher pRSA 
)
SINT32 encodeXMLEncryptedKey ( UINT8 key,
UINT32  keylen,
DOMElement *&  elemRootEncodedKey,
XERCES_CPP_NAMESPACE::DOMDocument *  docOwner,
CAASymCipher pRSA 
)
SINT32 encryptXMLElement ( DOMNode *  node,
CAASymCipher pRSA 
)

The resulting encrypted xml struct is as follows:

Replaces a DOM element with an encrypted version of this element.

	* <EncryptedData Type='http://www.w3.org/2001/04/xmlenc#Element'>
	*		<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
	*   <ds:KeyInfo xmlns:ds='http://www.w3.org/2000/09/xmldsig#'>
	*			<EncryptedKey>
	*				<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
	*				<CipherData>
	*					<CipherValue>...</CipherValue>
	*				</CipherData>
	*			</EncryptedKey>
	*		</ds:KeyInfo>
	*		<CipherData>
	*			<CipherValue>...</CipherValue>
	*		</CipherData>
	*	</EncryptedData>
	*

References createDOMElement(), DOM_Output::dumpToMem(), E_SUCCESS, CABase64::encode(), CASymCipher::encrypt1CBCwithPKCS7(), CAASymCipher::encryptOAEP(), getRandom(), setDOMElementValue(), CASymCipher::setIVs(), and CASymCipher::setKey().

Referenced by CALocalProxy::processKeyExchange().

UINT8* encryptXMLElement ( UINT8 inbuff,
UINT32  inlen,
UINT32 outlen,
CAASymCipher pRSA 
)

Encrypts an XML-Element by wrapping it with:

	* \<EncryptedData Type='http://www.w3.org/2001/04/xmlenc#Element'>
	*		\<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
	*   \<ds:KeyInfo xmlns:ds='http://www.w3.org/2000/09/xmldsig#'>
	*			\<EncryptedKey>
	*				\<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
	*				\<CipherData\>
	*					\<CipherValue>...\</CipherValue>
	*				\</CipherData>
	*			\</EncryptedKey>
	*		\</ds:KeyInfo>
	*		\<CipherData>
	*			\<CipherValue>...\</CipherValue>
	*		\</CipherData>
	*	\</EncryptedData>
	*
Returns:
a buffer with the encyrpted element (the caller is responsible for freeing it), or NULL

References CABase64::encode(), CASymCipher::encrypt1CBCwithPKCS7(), CAASymCipher::encryptOAEP(), getRandom(), CASymCipher::setIVs(), and CASymCipher::setKey().

bool equals ( const XMLCh *const  e1,
const char *const  e2 
)
SINT32 getcurrentTime ( timespec &  t)

Gets the current Systemtime in milli seconds.

Parameters:
bnTime- Big Number, in which the current time is placed
Return values:
E_UNSPECIFIED,ifbnTime was NULL
E_UNKNOWN,ifan error occurs
E_SUCCESS,otherwise

References E_SUCCESS.

Referenced by CAChain::addChannel(), CAChain::forceImmediateResponsesInternal(), CAAccountingInstance::handleAccountCertificate_internal(), initRandom(), CAChain::processDownstream(), and CAConditionVariable::wait().

Gets the current Systemtime in micros seconds.

Depending on the operating system, the time may not be so accurat.

Parameters:
u64Time- 64 bit Integer, in which the current time is placed
Return values:
E_UNKNOWN,ifan error occurs
E_SUCCESS,otherwise

References E_SUCCESS, and E_UNKNOWN.

Referenced by CAChain::CAChain(), fm_loopReadFromMix(), fm_loopSendToMix(), lm_loopReadFromMix(), lm_loopSendToMix(), CALastMixA::loop(), CAFirstMixB::loop(), CAFirstMixA::loop(), CALastMixB::loop(), CADatabase::measurePerformance(), CAReplayDatabase::measurePerformance(), mm_loopSendToMixAfter(), mm_loopSendToMixBefore(), CAFirstMixA::sendToUsers(), and CAChain::~CAChain().

SINT32 getDOMChildByName ( const DOMNode *  pNode,
const char *const  name,
DOMElement *&  child,
bool  deep 
)

References getDOMChildByName().

Referenced by CACmdLnOptions::addVisibleAddresses(), CAMix::appendTermsAndConditionsExtension(), CAMix::checkCompatibility(), decodeXMLEncryptedKey(), decryptXMLElement(), CAFirstMix::doUserLogin_internal(), CAInfoService::getCascadeHeloXMLAsString(), getDOMChildByName(), CAListenerInterface::getInstance(), CACmdLnOptions::getMixXml(), CAAccountingInstance::handleAccountCertificate_internal(), CAAccountingInstance::handleChallengeResponse_internal(), CAFirstMix::handleKeyInfoExtensions(), CAFirstMix::handleTermsAndConditionsExtension(), CAFirstMix::handleTermsAndConditionsLogin(), CAMix::initMixCascadeInfo(), CAAccountingInstance::makeCCRequest(), CAAccountingInstance::makeInitialCCRequest(), CACmdLnOptions::parseInfoServices(), CASignature::parseSignKeyXML(), CAAccountingInstance::prepareCCRequest(), CAReplayCtrlChannelMsgProc::proccessGetTimestamp(), CALocalProxy::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), CAFirstMix::processKeyExchange(), CACmdLnOptions::processXmlConfiguration(), CAReplayControlChannel::processXMLMessage(), CAReplayCtrlChannelMsgProc::propagateCurrentReplayTimestamp(), CACmdLnOptions::setAccountingDatabase(), CACmdLnOptions::setAccountingHardLimit(), CACmdLnOptions::setAccountingOptions(), CACmdLnOptions::setAccountingSoftLimit(), CACmdLnOptions::setCascadeNameFromOptions(), CACmdLnOptions::setCertificateOptions(), CACmdLnOptions::setDaemonMode(), CACmdLnOptions::setDynamicMix(), CACmdLnOptions::setGeneralOptions(), CACmdLnOptions::setInfoServices(), CACmdLnOptions::setKeepAliveTraffic(), CACmdLnOptions::setListenerInterfaces(), CACmdLnOptions::setLoggingOptions(), CACmdLnOptions::setMaxUsers(), CACmdLnOptions::setMinCascadeLength(), CACmdLnOptions::setMixCertificateVerification(), CACmdLnOptions::setMixDescription(), CACmdLnOptions::setMixID(), CACmdLnOptions::setMixName(), CACmdLnOptions::setMixType(), CACmdLnOptions::setNetworkOptions(), CACmdLnOptions::setNextMix(), CACmdLnOptions::setNextMixCertificate(), CACmdLnOptions::setNrOfFileDescriptors(), CACmdLnOptions::setOwnCertificate(), CACmdLnOptions::setOwnOperatorCertificate(), CACmdLnOptions::setPaymentInstance(), CACmdLnOptions::setPaymentReminder(), CACmdLnOptions::setPrepaidInterval(), CACmdLnOptions::setPrevMix(), CACmdLnOptions::setPrevMixCertificate(), CACmdLnOptions::setPriceCertificate(), CACmdLnOptions::setRessourceOptions(), CACmdLnOptions::setServerMonitoring(), CACmdLnOptions::setSettleInterval(), CACmdLnOptions::setTargetInterfaces(), CACmdLnOptions::setTermsAndConditions(), CACmdLnOptions::setTermsAndConditionsList(), CACmdLnOptions::setTermsAndConditionsTemplates(), CACmdLnOptions::setTrustedRootCertificates(), CACmdLnOptions::setUserID(), CAXMLCostConfirmation::setValues(), CAXMLBI::setValues(), CAXMLErrorMessage::setValues(), CAXMLPriceCert::setValues(), CASignature::setVerifyKey(), CAMultiSignature::signXML(), CACertStore::verifyMixCert(), CAMultiSignature::verifyXML(), and CASignature::verifyXML().

SINT32 getDOMChildByName ( const DOMNode *  pNode,
const XMLCh *const  name,
DOMNode *&  a_child,
bool  deep 
)
SINT32 getDOMChildByName ( const DOMNode *  pNode,
const char *const  name,
DOMNode *&  a_child,
bool  deep 
)

References E_UNKNOWN, and getDOMChildByName().

SINT32 getDOMElementAttribute ( const DOMNode *const  elem,
const char *  attrName,
UINT8 value,
UINT32 len 
)
SINT32 getDOMElementAttribute ( const DOMNode *const  elem,
const char *  attrName,
SINT32 value 
)
SINT32 getDOMElementAttribute ( const DOMNode *const  elem,
const char *  attrName,
SINT64 value 
)
SINT32 getDOMElementAttribute ( const DOMNode *const  elem,
const char *  attrName,
UINT64 value 
)
SINT32 getDOMElementAttribute ( const DOMNode *const  elem,
const char *  attrName,
UINT32 value 
)
SINT32 getDOMElementAttribute ( const DOMNode *const  elem,
const char *  attrName,
bool &  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.

If there is no text node len is set to 0.

TODO: Why is elem a DOM_Node and not a DOM_Element here?

Parameters:
elemthe element which has a text node under it
valuea buffer that gets the text value
valuelenon call contains the buffer size, on return contains the number of bytes copied
Return values:
E_SPACEif the buffer is too small
E_UNKNOWNif the element is NULL
E_SUCCESSotherwise

References ASSERT, E_SPACE, E_SUCCESS, and E_UNKNOWN.

Referenced by CACmdLnOptions::addVisibleAddresses(), CACertificate::decode(), decodeXMLEncryptedKey(), decryptXMLElement(), CAFirstMix::doUserLogin_internal(), getDOMElementValue(), CAListenerInterface::getInstance(), CAASymCipher::getKeyPart(), CAAccountingInstance::handleAccountCertificate_internal(), CAAccountingInstance::handleChallengeResponse_internal(), CACmdLnOptions::parseInfoServices(), CALocalProxy::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), CAFirstMix::processKeyExchange(), CACmdLnOptions::processXmlConfiguration(), CAReplayControlChannel::processXMLMessage(), CACmdLnOptions::setAccountingDatabase(), CACmdLnOptions::setAccountingHardLimit(), CACmdLnOptions::setAccountingSoftLimit(), CACmdLnOptions::setCascadeNameFromOptions(), CACmdLnOptions::setDaemonMode(), CACmdLnOptions::setDynamicMix(), CACmdLnOptions::setInfoServices(), CACmdLnOptions::setKeepAliveTraffic(), CACmdLnOptions::setLoggingOptions(), CACmdLnOptions::setMaxUsers(), CACmdLnOptions::setMixCertificateVerification(), CACmdLnOptions::setMixID(), CACmdLnOptions::setMixName(), CACmdLnOptions::setMixType(), CACmdLnOptions::setNrOfFileDescriptors(), CACmdLnOptions::setPaymentReminder(), CACmdLnOptions::setPrepaidInterval(), CACmdLnOptions::setRessourceOptions(), CACmdLnOptions::setServerMonitoring(), CACmdLnOptions::setSettleInterval(), CASignature::setSignKey(), CACmdLnOptions::setTargetInterfaces(), CACmdLnOptions::setTermsAndConditionsTemplates(), CACmdLnOptions::setUserID(), CAXMLCostConfirmation::setValues(), CAXMLBI::setValues(), CAXMLErrorMessage::setValues(), CAXMLPriceCert::setValues(), CASignature::setVerifyKey(), CAMultiSignature::verifyXML(), and CASignature::verifyXML().

SINT32 getDOMElementValue ( const DOMElement *const  pElem,
UINT32 value 
)
SINT32 getDOMElementValue ( const DOMElement *const  pElem,
SINT32 value 
)
SINT32 getDOMElementValue ( const DOMElement *const  pElem,
double *  value 
)
SINT32 getDOMElementValue ( const DOMElement *const  pElem,
UINT32 value,
UINT32  defaultValue 
)

Gets the value from an DOM-Element as UINT32.

If an error occurs, the default value is returned.

References E_SUCCESS, and getDOMElementValue().

SINT32 getDOMElementValue ( const DOMNode *const  pElem,
UINT64 value 
)
SINT32 getDOMElementValue ( const DOMElement *const  pElem,
SINT64 value 
)
SINT32 getDOMElementValue ( const DOMElement *const  pElem,
UINT16 value 
)
DOMNodeList* getElementsByTagName ( DOMElement *  pElem,
const char *const  name 
)
SINT32 getLastDOMChildByName ( const DOMNode *  pNode,
const char *const  name,
DOMElement *&  a_child 
)
SINT32 getLastDOMChildByName ( const DOMNode *  pNode,
const char *const  name,
DOMNode *&  a_child 
)
SINT32 getLastDOMChildByName ( const DOMNode *  pNode,
const XMLCh *const  name,
DOMNode *&  a_child 
)

References E_SUCCESS, E_UNKNOWN, and equals().

SINT32 getNodeName ( const DOMNode *const  pElem,
UINT8 value,
UINT32 valuelen 
)

References ASSERT, E_SPACE, E_SUCCESS, and E_UNKNOWN.

Referenced by CAMix::checkCompatibility().

SINT32 getRandom ( UINT32 val)
SINT32 getRandom ( UINT64 val)

References ASSERT, E_SUCCESS, and E_UNKNOWN.

SINT32 getRandom ( UINT8 buff,
UINT32  len 
)

Gets some random bytes.

Parameters:
buff- buff which is filled with randomness
len- number of bytes requested
Return values:
E_UNKNOWN,ifan error occured
E_SUCCESS,ifsuccessful

References ASSERT, E_SUCCESS, and E_UNKNOWN.

SINT32 getSignatureElements ( DOMNode *  parent,
DOMNode **  signatureNodes,
UINT32 length 
)
UINT8* getTermsAndConditionsTemplateRefId ( DOMNode *  tcTemplateRoot)
void initDOMParser ( )

Referenced by CALibProxytest::init().

SINT32 integrateDOMNode ( const DOMNode *  srcNode,
DOMNode *  dstNode,
bool  recursive,
bool  replace 
)

integrates the source node in the destination Node.

TODO 1. test for XERCES >= 3.0.1 2. specification

References E_SUCCESS, E_UNKNOWN, equals(), INTEGRATE_NOT_ALLOWED_POSITIONS, integrateDOMNode(), and CAMsg::printMsg().

Referenced by integrateDOMNode(), and CACmdLnOptions::setTermsAndConditionsList().

void logMemoryUsage ( )

Log information about the current memory (heap) usage.

References CAMsg::printMsg().

Referenced by fm_loopLog(), and lm_loopLog().

SINT32 memtrim ( UINT8 dest,
const UINT8 src,
UINT32  size 
)

Removes leading and ending whitespaces (chars<=32) from a byte array.

Parameters:
srcinput byte array
destoutput byte array
sizesize of the input byte array
Return values:
E_UNSPECIFIED,ifdest was NULL
Returns:
size of output otherwise
Todo:
replace UINT32 size with SINT32 size

References E_UNSPECIFIED.

XERCES_CPP_NAMESPACE::DOMDocument* parseDOMDocument ( const UINT8 *const  buff,
UINT32  len 
)
XERCES_CPP_NAMESPACE::DOMDocument* parseDOMDocument ( const UINT8 *const  pathOrURL)

parses a file via path or URL

References CAMutex::lock(), and CAMutex::unlock().

SINT32 parseS64 ( const UINT8 str,
SINT64 value 
)

Parses a 64bit signed integer.

Note: If the value is out of range or not parseable an erro is returned.

Todo:
code if we do not have native UINT64

References E_SUCCESS, E_UNKNOWN, and len.

Referenced by getDOMElementAttribute(), and getDOMElementValue().

SINT32 parseU64 ( const UINT8 str,
UINT64 value 
)

Parses a 64bit unsigned integer.

Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in milliseconds since the epoch.

Note: If the value is out of range or not parseable an erro is returned.

Todo:
code if we do not have native UINT64

References E_SUCCESS, E_UNKNOWN, and len.

Referenced by getDOMElementAttribute(), and getDOMElementValue().

UINT8* readFile ( const UINT8 *const  name,
UINT32 size 
)
SINT32 readPasswd ( UINT8 buff,
UINT32  len 
)

Read a passwd (i.e.

without echoing the chars typed in)

References E_SUCCESS, and flags.

Referenced by CACmdLnOptions::setOwnCertificate().

void releaseDOMParser ( )
SINT32 saveFile ( const UINT8 *const  name,
const UINT8 *const  buff,
UINT32  buffSize 
)
SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
const UINT8 value 
)
SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
UINT64  value 
)
SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
SINT64  value 
)
SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
SINT32  value 
)
SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
UINT32  value 
)
SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
bool  value 
)
SINT32 setDOMElementValue ( DOMElement *  pElem,
UINT32  value 
)
SINT32 setDOMElementValue ( DOMElement *  pElem,
SINT32  value 
)

References E_SUCCESS, and setDOMElementValue().

SINT32 setDOMElementValue ( DOMElement *  pElem,
double  floatValue 
)

References E_SUCCESS, and setDOMElementValue().

SINT32 setDOMElementValue ( DOMElement *  pElem,
const UINT64  text 
)

Sets the decimal text representation of a 64bit integer as node value TODO: implement this for non-64bit platforms.

Returns the content of the text node under elem as 64bit unsigned integer.

References E_SUCCESS, print64(), and setDOMElementValue().

SINT32 setDOMElementValue ( DOMElement *  pElem,
const UINT8 value 
)

References E_SUCCESS.

SINT32 setDOMElementValue ( DOMElement *  pElem,
bool  value 
)
SINT32 sSleep ( UINT32  sec)
char* strins ( const char *  src,
UINT32  pos,
const char *  ins 
)

Inserts a String ins in a String src starting after pos chars.

Returns a newly allocated String which must be freed using delete.

Referenced by strins().

char* strins ( const char *  src,
const char *  pos,
const char *  ins 
)

Inserts a String ins in a String src starting at the char pos points to.

Returns a newly allocated String which must be freed using delete.

References strins().

UINT32 strtrim ( UINT8 s)

Removes leading and ending whitespaces (chars<=32) from a zero terminated string.

Parameters:
sinput string (null terminated)
Returns:
new size of string
Return values:
0means, that either s was NULL or that the new string has a zero length (that means, that the old string only contains whitespaces)

Referenced by CAListenerInterface::getInstance(), CAChain::getPrintableChainId(), CAMultiSignature::getSKI(), CAAccountingInstance::prepareCCRequest(), CACmdLnOptions::setAccountingDatabase(), CACmdLnOptions::setLoggingOptions(), CACmdLnOptions::setMixID(), and CACmdLnOptions::setTargetInterfaces().

UINT32 toLower ( UINT8 a_string)

References E_SUCCESS.

Referenced by CACmdLnOptions::setLoggingOptions().


Variable Documentation

XercesDOMParser* theDOMParser = NULL

Referenced by releaseDOMParser().

Referenced by releaseDOMParser().