Lines Matching full:header

17 /* See RFC 1035, 4.1.1 Header section format
18 * DNS Message Header is always 12 bytes
44 /* RFC 1035 '4.1.1. Header section format' defines the following flags:
50 /* These two defines represent the 3rd and 4th bytes of the DNS msg header.
51 * See RFC 1035, 4.1.1. Header section format.
183 /** It returns the ID field in the DNS msg header */
184 static inline int dns_header_id(uint8_t *header) in dns_header_id() argument
186 return htons(UNALIGNED_GET((uint16_t *)(header))); in dns_header_id()
193 static inline int dns_unpack_header_id(uint8_t *header) in dns_unpack_header_id() argument
195 return ntohs(UNALIGNED_GET((uint16_t *)(header))); in dns_unpack_header_id()
198 /** It returns the QR field in the DNS msg header */
199 static inline int dns_header_qr(uint8_t *header) in dns_header_qr() argument
201 return ((*(header + 2)) & 0x80) ? 1 : 0; in dns_header_qr()
204 /** It returns the OPCODE field in the DNS msg header */
205 static inline int dns_header_opcode(uint8_t *header) in dns_header_opcode() argument
207 return ((*(header + 2)) & 0x70) >> 1; in dns_header_opcode()
210 /** It returns the AA field in the DNS msg header */
211 static inline int dns_header_aa(uint8_t *header) in dns_header_aa() argument
213 return ((*(header + 2)) & 0x04) ? 1 : 0; in dns_header_aa()
216 /** It returns the TC field in the DNS msg header */
217 static inline int dns_header_tc(uint8_t *header) in dns_header_tc() argument
219 return ((*(header + 2)) & 0x02) ? 1 : 0; in dns_header_tc()
222 /** It returns the RD field in the DNS msg header */
223 static inline int dns_header_rd(uint8_t *header) in dns_header_rd() argument
225 return ((*(header + 2)) & 0x01) ? 1 : 0; in dns_header_rd()
228 /** It returns the RA field in the DNS msg header */
229 static inline int dns_header_ra(uint8_t *header) in dns_header_ra() argument
231 return ((*(header + 3)) & 0x80) >> 7; in dns_header_ra()
234 /** It returns the Z field in the DNS msg header */
235 static inline int dns_header_z(uint8_t *header) in dns_header_z() argument
237 return ((*(header + 3)) & 0x70) >> 4; in dns_header_z()
240 /** It returns the RCODE field in the DNS msg header */
241 static inline int dns_header_rcode(uint8_t *header) in dns_header_rcode() argument
243 return ((*(header + 3)) & 0x0F); in dns_header_rcode()
246 /** It returns the QDCOUNT field in the DNS msg header */
247 static inline int dns_header_qdcount(uint8_t *header) in dns_header_qdcount() argument
249 return htons(UNALIGNED_GET((uint16_t *)(header + 4))); in dns_header_qdcount()
252 static inline int dns_unpack_header_qdcount(uint8_t *header) in dns_unpack_header_qdcount() argument
254 return ntohs(UNALIGNED_GET((uint16_t *)(header + 4))); in dns_unpack_header_qdcount()
257 /** It returns the ANCOUNT field in the DNS msg header */
258 static inline int dns_header_ancount(uint8_t *header) in dns_header_ancount() argument
260 return htons(UNALIGNED_GET((uint16_t *)(header + 6))); in dns_header_ancount()
263 static inline int dns_unpack_header_ancount(uint8_t *header) in dns_unpack_header_ancount() argument
265 return ntohs(UNALIGNED_GET((uint16_t *)(header + 6))); in dns_unpack_header_ancount()
268 /** It returns the NSCOUNT field in the DNS msg header */
269 static inline int dns_header_nscount(uint8_t *header) in dns_header_nscount() argument
271 return htons(UNALIGNED_GET((uint16_t *)(header + 8))); in dns_header_nscount()
274 /** It returns the ARCOUNT field in the DNS msg header */
275 static inline int dns_header_arcount(uint8_t *header) in dns_header_arcount() argument
277 return htons(UNALIGNED_GET((uint16_t *)(header + 10))); in dns_header_arcount()
352 * @brief Unpacks the header's response.
358 * @retval -ENOMEM if the buffer in msg has no enough space to store the header.
359 * The header is always 12 bytes length.
360 * @retval -EINVAL if the src_id does not match the header's id, or if the
361 * header's QR value is not DNS_RESPONSE or if the header's OPCODE
362 * value is not DNS_QUERY, or if the header's Z value is not 0 or if
392 * 12 bytes i.e., after the message's header. This function computes
432 * @retval -ENOMEM if the buffer in msg has no enough space to store the header.
433 * The header is always 12 bytes length.
434 * @retval -EINVAL if the src_id does not match the header's id, or if the
435 * header's QR value is not DNS_RESPONSE or if the header's OPCODE
436 * value is not DNS_QUERY, or if the header's Z value is not 0 or if