-mDNSlocal const mDNSu8 *mDNS_WABLabels[] =
- {
- (const mDNSu8 *)"\001b",
- (const mDNSu8 *)"\002db",
- (const mDNSu8 *)"\002lb",
- (const mDNSu8 *)"\001r",
- (const mDNSu8 *)"\002dr",
- (const mDNSu8 *)mDNSNULL,
- };
-
-// Returns true if it is a WAB question
-mDNSlocal mDNSBool WABQuestion(const domainname *qname)
- {
- const mDNSu8 *sd = (const mDNSu8 *)"\007_dns-sd";
- const mDNSu8 *prot = (const mDNSu8 *)"\004_udp";
- const domainname *d = qname;
- const mDNSu8 *label;
- int i = 0;
-
- // We need at least 3 labels (WAB prefix) + one more label to make
- // a meaningful WAB query
- if (CountLabels(qname) < 4) { debugf("WABQuestion: question %##s, not enough labels", qname->c); return mDNSfalse; }
-
- label = (const mDNSu8 *)d;
- while (mDNS_WABLabels[i] != (const mDNSu8 *)mDNSNULL)
- {
- if (SameDomainLabel(mDNS_WABLabels[i], label)) {debugf("WABquestion: WAB question %##s, label1 match", qname->c); break;}
- i++;
- }
- if (mDNS_WABLabels[i] == (const mDNSu8 *)mDNSNULL)
- {
- debugf("WABquestion: Not a WAB question %##s, label1 mismatch", qname->c);
- return mDNSfalse;
- }
- // CountLabels already verified the number of labels
- d = (const domainname *)(d->c + 1 + d->c[0]); // Second Label
- label = (const mDNSu8 *)d;
- if (!SameDomainLabel(label, sd)){ debugf("WABquestion: Not a WAB question %##s, label2 mismatch", qname->c);return(mDNSfalse); }
- debugf("WABquestion: WAB question %##s, label2 match", qname->c);
-
- d = (const domainname *)(d->c + 1 + d->c[0]); // Third Label
- label = (const mDNSu8 *)d;
- if (!SameDomainLabel(label, prot)){ debugf("WABquestion: Not a WAB question %##s, label3 mismatch", qname->c);return(mDNSfalse); }
- debugf("WABquestion: WAB question %##s, label3 match", qname->c);
-
- LogInfo("WABquestion: Question %##s is a WAB question", qname->c);
-
- return mDNStrue;
- }
-