int SipRegFindAppCallID(SipMsgHandle *msgHandle, char *callID) { char fn[] = "SipRegFindAppCallID():"; SipRegistration *sipreg; int rc = -1; SipCallLegKey leg = { 0 }; leg.remote = msgHandle->remote; // There is no need to do a lookup here, // as we intend to keep the SIP call ID the same // as the app callID. This code looks like this to keep // this identical to the Call SM code. In future, // we may have a functional mapping from the sip call id // to our call id. CacheGetLocks(sipregCache,LOCK_READ,LOCK_BLOCK); sipreg = CacheGet(sipregCache, &leg); if (sipreg) { memcpy(callID, sipreg->callID, CALL_ID_LEN); rc = 1; } CacheReleaseLocks(sipregCache); return rc; }
void CourseGetName(UInt16 courseID, MemHandle *charHandle, Boolean longformat) { if (! CacheValid(gCourseNameCacheID)) { // Cache has not yet been initialized gCourseNameCacheID = CacheRegister(CourseNameCacheNumI, CourseNameCacheLoad, CourseNameCacheFree); } CacheGet(gCourseNameCacheID, courseID, charHandle, longformat ? 0 : 3); }
const TCHAR *CAbstractSettings::Get (const TCHAR *pszKey) { const TCHAR *pszValue = CacheGet (pszKey); #ifdef _WIN32 if (!pszValue) { pszValue = RegistryGet (m_hkeyLocal, pszKey); if (!pszValue) { pszValue = RegistryGet (m_hkeyGlobal, pszKey); } } #endif return pszValue; }
int SipRegChangeState(SipEventHandle *evHandle, SipAppMsgHandle *appMsgHandle, int *prevState) { char fn[] = "SipRegChangeState()"; SipRegistration *sipreg; SipCallLegKey leg = { 0 }; SipMsgHandle *msgHandle = NULL; int rc = -1; if (!(leg.remote = appMsgHandle->calledpn)) { msgHandle = appMsgHandle->msgHandle; if (msgHandle) { leg.remote = msgHandle->remote; } } CacheGetLocks(sipregCache,LOCK_READ,LOCK_BLOCK); if (leg.remote && (sipreg = CacheGet(sipregCache, &leg))) { *prevState = sipreg->state; rc = SipRegChangeExistingState(evHandle, sipreg); } else { sipreg = SipRegistrationNew(sipregCache->malloc); // Insert the new entry in the cache sipreg->sipch.callLeg.remote = UrlDup(appMsgHandle->calledpn, sipregCache->malloc); memcpy(sipreg->callID, appMsgHandle->callID, CALL_ID_LEN); *prevState = sipreg->state = SipReg_sIdle; rc = SipRegChangeExistingState(evHandle, sipreg); if (CacheInsert(sipregCache, sipreg) < 0) { NETERROR(MSIP, ("%s Error inserting new state machine instance into cache\n", fn)); // free up everything SipRegistrationFree(sipreg, sipregCache->free); } rc = 0; } CacheReleaseLocks(sipregCache); return rc; }
// search local database for genre/discID bool Dbase::Search(Cddb::Album& a, const QString& genre, const Cddb::discid_t discID) { if (CacheGet(a, genre, discID)) return true; QFile file(GetDB() + '/' + genre.toLower() + '/' + QString::number(discID,16)); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { a = QTextStream(&file).readAll(); a.discGenre = genre.toLower(); a.discID = discID; LOG(VB_MEDIA, LOG_INFO, QString("LocalCDDB matched %1 ").arg(discID,0,16) + genre + " to " + a.artist + " / " + a.title); CachePut(a); return true; } return false; }
// search local database for discID bool Dbase::Search(Cddb::Matches& res, const Cddb::discid_t discID) { res.matches.clear(); res.discID = discID; if (CacheGet(res, discID)) return true; QFileInfoList list = QDir(GetDB()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); for (QFileInfoList::const_iterator it = list.begin(); it != list.end(); ++it) { QString genre = it->baseName(); QFileInfoList ids = QDir(it->canonicalFilePath()).entryInfoList(QDir::Files); for (QFileInfoList::const_iterator it2 = ids.begin(); it2 != ids.end(); ++it2) { if (it2->baseName().toUInt(nullptr,16) == discID) { QFile file(it2->canonicalFilePath()); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { Cddb::Album a(QTextStream(&file).readAll()); a.discGenre = genre; a.discID = discID; LOG(VB_MEDIA, LOG_INFO, QString("LocalCDDB found %1 in "). arg(discID,0,16) + genre + " : " + a.artist + " / " + a.title); CachePut(a); res.matches.push_back(Cddb::Match(genre,discID,a.artist,a.title)); } } } } return res.matches.size() > 0; }
int HandleNetoidLkup(Command *comm, int argc, char **argv) { CacheTableInfo *cacheInfo; CacheTableEntry *cacheHandle; char fn[] = "HandleNetoidLkup():"; unsigned long pkey; RealmIP realmip; RealmSubnet realmsub; char *sphone = 0, *url = 0, *tg = 0; int shmId, i; char *regid, *port; char *realmNamei, lkupip=0; PhoNode phonode = { 0 }; int release_lock = 0; /* Lookup in the LUS's cache and VPNS's cache */ if (argc < 1) { /* Here we prompt the user for the rest of the * information */ HandleCommandUsage(comm, argc, argv); return -xleInsuffArgs; } tg = url = sphone = argv[0]; if ((shmId = CacheAttach()) == -1) { CLIPRINTF((stdout, "Unable to attach to GIS cache\n")); } else if (argc == 1) { InitCfgFromCfgParms(lsMem->cfgParms); realmip.ipaddress = StringToIp(sphone); realmip.realmId = 0; lkupip = (realmip.ipaddress? 1 : 0); CacheGetLocks(regCache, LOCK_WRITE, LOCK_BLOCK); release_lock = 1; cacheInfo = CacheGet(phoneCache, sphone); if (cacheInfo) { CLIPRINTF((stdout, "Phone Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } cacheInfo = CacheGet(vpnPhoneCache, sphone); if (cacheInfo) { CLIPRINTF((stdout, "Vpn Phone Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } /* do a reg-id lookup */ memset(&phonode, 0, sizeof(PhoNode)); strncpy(phonode.regid, sphone, REG_ID_LEN); cacheInfo = CacheGet(regidCache, &phonode); if (cacheInfo) { CLIPRINTF((stdout, "Reg Id Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); /* Print some information relevent only to the * regid cache entry */ fprintf(stdout, "\tNo of ports configured = %d \n\t[", cacheInfo->data.ncfgports); for (i=0; i<MAX_IEDGE_PORTS; i++) { if (BITA_TEST(cacheInfo->data.cfgports, i)) { fprintf(stdout, " %d", i); } } fprintf(stdout, " ]\n\n"); } /* do a url lookup */ cacheInfo = CacheGet(uriCache, url); if (cacheInfo) { CLIPRINTF((stdout, "Url Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } // h323id cache cacheInfo = CacheGet(h323idCache, sphone); if (cacheInfo) { CLIPRINTF((stdout, "H323 ID Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } /* do a tg lookup */ cacheInfo = CacheGet(tgCache, tg); if (cacheInfo) { CLIPRINTF((stdout, "TG Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } } else if (argc == 2) { InitCfgFromCfgParms(lsMem->cfgParms); CacheGetLocks(regCache, LOCK_WRITE, LOCK_BLOCK); release_lock = 1; /* Do a reg-id uport lkup also, in the end */ strncpy(phonode.regid, argv[0], REG_ID_LEN); phonode.uport = atoi(argv[1]); cacheInfo = CacheGet(regCache, &phonode); if (cacheInfo) { CLIPRINTF((stdout, "Reg Id/Uport Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } /* Look up this ip address in our cache */ realmip.ipaddress = StringToIp(argv[0]); realmip.realmId = realmNameToRealmId(argv[1]); if (realmip.ipaddress && realmip.realmId) { lkupip = 1; } } if (lkupip) { cacheInfo = CacheGet(ipCache, &realmip); if (cacheInfo) { CLIPRINTF((stdout, "IP/Realm Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); /* Print some information relevent only to the * ip cache entry */ fprintf(stdout, "\tNo of ports registered = %d \n\t[", cacheInfo->data.nports); for (i=0; i<MAX_IEDGE_PORTS; i++) { if (BITA_TEST(cacheInfo->data.ports, i)) { fprintf(stdout, " %d", i); } } fprintf(stdout, " ]\n\n"); } // Also lookup in subnets realmsub.subnetip = realmip.ipaddress; realmsub.realmId = realmip.realmId; cacheInfo = GetIedgeLongestMatch(&realmsub); if (cacheInfo) { CLIPRINTF((stdout, "Longest Match:\n")); PrintInfoEntry(stdout, &cacheInfo->data); } } if(release_lock) { CacheReleaseLocks(regCache); } CacheDetach(); return xleOk; }
// Command takes regid/uport, ip4: or phone# as source int ComputeNetoidRoute(Command *comm, int argc, char **argv, int hunt) { char fn[] = "ComputeNetoidRoute():"; char *phone = 0, *url = 0, *tg = 0, *cic = 0, *dtg = NULL; char *regid = NULL, *sphone = NULL; int uport = 0, shmId; PhoNode phonode = { 0 }, fphonode = { 0 }; PhoNode phonodeTmp = { 0 }, fphonodeTmp = { 0 }; CacheTableInfo srcCacheInfoEntry, *srcCacheInfo; char *rPhone, guessPhone[PHONE_NUM_LEN] = { 0 }; InfoEntry *entry = 0x0, fentry, aentry; int rc = -xleInvalArgs, nhunt = 0, xhunt = 0; int checkZone = 0, checkVpnGroup = 0; PhoNode *phonodep = &phonode; PhoNode *fphonodep = &fphonode; ResolveHandle *rhandle,*rhandle2; RouteNode routeNode = { 0 }; ListEntry *rejectList = NULL; char crname[CALLPLAN_ATTR_LEN]; NetoidSNKey key = {0}; CacheTableInfo *info = NULL; eSourceType sourceType = ST_REGID_UPORT; RealmIP realmip; /* Lookup in the LUS's cache and VPNS's cache */ if (argc < 2) { rc = -xleInsuffArgs; goto _error; } if (strncasecmp(argv[1], "ani:", 4) == 0) { sourceType = ST_REGID_ANI; } else if (strncasecmp(argv[1], "dnis:", 5) == 0) { sourceType = ST_REGID_DNIS; } else if (strncasecmp(argv[0], "cid:", 4) == 0) { sourceType = ST_CID; } else if (strncasecmp(argv[0], "realm:", 6) == 0) { sourceType = ST_REALM_IP; } switch (argc) { case 2: if (sourceType == ST_REGID_ANI) { regid = argv[0]; sphone = argv[1] + 4; } else if (sourceType == ST_REGID_DNIS) { regid = argv[0]; phone = argv[1] + 5; } else if (sourceType == ST_CID) { sphone = argv[0] + 4; phone = argv[1]; } else { goto _error; } break; case 3: if (sourceType == ST_REGID_UPORT) { regid = argv[0]; uport = atoi(argv[1]); phone = argv[2]; } else if (sourceType == ST_REALM_IP) { realmip.realmId = realmNameToRealmId(argv[0] + 6); realmip.ipaddress = ntohl(inet_addr(argv[1])); phone = argv[2]; } else if (sourceType == ST_CID) { sphone = argv[0] + 4; phone = argv[1]; dtg = argv[2]; } else { goto _error; } break; case 4: if (sourceType == ST_REGID_UPORT) { regid = argv[0]; uport = atoi(argv[1]); } else if (sourceType == ST_REALM_IP) { realmip.realmId = realmNameToRealmId(argv[0] + 6); realmip.ipaddress = ntohl(inet_addr(argv[1])); } else { goto _error; } phone = argv[2]; dtg = argv[3]; break; #if 0 /* comment it out since it is not supported */ case 5: phonodep->ipaddress.l = ntohl(inet_addr(argv[0])); BIT_SET(phonodep->sflags, ISSET_IPADDRESS); tg = argv[1]; cic = argv[2]; sphone = argv[3]; phone = argv[4]; break; #endif default: goto _error; } checkVpnGroup = 1; checkZone = 1; #ifdef TURN_SYSLOG_LOGGING_ON /* Set the debug modules to appropriate levels */ NetLogInit(); NetLogOpen(NULL, 0, NETLOG_TERMINAL); NETLOG_SETLEVEL(MFIND, NETLOG_DEBUG4); #endif if ((shmId = CacheAttach()) == -1) { CLIPRINTF((stdout, "Unable to attach to GIS cache\n")); rc = -xleNoAccess; } else { InitCfgFromCfgParms(lsMem->cfgParms); /* Call the gis call routing api */ srcCacheInfo = &srcCacheInfoEntry; switch (sourceType) { case ST_REGID_UPORT: strncpy(phonodep->regid, regid, REG_ID_LEN); phonodep->uport = uport; BIT_SET(phonodep->sflags, ISSET_REGID); BIT_SET(phonodep->sflags, ISSET_UPORT); break; case ST_REGID_ANI: case ST_REGID_DNIS: strncpy(key.regid, regid, REG_ID_LEN); CacheGetLocks(regidCache, LOCK_READ, LOCK_BLOCK); info = CacheGet(regidCache, &key); CacheReleaseLocks(regidCache); if (info == NULL) { CLIPRINTF((stdout, "regid not found\n")); goto _return; } phonodep->ipaddress.l = info->data.ipaddress.l; phonodep->realmId = info->data.realmId; BIT_SET(phonodep->sflags, ISSET_IPADDRESS); if (sourceType == ST_REGID_ANI) { strncpy(phonodep->phone, sphone, PHONE_NUM_LEN); BIT_SET(phonodep->sflags, ISSET_PHONE); } break; case ST_REALM_IP: CacheGetLocks(ipCache, LOCK_READ, LOCK_BLOCK); info = CacheGet(ipCache, &realmip); CacheReleaseLocks(ipCache); if (info == NULL) { CLIPRINTF((stdout, "source not found\n")); goto _return; } phonodep->ipaddress.l = info->data.ipaddress.l; phonodep->realmId = info->data.realmId; BIT_SET(phonodep->sflags, ISSET_IPADDRESS); break; case ST_CID: if (CacheFind(phoneCache, sphone, srcCacheInfo, sizeof(CacheTableInfo)) < 0) { CLIPRINTF((stdout, "caller not found\n")); rc = -xleInvalArgs; goto _return; } phonodep->ipaddress.l = srcCacheInfo->data.ipaddress.l; phonodep->realmId = srcCacheInfo->data.realmId; BIT_SET(phonodep->sflags, ISSET_IPADDRESS); strncpy(phonodep->phone, sphone, PHONE_NUM_LEN); BIT_SET(phonodep->sflags, ISSET_PHONE); } if (phone) { strncpy(fphonodep->phone, phone, PHONE_NUM_LEN); BIT_SET(fphonodep->sflags, ISSET_PHONE); } /* Initialize the rhandle */ rhandle = GisAllocRHandle(); rhandle->phonodep = phonodep; rhandle->rfphonodep = fphonodep; rhandle->dtg = dtg; rhandle->crname = crname; memset(&rhandle->sVpn, 0, sizeof(VpnEntry)); memset(rhandle->sZone, 0, ZONE_LEN); /* Get the originator's entry, straight from database. It may * be faster to look him up from the database (not true when there * are lesser netoids */ if (FillSourceCacheForCallerId(phonodep, "", tg, cic, phone, srcCacheInfo) < 0) { if (!allowSrcAll) { CLIPRINTF((stdout, "%s No Src Entry Found\n", fn)); rc = -xleNoEntry; goto _return; } } else { CLIPRINTF((stdout, "\tFound SRC %s/%lu\n", srcCacheInfo->data.regid, srcCacheInfo->data.uport)); SetPhonodeFromDb(phonodep, &srcCacheInfo->data); // copy back whatever the user specified! if (sourceType == ST_CID) { strncpy(phonodep->phone, sphone, PHONE_NUM_LEN); BIT_SET(phonodep->sflags, ISSET_PHONE); } else { nx_strlcpy(phonodep->regid, srcCacheInfo->data.regid, REG_ID_LEN); phonodep->uport = srcCacheInfo->data.uport; BIT_SET(phonodep->sflags, ISSET_REGID); BIT_SET(phonodep->sflags, ISSET_UPORT); } } if (hunt) { xhunt = srcCacheInfo->data.maxHunts; if (xhunt == 0) { xhunt = maxHunts; } else if (xhunt > SYSTEM_MAX_HUNTS) { xhunt = SYSTEM_MAX_HUNTS; } } if(!allowHairPin) { // Hairpin is NOT allowed, add src into reject list. // If src is not found, add the src ip addr // Add it to the resolve handle reject list // and remember to free it up later GwAddPhoNodeToRejectList(phonodep, NULL, &rhandle->destRejectList, malloc); } rc = xleOk; entry = &srcCacheInfo->data; FindIedgeVpn(entry->vpnName, &rhandle->sVpn); nx_strlcpy(rhandle->sZone, entry->zone, ZONE_LEN); rhandle->scpname = entry->cpname; memcpy(&routeNode.xphonode, rhandle->rfphonodep, sizeof(PhoNode)); if (!hunt) { CLIPRINTF((stdout, "\t----------------------\n")); } /* Set policy */ rhandle->checkZone = 1; rhandle->checkVpnGroup = 1; rhandle->reservePort = 0; rhandle->phoneChange = 1; rhandle->primary = 0; if (srcCacheInfo->data.srcEgressTG[0] != '\0') { rhandle->dtg = srcCacheInfo->data.srcEgressTG; } memcpy(&phonodeTmp, rhandle->phonodep, sizeof(PhoNode)); memcpy(&fphonodeTmp, rhandle->rfphonodep, sizeof(PhoNode)); _resolve: memcpy(rhandle->phonodep, &phonodeTmp, sizeof(PhoNode)); memcpy(rhandle->rfphonodep, &fphonodeTmp, sizeof(PhoNode)); memset(crname, 0, CALLPLAN_ATTR_LEN); ResolvePhoneLocally(rhandle, hunt?0:_CliRouteLogFn); switch (rhandle->result) { case CACHE_FOUND: case CACHE_INPROG: memcpy(&routeNode.yphonode, rhandle->rfphonodep, sizeof(PhoNode)); routeNode.branch = rhandle->primary; routeNode.crname = rhandle->crname; if (hunt) { CLIPRINTF((stdout, "\t------- result %d --------\n", nhunt+1)); } else { CLIPRINTF((stdout, "\t------- final result --------\n")); } if (regid) CLIPRINTF((stdout, "\tSRC %s/%lu DEST %s\n", phonodep->regid, phonodep->uport, fphonodep->phone)); else CLIPRINTF((stdout, "\tSRC %s DEST %s\n", phonodep->phone, fphonodep->phone)); _CliRouteLogFn(&routeNode); // make sure we don't get into some infinite loop if (hunt && ++nhunt < xhunt) { GwAddPhoNodeToRejectList(rhandle->rfphonodep, rhandle->crname, &rhandle->destRejectList, malloc); goto _resolve; } break; case CACHE_NOTFOUND: routeNode.branch = rhandle->primary; routeNode.rejectReason = nextoneNoEntry; if (!nhunt) { CLIPRINTF((stdout, "\t-------no result--------\n")); if (regid) CLIPRINTF((stdout, "\tSRC %s/%lu DEST %s\n", phonodep->regid, phonodep->uport, fphonodep->phone)); else CLIPRINTF((stdout, "\tSRC %s DEST %s\n", phonodep->phone, fphonodep->phone)); _CliRouteLogFn(&routeNode); } goto _finish; break; default: break; } _finish: CLIPRINTF((stdout, "\t-------end--------\n")); if (rhandle->destRejectList) { GwFreeRejectList(rhandle->destRejectList, free); } GisFreeRHandle(rhandle); _return: CacheDetach(); } return rc; _error: /* Here we prompt the user for the rest of the * information */ HandleCommandUsage(comm, argc, argv); return rc; }
// MUST remove both mappings: // Conf -> call // call -> conf int GisDeleteCallFromConf(char *callID, char *confID) { char fn[] = "GisDeleteCallFromConf():"; ConfHandle *confHandle; CallHandle *callHandle; int i; char cid[CALL_ID_LEN]; char cfid[CONF_ID_LEN]; if (confCache == NULL) { // coming through generator code return 0; } CacheGetLocks(confCache, LOCK_WRITE, LOCK_BLOCK); confHandle = CacheGet(confCache, confID); if (confHandle) { if (confHandle->ncalls <= 0) { NETERROR(MARQ, ("%s Conf handle %s has no calls\n", fn, ConfID2String(confID, cfid))); } for(i =0;i<confHandle->ncalls;++i) { if (!memcmp(confHandle->callID[i], callID, CALL_ID_LEN)) { NETDEBUG(MARQ, NETLOG_DEBUG4, ("%s Deleting callID %s from conf handle %s\n", fn, CallID2String(callID, cid), ConfID2String(confID, cfid))); /* match */ memset(confHandle->callID[i], 0, CALL_ID_LEN); if ((confHandle->ncalls>1)&&(i!=(confHandle->ncalls-1))) { memcpy(confHandle->callID[i], confHandle->callID[confHandle->ncalls-1], CALL_ID_LEN); memset(confHandle->callID[confHandle->ncalls-1], 0, CALL_ID_LEN); } confHandle->ncalls --; } } if (confHandle->ncalls<= 0) { NETDEBUG(MARQ, NETLOG_DEBUG4, ("%s Deleting conf handle %s\n", fn, ConfID2String(confID, cfid))); if (CacheDelete(confCache, confID) != confHandle) { NETERROR(MARQ, ("%s Failed to delete conf handle %s\n", fn, ConfID2String(confID, cfid))); } GisFreeConfHandle(confHandle); } } CacheReleaseLocks(confCache); // Reset the other mapping also CacheGetLocks(callCache, LOCK_WRITE, LOCK_BLOCK); callHandle = CacheGet(callCache, callID); if (callHandle) { memset(callHandle->confID, 0, CALL_ID_LEN); } CacheReleaseLocks(callCache); return(0); }
int GisAddCallToConfGetConf(CallHandle *callHandle, ConfHandle **confhp) { char fn[] = "GisAddCallToConf():"; ConfHandle *confHandle; char confIdStr[CALL_ID_LEN]; if (confhp) { *confhp = NULL; } if (confCache == NULL) { // coming through generator code return 0; } CacheGetLocks(confCache, LOCK_WRITE, LOCK_BLOCK); confHandle = (ConfHandle *)CacheGet(confCache, callHandle->confID); if (confHandle == NULL) { if(nlm_getvport() <0 ) { NETDEBUG(MLMGR, NETLOG_DEBUG4, ("%s nlm_getvport failed - %s\n", fn, (char*) ConfID2String(callHandle->confID, confIdStr))); CacheReleaseLocks(confCache); return -1; } /* Allocate a conf handle */ confHandle = GisAllocConfHandle(); /* Initialize the main parameter */ ConfSetConfID(confHandle, callHandle->confID); /* Insert the call handle into the cache */ if (CacheInsert(confCache, confHandle) < 0) { NETERROR(MARQ, ("%s Failed to add confHandle into cache\n", fn)); } NETDEBUG(MARQ, NETLOG_DEBUG4, ("%s Inserting new conf handle %s into the cache\n", fn, (char*) CallID2String(callHandle->confID, confIdStr))); } if (confHandle->ncalls < MAX_CONF_CALLS) { int i; for(i = 0; i < confHandle->ncalls; i++) { if (!memcmp(confHandle->callID[i], callHandle->callID, CALL_ID_LEN)) { NETERROR(MARQ, ("%s Conf already has this call id\n", fn)); CacheReleaseLocks(confCache); return -1; } } /* Insert the call id into the call handle */ memcpy(confHandle->callID[confHandle->ncalls], callHandle->callID, CALL_ID_LEN); confHandle->ncalls++; CacheReleaseLocks(confCache); } else { NETERROR(MARQ, ("%s Conf already has %d calls\n", fn, confHandle->ncalls)); CacheReleaseLocks(confCache); return -1; } if (confhp) { *confhp = confHandle; } return 0; }
int HandleAgedIedgeIpAddr(NetoidInfoEntry *infoEntry) { PhoNode phonode; CacheTableInfo *info = 0; InfoEntry tmpInfo; int i; char tags[TAGH_LEN] = { 0 }; /* This aged ip address represents a bunch of * iedge ports, which we must now disable. * Using the ports mentioned in this iedge, * traverse the regCache, and disable the ports */ memcpy(&phonode, infoEntry, REG_ID_LEN); CacheGetLocks(regCache, LOCK_WRITE, LOCK_BLOCK); for (i=0; i<MAX_IEDGE_PORTS; i++) { if (BITA_TEST(infoEntry->ports, i)) { /* Look for this iedge port */ phonode.uport = i; info = (CacheTableInfo *)CacheGet(regCache, &phonode); if (info) { /* This iedge port is to be aged now */ /* We must mark in the db that this * netoid is inactive now */ if (!(info->data.stateFlags & CL_STATIC)) { memset(info->data.contact, 0, SIPURL_LEN); } info->data.stateFlags &= ~CL_ACTIVE; time(&info->data.iaTime); BITA_SET(tags, TAG_REGSTATUS); /* Update the database also */ //UpdateNetoidDatabase(&info->data); DbScheduleIedgeUpdate(&info->data); GisPostCliIedgeRegCmd(info->data.regid, info->data.uport, tags); if (!(info->data.stateFlags & CL_STATIC)) { if (!(info->data.stateFlags & CL_DYNAMIC)) { DeleteIedgeIpAddr(ipCache, &info->data); } else { DeleteIedge(&info->data); if (!IServerIsSecondary()) { infoEntry->uport = i; DbScheduleIedgeDelete(infoEntry); } } } } } } CacheReleaseLocks(regCache); return(1); }