Lines Matching defs:ar

78 mDNSlocal void mDNS_ExtractKeepaliveInfo(AuthRecord *ar, mDNSu32 *timeout, mDNSAddr *laddr, mDNSAddr *raddr, mDNSEthAddr *eth,
3306 AuthRecord *ar;
3501 ar = m->CurrentRecord;
3502 m->CurrentRecord = ar->next;
3503 if (!AuthRecord_uDNS(ar) && ar->resrec.RecordType == kDNSRecordTypeUnique) // For all records that are still probing...
3506 if (m->timenow - (ar->LastAPTime + ar->ThisAPInterval) < 0)
3508 SetNextAnnounceProbeTime(m, ar);
3511 else if (ar->ProbeCount)
3513 if (ar->AddressProxy.type == mDNSAddrType_IPv4)
3520 LogSPS("SendQueries ARP Probe %d %s %s", ar->ProbeCount, InterfaceNameForID(m, ar->resrec.InterfaceID), ARDisplayString(m,ar));
3521 SendARP(m, 1, ar, &zerov4Addr, &zeroEthAddr, &ar->AddressProxy.ip.v4, &ar->WakeUp.IMAC);
3523 else if (ar->AddressProxy.type == mDNSAddrType_IPv6)
3525 LogSPS("SendQueries NDP Probe %d %s %s", ar->ProbeCount, InterfaceNameForID(m, ar->resrec.InterfaceID), ARDisplayString(m,ar));
3530 SendNDP(m, NDP_Sol, 0, ar, &zerov6Addr, mDNSNULL, &ar->AddressProxy.ip.v6, &ar->WakeUp.IMAC);
3533 ar->SendRNow = (!intf || ar->WakeUp.HMAC.l[0]) ? mDNSNULL : ar->resrec.InterfaceID ? ar->resrec.InterfaceID : intf->InterfaceID;
3534 ar->LastAPTime = m->timenow;
3536 // than DefaultProbeCountForTypeUnique. Here we detect that state and reset ar->ProbeCount back to the right value.
3537 if (ar->ProbeCount > DefaultProbeCountForTypeUnique)
3538 ar->ProbeCount = DefaultProbeCountForTypeUnique;
3539 ar->ProbeCount--;
3540 SetNextAnnounceProbeTime(m, ar);
3541 if (ar->ProbeCount == 0)
3547 if (r2->resrec.RecordType == kDNSRecordTypeUnique && RecordIsLocalDuplicate(r2, ar))
3557 if (!ar->Acknowledged) AcknowledgeRecord(m, ar);
3564 if (!ar->Acknowledged) AcknowledgeRecord(m, ar); // Defensive, just in case it got missed somehow
3565 ar->resrec.RecordType = kDNSRecordTypeVerified;
3566 ar->ThisAPInterval = DefaultAnnounceIntervalForTypeUnique;
3567 ar->LastAPTime = m->timenow - DefaultAnnounceIntervalForTypeUnique;
3568 SetNextAnnounceProbeTime(m, ar);
3575 ar = m->CurrentRecord;
3576 m->CurrentRecord = ar->next;
3577 if (ar->resrec.RecordType == kDNSRecordTypeUnique && ar->ProbeCount == 0 && !ar->Acknowledged)
3578 AcknowledgeRecord(m, ar);
3650 for (ar = m->ResourceRecords; ar; ar=ar->next)
3651 if (ar->SendRNow == intf->InterfaceID)
3653 mDNSBool ucast = (ar->ProbeCount >= DefaultProbeCountForTypeUnique-1) && m->CanReceiveUnicastOn5353 && intf->SupportsUnicastMDNSResponse;
3657 mDNSu32 forecast = answerforecast + 12 + ar->resrec.rdestimate;
3658 mDNSu8 *newptr = putQuestion(&m->omsg, queryptr, limit - forecast, ar->resrec.name, kDNSQType_ANY, (mDNSu16)(ar->resrec.rrclass | ucbit));
3663 ar->SendRNow = (ar->resrec.InterfaceID) ? mDNSNULL : GetNextActiveInterfaceID(intf);
3664 ar->IncludeInProbe = mDNStrue;
3666 ar->resrec.name->c, DNSTypeName(ar->resrec.rrtype), ar->ProbeCount);
3697 for (ar = m->ResourceRecords; ar; ar=ar->next)
3699 if (ar->IncludeInProbe)
3701 mDNSu8 *newptr = PutResourceRecord(&m->omsg, queryptr, &m->omsg.h.numAuthorities, &ar->resrec);
3702 ar->IncludeInProbe = mDNSfalse;
3704 else LogMsg("SendQueries: How did we fail to have space for the Update record %s", ARDisplayString(m,ar));
3796 for (ar = m->ResourceRecords; ar; ar=ar->next)
3797 if (ar->SendRNow)
3799 if (ar->ARType != AuthRecordLocalOnly && ar->ARType != AuthRecordP2P)
3801 (uint32_t)ar->SendRNow, (uint32_t)ar->resrec.InterfaceID, ARDisplayString(m, ar));
3802 ar->SendRNow = mDNSNULL;
5994 AuthRecord *ar;
5995 for (ar = m->ResourceRecords; ar && ar != rr; ar=ar->next)
5996 if (mDNSPlatformMemSame(&rr->WakeUp, &ar->WakeUp, sizeof(rr->WakeUp))) return mDNSfalse;
6043 AuthRecord *ar;
6054 for (ar = m->ResourceRecords; ar; ar=ar->next)
6056 ar->updateIntID = zeroOpaque64;
6057 ar->updateid = zeroID;
6058 if (AuthRecord_uDNS(ar))
6062 if (ar->AuthFlags & AuthFlagsWakeOnly)
6064 if (ar->resrec.RecordType == kDNSRecordTypeShared && ar->RequireGoodbye)
6066 ar->ImmedAnswer = mDNSInterfaceMark;
6071 if (!ar->resrec.InterfaceID)
6073 LogSPS("Setting scopeid (ALL) 0x%x 0x%x for %s", updateIntID.l[1], updateIntID.l[0], ARDisplayString(m, ar));
6074 ar->updateIntID = updateIntID;
6080 mDNSu32 scopeid = mDNSPlatformInterfaceIndexfromInterfaceID(m, ar->resrec.InterfaceID, mDNStrue);
6083 bit_set_opaque64(ar->updateIntID, scopeid);
6084 LogSPS("SPSInitRecordsBeforeUpdate: Setting scopeid(%d) 0x%x 0x%x for %s", scopeid, ar->updateIntID.l[1],
6085 ar->updateIntID.l[0], ARDisplayString(m, ar));
6094 if (ar->resrec.rrtype == kDNSType_A || ar->resrec.rrtype == kDNSType_AAAA)
6096 mDNSCoreStoreProxyRR(m, ar->resrec.InterfaceID, ar);
6103 AuthRecord *ar;
6108 for (ar = m->ResourceRecords; ar; ar=ar->next)
6110 if (!mDNSPlatformMemSame(&owner, &ar->WakeUp, sizeof(owner)) && RecordIsFirstOccurrenceOfOwner(m, ar))
6112 owner = ar->WakeUp;
6820 AuthRecord *ar;
6845 for (ar = m->ResourceRecords; ar; ar = ar->next)
6846 if (ar->expire && ar->expire - now > mDNSPlatformOneSecond*4)
6848 mDNSs32 t = ar->expire - (ar->expire - now) / 10; // Wake up when 90% of the way to the expiry time
6851 ar, ar->ThisAPInterval / mDNSPlatformOneSecond,
6852 (ar->LastAPTime + ar->ThisAPInterval - now) / mDNSPlatformOneSecond,
6853 ar->expire ? (ar->expire - now) / mDNSPlatformOneSecond : 0,
6854 (t - now) / mDNSPlatformOneSecond, ARDisplayString(m, ar));
9498 mDNSlocal void SPSRecordCallback(mDNS *const m, AuthRecord *const ar, mStatus result)
9501 LogInfo("SPS Callback %d %s", result, ARDisplayString(m, ar));
9506 LogMsg("%-7s Conflicting mDNS -- waking %.6a %s", InterfaceNameForID(m, ar->resrec.InterfaceID), &ar->WakeUp.HMAC, ARDisplayString(m, ar));
9507 if (ar->WakeUp.HMAC.l[0])
9509 SendWakeup(m, ar->resrec.InterfaceID, &ar->WakeUp.IMAC, &ar->WakeUp.password); // Send one wakeup magic packet
9510 ScheduleWakeup(m, ar->resrec.InterfaceID, &ar->WakeUp.HMAC); // Schedule all other records with the same owner to be woken
9518 mDNSPlatformMemFree(ar);
9754 mDNSlocal void mDNS_ExtractKeepaliveInfo(AuthRecord *ar, mDNSu32 *timeout, mDNSAddr *laddr, mDNSAddr *raddr, mDNSEthAddr *eth, mDNSu32 *seq,
9757 if (ar->resrec.rrtype != kDNSType_NULL)
9760 if (mDNS_KeepaliveRecord(&ar->resrec))
9762 int len = ar->resrec.rdlength;
9763 mDNSu8 *ptr = &ar->resrec.rdata->u.txt.c[1];
9847 AuthRecord *ar;
9854 for (ar = m->ResourceRecords; ar; ar=ar->next)
9861 if (!ar->WakeUp.HMAC.l[0]) continue;
9863 mDNS_ExtractKeepaliveInfo(ar, &timeout, &laddr, &raddr, &eth, &seq, &ack, &lport, &rport, &win);
9868 debugf("mDNS_MatchKeepaliveInfo: not a valid record %s for keepalive", ARDisplayString(m, ar));
9881 return ar;
9889 AuthRecord *ar;
9891 for (ar = m->ResourceRecords; ar; ar=ar->next)
9905 if (!ar->WakeUp.HMAC.l[0]) continue;
9907 mDNS_ExtractKeepaliveInfo(ar, &timeout, &laddr, &raddr, &eth, &seq, &ack, &lport, &rport, &win);
9911 debugf("mDNS_SendKeepalives: not a valid record %s for keepalive", ARDisplayString(m, ar));
9918 if (!ar->KATimeExpire || (m->timenow - ar->KATimeExpire >= 0))
9921 ar->KATimeExpire = NonZeroTime(m->timenow + timeout * mDNSPlatformOneSecond);
9923 if (m->NextScheduledKA - ar->KATimeExpire > 0)
9924 m->NextScheduledKA = ar->KATimeExpire;
9928 mDNSlocal void mDNS_SendKeepaliveACK(mDNS *const m, AuthRecord *ar)
9937 if (ar == mDNSNULL)
9949 mDNS_ExtractKeepaliveInfo(ar, &timeout, &laddr, &raddr, &eth, &seq, &ack, &lport, &rport, &win);
9953 LogInfo("mDNS_SendKeepaliveACK: not a valid record %s for keepalive", ARDisplayString(m, ar));
10059 AuthRecord *ar = mDNSPlatformMemAllocate(sizeof(AuthRecord) - sizeof(RDataBody) + RDLengthMem);
10060 if (!ar)
10075 mDNS_SetupResourceRecord(ar, mDNSNULL, InterfaceID, m->rec.r.resrec.rrtype, m->rec.r.resrec.rroriginalttl, RecordType, AuthRecordAny, SPSRecordCallback, ar);
10076 AssignDomainName(&ar->namestorage, m->rec.r.resrec.name);
10077 ar->resrec.rdlength = GetRDLength(&m->rec.r.resrec, mDNSfalse);
10078 ar->resrec.rdata->MaxRDLength = RDLengthMem;
10079 mDNSPlatformMemCopy(ar->resrec.rdata->u.data, m->rec.r.resrec.rdata->u.data, RDLengthMem);
10080 ar->ForceMCast = mDNStrue;
10081 ar->WakeUp = owner;
10085 if (t == mDNSAddrType_IPv4) GetIPv4FromName(&ar->AddressProxy, m->rec.r.resrec.name);
10086 else if (t == mDNSAddrType_IPv6) GetIPv6FromName(&ar->AddressProxy, m->rec.r.resrec.name);
10087 debugf("mDNSCoreReceiveUpdate: PTR %d %d %#a %s", t, ar->AddressProxy.type, &ar->AddressProxy, ARDisplayString(m, ar));
10088 if (ar->AddressProxy.type) SetSPSProxyListChanged(InterfaceID);
10090 ar->TimeRcvd = m->timenow;
10091 ar->TimeExpire = m->timenow + updatelease * mDNSPlatformOneSecond;
10092 if (m->NextScheduledSPS - ar->TimeExpire > 0)
10093 m->NextScheduledSPS = ar->TimeExpire;
10094 ar->KATimeExpire = 0;
10095 mDNS_Register_internal(m, ar);
10099 LogSPS("SPS Registered %4d %X %s", m->ProxyRecords, RecordType, ARDisplayString(m,ar));
15050 mDNS_Deregister_internal(m, &dereg->ar, mDNS_Dereg_normal); // Memory will be freed in the FreeARElemCallback