Mixes for Privacy and Anonymity in the Internet
Macros | Functions
CAUtil.hpp File Reference

Macros

#define UNIVERSAL_ATTRIBUTE_LAST_UPDATE   "lastUpdate"
 
#define UNIVERSAL_NODE_LAST_UPDATE   "LastUpdate"
 
#define STR_VALUE_TRUE   "true"
 
#define STR_VALUE_FALSE   "false"
 
#define TMP_BUFF_SIZE   255
 
#define TMP_LOCALE_SIZE   3
 
#define TMP_DATE_SIZE   9
 
#define TEMPLATE_REFID_MAXLEN   ((TMP_BUFF_SIZE) + (TMP_LOCALE_SIZE) + (TMP_DATE_SIZE) + 2)
 
#define INTEGRATE_NOT_ALLOWED_POSITIONS
 

Functions

UINT32 strtrim (UINT8 *)
 Removes leading and ending whitespaces (chars<=32) from a zero terminated string. More...
 
UINT32 toLower (UINT8 *a_string)
 
SINT32 memtrim (UINT8 *out, const UINT8 *in, UINT32 len)
 Removes leading and ending whitespaces (chars<=32) from a byte array. More...
 
UINT8bytes2hex (const void *bytes, UINT32 len)
 Converts the byte array to a hex string. More...
 
char * strins (const char *src, UINT32 pos, const char *ins)
 Inserts a String ins in a String src starting after pos chars. More...
 
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. More...
 
SINT32 getcurrentTime (timespec &t)
 Gets the current Systemtime in milli seconds. More...
 
SINT32 getcurrentTimeMillis (UINT64 &u64Time)
 Gets the current Systemtime in milli seconds. More...
 
SINT32 getcurrentTimeMicros (UINT64 &u64Time)
 Gets the current Systemtime in micros seconds. More...
 
SINT32 compDate (struct tm *date1, struct tm *date2)
 
SINT32 initRandom ()
 
SINT32 getRandom (UINT8 *buff, UINT32 len)
 Gets some random bytes. More...
 
SINT32 getRandom (UINT16 *val)
 Gets 16 random bits. More...
 
SINT32 getRandom (UINT32 *val)
 Gets 32 random bits. More...
 
SINT32 getRandom (UINT64 *val)
 
SINT32 msSleep (UINT32 ms)
 Sleeps ms milliseconds. More...
 
SINT32 sSleep (UINT32 sec)
 Sleeps sec Seconds. More...
 
UINT32 getMemoryUsage ()
 
SINT64 filesize64 (int handle)
 
SINT32 filesize32 (int handle)
 
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument (const UINT8 *const buff, UINT32 len)
 Parses a buffer containing an XML document and returns this document. More...
 
XERCES_CPP_NAMESPACE::DOMDocument * parseDOMDocument (const UINT8 *const pathOrURL)
 parses a file via path or URL More...
 
void initDOMParser ()
 
void releaseDOMParser ()
 
SINT32 getDOMChildByName (const DOMNode *pNode, const XMLCh *const name, DOMNode *&child, bool deep=false)
 
SINT32 getDOMChildByName (const DOMNode *pNode, const char *const name, DOMNode *&child, bool deep=false)
 
SINT32 getDOMChildByName (const DOMNode *pNode, const char *const name, DOMElement *&child, bool deep=false)
 
SINT32 getSignatureElements (DOMNode *parent, DOMNode **signatureNodes, UINT32 *length)
 
SINT32 getDOMElementValue (const DOMNode *const pElem, UINT8 *value, UINT32 *len)
 Returns the content of the text node(s) under elem as null-terminated C String. More...
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, const UINT8 *value)
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, const char *value)
 
bool equals (const XMLCh *const e1, const char *const e2)
 
SINT32 getDOMElementAttribute (const DOMNode *const pElem, 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. More...
 
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. More...
 
SINT32 getDOMElementValue (const DOMElement *const pElem, UINT32 &value, UINT32 defaultValue)
 Gets the value from an DOM-Element as UINT32. More...
 
SINT32 getDOMElementValue (const DOMElement *const pElem, UINT32 *value)
 
XERCES_CPP_NAMESPACE::DOMDocument * createDOMDocument ()
 Creates an empty DOM DOcument. More...
 
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 *pRoot, CAASymCipher *pRSA)
 
SINT32 getDOMElementValue (const DOMElement *const pElem, UINT16 *value)
 
SINT32 setDOMElementValue (DOMElement *pElem, const UINT8 *value)
 
SINT32 setDOMElementValue (DOMElement *pElem, UINT32 value)
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, UINT32 value)
 
SINT32 getDOMElementAttribute (const DOMNode *const pElem, const char *attrName, UINT32 &value)
 
SINT32 getDOMElementAttribute (const DOMNode *const pElem, const char *attrName, UINT8 *value, UINT32 *len)
 
SINT32 getDOMElementAttribute (const DOMNode *const pElem, const char *attrName, SINT64 &value)
 
SINT32 getDOMElementAttribute (const DOMNode *const pElem, const char *attrName, bool &value)
 
SINT32 getNodeName (const DOMNode *const pElem, UINT8 *value, UINT32 *valuelen)
 
SINT32 getLastDOMChildByName (const DOMNode *pNode, const char *const name, DOMElement *&a_child)
 
SINT32 getLastDOMChildByName (const DOMNode *pNode, const XMLCh *const name, DOMNode *&a_child)
 
SINT32 getLastDOMChildByName (const DOMNode *pNode, const char *const name, DOMNode *&a_child)
 
DOMNodeList * getElementsByTagName (DOMElement *pElem, const char *const name)
 
DSA * DSA_clone (DSA *dsa)
 Clones an OpenSSL DSA structure. More...
 
RSA * RSA_clone (RSA *rsa)
 Clones an OpenSSL RSA structure. More...
 
SINT32 setDOMElementValue (DOMElement *pElem, SINT32 value)
 
SINT32 setDOMElementValue (DOMElement *pElem, const UINT64 text)
 Returns the content of the text node under elem as 64bit unsigned integer. More...
 
SINT32 setDOMElementValue (DOMElement *pElem, const SINT64 text)
 
SINT32 getDOMElementValue (const DOMNode *const pElem, UINT64 &value)
 
SINT32 getDOMElementValue (const DOMElement *const pElem, SINT64 &value)
 
SINT32 getDOMElementValue (const DOMElement *const pElem, SINT32 *value)
 
SINT32 getDOMElementValue (const DOMElement *const pElem, double *value)
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, bool value)
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, SINT32 value)
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, UINT64 value)
 
SINT32 setDOMElementAttribute (DOMNode *pElem, const char *attrName, SINT64 value)
 
SINT32 setDOMElementValue (DOMElement *pElem, double floatValue)
 
SINT32 setDOMElementValue (DOMElement *pElem, bool value)
 
SINT32 setCurrentTimeMilliesAsDOMAttribute (DOMNode *pElem)
 
SINT32 integrateDOMNode (const DOMNode *srcNode, DOMNode *dstNode, bool recursive, bool replace)
 integrates the source node in the destination Node. More...
 
SINT32 encryptXMLElement (DOMNode *pElem, CAASymCipher *pRSA)
 Replaces a DOM element with an encrypted version of this element. More...
 
SINT32 decryptXMLElement (DOMNode *pelem, CAASymCipher *pRSA)
 Replaces a DOM element with a deencrypted version of this element. More...
 
UINT8getTermsAndConditionsTemplateRefId (DOMNode *tcTemplateRoot)
 
UINT8encryptXMLElement (UINT8 *inbuff, UINT32 inlen, UINT32 &outlen, CAASymCipher *pRSA)
 ONLY_LOCAL_PROXY or first. More...
 
void set64 (UINT64 &op1, UINT32 op2)
 
void set64 (UINT64 &dst, UINT64 src)
 Sets the value of dst to the value of src. More...
 
void set64 (SINT64 &dst, SINT64 src)
 Sets the value of dst to the value of src. More...
 
void setZero64 (UINT64 &op1)
 
void setZero64 (SINT64 &op1)
 
void add64 (UINT64 &op1, UINT32 op2)
 
void inc64 (UINT64 &op1)
 
UINT32 diff64 (const UINT64 &bigop, const UINT64 &smallop)
 
UINT32 div64 (UINT64 &op1, UINT32 op2)
 
bool isGreater64 (UINT64 &op1, UINT64 &op2)
 
bool isGreater64 (SINT64 op1, SINT64 op2)
 
bool isLesser64 (UINT64 &smallOp1, UINT64 &bigOp2)
 
bool isEqual64 (UINT64 &op1, UINT64 &op2)
 
bool isZero64 (UINT64 &op1)
 
bool isZero64 (SINT64 &op1)
 
void print64 (UINT8 *buff, UINT64 num)
 
UINT8readFile (const UINT8 *const name, UINT32 *size)
 ONLY_LOCAL_PROXY or first. More...
 
SINT32 saveFile (const UINT8 *const name, const UINT8 *const buff, UINT32 buffSize)
 
SINT32 parseUINT16 (const UINT8 *str, UINT16 &value)
 Parses a timestamp in JDBC timestamp escape format (as it comes from the BI) and outputs the value in milliseconds since the epoch. More...
 
SINT32 parseU64 (const UINT8 *str, UINT64 &value)
 Parses a 64bit unsigned integer. More...
 
SINT32 parseS64 (const UINT8 *str, SINT64 &value)
 Parses a 64bit signed integer. More...
 
SINT32 readPasswd (UINT8 *buff, UINT32 len)
 Read a passwd (i.e. More...
 
void formatBytesPerSecond (UINT8 *buff, UINT32 buffsize, UINT64 bytespersecond)
 
void logMemoryUsage ()
 Log information about the current memory (heap) usage. More...
 

Macro Definition Documentation

◆ INTEGRATE_NOT_ALLOWED_POSITIONS

#define INTEGRATE_NOT_ALLOWED_POSITIONS
Value:
(DOMNode::TREE_POSITION_ANCESTOR | DOMNode::TREE_POSITION_DESCENDANT | \
DOMNode::TREE_POSITION_EQUIVALENT | DOMNode::TREE_POSITION_SAME_NODE )

◆ STR_VALUE_FALSE

#define STR_VALUE_FALSE   "false"

◆ STR_VALUE_TRUE

#define STR_VALUE_TRUE   "true"

◆ TEMPLATE_REFID_MAXLEN

#define TEMPLATE_REFID_MAXLEN   ((TMP_BUFF_SIZE) + (TMP_LOCALE_SIZE) + (TMP_DATE_SIZE) + 2)

◆ TMP_BUFF_SIZE

#define TMP_BUFF_SIZE   255

◆ TMP_DATE_SIZE

#define TMP_DATE_SIZE   9

◆ TMP_LOCALE_SIZE

#define TMP_LOCALE_SIZE   3

◆ UNIVERSAL_ATTRIBUTE_LAST_UPDATE

#define UNIVERSAL_ATTRIBUTE_LAST_UPDATE   "lastUpdate"

◆ UNIVERSAL_NODE_LAST_UPDATE

#define UNIVERSAL_NODE_LAST_UPDATE   "LastUpdate"

Function Documentation

◆ add64()

void add64 ( UINT64 op1,
UINT32  op2 
)

◆ bytes2hex()

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().

◆ compDate()

SINT32 compDate ( struct tm *  date1,
struct tm *  date2 
)

◆ createDOMDocument()

XERCES_CPP_NAMESPACE::DOMDocument* createDOMDocument ( )

◆ createDOMElement()

DOMElement* createDOMElement ( XERCES_CPP_NAMESPACE::DOMDocument *  pOwnerDoc,
const char *const  name 
)

◆ createDOMText()

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().

◆ decodeXMLEncryptedKey() [1/2]

SINT32 decodeXMLEncryptedKey ( UINT8 key,
UINT32 keylen,
const DOMNode *  pRoot,
CAASymCipher pRSA 
)

◆ decodeXMLEncryptedKey() [2/2]

SINT32 decodeXMLEncryptedKey ( UINT8 key,
UINT32 keylen,
const UINT8 *const  xml,
UINT32  xmllen,
CAASymCipher pRSA 
)

◆ decryptXMLElement()

SINT32 decryptXMLElement ( DOMNode *  pelem,
CAASymCipher pRSA 
)

◆ diff64()

UINT32 diff64 ( const UINT64 bigop,
const UINT64 smallop 
)

◆ div64()

UINT32 div64 ( UINT64 op1,
UINT32  op2 
)

◆ DSA_clone()

DSA* DSA_clone ( DSA *  dsa)

Clones an OpenSSL DSA structure.

Referenced by CASignature::clone(), CASignature::setSignKey(), and CASignature::setVerifyKey().

◆ encodeXMLEncryptedKey() [1/2]

SINT32 encodeXMLEncryptedKey ( UINT8 key,
UINT32  keylen,
DOMElement *&  elemRootEncodedKey,
XERCES_CPP_NAMESPACE::DOMDocument *  docOwner,
CAASymCipher pRSA 
)

◆ encodeXMLEncryptedKey() [2/2]

SINT32 encodeXMLEncryptedKey ( UINT8 key,
UINT32  keylen,
UINT8 xml,
UINT32 xmllen,
CAASymCipher pRSA 
)

◆ encryptXMLElement() [1/2]

SINT32 encryptXMLElement ( DOMNode *  node,
CAASymCipher pRSA 
)

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

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::encryptCBCwithPKCS7(), CAASymCipher::encryptOAEP(), getRandom(), setDOMElementValue(), CASymCipher::setIV(), and CASymCipher::setKey().

Referenced by CALocalProxy::processKeyExchange().

◆ encryptXMLElement() [2/2]

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

ONLY_LOCAL_PROXY or first.

ONLY_LOCAL_PROXY or first.

 * \<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::encryptCBCwithPKCS7(), CAASymCipher::encryptOAEP(), getRandom(), CASymCipher::setIV(), and CASymCipher::setKey().

◆ equals()

bool equals ( const XMLCh *const  e1,
const char *const  e2 
)

◆ filesize32()

SINT32 filesize32 ( int  handle)

◆ filesize64()

SINT64 filesize64 ( int  handle)

References E_UNKNOWN.

Referenced by CAMsg::printMsg().

◆ formatBytesPerSecond()

void formatBytesPerSecond ( UINT8 buff,
UINT32  buffsize,
UINT64  bytespersecond 
)

◆ getcurrentTime()

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().

◆ getcurrentTimeMicros()

SINT32 getcurrentTimeMicros ( UINT64 u64Time)

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(), CAFirstMixA::loop(), CALastMixA::loop(), CAFirstMixB::loop(), CALastMixB::loop(), CADatabase::measurePerformance(), CAReplayDatabase::measurePerformance(), CAFirstMixA::sendToUsers(), and CAChain::~CAChain().

◆ getcurrentTimeMillis()

SINT32 getcurrentTimeMillis ( UINT64 u64Time)

◆ getDOMChildByName() [1/3]

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

Referenced by CACmdLnOptions::addVisibleAddresses(), 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(), CALastMix::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALocalProxy::processKeyExchange(), CACmdLnOptions::processXmlConfiguration(), CAReplayControlChannel::processXMLMessage(), CAReplayCtrlChannelMsgProc::propagateCurrentReplayTimestamp(), CACmdLnOptions::setAccessControlCredential(), 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::setSymChannelCipherAlgorithm(), CACmdLnOptions::setTargetInterfaces(), CACmdLnOptions::setTermsAndConditions(), CACmdLnOptions::setTermsAndConditionsList(), CACmdLnOptions::setTermsAndConditionsTemplates(), CACmdLnOptions::setTrustedRootCertificates(), CACmdLnOptions::setUserID(), CAXMLErrorMessage::setValues(), CASignature::setVerifyKey(), CAMultiSignature::signXML(), CACertStore::verifyMixCert(), CAMultiSignature::verifyXML(), and CASignature::verifyXML().

◆ getDOMChildByName() [2/3]

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

References E_UNKNOWN, and getDOMChildByName().

◆ getDOMChildByName() [3/3]

SINT32 getDOMChildByName ( const DOMNode *  pNode,
const XMLCh *const  name,
DOMNode *&  child,
bool  deep = false 
)

◆ getDOMElementAttribute() [1/5]

SINT32 getDOMElementAttribute ( const DOMNode *const  pElem,
const char *  attrName,
bool &  value 
)

◆ getDOMElementAttribute() [2/5]

SINT32 getDOMElementAttribute ( const DOMNode *const  pElem,
const char *  attrName,
SINT32 value 
)

◆ getDOMElementAttribute() [3/5]

SINT32 getDOMElementAttribute ( const DOMNode *const  pElem,
const char *  attrName,
SINT64 value 
)

◆ getDOMElementAttribute() [4/5]

SINT32 getDOMElementAttribute ( const DOMNode *const  pElem,
const char *  attrName,
UINT32 value 
)

◆ getDOMElementAttribute() [5/5]

SINT32 getDOMElementAttribute ( const DOMNode *const  pElem,
const char *  attrName,
UINT8 value,
UINT32 len 
)

◆ getDOMElementValue() [1/8]

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

◆ getDOMElementValue() [2/8]

SINT32 getDOMElementValue ( const DOMElement *const  pElem,
SINT32 value 
)

◆ getDOMElementValue() [3/8]

SINT32 getDOMElementValue ( const DOMElement *const  pElem,
SINT64 value 
)

◆ getDOMElementValue() [4/8]

SINT32 getDOMElementValue ( const DOMElement *const  pElem,
UINT16 value 
)

◆ getDOMElementValue() [5/8]

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().

◆ getDOMElementValue() [6/8]

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

◆ getDOMElementValue() [7/8]

SINT32 getDOMElementValue ( const DOMNode *const  pElem,
UINT64 value 
)

◆ getDOMElementValue() [8/8]

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.

Parameters
DOM_Nodethe element which has a text node under it
valuea buffer that gets the text value
lenon call contains the buffer size, on return contains the number of bytes copied
Returns
E_SPACE if the buffer is too small, E_SUCCESS otherwise, E_UNKNOWN if the element is NULL

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(), CALastMix::processKeyExchange(), CAMiddleMix::processKeyExchange(), CALocalProxy::processKeyExchange(), CACmdLnOptions::processXmlConfiguration(), CAReplayControlChannel::processXMLMessage(), CACmdLnOptions::setAccessControlCredential(), 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(), CAXMLErrorMessage::setValues(), CASignature::setVerifyKey(), CAMultiSignature::verifyXML(), and CASignature::verifyXML().

◆ getElementsByTagName()

DOMNodeList* getElementsByTagName ( DOMElement *  pElem,
const char *const  name 
)

◆ getLastDOMChildByName() [1/3]

SINT32 getLastDOMChildByName ( const DOMNode *  pNode,
const char *const  name,
DOMElement *&  a_child 
)

◆ getLastDOMChildByName() [2/3]

SINT32 getLastDOMChildByName ( const DOMNode *  pNode,
const char *const  name,
DOMNode *&  a_child 
)

◆ getLastDOMChildByName() [3/3]

SINT32 getLastDOMChildByName ( const DOMNode *  pNode,
const XMLCh *const  name,
DOMNode *&  a_child 
)

References E_SUCCESS, E_UNKNOWN, and equals().

◆ getMemoryUsage()

UINT32 getMemoryUsage ( )

◆ getNodeName()

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

References ASSERT, E_SPACE, E_SUCCESS, and E_UNKNOWN.

Referenced by CAMix::checkCompatibility().

◆ getRandom() [1/4]

SINT32 getRandom ( UINT16 val)

Gets 16 random bits.

Parameters
val- on return the bits are random
Return values
E_UNKNOWN,ifan error occured
E_SUCCESS,ifsuccessful

References ASSERT, E_SUCCESS, and E_UNKNOWN.

◆ getRandom() [2/4]

SINT32 getRandom ( UINT32 val)

◆ getRandom() [3/4]

SINT32 getRandom ( UINT64 val)

References ASSERT, E_SUCCESS, and E_UNKNOWN.

◆ getRandom() [4/4]

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, E_UNKNOWN, and len.

◆ getSignatureElements()

SINT32 getSignatureElements ( DOMNode *  parent,
DOMNode **  signatureNodes,
UINT32 length 
)

◆ getTermsAndConditionsTemplateRefId()

UINT8* getTermsAndConditionsTemplateRefId ( DOMNode *  tcTemplateRoot)

◆ inc64()

void inc64 ( UINT64 op1)

◆ initDOMParser()

void initDOMParser ( )

◆ initRandom()

SINT32 initRandom ( )

◆ integrateDOMNode()

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

  1. specification
Todo:
: check!

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

Referenced by CACmdLnOptions::setTermsAndConditionsList().

◆ isEqual64()

bool isEqual64 ( UINT64 op1,
UINT64 op2 
)

◆ isGreater64() [1/2]

bool isGreater64 ( SINT64  op1,
SINT64  op2 
)

◆ isGreater64() [2/2]

bool isGreater64 ( UINT64 op1,
UINT64 op2 
)

◆ isLesser64()

bool isLesser64 ( UINT64 smallOp1,
UINT64 bigOp2 
)

◆ isZero64() [1/2]

bool isZero64 ( SINT64 op1)

◆ isZero64() [2/2]

bool isZero64 ( UINT64 op1)

◆ logMemoryUsage()

void logMemoryUsage ( )

Log information about the current memory (heap) usage.

References CAMsg::printMsg().

◆ memtrim()

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.

◆ msSleep()

SINT32 msSleep ( UINT32  ms)

◆ parseDOMDocument() [1/2]

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

◆ parseDOMDocument() [2/2]

XERCES_CPP_NAMESPACE::DOMDocument* parseDOMDocument ( const UINT8 *const  pathOrURL)

parses a file via path or URL

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

◆ parseS64()

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().

◆ parseU64()

SINT32 parseU64 ( const UINT8 str,
UINT64 value 
)

Parses a 64bit unsigned integer.

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

Todo:
code if we do not have native UINT64

References E_SUCCESS, E_UNKNOWN, and len.

Referenced by getDOMElementAttribute(), and getDOMElementValue().

◆ parseUINT16()

SINT32 parseUINT16 ( const UINT8 str,
UINT16 value 
)

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

Parameters
strTimestampthe string containing the timestamp
valuean integer variable that gets the milliseconds value. Converts a timestamp (in seconds) to the String JDBC timestamp escape format (YYYY-MM-DD HH:MM:SS)
secondsinteger value containing the timestamp in seconds since the epoch
strTimestampa string buffer that gets the result
lenthe buffer length
Todo:
think about timezone handling

Parses a 16bit unsigned integer

References E_SUCCESS.

◆ print64()

void print64 ( UINT8 buff,
UINT64  num 
)

◆ readFile()

UINT8* readFile ( const UINT8 *const  name,
UINT32 size 
)

ONLY_LOCAL_PROXY or first.

References filesize32(), and O_BINARY.

Referenced by CALastMix::init(), and CAMiddleMix::init().

◆ readPasswd()

SINT32 readPasswd ( UINT8 buff,
UINT32  len 
)

Read a passwd (i.e.

without echoing the chars typed in)

References E_SUCCESS, flags, and len.

Referenced by CACmdLnOptions::setOwnCertificate().

◆ releaseDOMParser()

void releaseDOMParser ( )

◆ RSA_clone()

RSA* RSA_clone ( RSA *  rsa)

Clones an OpenSSL RSA structure.

Referenced by CASignature::clone(), CASignature::setSignKey(), and CASignature::setVerifyKey().

◆ saveFile()

SINT32 saveFile ( const UINT8 *const  name,
const UINT8 *const  buff,
UINT32  buffSize 
)

◆ set64() [1/3]

void set64 ( SINT64 dst,
SINT64  src 
)

Sets the value of dst to the value of src.

References __SINT64__t_::high, and __SINT64__t_::low.

◆ set64() [2/3]

void set64 ( UINT64 dst,
UINT64  src 
)

Sets the value of dst to the value of src.

References __UINT64__t_::high, and __UINT64__t_::low.

◆ set64() [3/3]

void set64 ( UINT64 op1,
UINT32  op2 
)

◆ setCurrentTimeMilliesAsDOMAttribute()

SINT32 setCurrentTimeMilliesAsDOMAttribute ( DOMNode *  pElem)

◆ setDOMElementAttribute() [1/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
bool  value 
)

◆ setDOMElementAttribute() [2/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
const char *  value 
)

◆ setDOMElementAttribute() [3/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
const UINT8 value 
)

References E_SUCCESS, and E_UNKNOWN.

◆ setDOMElementAttribute() [4/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
SINT32  value 
)

◆ setDOMElementAttribute() [5/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
SINT64  value 
)

◆ setDOMElementAttribute() [6/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
UINT32  value 
)

◆ setDOMElementAttribute() [7/7]

SINT32 setDOMElementAttribute ( DOMNode *  pElem,
const char *  attrName,
UINT64  value 
)

◆ setDOMElementValue() [1/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
bool  value 
)

◆ setDOMElementValue() [2/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
const SINT64  text 
)

◆ setDOMElementValue() [3/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
const UINT64  text 
)

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

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().

◆ setDOMElementValue() [4/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
const UINT8 value 
)

References E_SUCCESS.

◆ setDOMElementValue() [5/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
double  floatValue 
)

References E_SUCCESS, and setDOMElementValue().

◆ setDOMElementValue() [6/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
SINT32  value 
)

◆ setDOMElementValue() [7/7]

SINT32 setDOMElementValue ( DOMElement *  pElem,
UINT32  value 
)

References E_SUCCESS, and setDOMElementValue().

◆ setZero64() [1/2]

void setZero64 ( SINT64 op1)

◆ setZero64() [2/2]

void setZero64 ( UINT64 op1)

◆ sSleep()

SINT32 sSleep ( UINT32  sec)

◆ strins() [1/2]

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().

◆ strins() [2/2]

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().

◆ strtrim()

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().

◆ toLower()

UINT32 toLower ( UINT8 a_string)

References E_SUCCESS.

Referenced by CACmdLnOptions::setLoggingOptions().