Lines Matching defs:query

250 by the query packet, and then the answer were later suppressed in a subsequent KA packet.)
489 <rdar://problem/3709039> Disable targeted unicast query support by default
661 which means "do this query via multicast, even if it's apparently a unicast domain"
664 If the client has specified an explicit InterfaceID, then do query by multicast, not unicast
667 Make sure uDNS client doesn't accidentally use query ID zero
695 <rdar://problem/3192548>: DynDNS: Unicast query of service records
714 <rdar://problem/3490355>: Don't exclude known answers whose expiry time is before the next query
716 halfway to expiry, the check to also see if we have another query scheduled
761 <rdar://problem/3437556> We should delay AAAA record query if A record already in cache.
852 <rdar://problem/3396034> Add syslog message to report when query is reset because of immediate answer burst
856 One more change: "query->GotTXT" is now a straightforward bi-state boolean again
903 1. A dual-stack host should only suppress its own query if it sees the same query from other hosts on BOTH IPv4 and IPv6.
1130 <rdar://problem/3324795> Duplicate query suppression not working right
1138 Minor refinement: No need to make address query broader than the original SRV query that provoked it
1161 <rdar://problem/3324795> Duplicate query suppression not working right
1162 The correct cutoff time for duplicate query suppression is timenow less one-half the query interval.
1163 The code was incorrectly using the last query time plus one-half the query interval.
1164 This was only correct in the case where query acceleration was not in effect.
1249 <rdar://problem/3283637> React when we observe other people query unsuccessfully for a record that's in our cache
1281 <rdar://problem/3283637> React when we observe other people query unsuccessfully for a record that's in our cache
1284 <rdar://problem/3283540> When query produces zero results, call mDNS_Reconfirm() on any antecedent records
1292 <rdar://problem/3283540> When query produces zero results, call mDNS_Reconfirm() on any antecedent records
1547 <rdar://problem/3231321> No need to query again when a service goes away
1579 FoundServiceInfoSRV() making an interface-specific query on the interface that was just removed.
2363 // CacheRecord *ks is the CacheRecord from the known answer list in the query.
2419 // If we already have a query scheduled to go out sooner, then use that time to get better aggregation
3144 else if (rr->ImmedAnswer) // Else, just respond to a single query on single interface:
3356 // If we have an active question, then see if we want to schedule a refresher query for this record.
3392 // so that the reconfirmation questions can be grouped into a single query packet
3408 mDNSlocal mDNSBool BuildQuestion(mDNS *const m, DNSMessage *query, mDNSu8 **queryptr, DNSQuestion *q,
3413 const mDNSu8 *const limit = query->data + NormalMaxDNSMessageData;
3414 mDNSu8 *newptr = putQuestion(query, *queryptr, limit, &q->qname, q->qtype, (mDNSu16)(q->qclass | ucbit));
3423 q->qname.c, newptr + *answerforecast - query->data);
3424 query->h.numQuestions--;
3449 if (query->h.numQuestions > 1 && newptr + forecast >= limit)
3452 q->qname.c, DNSTypeName(q->qtype), newptr + forecast - query->data);
3453 query->h.numQuestions--;
3473 query->h.numQuestions--;
3526 mDNSBool v4 = !intf->IPv4Available; // If this interface doesn't do v4, we don't need to find a v4 duplicate of this query
3527 mDNSBool v6 = !intf->IPv6Available; // If this interface doesn't do v6, we don't need to find a v6 duplicate of this query
3554 // Record the info about this query we saw
3564 // If more than 90% of the way to the query time, we should unconditionally accelerate it
3568 // If half-way to next scheduled query time, only accelerate if it will add less than 512 bytes to the packet
3617 // 1. If time for a query, work out what we need to do
3623 // We're expecting to send a query anyway, so see if any expiring cache records are close enough
3631 if (q->Target.type) q->SendQNow = mDNSInterfaceMark; // If unicast query, mark it
3672 // If at least halfway to next query time, advance to next interval
3673 // If less than halfway to next query time, then
3685 ReconfirmAntecedents(m, q); // Sending third query, and no answers yet; time to begin doubting the source
3698 // then we consider it recent enough that we don't need to do an identical query ourselves.
3778 // Put query questions in this packet
3942 // (a) a no-cache add, where we've already done at least one 'QM' query, or
4020 // second of sending the last query packet, then that indicates some radical network topology change,
4023 // because we will anyway send another query within a few seconds. The first reset query is sent out
4185 else // else, not expired; see if we need to query
4194 if (m->timenow - rr->NextRequiredQuery < 0) // If not yet time for next query
4195 event = rr->NextRequiredQuery; // then just record when we want the next query
4201 // After sending the query we'll increment UnansweredQueries and call SetNextCacheCheckTime(),
4273 // -- we don't need to rush out on the network and query immediately to see if there are more answers out there
4686 mDNSlocal mDNSu8 *GenerateUnicastResponse(const DNSMessage *const query, const mDNSu8 *const end,
4691 const mDNSu8 *ptr = query->data;
4697 InitializeDNSMessage(&response->h, query->h.id, ResponseFlags);
4705 for (i=0; i<query->h.numQuestions; i++) // For each question...
4708 ptr = getQuestion(query, ptr, end, InterfaceID, &q); // get the question...
4856 mDNSlocal void ResolveSimultaneousProbe(mDNS *const m, const DNSMessage *const query, const mDNSu8 *const end,
4860 const mDNSu8 *ptr = LocateAuthorities(query, end);
4863 for (i = 0; i < query->h.numAuthorities; i++)
4865 ptr = GetLargeResourceRecord(m, query, ptr, end, q->InterfaceID, kDNSRecordTypePacketAuth, &m->rec);
4903 // ProcessQuery examines a received query to see if we have any answers to give
4904 mDNSlocal mDNSu8 *ProcessQuery(mDNS *const m, const DNSMessage *const query, const mDNSu8 *const end,
4917 const mDNSu8 *ptr = query->data;
4925 for (i=0; i<query->h.numQuestions; i++) // For each question...
4930 ptr = getQuestion(query, ptr, end, InterfaceID, &pktq); // get the question...
4960 ResolveSimultaneousProbe(m, query, end, &pktq, rr);
4965 // NR_AnswerTo pointing into query packet means "answer via immediate legacy unicast" (may *also* choose to multicast)
4991 // For any query generating a unicast response we don't do this because we can't assume we will see the response
4998 // Make a list indicating which of our own cache records we expect to see updated as a result of this query
5008 // Although MPUnansweredQ is only really used for multi-packet query processing,
5010 // with the MPUnansweredKA value, which by necessity is incremented for both query types.
5020 // can't guarantee to receive all of the Known Answer packets that go with a particular query.
5021 if (!(query->h.flags.b[0] & kDNSFlag0_TC))
5048 for (i=0; i<query->h.numAnswers; i++) // For each record in the query's answer section...
5053 ptr = GetLargeResourceRecord(m, query, ptr, end, InterfaceID, kDNSRecordTypePacketAns, &m->rec);
5107 // See if this Known-Answer is a surprise to us. If so, we shouldn't suppress our own query.
5183 if (query->h.flags.b[0] & kDNSFlag0_TC) delayresponse = mDNSPlatformOneSecond * 20; // Divided by 50 = 400ms
5229 // *** 8. If query is from a legacy client, or from a new client requesting a unicast reply, then generate a unicast response too
5232 responseptr = GenerateUnicastResponse(query, end, InterfaceID, LegacyQuery, response, ResponseRecords);
5258 if (!(query->h.flags.b[0] & kDNSFlag0_TC))
5279 // Make a guess, based on the multi-packet query / known answer counts, whether we think we
5300 rr->UnansweredQueries++; // Treat this as equivalent to one definite unanswered query
5775 // then we do a multicast query on that interface, even for unicast domains.
5815 LogMsg("Attempt to start query with invalid qname %##s (%s)", question->qname.c, DNSTypeName(question->qtype));
5820 // wanted, and they may immediately cancel their question. In this case, sending an actual query on the wire would
5821 // be a waste. For that reason, we schedule our first query to go out in half a second. If AnswerNewQuestion() finds
5884 if (question->ThisQInterval >= 0) // Only log error message if the query was supposed to be active
6020 ServiceInfoQuery *query = (ServiceInfoQuery *)question->QuestionContext;
6021 mDNSBool PortChanged = (mDNSBool)(query->info->port.NotAnInteger != answer->rdata->u.srv.port.NotAnInteger);
6025 query->info->port = answer->rdata->u.srv.port;
6027 // If this is our first answer, then set the GotSRV flag and start the address query
6028 if (!query->GotSRV)
6030 query->GotSRV = mDNStrue;
6031 query->qAv4.InterfaceID = answer->InterfaceID;
6032 AssignDomainName(&query->qAv4.qname, &answer->rdata->u.srv.target);
6033 query->qAv6.InterfaceID = answer->InterfaceID;
6034 AssignDomainName(&query->qAv6.qname, &answer->rdata->u.srv.target);
6035 mDNS_StartQuery(m, &query->qAv4);
6036 // Only do the AAAA query if this machine actually has IPv6 active
6037 if (MachineHasActiveIPv6(m)) mDNS_StartQuery(m, &query->qAv6);
6039 // If this is not our first answer, only re-issue the address query if the target host name has changed
6040 else if ((query->qAv4.InterfaceID != query->qSRV.InterfaceID && query->qAv4.InterfaceID != answer->InterfaceID) ||
6041 !SameDomainName(&query->qAv4.qname, &answer->rdata->u.srv.target))
6043 mDNS_StopQuery(m, &query->qAv4);
6044 if (query->qAv6.ThisQInterval >= 0) mDNS_StopQuery(m, &query->qAv6);
6045 if (SameDomainName(&query->qAv4.qname, &answer->rdata->u.srv.target) && !PortChanged)
6051 // make our address queries at least as broad as the original SRV query so that we catch all the answers.
6052 query->qAv4.InterfaceID = query->qSRV.InterfaceID; // Will be mDNSInterface_Any, or a specific interface
6053 query->qAv6.InterfaceID = query->qSRV.InterfaceID;
6057 query->qAv4.InterfaceID = answer->InterfaceID;
6058 AssignDomainName(&query->qAv4.qname, &answer->rdata->u.srv.target);
6059 query->qAv6.InterfaceID = answer->InterfaceID;
6060 AssignDomainName(&query->qAv6.qname, &answer->rdata->u.srv.target);
6062 debugf("FoundServiceInfoSRV: Restarting address queries for %##s", query->qAv4.qname.c);
6063 mDNS_StartQuery(m, &query->qAv4);
6064 // Only do the AAAA query if this machine actually has IPv6 active
6065 if (MachineHasActiveIPv6(m)) mDNS_StartQuery(m, &query->qAv6);
6067 else if (query->ServiceInfoQueryCallback && query->GotADD && query->GotTXT && PortChanged)
6069 if (++query->Answers >= 100)
6071 query->Answers, query->qSRV.qname.c, answer->rdata->u.srv.target.c,
6073 query->ServiceInfoQueryCallback(m, query);
6075 // CAUTION: MUST NOT do anything more with query after calling query->Callback(), because the client's
6076 // callback function is allowed to do anything, including deleting this query and freeing its memory.
6081 ServiceInfoQuery *query = (ServiceInfoQuery *)question->QuestionContext;
6084 if (answer->rdlength > sizeof(query->info->TXTinfo)) return;
6086 query->GotTXT = mDNStrue;
6087 query->info->TXTlen = answer->rdlength;
6088 query->info->TXTinfo[0] = 0; // In case answer->rdlength is zero
6089 mDNSPlatformMemCopy(answer->rdata->u.txt.c, query->info->TXTinfo, answer->rdlength);
6091 verbosedebugf("FoundServiceInfoTXT: %##s GotADD=%d", query->info->name.c, query->GotADD);
6093 // CAUTION: MUST NOT do anything more with query after calling query->Callback(), because the client's
6094 // callback function is allowed to do anything, including deleting this query and freeing its memory.
6095 if (query->ServiceInfoQueryCallback && query->GotADD)
6097 if (++query->Answers >= 100)
6099 query->Answers, query->qSRV.qname.c, answer->rdata->u.txt.c);
6100 query->ServiceInfoQueryCallback(m, query);
6106 ServiceInfoQuery *query = (ServiceInfoQuery *)question->QuestionContext;
6112 query->info->ip.type = mDNSAddrType_IPv4;
6113 query->info->ip.ip.v4 = answer->rdata->u.ipv4;
6117 query->info->ip.type = mDNSAddrType_IPv6;
6118 query->info->ip.ip.v6 = answer->rdata->u.ipv6;
6126 query->GotADD = mDNStrue;
6127 query->info->InterfaceID = answer->InterfaceID;
6129 verbosedebugf("FoundServiceInfo v%ld: %##s GotTXT=%d", query->info->ip.type, query->info->name.c, query->GotTXT);
6131 // CAUTION: MUST NOT do anything more with query after calling query->Callback(), because the client's
6132 // callback function is allowed to do anything, including deleting this query and freeing its memory.
6133 if (query->ServiceInfoQueryCallback && query->GotTXT)
6135 if (++query->Answers >= 100)
6139 query->Answers, query->qSRV.qname.c, &answer->rdata->u.data);
6140 query->ServiceInfoQueryCallback(m, query);
6145 // If the query is not interface-specific, then InterfaceID may be zero
6149 ServiceInfoQuery *query, ServiceInfo *info, mDNSServiceInfoQueryCallback *Callback, void *Context)
6154 query->qSRV.ThisQInterval = -1; // So that mDNS_StopResolveService() knows whether to cancel this question
6155 query->qSRV.InterfaceID = info->InterfaceID;
6156 query->qSRV.Target = zeroAddr;
6157 AssignDomainName(&query->qSRV.qname, &info->name);
6158 query->qSRV.qtype = kDNSType_SRV;
6159 query->qSRV.qclass = kDNSClass_IN;
6160 query->qSRV.LongLived = mDNSfalse;
6161 query->qSRV.ExpectUnique = mDNStrue;
6162 query->qSRV.ForceMCast = mDNSfalse;
6163 query->qSRV.QuestionCallback = FoundServiceInfoSRV;
6164 query->qSRV.QuestionContext = query;
6166 query->qTXT.ThisQInterval = -1; // So that mDNS_StopResolveService() knows whether to cancel this question
6167 query->qTXT.InterfaceID = info->InterfaceID;
6168 query->qTXT.Target = zeroAddr;
6169 AssignDomainName(&query->qTXT.qname, &info->name);
6170 query->qTXT.qtype = kDNSType_TXT;
6171 query->qTXT.qclass = kDNSClass_IN;
6172 query->qTXT.LongLived = mDNSfalse;
6173 query->qTXT.ExpectUnique = mDNStrue;
6174 query->qTXT.ForceMCast = mDNSfalse;
6175 query->qTXT.QuestionCallback = FoundServiceInfoTXT;
6176 query->qTXT.QuestionContext = query;
6178 query->qAv4.ThisQInterval = -1; // So that mDNS_StopResolveService() knows whether to cancel this question
6179 query->qAv4.InterfaceID = info->InterfaceID;
6180 query->qAv4.Target = zeroAddr;
6181 query->qAv4.qname.c[0] = 0;
6182 query->qAv4.qtype = kDNSType_A;
6183 query->qAv4.qclass = kDNSClass_IN;
6184 query->qAv4.LongLived = mDNSfalse;
6185 query->qAv4.ExpectUnique = mDNStrue;
6186 query->qAv4.ForceMCast = mDNSfalse;
6187 query->qAv4.QuestionCallback = FoundServiceInfo;
6188 query->qAv4.QuestionContext = query;
6190 query->qAv6.ThisQInterval = -1; // So that mDNS_StopResolveService() knows whether to cancel this question
6191 query->qAv6.InterfaceID = info->InterfaceID;
6192 query->qAv6.Target = zeroAddr;
6193 query->qAv6.qname.c[0] = 0;
6194 query->qAv6.qtype = kDNSType_AAAA;
6195 query->qAv6.qclass = kDNSClass_IN;
6196 query->qAv6.LongLived = mDNSfalse;
6197 query->qAv6.ExpectUnique = mDNStrue;
6198 query->qAv6.ForceMCast = mDNSfalse;
6199 query->qAv6.QuestionCallback = FoundServiceInfo;
6200 query->qAv6.QuestionContext = query;
6202 query->GotSRV = mDNSfalse;
6203 query->GotTXT = mDNSfalse;
6204 query->GotADD = mDNSfalse;
6205 query->Answers = 0;
6207 query->info = info;
6208 query->ServiceInfoQueryCallback = Callback;
6209 query->ServiceInfoQueryContext = Context;
6218 status = mDNS_StartQuery_internal(m, &query->qSRV);
6219 if (status == mStatus_NoError) status = mDNS_StartQuery_internal(m, &query->qTXT);
6220 if (status != mStatus_NoError) mDNS_StopResolveService(m, query);