Lines Matching refs:packet

457 _dnsPacket_init( DnsPacket*  packet, const uint8_t*  buff, int  bufflen )  in _dnsPacket_init()  argument
459 packet->base = buff; in _dnsPacket_init()
460 packet->end = buff + bufflen; in _dnsPacket_init()
461 packet->cursor = buff; in _dnsPacket_init()
465 _dnsPacket_rewind( DnsPacket* packet ) in _dnsPacket_rewind() argument
467 packet->cursor = packet->base; in _dnsPacket_rewind()
471 _dnsPacket_skip( DnsPacket* packet, int count ) in _dnsPacket_skip() argument
473 const uint8_t* p = packet->cursor + count; in _dnsPacket_skip()
475 if (p > packet->end) in _dnsPacket_skip()
476 p = packet->end; in _dnsPacket_skip()
478 packet->cursor = p; in _dnsPacket_skip()
482 _dnsPacket_readInt16( DnsPacket* packet ) in _dnsPacket_readInt16() argument
484 const uint8_t* p = packet->cursor; in _dnsPacket_readInt16()
486 if (p+2 > packet->end) in _dnsPacket_readInt16()
489 packet->cursor = p+2; in _dnsPacket_readInt16()
500 _dnsPacket_checkBytes( DnsPacket* packet, int numBytes, const void* bytes ) in _dnsPacket_checkBytes() argument
502 const uint8_t* p = packet->cursor; in _dnsPacket_checkBytes()
504 if (p + numBytes > packet->end) in _dnsPacket_checkBytes()
510 packet->cursor = p + numBytes; in _dnsPacket_checkBytes()
519 _dnsPacket_checkQName( DnsPacket* packet ) in _dnsPacket_checkQName() argument
521 const uint8_t* p = packet->cursor; in _dnsPacket_checkQName()
522 const uint8_t* end = packet->end; in _dnsPacket_checkQName()
533 packet->cursor = p; in _dnsPacket_checkQName()
554 _dnsPacket_checkQR( DnsPacket* packet ) in _dnsPacket_checkQR() argument
556 if (!_dnsPacket_checkQName(packet)) in _dnsPacket_checkQR()
560 if (!_dnsPacket_checkBytes(packet, 2, DNS_TYPE_A) && in _dnsPacket_checkQR()
561 !_dnsPacket_checkBytes(packet, 2, DNS_TYPE_PTR) && in _dnsPacket_checkQR()
562 !_dnsPacket_checkBytes(packet, 2, DNS_TYPE_MX) && in _dnsPacket_checkQR()
563 !_dnsPacket_checkBytes(packet, 2, DNS_TYPE_AAAA) && in _dnsPacket_checkQR()
564 !_dnsPacket_checkBytes(packet, 2, DNS_TYPE_ALL)) in _dnsPacket_checkQR()
570 if (!_dnsPacket_checkBytes(packet, 2, DNS_CLASS_IN)) { in _dnsPacket_checkQR()
582 _dnsPacket_checkQuery( DnsPacket* packet ) in _dnsPacket_checkQuery() argument
584 const uint8_t* p = packet->base; in _dnsPacket_checkQuery()
587 if (p + DNS_HEADER_SIZE > packet->end) { in _dnsPacket_checkQuery()
634 packet->cursor = p + DNS_HEADER_SIZE; in _dnsPacket_checkQuery()
637 if (!_dnsPacket_checkQR(packet)) in _dnsPacket_checkQuery()
647 _dnsPacket_bprintQName(DnsPacket* packet, char* bp, char* bend) in _dnsPacket_bprintQName() argument
649 const uint8_t* p = packet->cursor; in _dnsPacket_bprintQName()
650 const uint8_t* end = packet->end; in _dnsPacket_bprintQName()
662 packet->cursor = p; in _dnsPacket_bprintQName()
687 _dnsPacket_bprintQR(DnsPacket* packet, char* p, char* end) in _dnsPacket_bprintQR() argument
702 p = _dnsPacket_bprintQName(packet, p, end); in _dnsPacket_bprintQR()
708 if (_dnsPacket_checkBytes(packet, 2, qTypes[nn].typeBytes)) { in _dnsPacket_bprintQR()
717 int typeCode = _dnsPacket_readInt16(packet); in _dnsPacket_bprintQR()
724 _dnsPacket_skip(packet, 2); in _dnsPacket_bprintQR()
730 _dnsPacket_bprintQuery( DnsPacket* packet, char* p, char* end ) in _dnsPacket_bprintQuery() argument
734 if (packet->base[2] & 0x1) { in _dnsPacket_bprintQuery()
738 _dnsPacket_skip(packet, 4); in _dnsPacket_bprintQuery()
739 qdCount = _dnsPacket_readInt16(packet); in _dnsPacket_bprintQuery()
740 _dnsPacket_skip(packet, 6); in _dnsPacket_bprintQuery()
743 p = _dnsPacket_bprintQR(packet, p, end); in _dnsPacket_bprintQuery()
761 _dnsPacket_hashBytes( DnsPacket* packet, int numBytes, unsigned hash ) in _dnsPacket_hashBytes() argument
763 const uint8_t* p = packet->cursor; in _dnsPacket_hashBytes()
764 const uint8_t* end = packet->end; in _dnsPacket_hashBytes()
769 packet->cursor = p; in _dnsPacket_hashBytes()
775 _dnsPacket_hashQName( DnsPacket* packet, unsigned hash ) in _dnsPacket_hashQName() argument
777 const uint8_t* p = packet->cursor; in _dnsPacket_hashQName()
778 const uint8_t* end = packet->end; in _dnsPacket_hashQName()
807 packet->cursor = p; in _dnsPacket_hashQName()
812 _dnsPacket_hashQR( DnsPacket* packet, unsigned hash ) in _dnsPacket_hashQR() argument
814 hash = _dnsPacket_hashQName(packet, hash); in _dnsPacket_hashQR()
815 hash = _dnsPacket_hashBytes(packet, 4, hash); /* TYPE and CLASS */ in _dnsPacket_hashQR()
820 _dnsPacket_hashRR( DnsPacket* packet, unsigned hash ) in _dnsPacket_hashRR() argument
823 hash = _dnsPacket_hashQR(packet, hash); in _dnsPacket_hashRR()
824 hash = _dnsPacket_hashBytes(packet, 4, hash); /* TTL */ in _dnsPacket_hashRR()
825 rdlength = _dnsPacket_readInt16(packet); in _dnsPacket_hashRR()
826 hash = _dnsPacket_hashBytes(packet, rdlength, hash); /* RDATA */ in _dnsPacket_hashRR()
831 _dnsPacket_hashQuery( DnsPacket* packet ) in _dnsPacket_hashQuery() argument
835 _dnsPacket_rewind(packet); in _dnsPacket_hashQuery()
838 _dnsPacket_skip(packet, 2); in _dnsPacket_hashQuery()
847 hash = hash*FNV_MULT ^ (packet->base[2] & 1); in _dnsPacket_hashQuery()
850 _dnsPacket_skip(packet, 1); in _dnsPacket_hashQuery()
853 hash = _dnsPacket_hashBytes(packet, 1, hash); in _dnsPacket_hashQuery()
856 count = _dnsPacket_readInt16(packet); in _dnsPacket_hashQuery()
859 _dnsPacket_skip(packet, 4); in _dnsPacket_hashQuery()
862 arcount = _dnsPacket_readInt16(packet); in _dnsPacket_hashQuery()
866 hash = _dnsPacket_hashQR(packet, hash); in _dnsPacket_hashQuery()
870 hash = _dnsPacket_hashRR(packet, hash); in _dnsPacket_hashQuery()