Lines Matching refs:cp
57 ns_nskip(register const u_char *cp)
61 if (!TTEST2(*cp, 1))
63 i = *cp++;
66 return (cp + 1);
72 if (!TTEST2(*cp, 1))
74 if ((bitlen = *cp++) == 0)
77 cp += bytelen;
79 cp += i;
80 if (!TTEST2(*cp, 1))
82 i = *cp++;
84 return (cp);
89 blabel_print(const u_char *cp)
95 if (!TTEST2(*cp, 1))
97 if ((bitlen = *cp) == 0)
100 lim = cp + 1 + slen;
104 for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++) {
125 labellen(const u_char *cp)
129 if (!TTEST2(*cp, 1))
131 i = *cp;
138 if (!TTEST2(*(cp + 1), 1))
140 if ((bitlen = *(cp + 1)) == 0)
148 ns_nprint(register const u_char *cp, register const u_char *bp)
157 if ((l = labellen(cp)) == (u_int)-1)
159 if (!TTEST2(*cp, 1))
162 if (((i = *cp++) & INDIR_MASK) != INDIR_MASK) {
164 rp = cp + l;
168 while (i && cp < snapend) {
171 rp = cp + 1;
174 if (!TTEST2(*cp, 1))
176 cp = bp + (((i << 8) | *cp) & 0x3fff);
177 if ((l = labellen(cp)) == (u_int)-1)
179 if (!TTEST2(*cp, 1))
181 i = *cp++;
200 if (blabel_print(cp) == NULL)
209 if (fn_printn(cp, l, snapend))
213 cp += l;
216 if ((l = labellen(cp)) == (u_int)-1)
218 if (!TTEST2(*cp, 1))
220 i = *cp++;
232 ns_cprint(register const u_char *cp)
236 if (!TTEST2(*cp, 1))
238 i = *cp++;
239 if (fn_printn(cp, i, snapend))
241 return (cp + i);
320 ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns)
322 register const u_char *np = cp;
325 cp = ns_nskip(cp);
327 if (cp == NULL || !TTEST2(*cp, 4))
331 i = EXTRACT_16BITS(cp);
332 cp += 2;
335 i = EXTRACT_16BITS(cp);
336 cp += 2;
351 cp = ns_nprint(np, bp);
352 return(cp ? cp + 4 : NULL);
357 ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
365 if ((cp = ns_nprint(cp, bp)) == NULL)
368 cp = ns_nskip(cp);
370 if (cp == NULL || !TTEST2(*cp, 10))
374 typ = EXTRACT_16BITS(cp);
375 cp += 2;
377 i = EXTRACT_16BITS(cp);
378 cp += 2;
391 cp += 2;
394 opt_flags = EXTRACT_16BITS(cp);
396 cp += 2;
398 len = EXTRACT_16BITS(cp);
399 cp += 2;
401 rp = cp + len;
409 if (!TTEST2(*cp, sizeof(struct in_addr)))
411 printf(" %s", ipaddr_string(cp));
421 if (ns_nprint(cp, bp) == NULL)
429 if ((cp = ns_nprint(cp, bp)) == NULL)
432 if ((cp = ns_nprint(cp, bp)) == NULL)
434 if (!TTEST2(*cp, 5 * 4))
436 printf(" %u", EXTRACT_32BITS(cp));
437 cp += 4;
438 printf(" %u", EXTRACT_32BITS(cp));
439 cp += 4;
440 printf(" %u", EXTRACT_32BITS(cp));
441 cp += 4;
442 printf(" %u", EXTRACT_32BITS(cp));
443 cp += 4;
444 printf(" %u", EXTRACT_32BITS(cp));
445 cp += 4;
449 if (!TTEST2(*cp, 2))
451 if (ns_nprint(cp + 2, bp) == NULL)
453 printf(" %d", EXTRACT_16BITS(cp));
457 while (cp < rp) {
459 cp = ns_cprint(cp);
460 if (cp == NULL)
468 if (!TTEST2(*cp, 6))
470 if (ns_nprint(cp + 6, bp) == NULL)
472 printf(":%d %d %d", EXTRACT_16BITS(cp + 4),
473 EXTRACT_16BITS(cp), EXTRACT_16BITS(cp + 2));
478 if (!TTEST2(*cp, sizeof(struct in6_addr)))
480 printf(" %s", ip6addr_string(cp));
488 if (!TTEST2(*cp, 1))
490 pbit = *cp;
496 if (!TTEST2(*(cp + 1), sizeof(a) - pbyte))
499 memcpy(&a.s6_addr[pbyte], cp + 1, sizeof(a) - pbyte);
504 if (ns_nprint(cp + 1 + sizeof(a) - pbyte, bp) == NULL)
518 if (!TTEST2(*cp, len))
520 if (fn_printn(cp, len, snapend))
526 if (cp + len > snapend)
531 if ((cp = ns_nprint(cp, bp)) == NULL)
533 cp += 6;
534 if (!TTEST2(*cp, 2))
536 printf(" fudge=%u", EXTRACT_16BITS(cp));
537 cp += 2;
538 if (!TTEST2(*cp, 2))
540 printf(" maclen=%u", EXTRACT_16BITS(cp));
541 cp += 2 + EXTRACT_16BITS(cp);
542 if (!TTEST2(*cp, 2))
544 printf(" origid=%u", EXTRACT_16BITS(cp));
545 cp += 2;
546 if (!TTEST2(*cp, 2))
548 printf(" error=%u", EXTRACT_16BITS(cp));
549 cp += 2;
550 if (!TTEST2(*cp, 2))
552 printf(" otherlen=%u", EXTRACT_16BITS(cp));
553 cp += 2;
564 register const u_char *cp;
589 cp = (const u_char *)(np + 1);
595 if ((cp = ns_qprint(cp, bp, is_mdns)) == NULL)
598 if ((cp = ns_nskip(cp)) == NULL)
600 cp += 4; /* skip QTYPE and QCLASS */
605 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
607 while (cp < snapend && ancount--) {
609 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
617 if (cp < snapend && nscount--) {
619 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
621 while (cp < snapend && nscount--) {
623 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
629 if (cp < snapend && arcount--) {
631 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
633 while (cp < snapend && arcount--) {
635 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
671 cp = (const u_char *)(np + 1);
673 cp = ns_qprint(cp, (const u_char *)np, is_mdns);
674 if (!cp)
676 while (cp < snapend && qdcount--) {
677 cp = ns_qprint((const u_char *)cp,
680 if (!cp)
690 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
692 while (cp < snapend && ancount--) {
694 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
700 if (cp < snapend && nscount--) {
702 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
704 while (nscount-- && cp < snapend) {
706 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
712 if (cp < snapend && arcount--) {
714 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
716 while (cp < snapend && arcount--) {
718 if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)