Lines Matching refs:pkt
323 * @param pkt: the wire packet to examine for sanity.
328 worker_check_request(sldns_buffer* pkt, struct worker* worker)
330 if(sldns_buffer_limit(pkt) < LDNS_HEADER_SIZE) {
334 if(sldns_buffer_limit(pkt) > NORMAL_UDP_SIZE &&
339 if(LDNS_QR_WIRE(sldns_buffer_begin(pkt))) {
343 if(LDNS_TC_WIRE(sldns_buffer_begin(pkt))) {
344 LDNS_TC_CLR(sldns_buffer_begin(pkt));
348 if(LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)) != LDNS_PACKET_QUERY &&
349 LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)) != LDNS_PACKET_NOTIFY) {
351 LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)));
354 if(LDNS_QDCOUNT(sldns_buffer_begin(pkt)) != 1) {
356 LDNS_QDCOUNT(sldns_buffer_begin(pkt)));
359 if(LDNS_ANCOUNT(sldns_buffer_begin(pkt)) != 0 &&
360 (LDNS_ANCOUNT(sldns_buffer_begin(pkt)) != 1 ||
361 LDNS_OPCODE_WIRE(sldns_buffer_begin(pkt)) != LDNS_PACKET_NOTIFY)) {
363 LDNS_ANCOUNT(sldns_buffer_begin(pkt)));
366 if(LDNS_NSCOUNT(sldns_buffer_begin(pkt)) != 0) {
368 LDNS_NSCOUNT(sldns_buffer_begin(pkt)));
371 if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 1) {
373 LDNS_ARCOUNT(sldns_buffer_begin(pkt)));
808 * @param pkt: buffer
817 chaos_replystr(sldns_buffer* pkt, char** str, int num, struct edns_data* edns,
821 unsigned int rd = LDNS_RD_WIRE(sldns_buffer_begin(pkt));
822 unsigned int cd = LDNS_CD_WIRE(sldns_buffer_begin(pkt));
823 sldns_buffer_clear(pkt);
824 sldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip id */
825 sldns_buffer_write_u16(pkt, (uint16_t)(BIT_QR|BIT_RA));
826 if(rd) LDNS_RD_SET(sldns_buffer_begin(pkt));
827 if(cd) LDNS_CD_SET(sldns_buffer_begin(pkt));
828 sldns_buffer_write_u16(pkt, 1); /* qdcount */
829 sldns_buffer_write_u16(pkt, (uint16_t)num); /* ancount */
830 sldns_buffer_write_u16(pkt, 0); /* nscount */
831 sldns_buffer_write_u16(pkt, 0); /* arcount */
832 (void)query_dname_len(pkt); /* skip qname */
833 sldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip qtype */
834 sldns_buffer_skip(pkt, (ssize_t)sizeof(uint16_t)); /* skip qclass */
838 sldns_buffer_write_u16(pkt, 0xc00c); /* compr ptr to query */
839 sldns_buffer_write_u16(pkt, LDNS_RR_TYPE_TXT);
840 sldns_buffer_write_u16(pkt, LDNS_RR_CLASS_CH);
841 sldns_buffer_write_u32(pkt, 0); /* TTL */
842 sldns_buffer_write_u16(pkt, sizeof(uint8_t) + len);
843 sldns_buffer_write_u8(pkt, len);
844 sldns_buffer_write(pkt, str[i], len);
846 sldns_buffer_flip(pkt);
854 if(sldns_buffer_capacity(pkt) >=
855 sldns_buffer_limit(pkt)+calc_edns_field_size(edns))
856 attach_edns_record(pkt, edns);
861 chaos_replyonestr(sldns_buffer* pkt, const char* str, struct edns_data* edns,
864 chaos_replystr(pkt, (char**)&str, 1, edns, worker, repinfo);
869 * @param pkt: buffer
875 chaos_trustanchor(sldns_buffer* pkt, struct edns_data* edns, struct worker* w,
887 chaos_replystr(pkt, NULL, 0, edns, w, repinfo);
921 chaos_replystr(pkt, str_array, num, edns, w, repinfo);
931 * @param pkt: packet buffer.
936 struct edns_data* edns, struct comm_reply* repinfo, sldns_buffer* pkt)
952 chaos_replyonestr(pkt, buf, edns, w, repinfo);
955 chaos_replyonestr(pkt, "no hostname", edns, w, repinfo);
958 else chaos_replyonestr(pkt, cfg->identity, edns, w, repinfo);
969 chaos_replyonestr(pkt, PACKAGE_STRING, edns, w, repinfo);
970 else chaos_replyonestr(pkt, cfg->version, edns, w, repinfo);
978 chaos_trustanchor(pkt, edns, w, repinfo);
993 * @param pkt: packet buffer.
997 struct edns_data* edns, sldns_buffer* pkt, struct comm_reply* repinfo)
1004 has_serial = auth_zone_parse_notify_serial(pkt, &serial);
1039 error_encode(pkt, rcode, qinfo,
1040 *(uint16_t*)(void *)sldns_buffer_begin(pkt),
1041 sldns_buffer_read_u16_at(pkt, 2), edns);
1042 LDNS_OPCODE_SET(sldns_buffer_begin(pkt), LDNS_PACKET_NOTIFY);