void DialByNameDB::getContacts ( const UtlString& digitString, ResultSet& rResultSet ) const { // This should erase the contents of the existing resultset rResultSet.destroyAll(); if ( !digitString.isNull() && (m_pFastDB != NULL) ) { // Check the TableInfo table to see whether we need to reload // the Tables from the Credential/Permission tables SIPDBManager* pSIPDBManager = SIPDBManager::getInstance(); if ( pSIPDBManager->getDatabaseChangedFlag( "credential" ) || pSIPDBManager->getDatabaseChangedFlag( "permission" ) ) { // Reload this IMDB and rese the changed flags // in the credential and permission tables this->load(); } // Thread Local Storage m_pFastDB->attach(); // Search to see if we have a Credential Row dbCursor< DialByNameRow > cursor; dbQuery query; UtlString queryString = "np_digits like '" + digitString + "%'"; query = queryString; if ( cursor.select(query) > 0 ) { do { UtlHashMap record; UtlString* np_identityValue = new UtlString ( cursor->np_identity ); UtlString* np_contactValue = new UtlString ( cursor->np_contact ); UtlString* np_digitsValue = new UtlString ( cursor->np_digits ); // Memory Leak fixes, make shallow copies of static keys UtlString* np_identityKey = new UtlString( gNp_identityKey ); UtlString* np_contactKey = new UtlString( gNp_contactKey ); UtlString* np_digitsKey = new UtlString( gNp_digitsKey ); record.insertKeyAndValue ( np_identityKey, np_identityValue ); record.insertKeyAndValue ( np_contactKey, np_contactValue ); record.insertKeyAndValue ( np_digitsKey, np_digitsValue ); rResultSet.addValue(record); } while ( cursor.next() ); } // Commit the rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void addPermission(ResultSet& permissions, const char* permissionValue) { UtlHashMap record; record.insertKeyAndValue(new UtlString("identity"), new UtlString("dummy identity")); record.insertKeyAndValue(new UtlString("permission"), new UtlString(permissionValue)); permissions.addValue(record); }
void DialByNameDB::getAllRows(ResultSet& rResultSet) const { // Clear the results rResultSet.destroyAll(); // Check the TableInfo table to see whether we need to reload // the Tables from the Credential/Permission tables if ( m_pFastDB != NULL ) { SIPDBManager* pSIPDBManager = SIPDBManager::getInstance(); if ( pSIPDBManager->getDatabaseChangedFlag( "credential" ) || pSIPDBManager->getDatabaseChangedFlag( "permission" ) ) { // Reload this IMDB and reset the changed flags // in both the credential and permission tables this->load(); } // Thread Local Storage m_pFastDB->attach(); dbCursor< DialByNameRow > cursor; if ( cursor.select() > 0 ) { do { UtlHashMap record; UtlString* np_identityValue = new UtlString ( cursor->np_identity ); UtlString* np_contactValue = new UtlString ( cursor->np_contact ); UtlString* np_digitsValue = new UtlString ( cursor->np_digits ); // Memory Leak fixes, make shallow copies of static keys UtlString* np_identityKey = new UtlString( gNp_identityKey ); UtlString* np_contactKey = new UtlString( gNp_contactKey ); UtlString* np_digitsKey = new UtlString( gNp_digitsKey ); record.insertKeyAndValue ( np_identityKey, np_identityValue ); record.insertKeyAndValue ( np_contactKey, np_contactValue ); record.insertKeyAndValue ( np_digitsKey, np_digitsValue ); rResultSet.addValue(record); } while (cursor.next()); } // Commit rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void RegistrationDB::getAllRows ( ResultSet& rResultSet ) const { // Clear out any previous records rResultSet.destroyAll(); if ( m_pFastDB != NULL ) { SMART_DB_ACCESS; dbCursor< RegistrationRow > cursor; if ( cursor.select() > 0 ) { do { UtlHashMap record; UtlString* uriValue = new UtlString(cursor->uri); UtlString* callidValue = new UtlString(cursor->callid); UtlString* contactValue = new UtlString(cursor->contact); UtlInt* expiresValue = new UtlInt(cursor->expires); UtlInt* cseqValue = new UtlInt(cursor->cseq); UtlString* qvalueValue = new UtlString(cursor->qvalue); UtlString* primaryValue = new UtlString(cursor->primary); UtlLongLongInt* updateNumberValue = new UtlLongLongInt(cursor->update_number); // Memory Leak fixes, make shallow copies of static keys UtlString* uriKey = new UtlString(gUriKey); UtlString* callidKey = new UtlString(gCallidKey); UtlString* contactKey = new UtlString(gContactKey); UtlString* expiresKey = new UtlString(gExpiresKey); UtlString* cseqKey = new UtlString(gCseqKey); UtlString* qvalueKey = new UtlString(gQvalueKey); UtlString* primaryKey = new UtlString(gPrimaryKey); UtlString* updateNumberKey = new UtlString(gUpdateNumberKey); record.insertKeyAndValue(uriKey, uriValue); record.insertKeyAndValue(callidKey, callidValue); record.insertKeyAndValue(contactKey, contactValue); record.insertKeyAndValue(expiresKey, expiresValue); record.insertKeyAndValue(cseqKey, cseqValue); record.insertKeyAndValue(qvalueKey, qvalueValue); record.insertKeyAndValue(primaryKey, primaryValue); record.insertKeyAndValue(updateNumberKey, updateNumberValue); rResultSet.addValue(record); } while (cursor.next()); } } else { OsSysLog::add(FAC_DB, PRI_CRIT, "RegistrationDB::getAllRows failed - no DB"); } }
void CredentialDB::getAllRows( ResultSet& rResultSet ) const { // Clear the out any previous records rResultSet.destroyAll(); if (m_pFastDB != NULL) { // must do this first to ensure process/tls integrity m_pFastDB->attach(); dbCursor< CredentialRow > cursor; if ( cursor.select() > 0 ) { do { UtlHashMap record; UtlString* uriValue = new UtlString ( cursor->uri ); UtlString* realmValue = new UtlString ( cursor->realm ); UtlString* useridValue = new UtlString ( cursor->userid ); UtlString* passtokenValue = new UtlString ( cursor->passtoken ); UtlString* pintokenValue = new UtlString ( cursor->pintoken ); UtlString* authtypeValue = new UtlString ( cursor->authtype ); // Memory Leak fixes, make shallow copies of static keys UtlString* uriKey = new UtlString( gUriKey ); UtlString* realmKey = new UtlString( gRealmKey ); UtlString* useridKey = new UtlString( gUseridKey ); UtlString* passtokenKey = new UtlString( gPasstokenKey ); UtlString* pintokenKey = new UtlString( gPintokenKey ); UtlString* authtypeKey = new UtlString( gAuthtypeKey ); record.insertKeyAndValue ( uriKey, uriValue ); record.insertKeyAndValue ( realmKey, realmValue ); record.insertKeyAndValue ( useridKey, useridValue ); record.insertKeyAndValue ( passtokenKey, passtokenValue ); record.insertKeyAndValue ( pintokenKey, pintokenValue ); record.insertKeyAndValue ( authtypeKey, authtypeValue ); rResultSet.addValue(record); } while (cursor.next()); } // commit rows and also ensure process/tls integrity m_pFastDB->detach(0); } }
void AliasDB::getAliases ( const Url& contactIdentity, ResultSet& rResultSet ) const { UtlString contactIdentityStr; contactIdentity.getIdentity(contactIdentityStr); // This should erase the contents of the existing resultset rResultSet.clear(); if ( !contactIdentityStr.isNull() && (m_pFastDB != NULL) ) { // Thread Local Storage m_pFastDB->attach(); // Match a all rows where the contact identity matches UtlString queryString = "contact like '%" + contactIdentityStr + "%'"; dbQuery query; query=queryString; // Search to see if we have a Credential Row dbCursor< AliasRow > cursor; if ( cursor.select(query) > 0 ) { do { UtlHashMap record; UtlString* identityValue = new UtlString ( cursor->identity ); UtlString* contactValue = new UtlString ( cursor->contact ); // Memory Leak fixes, make shallow copies of static keys UtlString* identityKey = new UtlString( gIdentityKey ); UtlString* contactKey = new UtlString( gContactKey ); record.insertKeyAndValue ( identityKey, identityValue ); record.insertKeyAndValue ( contactKey, contactValue ); rResultSet.addValue(record); } while ( cursor.next() ); } // Commit the rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void AliasDB::getContacts ( const Url& identity, ResultSet& rResultSet ) const { UtlString identityStr; identity.getIdentity(identityStr); // This should erase the contents from the resultset object rResultSet.clear(); if ( !identityStr.isNull() && (m_pFastDB != NULL) ) { // Thread Local Storage m_pFastDB->attach(); dbQuery query; // Primary Key is the urialias's identity query="identity=",identityStr; // Search to see if we have a Credential Row dbCursor< AliasRow > cursor; if ( cursor.select(query) > 0 ) { do { UtlHashMap record; UtlString* identityValue = new UtlString ( cursor->identity ); UtlString* contactValue = new UtlString ( cursor->contact ); // Memory Leak fixes, make shallow copies of static keys UtlString* identityKey = new UtlString( gIdentityKey ); UtlString* contactKey = new UtlString( gContactKey ); record.insertKeyAndValue ( identityKey, identityValue ); record.insertKeyAndValue ( contactKey, contactValue ); rResultSet.addValue(record); } while ( cursor.next() ); } // Commit the rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void PermissionDB::getIdentities ( const UtlString& permission, ResultSet& rResultSet ) const { // This should erase the contents of the existing resultset rResultSet.destroyAll(); if ( !permission.isNull() && (m_pFastDB != NULL) ) { // Thread Local Storage m_pFastDB->attach(); dbQuery query; // Primary Key is the uriPermission's identity query="permission=", permission; // Search to see if we have a Credential Row dbCursor< PermissionRow > cursor; if ( cursor.select(query) > 0 ) { do { UtlHashMap record; UtlString* identityValue = new UtlString ( cursor->identity ); UtlString* permissionValue = new UtlString ( cursor->permission ); // Memory Leak fixes, make shallow copies of static keys UtlString* identityKey = new UtlString( gIdentityKey ); UtlString* permissionKey = new UtlString( gPermissionKey ); record.insertKeyAndValue ( identityKey, identityValue ); record.insertKeyAndValue ( permissionKey, permissionValue ); rResultSet.addValue(record); } while ( cursor.next() ); } // Commit the rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void UserLocationDB::getLocations ( const UtlString& identityString, ResultSet& rResultSet ) const { // This should erase the contents of the existing resultset rResultSet.clear(); if ( !identityString.isNull() && ( m_pFastDB != NULL) ) { // Thread Local Storage m_pFastDB->attach(); dbQuery query; query="identity=",identityString; // Search to see if we have a Credential Row dbCursor< UserLocationRow > cursor; if ( cursor.select(query) > 0 ) { do { UtlHashMap record; UtlString* identityValue = new UtlString ( cursor->identity ); UtlString* locationValue = new UtlString ( cursor->location ); // Memory Leak fixes, make shallow copies of static keys UtlString* identityKey = new UtlString( gIdentityKey ); UtlString* locationKey = new UtlString( gLocationKey ); record.insertKeyAndValue ( identityKey, identityValue ); record.insertKeyAndValue ( locationKey, locationValue ); rResultSet.addValue(record); } while ( cursor.next() ); } // Commit the rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void ExtensionDB::getAllRows(ResultSet& rResultSet) const { // Clear the out any previous records rResultSet.destroyAll(); if ( m_pFastDB != NULL ) { // must do this first to ensure process/tls integrity m_pFastDB->attach(); dbCursor< ExtensionRow > cursor; if ( cursor.select() > 0 ) { do { UtlHashMap record; UtlString* uriValue = new UtlString ( cursor->uri ); UtlString* extensionValue = new UtlString ( cursor->extension ); // Memory Leak fixes, make shallow copies of static keys UtlString* uriKey = new UtlString( gUriKey ); UtlString* extensionKey = new UtlString( gExtensionKey ); record.insertKeyAndValue ( uriKey, uriValue ); record.insertKeyAndValue ( extensionKey, extensionValue ); rResultSet.addValue(record); } while (cursor.next()); } // commit rows and also ensure process/tls integrity m_pFastDB->detach(0); } }
void UserForwardDB::getAllRows(ResultSet& rResultSet) const { // Clear the out any previous records rResultSet.destroyAll(); if (m_pFastDB != NULL) { // must do this first to ensure process/tls integrity m_pFastDB->attach(); dbCursor< UserForwardRow > cursor; if ( cursor.select() > 0 ) { do { UtlHashMap record; UtlString* identityValue = new UtlString ( cursor->identity ); UtlString* cfwdtimeValue = new UtlString ( cursor->cfwdtime ); // Memory Leak fixes, make shallow copies of static keys UtlString* identityKey = new UtlString( gIdentityKey ); UtlString* cfwdtimeKey = new UtlString( gCfwdtimeKey ); record.insertKeyAndValue ( identityKey, identityValue ); record.insertKeyAndValue ( cfwdtimeKey, cfwdtimeValue ); rResultSet.addValue(record); } while (cursor.next()); } // commit rows and also ensure process/tls integrity m_pFastDB->detach(0); } }
void UserLocationDB::getAllRows(ResultSet& rResultSet) const { // Clear the results rResultSet.destroyAll(); if ( m_pFastDB != NULL ) { // Thread Local Storage m_pFastDB->attach(); dbCursor< UserLocationRow > cursor; if ( cursor.select() > 0 ) { do { UtlHashMap record; UtlString* identityValue = new UtlString ( cursor->identity ); UtlString* locationValue = new UtlString ( cursor->location ); // Memory Leak fixes, make shallow copies of static keys UtlString* identityKey = new UtlString( gIdentityKey ); UtlString* locationKey = new UtlString( gLocationKey ); record.insertKeyAndValue ( identityKey, identityValue ); record.insertKeyAndValue ( locationKey, locationValue ); rResultSet.addValue(record); } while (cursor.next()); } // Commit rows to memory - multiprocess workaround m_pFastDB->detach(0); } }
void testRegistrationSet() { ResultSet registrations; size_t row; for (row = 0; row < sizeof(regdata)/sizeof(RegistrationRow); row++) { UtlHashMap regRow; UtlString* uriKey = new UtlString("uri"); UtlString* uriValue = new UtlString(regdata[row].uri); regRow.insertKeyAndValue(uriKey, uriValue); UtlString* callidKey = new UtlString("callid"); UtlString* callidValue = new UtlString(regdata[row].callid); regRow.insertKeyAndValue(callidKey, callidValue); UtlString* contactKey = new UtlString("contact"); UtlString* contactValue = new UtlString(regdata[row].contact); regRow.insertKeyAndValue(contactKey, contactValue); UtlString* expiresKey = new UtlString("expires"); UtlString* expiresValue = new UtlString(regdata[row].expires); regRow.insertKeyAndValue(expiresKey, expiresValue); UtlString* cseqKey = new UtlString("cseq"); UtlString* cseqValue = new UtlString(regdata[row].cseq); regRow.insertKeyAndValue(cseqKey, cseqValue); UtlString* qvalueKey = new UtlString("qvalue"); UtlString* qvalueValue = new UtlString(regdata[row].qvalue); regRow.insertKeyAndValue(qvalueKey, qvalueValue); UtlString* instanceIdKey = new UtlString("instance_id"); UtlString* instanceIdValue = new UtlString(regdata[row].instance_id); regRow.insertKeyAndValue(instanceIdKey, instanceIdValue); UtlString* gruuKey = new UtlString("gruu"); UtlString* gruuValue = new UtlString(regdata[row].gruu); regRow.insertKeyAndValue(gruuKey, gruuValue); UtlString* pathKey = new UtlString("path"); UtlString* pathValue = new UtlString(regdata[row].path); regRow.insertKeyAndValue(pathKey, pathValue); registrations.addValue(regRow); } Url target("http://server.exmple.com"); XmlRpcRequest request(target,"RPC.METHOD"); request.addParam(®istrations); UtlString requestBody; ssize_t bodyLength; request.mpRequestBody->getBytes(&requestBody, &bodyLength); const char* correctRequestBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<methodCall>\n" "<methodName>RPC.METHOD</methodName>\n" "<params>\n" "<param>\n" "<value><array><data>\n" "<value><struct>\n" "<member>\n" "<name>gruu</name><value><string>sip:[email protected];gr</string></value>\n" "</member>\n" "<member>\n" "<name>path</name><value><string><sip:visitme.com>,<sip:overhere.com>,<sip:comemyway.com></string></value>\n" "</member>\n" "<member>\n" "<name>uri</name><value><string>sip:[email protected]</string></value>\n" "</member>\n" "<member>\n" "<name>contact</name><value><string>sip:[email protected]:6012</string></value>\n" "</member>\n" "<member>\n" "<name>qvalue</name><value><string></string></value>\n" "</member>\n" "<member>\n" "<name>cseq</name><value><string>3</string></value>\n" "</member>\n" "<member>\n" "<name>expires</name><value><string>1133218054</string></value>\n" "</member>\n" "<member>\n" "<name>instance_id</name><value><string>1111</string></value>\n" "</member>\n" "<member>\n" "<name>callid</name><value><string>6745637808245563@TmVhbC1sYXB0b3Ay</string></value>\n" "</member>\n" "</struct></value>\n" "<value><struct>\n" "<member>\n" "<name>gruu</name><value><string>sip:[email protected];gr</string></value>\n" "</member>\n" "<member>\n" "<name>path</name><value><string><sip:visitme.com>,<sip:overhere.com>,<sip:comemyway.com></string></value>\n" "</member>\n" "<member>\n" "<name>uri</name><value><string>sip:[email protected]</string></value>\n" "</member>\n" "<member>\n" "<name>contact</name><value><string>sip:[email protected]:24907</string></value>\n" "</member>\n" "<member>\n" "<name>qvalue</name><value><string>0.8</string></value>\n" "</member>\n" "<member>\n" "<name>cseq</name><value><string>2</string></value>\n" "</member>\n" "<member>\n" "<name>expires</name><value><string>1133221655</string></value>\n" "</member>\n" "<member>\n" "<name>instance_id</name><value><string>2222</string></value>\n" "</member>\n" "<member>\n" "<name>callid</name><value><string>8d2d9c70405f4e66@TmVhbC1sYXB0b3Ay</string></value>\n" "</member>\n" "</struct></value>\n" "<value><struct>\n" "<member>\n" "<name>gruu</name><value><string>sip:[email protected];gr</string></value>\n" "</member>\n" "<member>\n" "<name>path</name><value><string><sip:visitme.com>,<sip:overhere.com>,<sip:comemyway.com></string></value>\n" "</member>\n" "<member>\n" "<name>uri</name><value><string>sip:[email protected]</string></value>\n" "</member>\n" "<member>\n" "<name>contact</name><value><string>sip:[email protected]:6000</string></value>\n" "</member>\n" "<member>\n" "<name>qvalue</name><value><string>0.2</string></value>\n" "</member>\n" "<member>\n" "<name>cseq</name><value><string>1</string></value>\n" "</member>\n" "<member>\n" "<name>expires</name><value><string>1133221680</string></value>\n" "</member>\n" "<member>\n" "<name>instance_id</name><value><string>3333</string></value>\n" "</member>\n" "<member>\n" "<name>callid</name><value><string>fa294244984e0c3f@TmVhbC1sYXB0b3Ay</string></value>\n" "</member>\n" "</struct></value>\n" "</data></array></value>\n" "</param>\n" ; ASSERT_STR_EQUAL(correctRequestBody, requestBody.data()); CPPUNIT_ASSERT_EQUAL(strlen(correctRequestBody), requestBody.length()); };
OsStatus MappingRulesUrlMapping::parsePermMatchContainer(const Url& requestUri, const UtlString& vdigits, ResultSet& rContactResultSet, ResultSet& rPermissions, UtlString& callTag, const TiXmlNode* pUserMatchNode //parent node ) const { OsStatus doTransformStatus = OS_FAILED; UtlBoolean bPermissionFound = false; UtlString requestUriStr; callTag = "UNK"; requestUri.toString(requestUriStr); const TiXmlNode* pPermMatchNode = NULL; while ( (pPermMatchNode = pUserMatchNode->IterateChildren( pPermMatchNode ) ) && (doTransformStatus != OS_SUCCESS) ) { if(pPermMatchNode && pPermMatchNode->Type() == TiXmlNode::ELEMENT) { UtlString tagValue = pPermMatchNode->Value(); if( tagValue.compareTo(XML_TAG_CALLTAG) == 0 ) { // Found call tag element. Read the text value for it. textContentShallow(callTag, pPermMatchNode); } if( tagValue.compareTo(XML_TAG_PERMISSIONMATCH) == 0 ) { //practically there should always be only one permission match tag const TiXmlElement* pPermissionMatchElement = pPermMatchNode->ToElement(); UtlBoolean bPermNodePresent = false; //get the user text value from it for( const TiXmlNode* pPermissionNode = pPermissionMatchElement->FirstChild( XML_TAG_PERMISSION ); pPermissionNode; pPermissionNode = pPermissionNode->NextSibling( XML_TAG_PERMISSION ) ) { bPermNodePresent = true; const TiXmlElement* pPermissionElement = pPermissionNode->ToElement(); //get permission Name const TiXmlNode* pPermissionText = pPermissionElement->FirstChild(); if(pPermissionText) { UtlString permission = pPermissionText->Value(); UtlHashMap record; UtlString* pIdentityKey = new UtlString ( "identity" ); UtlString* pPermissionKey = new UtlString ( "permission" ); UtlString* pIdentityValue = new UtlString ( requestUriStr ); UtlString* pPermissionValue = new UtlString ( permission ); record.insertKeyAndValue ( pIdentityKey, pIdentityValue ); record.insertKeyAndValue ( pPermissionKey, pPermissionValue ); rPermissions.addValue(record); bPermissionFound = true; } } //if no permission node - then it means no permission required - allow all if((!bPermNodePresent || bPermissionFound ) ) { //if the premission matches in the permissions database //go ahead and get the transform tag doTransformStatus = doTransform(requestUri, vdigits, rContactResultSet, pPermMatchNode); } } } } return doTransformStatus; }
void RegistrationDB::getUnexpiredContacts ( const Url& uri, const int& timeNow, ResultSet& rResultSet) const { // Clear the results rResultSet.destroyAll(); UtlString identity; uri.getIdentity( identity ); if ( !identity.isNull() && ( m_pFastDB != NULL) ) { SMART_DB_ACCESS; dbCursor< RegistrationRow > cursor; dbQuery query; OsSysLog::add(FAC_SIP, PRI_DEBUG, "RegistrationDB::getUnexpiredContacts " "identity = '%s'", identity.data()); if (strncmp(identity.data(), GRUU_PREFIX, sizeof (GRUU_PREFIX) - 1) == 0) { // This is a GRUU, search for it in the gruu column. query="gruu=",identity," and expires>",timeNow; OsSysLog::add(FAC_DB, PRI_DEBUG, "RegistrationDB::getUnexpiredContacts recognized GRUU"); } else { // This is not a GRUU, search for it in the identity column. query="np_identity=",identity," and expires>",timeNow; } if ( cursor.select(query) > 0 ) { // Copy all the unexpired contacts into the result hash do { UtlHashMap record; UtlString* uriValue = new UtlString(cursor->uri); UtlString* callidValue = new UtlString(cursor->callid); UtlString* contactValue = new UtlString(cursor->contact); UtlInt* expiresValue = new UtlInt(cursor->expires); UtlInt* cseqValue = new UtlInt(cursor->cseq); UtlString* qvalueValue = new UtlString(cursor->qvalue); UtlString* primaryValue = new UtlString(cursor->primary); UtlLongLongInt* updateNumberValue = new UtlLongLongInt(cursor->update_number); UtlString* instanceIdValue = new UtlString(cursor->instance_id); UtlString* gruuValue = new UtlString(cursor->gruu); UtlString* pathValue = new UtlString(cursor->path); OsSysLog::add(FAC_DB, PRI_DEBUG, "RegistrationDB::getUnexpiredContacts Record found " "uri = '%s', contact = '%s', instance_id = '%s', " "gruu = '%s', path = '%s'", uriValue->data(), contactValue->data(), instanceIdValue->data(), gruuValue->data(), pathValue->data()); // Memory Leak fixes, make shallow copies of static keys UtlString* uriKey = new UtlString(gUriKey); UtlString* callidKey = new UtlString(gCallidKey); UtlString* contactKey = new UtlString(gContactKey); UtlString* expiresKey = new UtlString(gExpiresKey); UtlString* cseqKey = new UtlString(gCseqKey); UtlString* qvalueKey = new UtlString(gQvalueKey); UtlString* primaryKey = new UtlString(gPrimaryKey); UtlString* updateNumberKey = new UtlString(gUpdateNumberKey); UtlString* instanceIdKey = new UtlString(gInstanceIdKey); UtlString* gruuKey = new UtlString(gGruuKey); UtlString* pathKey = new UtlString(gPathKey); record.insertKeyAndValue(uriKey, uriValue); record.insertKeyAndValue(callidKey, callidValue); record.insertKeyAndValue(contactKey, contactValue); record.insertKeyAndValue(expiresKey, expiresValue); record.insertKeyAndValue(cseqKey, cseqValue); record.insertKeyAndValue(qvalueKey, qvalueValue); record.insertKeyAndValue(primaryKey, primaryValue); record.insertKeyAndValue(updateNumberKey, updateNumberValue); record.insertKeyAndValue(instanceIdKey, instanceIdValue); record.insertKeyAndValue(gruuKey, gruuValue); record.insertKeyAndValue(pathKey, pathValue); rResultSet.addValue(record); } while ( cursor.next() ); } } else { OsSysLog::add(FAC_DB, PRI_CRIT, "RegistrationDB::getUnexpiredContacts failed - no DB"); } }
void CredentialDB::getAllCredentials ( const Url& uri, ResultSet& rResultSet ) const { UtlString identity; uri.getIdentity(identity); // This should erase the contents of the existing resultset rResultSet.clear(); if ( !identity.isNull() && (m_pFastDB != NULL) ) { // Thread Local Storage m_pFastDB->attach(); // Search to see if we have a Credential Row dbCursor< CredentialRow > cursor; dbQuery query; query="np_identity=",identity; if ( cursor.select( query ) > 0 ) { do { UtlHashMap record; UtlString* uriValue = new UtlString ( cursor->uri ); UtlString* realmValue = new UtlString ( cursor->realm ); UtlString* useridValue = new UtlString ( cursor->userid ); UtlString* passtokenValue = new UtlString ( cursor->passtoken ); UtlString* pintokenValue = new UtlString ( cursor->pintoken ); UtlString* authtypeValue = new UtlString ( cursor->authtype ); // Memory Leak fixes, make shallow copies of static keys UtlString* uriKey = new UtlString( gUriKey ); UtlString* realmKey = new UtlString( gRealmKey ); UtlString* useridKey = new UtlString( gUseridKey ); UtlString* passtokenKey = new UtlString( gPasstokenKey ); UtlString* pintokenKey = new UtlString( gPintokenKey ); UtlString* authtypeKey = new UtlString( gAuthtypeKey ); record.insertKeyAndValue ( uriKey, uriValue ); record.insertKeyAndValue ( realmKey, realmValue ); record.insertKeyAndValue ( useridKey, useridValue ); record.insertKeyAndValue ( passtokenKey, passtokenValue ); record.insertKeyAndValue ( pintokenKey, pintokenValue ); record.insertKeyAndValue ( authtypeKey, authtypeValue ); rResultSet.addValue(record); } while ( cursor.next() ); } // Commit the rows to memory - multiprocess workaround m_pFastDB->detach(0); } }