Lines Matching +defs:label +defs:offset
638 { debugf("Malformed label (too long)"); return(mDNSfalse); }
718 // Returns length of a domain name INCLUDING the byte for the final null label
719 // e.g. for the root label "." it returns one
721 // Legal results are 1 (just root label) to 256 (MAX_DOMAIN_NAME)
735 // for the final null label, e.g. for the root label "." it returns one.
757 // CountLabels() returns number of labels in name, excluding final root label
775 // AppendLiteralLabelString appends a single label to an existing (possibly empty) domainname.
776 // The C string contains the label as-is, with no escaping, etc.
777 // Any dots in the name are literal dots, not label separators
780 // If unable to construct a legal domain name (i.e. label more than 63 bytes, or total more than 256 bytes)
792 *ptr++ = 0; // Put the null root label on the end
802 // If unable to construct a legal domain name (i.e. label more than 63 bytes, or total more than 256 bytes)
812 if (*cstr == '.') { LogMsg("AppendDNSNameString: Illegal empty label in name \"%s\"", cstring); return(mDNSNULL); }
813 while (*cstr && *cstr != '.' && ptr < lim) // While we have characters in the label...
832 if (ptr - lengthbyte - 1 > MAX_DOMAIN_LABEL) // If illegal label, abort
837 *ptr++ = 0; // Put the null root label on the end
842 // AppendDomainLabel appends a single label to a name.
845 // If unable to construct a legal domain name (i.e. label more than 63 bytes, or total more than 256 bytes)
847 mDNSexport mDNSu8 *AppendDomainLabel(domainname *const name, const domainlabel *const label)
852 // Check label is legal
853 if (label->c[0] > MAX_DOMAIN_LABEL) return(mDNSNULL);
856 if (ptr + 1 + label->c[0] + 1 > name->c + MAX_DOMAIN_NAME) return(mDNSNULL);
858 for (i=0; i<=label->c[0]; i++) *ptr++ = label->c[i]; // Copy the label data
859 *ptr++ = 0; // Put the null root label on the end
873 *ptr = 0; // Put the null root label on the end
879 // MakeDomainLabelFromLiteralString makes a single domain label from a single literal C string (with no escaping).
881 // If unable to convert the whole string to a legal domain label (i.e. because length is more than 63 bytes) then
882 // MakeDomainLabelFromLiteralString makes a legal domain label from the first 63 bytes of the string and returns mDNSfalse.
885 mDNSexport mDNSBool MakeDomainLabelFromLiteralString(domainlabel *const label, const char *cstr)
887 mDNSu8 * ptr = label->c + 1; // Where we're putting it
888 const mDNSu8 *const limit = label->c + 1 + MAX_DOMAIN_LABEL; // The maximum we can put
889 while (*cstr && ptr < limit) *ptr++ = (mDNSu8)*cstr++; // Copy the label
890 label->c[0] = (mDNSu8)(ptr - label->c - 1); // Set the length byte
899 // If unable to construct a legal domain name (i.e. label more than 63 bytes, or total more than 256 bytes)
907 mDNSexport char *ConvertDomainLabelToCString_withescape(const domainlabel *const label, char *ptr, char esc)
909 const mDNSu8 * src = label->c; // Domain label we're reading
910 const mDNSu8 len = *src++; // Read length of this (non-null) label
911 const mDNSu8 *const end = src + len; // Work out where the label ends
912 if (len > MAX_DOMAIN_LABEL) return(mDNSNULL); // If illegal label, abort
913 while (src < end) // While we have characters in the label
948 *ptr++ = '.'; // Write the dot after the label
996 // a single-label subtype is allowed as the first label of a three-part "type"
1000 if (s0[0] && s0[0] < 0x40) // If legal first label (at least one character, and no more than 63)
1003 if (s1[0] && s1[0] < 0x40) // and legal second label (at least one character, and no more than 63)
1009 src = s0; // Copy the first label
1108 if (!len) { debugf("DeconstructServiceName: FQDN contains only one label!"); return(mDNSfalse); }
1130 *dst++ = 0; // Put the null root label on the end
1253 // Returns true if a rich text label ends in " (nnn)", or if an RFC 1034
1278 // removes an auto-generated suffix (appended on a name collision) from a label. caller is
1279 // responsible for ensuring that the label does indeed contain a suffix. returns the number
1305 // appends a numerical suffix to a label, with the number following a whitespace and enclosed
1306 // in parentheses (rich text) or following two consecutive hyphens (RFC 1034 domain label).
1655 // Calculate the right byte offset first.
2103 if (*domname == 0) return(mDNSNULL); // There's no point trying to match just the root label
2108 // If the length byte and first character of the label match, then check further to see
2116 // First see if this label matches
2120 if (i <= *name) break; // If label did not match, bail out
2122 name += 1 + *name; // and proceed to check next label
2126 // The label matched, so now follow the pointer (if appropriate) and then see if the next label matches
2127 if (targ[0] < 0x40) continue; // If length value, continue to check next label
2158 if (!*np) // If just writing one-byte root label, make sure we have space for that
2162 else // else, loop through writing labels and/or a compression offset
2166 { LogMsg("Malformed domain name %##s (label more than 63 bytes)", name->c); return(mDNSNULL); }
2168 // This check correctly allows for the final trailing root label:
2170 // Suppose our domain name is exactly 256 bytes long, including the final trailing root label.
2171 // Suppose np is now at name->c[249], and we're about to write our last non-null label ("local").
2174 // six bytes, then exit the loop, write the final terminating root label, and the domain
2183 const mDNSu16 offset = (mDNSu16)(pointer - base);
2185 *ptr++ = (mDNSu8)(0xC0 | (offset >> 8));
2186 *ptr++ = (mDNSu8)( offset & 0xFF);
2189 else // Else copy one label and try again
2193 // If we don't at least have enough space for this label *plus* a terminating zero on the end, give up
2201 *ptr++ = 0; // Put the final root label
2718 const mDNSu8 len = *ptr++; // Read length of this label
2722 case 0x00: if (ptr + len >= end) // Remember: expect at least one more byte for the root label
2724 if (total + 1 + len >= MAX_DOMAIN_NAME) // Remember: expect at least one more byte for the root label
2730 case 0x40: debugf("skipDomainName: Extended EDNS0 label types 0x%X not supported", len); return(mDNSNULL);
2731 case 0x80: debugf("skipDomainName: Illegal label length 0x%X", len); return(mDNSNULL);
2748 *np = 0; // Tentatively place the root label here (may be overwritten if we have more labels)
2753 mDNSu16 offset;
2754 const mDNSu8 len = *ptr++; // Read length of this label
2759 case 0x00: if (ptr + len >= end) // Remember: expect at least one more byte for the root label
2761 if (np + 1 + len >= limit) // Remember: expect at least one more byte for the root label
2765 *np = 0; // Tentatively place the root label here (may be overwritten if we have more labels)
2768 case 0x40: debugf("getDomainName: Extended EDNS0 label types 0x%X not supported in name %##s", len, name->c);
2771 case 0x80: debugf("getDomainName: Illegal label length 0x%X in domain name %##s", len, name->c); return(mDNSNULL);
2773 case 0xC0: offset = (mDNSu16)((((mDNSu16)(len & 0x3F)) << 8) | *ptr++);
2775 ptr = (mDNSu8 *)msg + offset;
2779 { debugf("getDomainName: Compression pointer must point to real label"); return(mDNSNULL); }
3582 ptr[0] == 0 && // Name must be root label
3632 mDNSlocal const mDNSu8 *DumpRecords(mDNS *const m, const DNSMessage *const msg, const mDNSu8 *ptr, const mDNSu8 *const end, int count, char *label)
3635 LogInfo("%2d %s", count, label);
4266 case 2: { // DNS label-sequence name
4278 // so it's clear what's a literal dot and what's a label separator